atg.repository
Class ItemDescriptorImpl

java.lang.Object
  extended by atg.repository.ItemDescriptorImpl
All Implemented Interfaces:
DynamicBeanInfo, RepositoryItemDescriptor, java.io.Serializable
Direct Known Subclasses:
GSAItemDescriptor

public class ItemDescriptorImpl
extends java.lang.Object
implements RepositoryItemDescriptor

A simple implementation of RepositoryItemDescriptor which supports adding and removing DynamicPropertyDescriptors.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  java.util.ArrayList<PropertiesChangedListener> mPropertiesChangedListeners
           
protected  DynamicPropertyDescriptor[] mPropertyDescriptors
          An Array of all the DynamicPropertyDescriptors
protected  atg.core.util.UnsyncCaseInsensitiveHashtable mPropertyDescriptorTable
          Table of all the DynamicPropertyDescriptors hashed by property name.
protected  java.lang.String[] mPropertyNames
          An Array of all the property names
 
Constructor Summary
ItemDescriptorImpl()
          Constructs an instanceof ItemDescriptorImpl
ItemDescriptorImpl(Repository pRepository)
          Constructs an instanceof ItemDescriptorImpl for a given repository.
 
Method Summary
 void addPropertiesChangedListener(PropertiesChangedListener pListener)
          Adds a properties changed event listener from this item descriptor.
 void addPropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
          Adds the given property descriptor to the internal table of known descriptors
 boolean areInstances(DynamicBeanInfo pDynamicBeanInfo)
          Returns true if all objects described by some DynamicBeanInfo are also described by this one.
 java.lang.String encodeCompositeKey(java.lang.String[] pIdValues)
          Encode an array of ID values to be used as a Repository ID
 boolean equals(java.lang.Object pObj)
          Returns true if this RepositoryItemDescriptor and the supplied object (which should also be a RepositoryItemDescriptor) have the exact same set of properties (as defined by their name).
 DynamicBeanDescriptor getBeanDescriptor()
          Returns the DynamicBeanDescriptor for this DynamicBeanInfo.
 RepositoryPropertyDescriptor getContextMembershipProperty()
          Gets the property descriptor corresponding to the context membership property.
 java.lang.String getCreateDisplayName()
          Get the create display name label using the create-asset-name-resource key from the resource bundle.
 java.util.List<atg.repository.query.QueryDependency> getDependencies(Query pQuery)
          Generate query dependency list for this query used for query invalidation.
 RepositoryPropertyDescriptor getDisplayNameProperty()
          Gets the name of the display name property.
 java.lang.String getItemDescriptorName()
          Returns property ItemDescriptorName
 java.lang.String getItemDisplayNameProperty()
           
 java.lang.String getMoveToDisplayName()
          Get the move display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle.
 java.lang.String getNewDisplayName()
          Get the new display name using the new-asset-name-resource key from the resource bundle.
 java.lang.String getPluralDisplayName()
          Get the plural display name.
 java.util.List<PropertiesChangedListener> getPropertiesChangedListeners()
          Returns the list of properties changed listeners that are registered on this item descriptor.
 DynamicPropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
          Returns the DynamicPropertyDescriptor for the specified property
 DynamicPropertyDescriptor[] getPropertyDescriptors()
          Returns the all PropertyDescriptors
 java.lang.String[] getPropertyNames()
          Returns the list of the names of the known properties
 Repository getRepository()
          Returns the repository for this item descriptor.
 RepositoryImpl getRepositoryImpl()
           
 RepositoryPropertyDescriptor getRepositoryPropertyDescriptor(java.lang.String pPropertyName)
          Returns the RepositoryPropertyDescriptor for the specified property.
 RepositoryView getRepositoryView()
          Get property RepositoryView
 RepositoryView getRepositoryViewImpl()
          Get property RepositoryViewImpl
 java.lang.String getSelectDisplayName()
          Get the select display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle.
 java.lang.String getSelectPluralDisplayName()
          Get the select display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle.
 java.lang.Object getValue(java.lang.String pName)
          Get the value associated with a named attribute.
 boolean hasCompositeKey()
          Determine if this item type has a composite ID.
 int hashCode()
           
 boolean hasProperty(java.lang.String pPropertyName)
          Returns true if the Repository supports the given property
 void invalidateCaches()
          Invalidates both the item and query caches for this item descriptor.
 void invalidateCaches(boolean pGlobal)
          Invalidates both the item and query caches for this item descriptor.
 void invalidateItemCache()
          Invalidates the item caches for this item descriptor.
 void invalidateItemCache(boolean pGlobal)
          Invalidates the item caches for this item descriptor.
 boolean isContextMembershipEnabled()
          If context membership support is enabled for this item descriptor
 boolean isInstance(java.lang.Object pObj)
          Returns true if the given object belongs to the set of dynamic beans described by this DynamicBeanInfo.
 boolean isLoggingDebug()
           
 void removeItemFromCache(java.lang.String pId)
          Removes the specified item from any repository caches.
 void removeItemFromCache(java.lang.String pId, boolean pGlobal)
          Removes the specified item from any repository caches.
 void removeItemFromCache(java.lang.String pId, boolean pGlobal, boolean pRemoveTransientProperties)
          Removes the specified item from any repository caches.
 void removePropertiesChangedListener(PropertiesChangedListener pListener)
          Removes a properties changed event listener from this item descriptor.
 void removePropertyDescriptor(java.lang.String pPropertyName)
          Removes the given property descriptor from the internal table of known descriptors
 void sendPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem, int pType, java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
          Sends a propertiesChangedEvent given the item itself that changed
 void sendPropertiesChangedEvent(java.lang.String pId, int pType, java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
          Sends a propertiesChangedEvent given the id of the item that changed
 void sendQueryDependencyPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem, int pType, java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
          Sends a propertiesChangedEvent to QueryDependencies
 void sendQueryDependencyPropertiesChangedEvent(java.lang.String pId, int pType, java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
          Sends a propertiesChangedEvent given the id of the item that changed to QueryDependencies
 void setBeanDescriptor(DynamicBeanDescriptor pBeanDescriptor)
          Sets property BeanDescriptor
 void setContextMembershipProperty(RepositoryPropertyDescriptor pContextMembershipProperty)
          Sets the property when ContextMembershipProperty.
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
          Sets property ItemDescriptorName
 void setItemDisplayNameProperty(java.lang.String pItemDisplayNameProperty)
          Sets the property ItemDisplayNameProperty.
 void setLoggingDebug(boolean pLoggingDebug)
          Sets the property LoggingDebug.
 void setRepository(Repository pRepository)
          Sets the property Repository.
 void setRepositoryView(RepositoryView pRepositoryView)
          Set property RepositoryView
 void setValue(java.lang.String pName, java.lang.Object pValue)
          Associate an attribute value with a name for this descriptor.
protected  void updateDataStructures()
          Updates the internal data structures which perform property name-<property descriptor mapping, building the arrays of property names and DynamicPropertyDescriptors.
 void updatePropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
          Throws RepositoryException because this is an unsupported feature in this implementation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mPropertyDescriptorTable

protected atg.core.util.UnsyncCaseInsensitiveHashtable mPropertyDescriptorTable
Table of all the DynamicPropertyDescriptors hashed by property name. TODO: Add generic type arguments: mPropertyDescriptorTable could be declared as CaseInsensitiveHashMap


mPropertyNames

protected java.lang.String[] mPropertyNames
An Array of all the property names


mPropertyDescriptors

protected DynamicPropertyDescriptor[] mPropertyDescriptors
An Array of all the DynamicPropertyDescriptors


mPropertiesChangedListeners

protected transient java.util.ArrayList<PropertiesChangedListener> mPropertiesChangedListeners
Constructor Detail

ItemDescriptorImpl

public ItemDescriptorImpl()
Constructs an instanceof ItemDescriptorImpl


ItemDescriptorImpl

public ItemDescriptorImpl(Repository pRepository)
Constructs an instanceof ItemDescriptorImpl for a given repository.

Method Detail

setBeanDescriptor

public void setBeanDescriptor(DynamicBeanDescriptor pBeanDescriptor)
Sets property BeanDescriptor


getBeanDescriptor

public DynamicBeanDescriptor getBeanDescriptor()
Returns the DynamicBeanDescriptor for this DynamicBeanInfo.

Specified by:
getBeanDescriptor in interface DynamicBeanInfo

getPropertyDescriptors

public DynamicPropertyDescriptor[] getPropertyDescriptors()
Returns the all PropertyDescriptors

Specified by:
getPropertyDescriptors in interface DynamicBeanInfo

hasProperty

public boolean hasProperty(java.lang.String pPropertyName)
Returns true if the Repository supports the given property

Specified by:
hasProperty in interface DynamicBeanInfo
Parameters:
pPropertyName - the name of the property

getPropertyNames

public java.lang.String[] getPropertyNames()
Returns the list of the names of the known properties

Specified by:
getPropertyNames in interface DynamicBeanInfo

getPropertyDescriptor

public DynamicPropertyDescriptor getPropertyDescriptor(java.lang.String pPropertyName)
Returns the DynamicPropertyDescriptor for the specified property

Specified by:
getPropertyDescriptor in interface DynamicBeanInfo
Parameters:
pPropertyName - the name of the property
Returns:
null if the Repository has no such property.

getRepositoryPropertyDescriptor

public RepositoryPropertyDescriptor getRepositoryPropertyDescriptor(java.lang.String pPropertyName)
Returns the RepositoryPropertyDescriptor for the specified property. Use this version if you know you have an ItemDescriptorImpl and you need fast access to the property descriptor (i.e. to avoid a cast).

Returns:
null if the Repository has no such property.

setContextMembershipProperty

public void setContextMembershipProperty(RepositoryPropertyDescriptor pContextMembershipProperty)
Sets the property when ContextMembershipProperty. This property when specified is used for contextual filtering of queries and references for this item descriptor.

Parameters:
pContextMembershipProperty - new value to set

getContextMembershipProperty

public RepositoryPropertyDescriptor getContextMembershipProperty()
Description copied from interface: RepositoryItemDescriptor
Gets the property descriptor corresponding to the context membership property. This can be null if such a property is not configured.

Specified by:
getContextMembershipProperty in interface RepositoryItemDescriptor
Returns:
The value of the property ContextMembershipProperty.

isContextMembershipEnabled

public boolean isContextMembershipEnabled()
If context membership support is enabled for this item descriptor

Specified by:
isContextMembershipEnabled in interface RepositoryItemDescriptor
Returns:
true if context membership is enabled.

isInstance

public boolean isInstance(java.lang.Object pObj)
Returns true if the given object belongs to the set of dynamic beans described by this DynamicBeanInfo. The definition of this set is variable and is determined by the DynamicBeanInfo; however, all objects described by the same DynamicBeanInfo will generally have the same set of dynamic properties with the same behavior and semantics, and the same meta-behavior such as readability, writability, etc.

Specified by:
isInstance in interface DynamicBeanInfo

areInstances

public boolean areInstances(DynamicBeanInfo pDynamicBeanInfo)
Returns true if all objects described by some DynamicBeanInfo are also described by this one.

Specified by:
areInstances in interface DynamicBeanInfo

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Sets property ItemDescriptorName


getItemDescriptorName

public java.lang.String getItemDescriptorName()
Returns property ItemDescriptorName

Specified by:
getItemDescriptorName in interface RepositoryItemDescriptor

addPropertyDescriptor

public void addPropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
                           throws RepositoryException
Adds the given property descriptor to the internal table of known descriptors

Specified by:
addPropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyDescriptor - the descriptor for the new property to add to the Repository
Throws:
RepositoryException - if there was an error

updatePropertyDescriptor

public void updatePropertyDescriptor(RepositoryPropertyDescriptor pPropertyDescriptor)
                              throws RepositoryException
Throws RepositoryException because this is an unsupported feature in this implementation

Specified by:
updatePropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyDescriptor - the descriptor for the property to update
Throws:
RepositoryException - unsupported feature

removePropertyDescriptor

public void removePropertyDescriptor(java.lang.String pPropertyName)
                              throws RepositoryException
Removes the given property descriptor from the internal table of known descriptors

Specified by:
removePropertyDescriptor in interface RepositoryItemDescriptor
Parameters:
pPropertyName - the name of the property
Throws:
RepositoryException - if there was an error

setItemDisplayNameProperty

public void setItemDisplayNameProperty(java.lang.String pItemDisplayNameProperty)
Sets the property ItemDisplayNameProperty. If this is set to a non-null value, the getItemDisplayName() method on the RepositoryItem will return the value of this property for its display name. If it is not set, then just the repository id is returned.

Parameters:
pItemDisplayNameProperty - new value to set

getItemDisplayNameProperty

public java.lang.String getItemDisplayNameProperty()
Returns:
The value of the property ItemDisplayNameProperty.

getDisplayNameProperty

public RepositoryPropertyDescriptor getDisplayNameProperty()
Gets the name of the display name property. This can be null if such a property is not configured.

Specified by:
getDisplayNameProperty in interface RepositoryItemDescriptor
Returns:

equals

public boolean equals(java.lang.Object pObj)
Returns true if this RepositoryItemDescriptor and the supplied object (which should also be a RepositoryItemDescriptor) have the exact same set of properties (as defined by their name).

Overrides:
equals in class java.lang.Object

setRepositoryView

public void setRepositoryView(RepositoryView pRepositoryView)
Set property RepositoryView

Parameters:
pRepositoryView - new value to set

getRepositoryView

public RepositoryView getRepositoryView()
Get property RepositoryView

Specified by:
getRepositoryView in interface RepositoryItemDescriptor
Returns:
RepositoryView

getRepositoryViewImpl

public RepositoryView getRepositoryViewImpl()
Get property RepositoryViewImpl

Returns:
RepositoryView

updateDataStructures

protected void updateDataStructures()
Updates the internal data structures which perform property name-<property descriptor mapping, building the arrays of property names and DynamicPropertyDescriptors.


setRepository

public void setRepository(Repository pRepository)
Sets the property Repository.

Parameters:
pRepository - new value to set

getRepository

public final Repository getRepository()
Description copied from interface: RepositoryItemDescriptor
Returns the repository for this item descriptor.

Specified by:
getRepository in interface RepositoryItemDescriptor
Returns:
The value of the property Repository.

getRepositoryImpl

public final RepositoryImpl getRepositoryImpl()
Returns:
The value of the property Repository.

addPropertiesChangedListener

public void addPropertiesChangedListener(PropertiesChangedListener pListener)
Adds a properties changed event listener from this item descriptor.


removePropertiesChangedListener

public void removePropertiesChangedListener(PropertiesChangedListener pListener)
Removes a properties changed event listener from this item descriptor.


getPropertiesChangedListeners

public java.util.List<PropertiesChangedListener> getPropertiesChangedListeners()
Returns the list of properties changed listeners that are registered on this item descriptor.


sendPropertiesChangedEvent

public void sendPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem,
                                       int pType,
                                       java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
Sends a propertiesChangedEvent given the item itself that changed


sendQueryDependencyPropertiesChangedEvent

public void sendQueryDependencyPropertiesChangedEvent(atg.repository.RepositoryChangedItem pItem,
                                                      int pType,
                                                      java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
Sends a propertiesChangedEvent to QueryDependencies


sendPropertiesChangedEvent

public void sendPropertiesChangedEvent(java.lang.String pId,
                                       int pType,
                                       java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
Sends a propertiesChangedEvent given the id of the item that changed


sendQueryDependencyPropertiesChangedEvent

public void sendQueryDependencyPropertiesChangedEvent(java.lang.String pId,
                                                      int pType,
                                                      java.util.Map<RepositoryPropertyDescriptor,java.lang.Object> pProperties)
Sends a propertiesChangedEvent given the id of the item that changed to QueryDependencies


invalidateItemCache

public void invalidateItemCache()
Invalidates the item caches for this item descriptor.


invalidateItemCache

public void invalidateItemCache(boolean pGlobal)
Invalidates the item caches for this item descriptor.

Parameters:
pGlobal - if true, the item caches are invalidated in all servers in the cluster. Use of this option may require additional configuration in which case, the local cache is invalidated and a warning is issued.

invalidateCaches

public void invalidateCaches()
Invalidates both the item and query caches for this item descriptor.


invalidateCaches

public void invalidateCaches(boolean pGlobal)
Invalidates both the item and query caches for this item descriptor.

Parameters:
pGlobal - if true, the caches are invalidated in all servers in the cluster. Use of this option may require additional configuration in which case, the local cache is invalidated and a warning is issued.

removeItemFromCache

public void removeItemFromCache(java.lang.String pId)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

removeItemFromCache

public void removeItemFromCache(java.lang.String pId,
                                boolean pGlobal)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
pGlobal - if true, the item is removed from all servers in the cluster. This option may require additional configuration so that the cluster members can find each other. A warning is logged if this is not option is not supported and a true value is given.
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

removeItemFromCache

public void removeItemFromCache(java.lang.String pId,
                                boolean pGlobal,
                                boolean pRemoveTransientProperties)
                         throws RepositoryException
Removes the specified item from any repository caches.

Parameters:
pId - item id of item to remove
pGlobal - if true, the item is removed from all servers in the cluster. This option may require additional configuration so that the cluster members can find each other. A warning is logged if this is not option is not supported and a true value is given.
pRemoveTransientProperties - if true, transient properties for the item will also be remove from the cache.
Throws:
RepositoryException - if the id is null or there is a problem removing the item from cache

getDependencies

public java.util.List<atg.repository.query.QueryDependency> getDependencies(Query pQuery)
Generate query dependency list for this query used for query invalidation.

Parameters:
pQuery - Query to generate dependency list for.
Returns:
List of dependencies.

setValue

public void setValue(java.lang.String pName,
                     java.lang.Object pValue)
Associate an attribute value with a name for this descriptor. This is just a convenience method for accessing the "feature descriptor values" in the item-descriptors bean descriptor.

Parameters:
pName - name of attribute
pValue - value of attribute

getValue

public java.lang.Object getValue(java.lang.String pName)
Get the value associated with a named attribute.

Parameters:
pName - name of attribute
Returns:
the value, may be null of the attribute is unknown

hasCompositeKey

public boolean hasCompositeKey()
Determine if this item type has a composite ID.

Specified by:
hasCompositeKey in interface RepositoryItemDescriptor
Returns:
default is false, implementations may override

encodeCompositeKey

public java.lang.String encodeCompositeKey(java.lang.String[] pIdValues)
                                    throws RepositoryException
Encode an array of ID values to be used as a Repository ID

Specified by:
encodeCompositeKey in interface RepositoryItemDescriptor
Parameters:
pIdValues - Array of ID values
Returns:
the encoded String value of the composite key
Throws:
RepositoryException - unsupported feature

getPluralDisplayName

public java.lang.String getPluralDisplayName()
Get the plural display name. First try to get it using the plural-display-name-resource and the resource bundle. If that doesn't work, try the plural-display-name attribute. Still no luck? Then just return the singular display name.


setLoggingDebug

public void setLoggingDebug(boolean pLoggingDebug)
Sets the property LoggingDebug.

Parameters:
pLoggingDebug - new value to set

isLoggingDebug

public boolean isLoggingDebug()
Returns:
The value of the property LoggingDebug.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getNewDisplayName

public java.lang.String getNewDisplayName()
Get the new display name using the new-asset-name-resource key from the resource bundle. This is used in displaying the new asset label on the asset creation page.


getSelectPluralDisplayName

public java.lang.String getSelectPluralDisplayName()
Get the select display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle. This is used in displaying the select asset label in the asset selection dialog.


getCreateDisplayName

public java.lang.String getCreateDisplayName()
Get the create display name label using the create-asset-name-resource key from the resource bundle. This is used in displaying the new asset label on the asset creation page.


getSelectDisplayName

public java.lang.String getSelectDisplayName()
Get the select display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle. This is used in displaying the select asset label in the asset selection dialog.


getMoveToDisplayName

public java.lang.String getMoveToDisplayName()
Get the move display label when the asset name is in plural form using the plural-asset-name-resource key from the resource bundle. This is used in displaying the select asset label in the asset selection dialog.