atg.repository
Class NotEmptyChooserPropertyDescriptor

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by atg.beans.SerializableFeatureDescriptor
          extended by atg.beans.DynamicPropertyDescriptor
              extended by atg.repository.RepositoryPropertyDescriptor
                  extended by atg.repository.ChooserPropertyDescriptor
                      extended by atg.repository.NotEmptyChooserPropertyDescriptor
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class NotEmptyChooserPropertyDescriptor
extends atg.repository.ChooserPropertyDescriptor

A property descriptor to be used with a Repository that returns the first object that is not empty or the merged collection of all non-empty values. The getPropertyValue method iterates over the list of property names and fetches the value. If the attribute value merge is set to true (default false) and if the value is not empty, then it is added to a merged collection. If no merging is supposed to occur then we just return the first non-empty value. If all the values are empty, then null is returned.

The term empty means the following:

  1. Collection.isEmpty()
  2. Map.isEmpty()
  3. If an object array length not equal to 0
  4. If the object is null

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  boolean mMerge
           
protected  boolean mRemoveDuplicates
           
 
Fields inherited from class atg.repository.ChooserPropertyDescriptor
mDebug, mPropertyNames, PROPERTIES_PARAM
 
Fields inherited from class atg.repository.RepositoryPropertyDescriptor
EMPTY_LIST, EMPTY_MAP, EMPTY_SET, FOREIGN_REPOSITORY_NAME, FOREIGN_REPOSITORY_PATH, mCollectionOrMap
 
Fields inherited from class atg.beans.DynamicPropertyDescriptor
PORTABLE_VALUE_KEY
 
Fields inherited from class atg.beans.SerializableFeatureDescriptor
BUNDLE_ATTRIBUTE_NAME, LOCALE_ATTRIBUTE_NAME
 
Constructor Summary
NotEmptyChooserPropertyDescriptor()
          Constructs an instanceof NotEmptyChooserPropertyDescriptor
NotEmptyChooserPropertyDescriptor(java.lang.String pPropertyName)
          Constructs an instanceof NotEmptyChooserPropertyDescriptor
NotEmptyChooserPropertyDescriptor(java.lang.String pPropertyName, java.lang.Class pPropertyType, java.lang.String pShortDescription)
          Constructs an instanceof NotEmptyChooserPropertyDescriptor
 
Method Summary
 java.lang.Object getPropertyValue(RepositoryItemImpl pItem, java.lang.Object pValue)
          Returns the first non-empty property value, from the list of property names
 java.lang.String getTypeName()
          Returns the name this type uses in the XML file.
protected  java.lang.Object[] mergeIntoArray(RepositoryItemImpl pItem, java.lang.Object pValue)
           
protected  java.util.List mergeIntoList(RepositoryItemImpl pItem, java.lang.Object pValue)
           
protected  java.util.Map mergeIntoMap(RepositoryItemImpl pItem, java.lang.Object pValue)
           
protected  java.util.Set mergeIntoSet(RepositoryItemImpl pItem, java.lang.Object pValue)
           
 void setValue(java.lang.String pAttributeName, java.lang.Object pValue)
          Looks for an attribute named merge.
protected  boolean useArray(java.lang.Object pObject)
           
protected  boolean useCollection(java.lang.Object pObject)
           
protected  boolean useList(java.lang.Object pObject)
           
protected  boolean useMap(java.lang.Object pObject)
           
protected  boolean useObject(java.lang.Object pObject)
          Returns true if the object supplied is not "empty"
protected  boolean useSet(java.lang.Object pObject)
           
 
Methods inherited from class atg.repository.ChooserPropertyDescriptor
isQueryable, isWritable, logDebug
 
Methods inherited from class atg.repository.RepositoryPropertyDescriptor
clone, createPropertyDescriptorFromType, getCascadeDelete, getCascadeInsert, getCascadeUpdate, getComponentItemDescriptor, getComponentPropertyBeanInfo, getDefaultValue, getDefaultValueString, getItemDescriptor, getPropertyBeanInfo, getPropertyItemDescriptor, getResourceBundle, getResourceBundleName, getUnmodifiableDefaultValue, isAssignableFrom, isCacheable, isCollectionOrMap, isDerived, isIdProperty, isIgnoreNullValue, isLoggingDebug, isMultiValued, isPersistent, isValidValue, isVersionable, isVersionableSet, registerPropertyDescriptorClass, setCacheable, setCascadeDelete, setCascadeInsert, setCascadeUpdate, setComponentItemDescriptor, setDefaultValue, setDefaultValueString, setDerived, setIdProperty, setIgnoreNullValue, setItemDescriptor, setLoggingDebug, setPersistent, setPropertyItemDescriptor, setPropertyType, setPropertyValue, setQueryable, setResourceBundleName, setVersionable, toString
 
Methods inherited from class atg.beans.DynamicPropertyDescriptor
createLocalePropertyEditor, createLocalePropertyEditor, createPropertyEditor, getComponentPropertyType, getPropertyEditorClass, getPropertyType, getUIPropertyEditor, isReadable, isRequired, setComponentPropertyType, setPropertyEditorClass, setReadable, setRequired, setWritable
 
Methods inherited from class atg.beans.SerializableFeatureDescriptor
copyFeatureDescriptor, getDisplayName, getDisplayNameResource, getDisplaySortString, getShortDescription, getShortDescriptionResource, getSortString, setDisplayNameResource, setShortDescriptionResource
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getName, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mMerge

protected boolean mMerge

mRemoveDuplicates

protected boolean mRemoveDuplicates
Constructor Detail

NotEmptyChooserPropertyDescriptor

public NotEmptyChooserPropertyDescriptor()
Constructs an instanceof NotEmptyChooserPropertyDescriptor


NotEmptyChooserPropertyDescriptor

public NotEmptyChooserPropertyDescriptor(java.lang.String pPropertyName)
Constructs an instanceof NotEmptyChooserPropertyDescriptor


NotEmptyChooserPropertyDescriptor

public NotEmptyChooserPropertyDescriptor(java.lang.String pPropertyName,
                                         java.lang.Class pPropertyType,
                                         java.lang.String pShortDescription)
Constructs an instanceof NotEmptyChooserPropertyDescriptor

Method Detail

getPropertyValue

public java.lang.Object getPropertyValue(RepositoryItemImpl pItem,
                                         java.lang.Object pValue)
Returns the first non-empty property value, from the list of property names

Overrides:
getPropertyValue in class atg.repository.ChooserPropertyDescriptor

mergeIntoList

protected java.util.List mergeIntoList(RepositoryItemImpl pItem,
                                       java.lang.Object pValue)

useList

protected boolean useList(java.lang.Object pObject)

useCollection

protected boolean useCollection(java.lang.Object pObject)

mergeIntoSet

protected java.util.Set mergeIntoSet(RepositoryItemImpl pItem,
                                     java.lang.Object pValue)

useSet

protected boolean useSet(java.lang.Object pObject)

mergeIntoMap

protected java.util.Map mergeIntoMap(RepositoryItemImpl pItem,
                                     java.lang.Object pValue)

useMap

protected boolean useMap(java.lang.Object pObject)

mergeIntoArray

protected java.lang.Object[] mergeIntoArray(RepositoryItemImpl pItem,
                                            java.lang.Object pValue)

useArray

protected boolean useArray(java.lang.Object pObject)

useObject

protected boolean useObject(java.lang.Object pObject)
Returns true if the object supplied is not "empty"

Specified by:
useObject in class atg.repository.ChooserPropertyDescriptor

setValue

public void setValue(java.lang.String pAttributeName,
                     java.lang.Object pValue)
Looks for an attribute named merge. If merge is true then the getPropertyValue call will return a merged view of all the elements.

Overrides:
setValue in class atg.repository.ChooserPropertyDescriptor

getTypeName

public java.lang.String getTypeName()
Returns the name this type uses in the XML file.

Specified by:
getTypeName in class atg.repository.ChooserPropertyDescriptor