Package com.portal.bas
Class PControllerImpl
java.lang.Object
com.portal.bas.PControllerImpl
- All Implemented Interfaces:
PControllerBean
,Serializable
,Remote
,Unreferenced
- Direct Known Subclasses:
PAccountActivityBeanImpl
,PAREventSearchPageBeanImpl
,PARRefundBeanImpl
,PBrandBeanImpl
,PBrandBeanImpl
,PComponentControllerImpl
,PContentOpInvokerBeanImpl
,PFieldControllerBean
,PIAComponentCollectionBean
,PIAReservedResourcesBeanImpl
,PIAServiceProfileBeanImpl
,PInvoiceBeanImpl
,PLocaleInfoBeanImpl
,PLoginBeanImpl
,POnlinePaymentAuditBeanImpl
,POnlinePaymentBeanImpl
,PProductsBeanImpl
,PPurchasePlansBeanImpl
,PServicesBeanImpl
public abstract class PControllerImpl
extends Object
implements PControllerBean, Serializable, Unreferenced
PControllerImpl
is an abstract class that implements the server
side of a component controller. Use this abstract class as the base for all
component-specific controllers.
PControllerImpl
implements the functionality that is implied by
the PAppComponent
API (as implemented by PComponentDelegate
),
and provides general utility methods, for example, field access, model access,
and Portal connection access. All the subclasser needs to do is override
update(int, Object)
.
This is called when the model changes, and should be called when any other
property changes.- Version:
- %version: 10 % %date_modified: Fri Apr 12 09:12:24 2002 %
- Author:
- larrylf
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PModelHandle
protected EventListenerList
static final int
Constant reason code for a client update.static final int
Constant reason code for changed model update.static final int
Constant reason code for a new model update.static final int
Constant reason code for a property update. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRemoteListener
(Object remoteListenerHandle) Adds a remote listener to the list of listeners.void
Close the secondary connection created for the purpose of step_searching.Serves as a helper method.protected void
distributeEventToListeners
(Class listenerClass, EventObject evt) Distributes an event to a specific type of listener.protected void
fireModelChangeEvent
(PModelHandle old, PModelHandle newMH) Fires a controller model change event.protected PInfranetAppController
Gets the connection to Portal for this instance.int[]
getArrayRange
(PModelHandle mh, String spec) Gets the range of possible values of aSparseArray
, given the array as a model and a field description.protected PCachedContext
Retrieves the the current connection instanceprotected Object
getField
(PFieldSpecification spec) Gets a specific field from the data model.protected Object
getField
(PModelHandle mh, PFieldSpecification spec) Gets a specific field from the data model.protected Object
getField
(FList flist, PFieldSpecification spec) Gets a specific field from theFlist
.protected Object
Gets a specific field from the data model.protected Object
Gets a specific field from the data model.protected Object
getFieldWithRestriction
(FList flist, PFieldSpecification spec) Gets a specific field from the data model.getModel()
Gets the controller's model handle.Default implementation for getting a remote listener (it returns null).Opens a secondary connection for Step_search purposesprotected void
handleDistributeToListener
(Object listener, EventObject evt) Called bydistributeEventToListeners
to pass an event to specific listener methods.boolean
isLight()
Determines whether this is a lightweight component.void
register
(PControllerBean stub) Allows the component to register the controller stub it received when the controller was created.protected void
Returns the current connection instance to the pool if one existsvoid
releaseRemoteListener
(Object remoteListenerHandle) Releases a remote listener that is no longer in use.void
removeRemoteListener
(Object remoteListenerHandle) Removes a remote listener from the list of listeners.protected void
setField
(PFieldSpecification spec, Object val) Sets the value of a specific field within the controller's data model.protected void
setField
(FList flist, PFieldSpecification spec, Object val) Sets the value of a specific field within the controller's data model.void
setModel
(PModelHandle model) Sets the model handle in the controller.void
abstract void
Theupdate
method is called by various internal methods when the data has changed enough to require changing the client display.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.portal.bas.PControllerBean
getSelectionDataFor
-
Field Details
-
UPDATE_NEW_MODEL
public static final int UPDATE_NEW_MODELConstant reason code for a new model update.- See Also:
-
UPDATE_PROPERTY
public static final int UPDATE_PROPERTYConstant reason code for a property update.- See Also:
-
UPDATE_MODEL_CHANGE
public static final int UPDATE_MODEL_CHANGEConstant reason code for changed model update.- See Also:
-
UPDATE_CLIENT
public static final int UPDATE_CLIENTConstant reason code for a client update.- See Also:
-
mFList
-
mRemoteListeners
-
-
Constructor Details
-
PControllerImpl
Creates an instance ofPControllerImpl
.- Throws:
RemoteException
- thrown for errors
-
-
Method Details
-
setModel
Sets the model handle in the controller. Remotely called byPComponent
.- Specified by:
setModel
in interfacePControllerBean
- Parameters:
model
- a model handle- Throws:
RemoteException
- thrown for errors
-
getModel
Gets the controller's model handle. Remotely called byPComponent
.- Specified by:
getModel
in interfacePControllerBean
- Returns:
- The model handle used by this controller.
- Throws:
RemoteException
- thrown for errors
-
isLight
Determines whether this is a lightweight component. Lightweight components do not have their own model. Instead, they use that of their container. This means thatgetModel
always returns null,setModel
is ignored, and no property change events are generated.The default value is false.
- Specified by:
isLight
in interfacePControllerBean
- Returns:
- True if the component is lightweight; false otherwise.
- Throws:
RemoteException
- thrown for errors
-
update
Theupdate
method is called by various internal methods when the data has changed enough to require changing the client display. Must be overridden by a specific controller subclass.- Parameters:
reason
- an integer constant that indicates the reason for the update (UPDATE_NEW_MODEL
,UPDATE_PROPERTY
,UPDATE_MODEL_CHANGE
, orUPDATE_CLIENT
)data
- the data associated withupdate
- Throws:
RemoteException
- thrown for errors
-
getArrayRange
Gets the range of possible values of aSparseArray
, given the array as a model and a field description.- Specified by:
getArrayRange
in interfacePControllerBean
- Parameters:
mh
- a model handlespec
- a field description- Returns:
- An int array, where indexes 0 and 1 contain the low and high
bounds (if the array has a single element, only the low bound is
given). If the array doesn't contain consecutive indices,
then indices 2 and up contain the specific element number used in the
SparseArray
. - Throws:
RemoteException
- thrown for errors
-
createClientException
Serves as a helper method. Sometimes anEBufException
needs to be passed to a View, however, because it doesn't exist in the client class name space, a different exception with the relevant information must be thrown. That exception isPInfranetException
; the relevant information is the detailed error and help text from the Portal server. This helper method can be used to do the common conversion. The returned exception still needs to be thrown by the caller.- Parameters:
ebuf
- anEBufException
to convert- Returns:
- A new
PInfranetException
with text from the Portal server. - Throws:
RemoteException
- thrown for errors
-
getRemoteListenerHandle
Default implementation for getting a remote listener (it returns null).- Specified by:
getRemoteListenerHandle
in interfacePControllerBean
- Parameters:
type
- the type of remote listener to get- Returns:
- A handle to a remote listener object.
- Throws:
RemoteException
- thrown for errors
-
releaseRemoteListener
Releases a remote listener that is no longer in use.- Specified by:
releaseRemoteListener
in interfacePControllerBean
- Parameters:
remoteListenerHandle
- the handle for the remote listener- Throws:
RemoteException
- thrown for errors
-
addRemoteListener
Adds a remote listener to the list of listeners.- Specified by:
addRemoteListener
in interfacePControllerBean
- Parameters:
remoteListenerHandle
- the handle for the remote listener- Throws:
RemoteException
- thrown for errors
-
removeRemoteListener
Removes a remote listener from the list of listeners.- Specified by:
removeRemoteListener
in interfacePControllerBean
- Parameters:
remoteListenerHandle
- the handle for the remote listener- Throws:
RemoteException
- thrown for errors
-
distributeEventToListeners
Distributes an event to a specific type of listener. This call correctly picks out the listener type, then callshandleDistributeToListener( Object listener, EventObject evt )
, which should be overridden to call the correct listener methods.- Parameters:
listenerClass
- the class of listener to distribute toevt
- the event object to distribute
-
register
Allows the component to register the controller stub it received when the controller was created.- Specified by:
register
in interfacePControllerBean
- Parameters:
stub
- the controller stub owned by the client view.- Throws:
RemoteException
- thrown in case of error- See Also:
-
unreferenced
public void unreferenced()- Specified by:
unreferenced
in interfaceUnreferenced
-
handleDistributeToListener
Called bydistributeEventToListeners
to pass an event to specific listener methods. When overriding this method, be sure to pass calls for unknown listener classes to the parent controller to handle other types of event objects.- Parameters:
listener
- the listener to call a method forevt
- the event object to distribute
-
fireModelChangeEvent
Fires a controller model change event.- Parameters:
old
- the old model handlenewMH
- the new model handle
-
getAppController
Gets the connection to Portal for this instance.- Returns:
- A
PInfranetConnectionImpl
object.
-
getFieldWithRestriction
protected Object getFieldWithRestriction(PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from the data model. Gets all the fields specified by a compound specification. Same asgetField( PFieldSpecification spec )
but wraps the return value with its restriction object, if any.- Parameters:
spec
- a field specification- Returns:
- The value of the specified field.
-
getFieldWithRestriction
protected Object getFieldWithRestriction(FList flist, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from the data model. Gets all the fields specified by a compound specification. Same asgetField( FList flist, PFieldSpecification spec )
but wraps the return value with its restriction object, if any.- Parameters:
flist
- anFList
from which to get a restrained fieldspec
- a field specification- Returns:
- The value of the specified field.
-
getFieldWithRestriction
protected Object getFieldWithRestriction(PModelHandle mh, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from the data model. Gets all the fields specified by a compound specification. Same asgetField( PModelHandle mh, PFieldSpecification spec )
but wraps the return value with its restriction object, if any.- Parameters:
mh
- a model handle from which to get a restrained fieldspec
- a field specification- Returns:
- The value of the specified field.
-
getField
protected Object getField(PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from the data model. Gets all the fields specified by a compound specification.- Parameters:
spec
- a field specification- Returns:
- The value of the specified field.
-
getField
protected Object getField(FList flist, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from theFlist
. Gets all the fields specified by a compound specification.- Parameters:
flist
- theFList
to get a field fromspec
- a field specification- Returns:
- The value of the specified field.
-
getField
protected Object getField(PModelHandle mh, PFieldSpecification spec) throws PBadFieldDescriptionException, RemoteException, EBufException Gets a specific field from the data model. Gets all the fields specified by a compound specification.- Parameters:
mh
- a model handle from which to get a fieldspec
- a field specification- Returns:
- The value of the specified field.
-
setField
protected void setField(PFieldSpecification spec, Object val) throws PBadFieldDescriptionException, RemoteException, EBufException Sets the value of a specific field within the controller's data model.- Parameters:
spec
- the specification of the field to setval
- the value to set
-
setField
protected void setField(FList flist, PFieldSpecification spec, Object val) throws PBadFieldDescriptionException, RemoteException, EBufException Sets the value of a specific field within the controller's data model.- Parameters:
spec
- the specification of the field to setval
- the value to set
-
getContext
Retrieves the the current connection instance- Returns:
- PCachedContext
- Throws:
RemoteException
-
releaseContext
Returns the current connection instance to the pool if one exists- Throws:
RemoteException
-
getSecContext
Opens a secondary connection for Step_search purposes- Throws:
RemoteException
-
closeSecContext
Close the secondary connection created for the purpose of step_searching.- Throws:
RemoteException
-