de.esprit.netsuite.server.abo

## Class AbstractABO<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.common.util.TransferableObject
    - - de.esprit.netsuite.netdata.AbstractCrossPlatformObject<C,S>
      - - de.esprit.netsuite.server.core.AccessibleServerObject<C,S>
        - - de.esprit.netsuite.server.abo.AbstractABO<C,S,I>

- All Implemented Interfaces:
    Renderable, SimpleLogSupport, DeepCloneable, Dumpable, ClientObject<C>, CrossPlatformObject<C,S>, LastAccessed, AliveBusinessObject<C,S,I>, RemoteLockable, PermissionControlled, ServerObject<S>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
  Direct Known Subclasses:
    AbstractPersistentABO, AbstractSingletonABO

      public abstract class AbstractABO<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>
      extends AccessibleServerObject<C,S>
      implements AliveBusinessObject<C,S,I>

  This is the base class for all server side `AliveBusinessObject`s (ABOs)
  Author:
    Rainer Buesch
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractABO(C clientCtx)`
    `AbstractABO(S serverCtx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(ABOChangeEvent.Listener l)` Note that each ABO is responsible for receiving and processing its own change events from the server.
    `I` | `clone()`
    `int` | `compareTo(java.lang.Object o)`
    `void` | `copyABOValues(I inst)` Updates the values of this instance from another one.
    `I` | `create()` Initializes this instance with values.
    `SimpleGate` | `createChangeGate()`
    `protected I` | `createOnServer()`
    `protected PermissionDefinition` | `createPermissionDefinition()`
    `protected abstract PrimaryKey` | `createPrimaryKey()` The ABO class must create the PrimaryKey it will need by its own.
    `<T> T` | `deepClone()` Returns a deep clone of this object
    `boolean` | `delete()` Deletes this ABO instance on the server.
    `protected boolean` | `deleteOnServer()` Is called on server side before the ABO is deleted and removed from the cache
    `void` | `drop()` Deregisters the accessor from the access list.
    `protected void` | `dropOnServer()` Is called on server side before the ABO is dropped from the cache
    `boolean` | `equals(java.lang.Object obj)`
    `I` | `fetch(boolean withLock, java.lang.Object... pkValues)` Fetches a new ABO instance by primary key values.
    `I[]` | `findCachedABOs(ABOFilter filter)` Returns all cached ABOs of this type that match the filter condition.
    `void` | `fireABOInitialized()`
    `PermissionDefinition` | `getPermissionDefinition()` Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
    `PrimaryKey` | `getPrimaryKey()` Returns the primary key of this instance.
    `java.awt.Color` | `getRenderColor()`
    `javax.swing.Icon` | `getRenderIcon()`
    `java.lang.String` | `getRenderText()`
    `java.lang.String` | `getResourceName()` Returns the resource name being used for a server side `ResourceLock`
    `ResourceType` | `getResourceType()` Returns the resource type being used for a server side `ResourceLock`
    `int` | `getUpdateCount()` Tells how many server side updates have yet been performed on this instance.
    `int` | `hashCode()`
    `protected boolean` | `isbeingAccessed()`
    `boolean` | `isCacheResident()` This flag causes the ABO to remain in the `ABOServerCache` even if the last accessing client drops it.
    `boolean` | `isLockedByMe()` Tells whether this ABO is locked by this session.
    `boolean` | `isNumb()`
    `boolean` | `isOnline()` Tells whether this ABO is receiving events.
    `boolean` | `isVisibleInClientMonitor()` Tells whether this ABO shows up in the clients ActivityMonitor
    `protected abstract void` | `overtakeABOValues(I inst)` Must be implemented by subclasses to copy their instance values
    `protected void` | `receivedUpdateEvent(ABOChangeEvent e)` May be overridden to react specifically on `ABOChangeEvent`s that were received for this ABO.
    `void` | `refetch()` Re-fetches the values of this ABO instance and makes it online again.
    `void` | `removeChangeListener(ABOChangeEvent.Listener l)`
    `void` | `setLocked(boolean doLock)` Fetches an exclusive ResourceLock from the server
    `void` | `setNumb(boolean isNumb)` In numb mode the ABO does not react on change events from the server and thus does not fire any local change events.
    `DumpString` | `toDumpString(DumpString s)` This method allows subclasses to add values to the existing DumpString of the superclass.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.
    `void` | `update()` Updates this instance with the current values.
    `void` | `update(boolean isResetOnFailure)` Updates the ABO on the server.
    `protected void` | `updateOnServer()` Needs only be overridden to ensure persistence before ABO is replaced in the cache.

    - ### Methods inherited from class de.esprit.netsuite.server.core.AccessibleServerObject

      `getLastAccessedTs, getLastAccessorId, setLastAccessorId`

    - ### Methods inherited from class de.esprit.netsuite.netdata.AbstractCrossPlatformObject

      `checkOnClient, checkOnServer, getClientContext, getLogChannel, getServerContext, isLogDebug, isLogVerbose, isOnClient, isOnServer, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setClientContext, setLogChannel, setServerContext`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.netsuite.server.abo.AliveBusinessObject

      `createEditDialog, instantiateOnServer`

    - ### Methods inherited from interface de.esprit.netsuite.netdata.CrossPlatformObject

      `isOnClient, isOnServer, setClientContext, setServerContext`

    - ### Methods inherited from interface de.esprit.netsuite.client.ClientObject

      `getClientContext`

    - ### Methods inherited from interface de.esprit.netsuite.server.ServerObject

      `getServerContext`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toString`

    - ### Methods inherited from interface de.esprit.netsuite.netdata.LastAccessed

      `getLastAccessedTs, getLastAccessorId, setLastAccessorId`

- - ### Constructor Detail

    - #### AbstractABO

          public AbstractABO(C clientCtx)

    - #### AbstractABO

          public AbstractABO(S serverCtx)

  - ### Method Detail

    - #### getPermissionDefinition

          public PermissionDefinition getPermissionDefinition()

      Description copied from interface: `PermissionControlled`
      Returns an object that identifies a `PermissionControlled` object with a unique name and provides a list of supported assignable permissions.
      Specified by:
        `getPermissionDefinition` in interface `PermissionControlled`

    - #### createPermissionDefinition

          protected PermissionDefinition createPermissionDefinition()

    - #### getPrimaryKey

          public PrimaryKey getPrimaryKey()

      Description copied from interface: `AliveBusinessObject`
      Returns the primary key of this instance. The primary key is never null but it can have no values.
      Specified by:
        `getPrimaryKey` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### getResourceName

          public java.lang.String getResourceName()

      Description copied from interface: `RemoteLockable`
      Returns the resource name being used for a server side `ResourceLock`
      Specified by:
        `getResourceName` in interface `RemoteLockable`

    - #### getResourceType

          public ResourceType getResourceType()

      Description copied from interface: `RemoteLockable`
      Returns the resource type being used for a server side `ResourceLock`
      Specified by:
        `getResourceType` in interface `RemoteLockable`

    - #### createPrimaryKey

          protected abstract PrimaryKey createPrimaryKey()

      The ABO class must create the PrimaryKey it will need by its own. The PrimaryKey is never changed on an ABO instance, but you may change the primary key values.

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable`

    - #### isbeingAccessed

          protected boolean isbeingAccessed()

    - #### isOnline

          public boolean isOnline()

      Description copied from interface: `AliveBusinessObject`
      Tells whether this ABO is receiving events. After a `AliveBusinessObject.drop()` call the abo receives no more update notifications from the server an thus is considered to be offline. A `AliveBusinessObject.refetch()` call will bring it online again.
      Specified by:
        `isOnline` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### isCacheResident

          public boolean isCacheResident()

      Description copied from interface: `AliveBusinessObject`
      This flag causes the ABO to remain in the `ABOServerCache` even if the last accessing client drops it. Is false by default.
      Specified by:
        `isCacheResident` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### isVisibleInClientMonitor

          public boolean isVisibleInClientMonitor()

      Description copied from interface: `AliveBusinessObject`
      Tells whether this ABO shows up in the clients ActivityMonitor
      Specified by:
        `isVisibleInClientMonitor` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### update

          public final void update()
                            throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Updates this instance with the current values.
      Specified by:
        `update` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Throws:
        `java.lang.Exception`
      See Also:
        `AliveBusinessObject.update(boolean)`

    - #### update

          public final void update(boolean isResetOnFailure)
                            throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Updates the ABO on the server. If this fails and the isResetOnFailure flag is true, then the ABO values are automatically resetted to the original current values on the server.
      Specified by:
        `update` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Parameters:
        `isResetOnFailure` - tells whether a reset should happen on update failure
      Throws:
        `java.lang.Exception`

    - #### updateOnServer

          protected void updateOnServer()
                                 throws java.lang.Exception

      Needs only be overridden to ensure persistence before ABO is replaced in the cache.
      Throws:
        `java.lang.Exception`

    - #### delete

          public boolean delete()
                         throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Deletes this ABO instance on the server. If the instance is `AbstractPersistentABO`, then it is removed totally from the database.
      Specified by:
        `delete` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Returns:
        true if the ABO was found in the server cache an deletion was successful.
      Throws:
        `java.lang.Exception`

    - #### deleteOnServer

          protected boolean deleteOnServer()
                                    throws java.lang.Exception

      Is called on server side before the ABO is deleted and removed from the cache
      Returns:
        true if the ABO was found for deletion
      Throws:
        `java.lang.Exception`

    - #### create

          public I create()
                                               throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Initializes this instance with values. The returned instance contains the primary key as well as default values which have eventually been assigned by the database.
      Specified by:
        `create` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Throws:
        `java.lang.Exception`

    - #### createOnServer

          protected I createOnServer()
                                                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### findCachedABOs

          public I[] findCachedABOs(ABOFilter filter)
                                                         throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Returns all cached ABOs of this type that match the filter condition.
      Specified by:
        `findCachedABOs` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Throws:
        `java.lang.Exception`

    - #### fetch

          public I fetch(boolean withLock,
                java.lang.Object... pkValues)
                                              throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Fetches a new ABO instance by primary key values.
      Specified by:
        `fetch` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Throws:
        `java.lang.Exception`

    - #### refetch

          public void refetch()
                       throws java.lang.Exception

      Description copied from interface: `AliveBusinessObject`
      Re-fetches the values of this ABO instance and makes it online again. This may be useful, if an ABO has been dropped and was offline for a while.
      Specified by:
        `refetch` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`
      Throws:
        `java.lang.Exception`

    - #### drop

          public void drop()

      Description copied from interface: `AliveBusinessObject`
      Deregisters the accessor from the access list. Thus the ABO won't receive `ABOChangeEvent`s any more. If this was the last accessor and the ABO is not cache resistent it will be removed from the server cache.
      Specified by:
        `drop` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### dropOnServer

          protected void dropOnServer()

      Is called on server side before the ABO is dropped from the cache

    - #### isLockedByMe

          public boolean isLockedByMe()

      Tells whether this ABO is locked by this session. Note that the check is done by a lookup into the local `ActiveLocksListModel` for performance reason. Foreign locks are not considered here.
      Specified by:
        `isLockedByMe` in interface `RemoteLockable`

    - #### setLocked

          public void setLocked(boolean doLock)
                         throws java.lang.Exception

      Description copied from interface: `RemoteLockable`
      Fetches an exclusive ResourceLock from the server
      Specified by:
        `setLocked` in interface `RemoteLockable`
      Throws:
        `java.lang.Exception`

    - #### copyABOValues

          public final void copyABOValues(I inst)

      Description copied from interface: `AliveBusinessObject`
      Updates the values of this instance from another one. The primary keys of both must match.
      Specified by:
        `copyABOValues` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### overtakeABOValues

          protected abstract void overtakeABOValues(I inst)

      Must be implemented by subclasses to copy their instance values

    - #### getRenderIcon

          public javax.swing.Icon getRenderIcon()

      Specified by:
        `getRenderIcon` in interface `Renderable`

    - #### getRenderText

          public java.lang.String getRenderText()

      Specified by:
        `getRenderText` in interface `Renderable`

    - #### getRenderColor

          public java.awt.Color getRenderColor()

      Specified by:
        `getRenderColor` in interface `Renderable`

    - #### getUpdateCount

          public int getUpdateCount()

      Description copied from interface: `AliveBusinessObject`
      Tells how many server side updates have yet been performed on this instance.
      Specified by:
        `getUpdateCount` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### deepClone

          public <T> T deepClone()

      Description copied from interface: `DeepCloneable`
      Returns a deep clone of this object
      Specified by:
        `deepClone` in interface `DeepCloneable`
      Overrides:
        `deepClone` in class `TransferableObject`

    - #### clone

          public I clone()

      Overrides:
        `clone` in class `TransferableObject`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### addChangeListener

          public void addChangeListener(ABOChangeEvent.Listener l)

      Description copied from interface: `AliveBusinessObject`
      Note that each ABO is responsible for receiving and processing its own change events from the server. You may register here to get these events passed if you are explicitly interested in them.
      Specified by:
        `addChangeListener` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### removeChangeListener

          public void removeChangeListener(ABOChangeEvent.Listener l)

      Specified by:
        `removeChangeListener` in interface `AliveBusinessObject<C extends ClientContext,S extends ServerContext,I extends AliveBusinessObject>`

    - #### fireABOInitialized

          public void fireABOInitialized()

    - #### setNumb

          public void setNumb(boolean isNumb)

      In numb mode the ABO does not react on change events from the server and thus does not fire any local change events.

    - #### isNumb

          public boolean isNumb()

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `DumpableObject`

    - #### toDumpString

          public DumpString toDumpString(DumpString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing DumpString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toDumpString` in interface `Dumpable`
      Overrides:
        `toDumpString` in class `DumpableObject`

    - #### receivedUpdateEvent

          protected void receivedUpdateEvent(ABOChangeEvent e)

      May be overridden to react specifically on `ABOChangeEvent`s that were received for this ABO.

    - #### createChangeGate

          public SimpleGate createChangeGate()

Copyright © 2014 EsprIT-Systems. All Rights Reserved.