com.arsdigita.kernel
Class PackageInstance

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.kernel.PackageInstance

public class PackageInstance
extends ACSObject

Represents an object that corresponds to a package type. A package instance can have its own content, presentation, and parameters associated with it.

Since:
ACS 5.0
Version:
$Revision: #13 $, $Date: 2004/04/07 $
See Also:
PackageType

Field Summary
static String BASE_DATA_OBJECT_TYPE
           
static String versionId
           
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
protected PackageInstance()
          Constructs a new PackageInstance with no values set.
  PackageInstance(BigDecimal id)
          Retrieves the PackageInstance domain object with the specified ID.
  PackageInstance(DataObject dataObject)
          Constructs a PackageInstance domain object from a package instance data object.
  PackageInstance(OID oid)
          Retrieves the PackageInstance domain object with the specified OID.
protected PackageInstance(String objectType)
          Constructs a new PackageInstance with no values set.
 
Method Summary
 void delete()
          Deletes this object.
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.
 SiteNode getDefaultMountPoint()
          Returns the first site node on which this package instance is mounted.
 String getDisplayName()
          Returns a display name for this package instance.
 String getKey()
          Gets the name of this package.
 Locale getLocale()
           Returns the locale that is associated with this PackageInstance.
 SiteNodeCollection getMountPoints()
          Gets all the site nodes where this instance is mounted.
 String getName()
          Gets the package name.
 String getPackageKey()
          Deprecated.  
 PackageType getPackageType()
          Deprecated. use getType() instead
 String getParameter(String v)
           
 int getParameter(String v, int x)
           
 String getParameter(String v, String y)
           
 String getTargetBundle()
           The name of a resource bundle, suitable for passing as the first parameter to ResourceBundle.getBundle(String, Locale).
 PackageType getType()
           
 void setKey(String key)
          Sets the package key.
 void setLocale(Locale locale)
           Sets the locale to be associated with this PackageInstance.
 void setName(String prettyName)
           
protected  void setType(PackageType type)
           
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, beforeSave, checkPrivilege, doCreateCheck, doWriteCheck, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, initialize, isContainerModified, setID, setID
 
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, 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
Constructor Detail

PackageInstance

protected PackageInstance(String objectType)
Constructs a new PackageInstance with no values set. Use PackageType.createInstance to create a new instance, or PackageInstance(OID oid) to retrieve an existing one.

This is for use only by subclasses of PackageInstance.

Parameters:
objectType - The object type which the instance will be created as.
See Also:
DomainObject.DomainObject(String), PackageType.createInstance(java.lang.String), PackageInstance(OID)

PackageInstance

protected PackageInstance()
Constructs a new PackageInstance with no values set. Use PackageType.createInstance to create a new instance, or PackageInstance(OID oid) to retrieve an existing one.

See Also:
DomainObject.DomainObject(String), PackageType.createInstance(java.lang.String), PackageInstance(OID)

PackageInstance

public PackageInstance(DataObject dataObject)
Constructs a PackageInstance domain object from a package instance data object.

Parameters:
dataObject - a PackageInstance data object

PackageInstance

public PackageInstance(BigDecimal id)
                throws DataObjectNotFoundException
Retrieves the PackageInstance domain object with the specified ID.

Parameters:
id - the primary key of the package instance
Throws:
DataObjectNotFoundException - if the id does not correspond to an existing package instance.

PackageInstance

public PackageInstance(OID oid)
                throws DataObjectNotFoundException
Retrieves the PackageInstance domain object with the specified OID.

Parameters:
oid - the objectID of the package instance
Throws:
DataObjectNotFoundException - If the OID does not correspond to an existing package instance.
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 ACSObject

getType

public PackageType getType()

setType

protected void setType(PackageType type)

getDefaultMountPoint

public SiteNode getDefaultMountPoint()
Returns the first site node on which this package instance is mounted. Currently, the order is determined by the site node's ID property. In the future, an explicit sort key may be introduced on the links between a package instance and its mount points. Returns null if this package instance is not mounted.

Returns:
the first site node on which this package instance is mounted, or null if this package instance is not mounted.

getPackageType

public PackageType getPackageType()
Deprecated. use getType() instead

See Also:
getType()

getPackageKey

public String getPackageKey()
Deprecated.  


getKey

public String getKey()
Gets the name of this package.

Returns:
the package key.

setKey

public void setKey(String key)
Sets the package key.

Parameters:
key - the key for this package

getName

public String getName()
Gets the package name.

Returns:
the package's name.

getDisplayName

public String getDisplayName()
Returns a display name for this package instance.

Overrides:
getDisplayName in class ACSObject
Returns:
the displayable name for this object.
See Also:
ACSObject.getDisplayName()

setName

public void setName(String prettyName)

getParameter

public String getParameter(String v)

getParameter

public String getParameter(String v,
                           String y)

getParameter

public int getParameter(String v,
                        int x)

getTargetBundle

public String getTargetBundle()

The name of a resource bundle, suitable for passing as the first parameter to ResourceBundle.getBundle(String, Locale). Should be a fully qualified Java resource name.

TODO: For now we calculate the name based on the name of the Dispatcher for this package, using a hardcoded algorithm. Specifically, we replace "Dispatcher" with "Resources" (the corresponding bundle name for "MyDispatcher" would be "MyResources"). Eventually, we will do away with this algorithm and replace it with another attribute of a Package.

Returns:
the name of the resource bundle we should try loading for ResourceBundle.

getMountPoints

public SiteNodeCollection getMountPoints()
Gets all the site nodes where this instance is mounted.

Returns:
all the site nodes where this instance is mounted.

getLocale

public Locale getLocale()

Returns the locale that is associated with this PackageInstance.

Returns:
java.util.Locale.

setLocale

public void setLocale(Locale locale)

Sets the locale to be associated with this PackageInstance.

Parameters:
locale - java.util.Locale

getContainer

protected ACSObject getContainer()
Description copied from class: ACSObject
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).

Overrides:
getContainer in class ACSObject
Returns:
this object's container.

delete

public void delete()
Description copied from class: DomainObject
Deletes this object.

Overrides:
delete in class DomainObject
See Also:
DataObject.delete()


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