com.arsdigita.kernel
Class ACSObject

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
Direct Known Subclasses:
AuditedACSObject, BaseSubscription, BebopObjectType, Category, CategoryPurpose, Digest, Message, MessageThread, MetaObject, Notification, PackageInstance, Party, PersistentDataQuery, PersistentParameterListener, PersistentProcessListener, Resource, SearchableACSObject, SiteNode, Stylesheet, VersionedACSObject

public abstract class ACSObject
extends ObservableDomainObject

An ACSObject is a generic object that can be handled by any of a number of Core services e.g., versioning, permissions. Subclass ACSObject if you need any of these services. ACSObject contains a DataObject with an ObjectType of "ACSObject" or any subtype of it. The persistence storage mechanism guarantees that all DataObjects that are of type "ACSObject" can be uniquely identified from each other by a single identifier. Thus any instances of this class can be uniquely identified by a single identifier, which is currently found in this object's OID.


Field Summary
static String BASE_DATA_OBJECT_TYPE
           
protected static String CONTAINER
          The denormalized container.
static String DEFAULT_DOMAIN_CLASS
          The default domain class name.
static String DISPLAY_NAME
          The denormalized display name.
static String ID
          The BigDecimal ID.
static String OBJECT_TYPE
          The object type.
static String versionId
           
 
Constructor Summary
ACSObject()
          Default constructor.
ACSObject(DataObject acsObjectData)
           
ACSObject(ObjectType type)
          Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by type.
ACSObject(OID oid)
          Constructor in which the contained DataObject is retrieved from the persistent storage mechanism using the specified OID.
ACSObject(String typeName)
          Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by the string typeName.
 
Method Summary
 void assertPrivilege(PrivilegeDescriptor priv)
          Asserts that the current user has the specified privilege on this object.
protected  void beforeSave()
           
 boolean checkPrivilege(PrivilegeDescriptor priv)
          Check that the current user has the specified privilege on this object.
 void doCreateCheck()
          This method is called by the PermissionsObserver when an object is created.
 void doWriteCheck()
           
protected  String getBaseDataObjectType()
          Returns the base data object type for this domain object class.
protected  ACSObject getContainer()
          Returns the container for this object, or null if there is no container.
 String getDefaultDomainClass()
          Gets the name of the domain class for this object
 String getDisplayName()
          Returns a display name for this object.
 BigDecimal getID()
          Gets the value of the ID property.
 String getSpecificObjectType()
          Gets the value of the "objectType" property, which is the fully qualified name of the data object type that this domain object had when it was first created.
 OID getSpecificOID()
          Gets the specific OID for this ACSObject, which is the tuple of the 'objectType' & 'id' properties.
 ACSObject gimmeContainer()
          Deprecated.  
protected  void initialize()
          Called from base class (DomainObject) constructors.
protected  boolean isContainerModified()
          Returns true if this object has been moved to a new container, or null if the container has not changed.
 BigDecimal setID()
          Deprecated. No longer has any effect on the id. Will always return getID()
 BigDecimal setID(BigDecimal id)
          Deprecated. No longer has any effect on the id. Will always return getID()
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, afterSave, beforeDelete, clear, delete, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
See Also:
Constant Field Values

ID

public static final String ID
The BigDecimal ID.

See Also:
Constant Field Values

OBJECT_TYPE

public static final String OBJECT_TYPE
The object type.

See Also:
Constant Field Values

DEFAULT_DOMAIN_CLASS

public static final String DEFAULT_DOMAIN_CLASS
The default domain class name. This is the name of the java class that should should be instantiated by the domain object factory in the default case when no specific instantiator is able to handle the given data object.

See Also:
ACSObjectInstantiator, Constant Field Values

DISPLAY_NAME

public static final String DISPLAY_NAME
The denormalized display name.

See Also:
Constant Field Values

CONTAINER

protected static final String CONTAINER
The denormalized container.

See Also:
Constant Field Values
Constructor Detail

ACSObject

public ACSObject(DataObject acsObjectData)

ACSObject

public ACSObject()
Default constructor. The contained DataObject is initialized with a new DataObject with an ObjectType of "ACSObject".

See Also:
ObservableDomainObject.ObservableDomainObject(String), ObjectType

ACSObject

public ACSObject(String typeName)
Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by the string typeName.

Parameters:
typeName - the name of the ObjectType of the contained DataObject
See Also:
ObservableDomainObject.ObservableDomainObject(String), DataObject, ObjectType

ACSObject

public ACSObject(ObjectType type)
Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by type.

Parameters:
type - the ObjectType of the contained DataObject
See Also:
ObservableDomainObject.ObservableDomainObject(ObjectType), DataObject, ObjectType

ACSObject

public ACSObject(OID oid)
          throws DataObjectNotFoundException
Constructor in which the contained DataObject is retrieved from the persistent storage mechanism using the specified OID.

Parameters:
oid - the OID for the retrieved DataObject
See Also:
ObservableDomainObject.ObservableDomainObject(OID), DataObject, OID
Method Detail

getBaseDataObjectType

protected String getBaseDataObjectType()
Description copied from class: DomainObject
Returns the base data object type for this domain object class. Intended to be overrided by subclasses whenever the subclass will only work if their primary data object is of a certain base type.

Overrides:
getBaseDataObjectType in class DomainObject
Returns:
The fully qualified name ("modelName.typeName") of the base data object type for this domain object class, or null if there is no restriction on the data object type for the primary data object encapsulated by this class.

initialize

protected void initialize()
Called from base class (DomainObject) constructors.

Overrides:
initialize in class DomainObject

getID

public BigDecimal getID()
Gets the value of the ID property. This is a convenience method that is roughly equivalent to getOID().get("id"). In general, it should be used instead of the getOID method to get any ACSObject's ID.

Returns:
the value of the ID property.

setID

public BigDecimal setID(BigDecimal id)
Deprecated. No longer has any effect on the id. Will always return getID()

Sets the value of the ID property only if it is not already set. Returns the value that the ID is set to after execution (which is different from the passed in value if the ID had already been set).

Parameters:
id - the value to try to set the ID property to
Returns:
the value that the ID property is set to after execution.

setID

public BigDecimal setID()
                 throws PersistenceException
Deprecated. No longer has any effect on the id. Will always return getID()

Sets the value of the ID property to com.arsdigita.db.Sequences.getNextValue() only if the ID property is not already set. Returns the value that the ID is set to after execution.

Returns:
the value that the ID property is set to after execution.
Throws:
PersistenceException - if a unique id could not be generated.

getDisplayName

public String getDisplayName()
Returns a display name for this object. The display name is produced by domain-specific logic based on any properties of the domain object. The display name is used internally for efficient access in cursors like ACSObjectCollection. ACSObject.save() takes care of populating the internal data object's displayName property with the result of the getDisplayName method. While this method is not abstract, the default implementation is very useless. All subclasses should provide their own implementations.

Returns:
the displayable name for this object.

getContainer

protected ACSObject getContainer()
Returns the container for this object, or null if there is no container. The container is produced by domain-specific logic based on any properties of the domain object. The resulting container is denormalized internally by ACSObject.save(). The denormalized container hierarchy is currently only used for generically determining what package instance an object belongs to. In the future, other generic services may be introduced that take advantage of the denormalized container hierarchy. While this method is not abstract, the default implementation "guesses" the container based on metadata about the object. If this object's data object type has a composite role property (required, visible property where com.arsdigita.persistence.metadata.Property.isComposite()==true), then we fetch the value of the composite role property, pass it to the DomainObjectFactory, and return the resulting domain object. If no composite role property is found, then the return value is null. Subclasses should provide their own implementations if the metadata driven default implementation is inadequate. For example, in a File Storage application, a "Folder" domain class could provide an implementationof getContainer() that returns the parent folder (if it exists) OR the package instance (if the folder is the root folder of one File Storage application instance).

Returns:
this object's container.

isContainerModified

protected boolean isContainerModified()
Returns true if this object has been moved to a new container, or null if the container has not changed. This methods is used by ACSObject.save() to determine when to denormalize the result of getContainer(). While this method is not abstract, the default implementation "guesses" the container based on metadata about the object. If this object's data object type has a composite role property (required, visible property where com.arsdigita.persistence.metadata.Property.isComposite()==true), then we check whether the composite role property has been modified. If no composite role is found, then the return value is false. Subclasses should provide their own implementations if the metadata driven default implementation is inadequate. See the example mentioned in getContainer().

Returns:
this object's container.
See Also:
getContainer()

gimmeContainer

public ACSObject gimmeContainer()
Deprecated.  

A public version of getContainer().


getSpecificObjectType

public String getSpecificObjectType()
Gets the value of the "objectType" property, which is the fully qualified name of the data object type that this domain object had when it was first created.

Returns:
the object type for this domain object.

getSpecificOID

public OID getSpecificOID()
Gets the specific OID for this ACSObject, which is the tuple of the 'objectType' & 'id' properties.


getDefaultDomainClass

public String getDefaultDomainClass()
Gets the name of the domain class for this object


assertPrivilege

public final void assertPrivilege(PrivilegeDescriptor priv)
Asserts that the current user has the specified privilege on this object. The current user is determined via the current KernelContext. If there is no current user, we check if the public has the specified privilege on this object.

Throws:
PermissionException - if the user does not have the privilege

checkPrivilege

public final boolean checkPrivilege(PrivilegeDescriptor priv)
Check that the current user has the specified privilege on this object. The current user is determined via the current KernelContext. If there is no current user, we check if the public has the specified privilege on this object.

Returns:
true if the current user has the specified privilege on this object, false otherwise

doCreateCheck

public void doCreateCheck()
This method is called by the PermissionsObserver when an object is created. Override this method as needed for implementing a specific permission policy. The default checks to make sure the user has the CREATE privilege on the parent container. If the parent container does not exist, the call is logged but nothing else happens.


doWriteCheck

public void doWriteCheck()

beforeSave

protected void beforeSave()
Overrides:
beforeSave in class DomainObject


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC