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 Details

    • UPDATE_NEW_MODEL

      public static final int UPDATE_NEW_MODEL
      Constant reason code for a new model update.
      See Also:
    • UPDATE_PROPERTY

      public static final int UPDATE_PROPERTY
      Constant reason code for a property update.
      See Also:
    • UPDATE_MODEL_CHANGE

      public static final int UPDATE_MODEL_CHANGE
      Constant reason code for changed model update.
      See Also:
    • UPDATE_CLIENT

      public static final int UPDATE_CLIENT
      Constant reason code for a client update.
      See Also:
    • mFList

      protected PModelHandle mFList
    • mRemoteListeners

      protected EventListenerList mRemoteListeners
  • Constructor Details

    • PControllerImpl

      public PControllerImpl() throws RemoteException
      Creates an instance of PControllerImpl.
      Throws:
      RemoteException - thrown for errors
  • Method Details

    • setModel

      public void setModel(PModelHandle model) throws RemoteException
      Sets the model handle in the controller. Remotely called by PComponent.
      Specified by:
      setModel in interface PControllerBean
      Parameters:
      model - a model handle
      Throws:
      RemoteException - thrown for errors
    • getModel

      public PModelHandle getModel() throws RemoteException
      Gets the controller's model handle. Remotely called by PComponent.
      Specified by:
      getModel in interface PControllerBean
      Returns:
      The model handle used by this controller.
      Throws:
      RemoteException - thrown for errors
    • isLight

      public boolean isLight() throws RemoteException
      Determines whether this is a lightweight component. Lightweight components do not have their own model. Instead, they use that of their container. This means that getModel always returns null, setModel is ignored, and no property change events are generated.

      The default value is false.

      Specified by:
      isLight in interface PControllerBean
      Returns:
      True if the component is lightweight; false otherwise.
      Throws:
      RemoteException - thrown for errors
    • update

      public abstract void update(int reason, Object data) throws RemoteException
      The update 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, or UPDATE_CLIENT)
      data - the data associated with update
      Throws:
      RemoteException - thrown for errors
    • getArrayRange

      public int[] getArrayRange(PModelHandle mh, String spec) throws RemoteException
      Gets the range of possible values of a SparseArray, given the array as a model and a field description.
      Specified by:
      getArrayRange in interface PControllerBean
      Parameters:
      mh - a model handle
      spec - 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

      public PInfranetException createClientException(EBufException ebuf) throws RemoteException
      Serves as a helper method. Sometimes an EBufException 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 is PInfranetException; 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 - an EBufException to convert
      Returns:
      A new PInfranetException with text from the Portal server.
      Throws:
      RemoteException - thrown for errors
    • getRemoteListenerHandle

      public Object getRemoteListenerHandle(String type) throws RemoteException
      Default implementation for getting a remote listener (it returns null).
      Specified by:
      getRemoteListenerHandle in interface PControllerBean
      Parameters:
      type - the type of remote listener to get
      Returns:
      A handle to a remote listener object.
      Throws:
      RemoteException - thrown for errors
    • releaseRemoteListener

      public void releaseRemoteListener(Object remoteListenerHandle) throws RemoteException
      Releases a remote listener that is no longer in use.
      Specified by:
      releaseRemoteListener in interface PControllerBean
      Parameters:
      remoteListenerHandle - the handle for the remote listener
      Throws:
      RemoteException - thrown for errors
    • addRemoteListener

      public void addRemoteListener(Object remoteListenerHandle) throws RemoteException
      Adds a remote listener to the list of listeners.
      Specified by:
      addRemoteListener in interface PControllerBean
      Parameters:
      remoteListenerHandle - the handle for the remote listener
      Throws:
      RemoteException - thrown for errors
    • removeRemoteListener

      public void removeRemoteListener(Object remoteListenerHandle) throws RemoteException
      Removes a remote listener from the list of listeners.
      Specified by:
      removeRemoteListener in interface PControllerBean
      Parameters:
      remoteListenerHandle - the handle for the remote listener
      Throws:
      RemoteException - thrown for errors
    • distributeEventToListeners

      protected void distributeEventToListeners(Class listenerClass, EventObject evt)
      Distributes an event to a specific type of listener. This call correctly picks out the listener type, then calls handleDistributeToListener( Object listener, EventObject evt ), which should be overridden to call the correct listener methods.
      Parameters:
      listenerClass - the class of listener to distribute to
      evt - the event object to distribute
    • register

      public void register(PControllerBean stub) throws RemoteException
      Allows the component to register the controller stub it received when the controller was created.
      Specified by:
      register in interface PControllerBean
      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 interface Unreferenced
    • handleDistributeToListener

      protected void handleDistributeToListener(Object listener, EventObject evt)
      Called by distributeEventToListeners 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 for
      evt - the event object to distribute
    • fireModelChangeEvent

      protected void fireModelChangeEvent(PModelHandle old, PModelHandle newMH)
      Fires a controller model change event.
      Parameters:
      old - the old model handle
      newMH - the new model handle
    • getAppController

      protected PInfranetAppController 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 as getField( 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 as getField( FList flist, PFieldSpecification spec ) but wraps the return value with its restriction object, if any.
      Parameters:
      flist - an FList from which to get a restrained field
      spec - a field specification
      Returns:
      The value of the specified field.
    • getFieldWithRestriction

      Gets a specific field from the data model. Gets all the fields specified by a compound specification. Same as getField( 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 field
      spec - a field specification
      Returns:
      The value of the specified field.
    • getField

      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

      Gets a specific field from the Flist. Gets all the fields specified by a compound specification.
      Parameters:
      flist - the FList to get a field from
      spec - a field specification
      Returns:
      The value of the specified field.
    • getField

      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 field
      spec - a field specification
      Returns:
      The value of the specified field.
    • setField

      Sets the value of a specific field within the controller's data model.
      Parameters:
      spec - the specification of the field to set
      val - 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 set
      val - the value to set
    • getContext

      protected PCachedContext getContext() throws RemoteException
      Retrieves the the current connection instance
      Returns:
      PCachedContext
      Throws:
      RemoteException
    • releaseContext

      protected void releaseContext(PCachedContext ctx) throws RemoteException
      Returns the current connection instance to the pool if one exists
      Throws:
      RemoteException
    • getSecContext

      public PCachedContext getSecContext() throws RemoteException
      Opens a secondary connection for Step_search purposes
      Throws:
      RemoteException
    • closeSecContext

      public void closeSecContext(PCachedContext conn) throws RemoteException
      Close the secondary connection created for the purpose of step_searching.
      Throws:
      RemoteException