Class DataObjectMetadataImpl
- All Implemented Interfaces:
Serializable,DataObjectMetadata,DataObjectMetadataInternal,MetadataCommonInternal,MetadataCommon
Contains lists of all child elements.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String, DataObjectAttribute> protected List<DataObjectAttribute> protected Map<String, List<DataObjectRelationship>> protected Map<String, DataObjectCollection> protected List<DataObjectCollection> protected DataObjectMetadataInternalprotected Map<String, DataObjectRelationship> protected Stringprotected booleanprotected StringProperty used to help with debugging.protected Map<String, DataObjectRelationship> protected List<DataObjectRelationship> protected Booleanprotected Class<?> Fields inherited from class org.kuali.rice.krad.data.metadata.impl.MetadataCommonBase
backingObjectName, description, embeddedCommonMetadata, label, mergeAction, name, readOnly, shortLabel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String attributeName) Gets attribute metadata.Gets attributes defined on the data object.List of attribute names which form a "user friendly" key.getCollection(String collectionName) Gets the named collection's metadata from the data object.Gets child collections.The embedded DataObjectMetadata which will be used to fill in values not specified by this DataObjectMetadata.Gets sorted attribute list.Gets primary display attribute nameGet the list of primary key attribute names for this data object.Gets the metadata source.getRelationship(String relationshipName) Gets the named relationship's metadata from the data object.getRelationshipByLastAttributeInRelationship(String attributeName) Gets relationship of last attribute.Gets child relationships.getRelationshipsInvolvingAttribute(String attributeName) Gets attribute relationships.Class<?> getType()Gets metadata object type.Gets type based on unknown class.Returns the object's name without relying on embedded metadata.Returns true if the list of primary key names and business key attribute names are different.booleanDetermines whether optimistic locking is supported.orderAttributesByDefinedOrder(List<DataObjectAttribute> attributes) Orders attributes by defined order.voidsetAttributes(List<DataObjectAttribute> attributes) Sets attributes.voidsetBusinessKeyAttributeNames(List<String> businessKeyAttributeNames) Sets list of attribute names that make up business key.voidsetCollections(List<DataObjectCollection> collections) Sets collections.voidsetEmbedded(DataObjectMetadataInternal embedded) Sets the embedded DataObjectMetadata.voidsetOrderedAttributeList(List<String> orderedAttributeList) Sets sorted attribute list.voidsetPrimaryDisplayAttributeName(String primaryDisplayAttributeName) Sets list of attribute names used for display.voidsetPrimaryKeyAttributeNames(List<String> primaryKeyAttributeNames) Sets list of primary attribute names which make up key.voidsetProviderName(String providerName) Sets provider name.voidsetRelationships(List<DataObjectRelationship> relationships) Sets relationships.voidsetSupportsOptimisticLocking(boolean supportsOptimisticLocking) Sets whether optimistic locking is supported.voidSets unknown class to determine type.voidsetTypeClassName(String typeClassName) This is really a helper method for cases where these objects may need to be built up via Spring XML.toString()Methods inherited from class org.kuali.rice.krad.data.metadata.impl.MetadataCommonBase
getBackingObjectName, getDescription, getEmbeddedCommonMetadata, getLabel, getLabelFromPropertyName, getMergeAction, getName, getShortLabel, isReadOnly, mergeLists, setBackingObjectName, setDescription, setEmbeddedCommonMetadata, setLabel, setMergeAction, setName, setReadOnly, setShortLabelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kuali.rice.krad.data.metadata.MetadataCommon
getBackingObjectName, getDescription, getLabel, getMergeAction, getName, getShortLabel, isReadOnly
-
Field Details
-
embedded
-
providerName
Property used to help with debugging. It is used in the toString() method so you can determine from which provider this metadata was extracted. -
type
-
attributes
-
attributeMap
-
removedAttributeNames
-
orderedAttributeList
-
collections
-
collectionMap
-
removedCollectionNames
-
relationships
-
relationshipMap
-
removedRelationshipNames
-
attributeToRelationshipMap
-
lastAttributeToRelationshipMap
-
-
businessKeyAttributeNames
-
primaryDisplayAttributeName
-
primaryDisplayAttributeSetManually
protected boolean primaryDisplayAttributeSetManually -
supportsOptimisticLocking
-
-
Constructor Details
-
DataObjectMetadataImpl
public DataObjectMetadataImpl()
-
-
Method Details
-
getUniqueKeyForMerging
Returns the object's name without relying on embedded metadata. To override, this name must be set.- Specified by:
getUniqueKeyForMergingin interfaceMetadataCommonInternal- Overrides:
getUniqueKeyForMergingin classMetadataCommonBase
-
getType
Gets metadata object type.The type represented by this metadata object. Usually this will simply contain the class name created by the persistence layer when it is loaded from the database.
- Specified by:
getTypein interfaceDataObjectMetadata- Returns:
- metadata object type. Will never return null.
-
setType
Sets unknown class to determine type.- Parameters:
type- unknown class
-
getTypeClassName
Gets type based on unknown class.- Returns:
- class type or null
-
setTypeClassName
This is really a helper method for cases where these objects may need to be built up via Spring XML.- Parameters:
typeClassName- class type
-
getPrimaryKeyAttributeNames
Get the list of primary key attribute names for this data object.- Specified by:
getPrimaryKeyAttributeNamesin interfaceDataObjectMetadata- Returns:
- primary key attribute names.
-
setPrimaryKeyAttributeNames
Sets list of primary attribute names which make up key.- Parameters:
primaryKeyAttributeNames- list of attribute names.
-
getBusinessKeyAttributeNames
List of attribute names which form a "user friendly" key. (As opposed to a sequence number as used by some parts of the system).An example here would be the KIM Role object where the Role ID is the primary key, but the Namespace and Name properties form the user-visible and enterable key.
- Specified by:
getBusinessKeyAttributeNamesin interfaceDataObjectMetadata- Returns:
- a list containing the business key attributes names for the data object.
-
setBusinessKeyAttributeNames
Sets list of attribute names that make up business key.- Parameters:
businessKeyAttributeNames- attribute names
-
hasDistinctBusinessKey
Returns true if the list of primary key names and business key attribute names are different.- Specified by:
hasDistinctBusinessKeyin interfaceDataObjectMetadata- Returns:
- true if the list of primary key names and business key attributes are different, false if they are the same.
-
getPrimaryDisplayAttributeName
Gets primary display attribute nameThis is the field on the object which best represents it on displays. It will be used to build inquiry links and determine where to place quickfinder links. Usually this will be the the primary key or the last field of the primary key if there are multiple fields.
If not specified by the provider, the base implementation will default it to the last attribute in the primaryKeyAttributeNames list.
- Specified by:
getPrimaryDisplayAttributeNamein interfaceDataObjectMetadata- Returns:
- the name of the attribute to use for primary display purposes.
-
setPrimaryDisplayAttributeName
Sets list of attribute names used for display.- Parameters:
primaryDisplayAttributeName- list of attribute names.
-
orderAttributesByDefinedOrder
public List<DataObjectAttribute> orderAttributesByDefinedOrder(List<DataObjectAttribute> attributes) Orders attributes by defined order.First looks to see if attributes are inherited, then looks at the declared fields based on the attribute type.
- Parameters:
attributes- list of data object attributes- Returns:
- re-ordered list of data object attributes
-
getAttributes
Gets attributes defined on the data object.Gets all the attributes defined on the data object in the order given by the MetadataProvider. This may or may not be the same as the backing object's (table) and is most likely the order in which they appear in the source persistence metadata (XML or annotations).
- Specified by:
getAttributesin interfaceDataObjectMetadata- Returns:
- Data object attributes. Will never return null. Will return an empty list if no attributes defined.
-
setAttributes
Sets attributes.Looks at merge actions when adding, so not all attributes are added.
- Parameters:
attributes- list of data object attributes
-
getCollections
Gets child collections.Gets all the child collections defined on the data object in the order given by the MetadataProvider.
- Specified by:
getCollectionsin interfaceDataObjectMetadata- Returns:
- Child collections. Will never return null. Will return an empty list if no collections defined.
-
setCollections
Sets collections.Looks at merge actions when adding, so not all collections are added.
- Parameters:
collections- list of data object collections or null
-
getRelationships
Gets child relationships.Gets all the child relationships defined on the data object in the order given by the MetadataProvider.
- Specified by:
getRelationshipsin interfaceDataObjectMetadata- Returns:
- Child relationships. Will never return null. Will return an empty list if no relationships defined.
-
setRelationships
Sets relationships.Looks at merge actions and whether the relationship is empty when adding, so not all relationships are added.
- Parameters:
relationships- list of data object relationships or null
-
getAttribute
Gets attribute metadata.Get the named attribute's metadata from the data object.
- Specified by:
getAttributein interfaceDataObjectMetadata- Returns:
- null if the attributeName does not exist, the associated
DataObjectAttributeotherwise.
-
getCollection
Gets the named collection's metadata from the data object.The name is the property on the data object which holds the
Collection.- Specified by:
getCollectionin interfaceDataObjectMetadata- Returns:
- null if the attributeName does not exist, the associated
DataObjectCollectionotherwise.
-
getRelationship
Gets the named relationship's metadata from the data object.The name is the property on the data object which holds the related business object's instance.
- Specified by:
getRelationshipin interfaceDataObjectMetadata- Returns:
- null if the attributeName does not exist, the associated
DataObjectRelationshipotherwise.
-
getRelationshipsInvolvingAttribute
Gets attribute relationships.Returns all relationships of which the given attribute is part of the foreign key relationship.
- Specified by:
getRelationshipsInvolvingAttributein interfaceDataObjectMetadata- Returns:
- The list of relationship metadata objects or an empty list if none found.
-
getRelationshipByLastAttributeInRelationship
Gets relationship of last attribute.Returns a single relationship for which the given attribute is the last in the foreign key relationship.
- Specified by:
getRelationshipByLastAttributeInRelationshipin interfaceDataObjectMetadata- Returns:
- null if no relationship's foreign key set ends wit the given field. The
DataObjectRelationshipotherwise.
-
getEmbedded
The embedded DataObjectMetadata which will be used to fill in values not specified by this DataObjectMetadata.- Specified by:
getEmbeddedin interfaceDataObjectMetadataInternal- Returns:
- the embedded metadata, or no if no metadata is embedded
-
setEmbedded
Sets the embedded DataObjectMetadata.- Specified by:
setEmbeddedin interfaceDataObjectMetadataInternal- Parameters:
embedded- or null
-
getProviderName
Gets the metadata source.Helper property to allow identification of the source of metadata. Value is transient, so it will not survive serialization.
- Returns:
- metadata source
-
setProviderName
Sets provider name.- Parameters:
providerName- name of provider
-
toString
- Overrides:
toStringin classMetadataCommonBase
-
isSupportsOptimisticLocking
public boolean isSupportsOptimisticLocking()Determines whether optimistic locking is supported.Returns true if the underlying ORM tool performs optimistic locking checks on this object before saving. Under the KNS, this was done via the versionNumber property and appropriate OJB configuration. In JPA, this is linked to the @Version annotation.
- Specified by:
isSupportsOptimisticLockingin interfaceDataObjectMetadata- Returns:
- true if this data object is configured for optimistic locking.
-
setSupportsOptimisticLocking
public void setSupportsOptimisticLocking(boolean supportsOptimisticLocking) Sets whether optimistic locking is supported.- Parameters:
supportsOptimisticLocking- whether optimistic locking is supported
-
getOrderedAttributeList
Gets sorted attribute list.- Returns:
- ordered attribute list
-
setOrderedAttributeList
Sets sorted attribute list.- Parameters:
orderedAttributeList- sorted attributes
-