public class DataObjectMetadataImpl extends MetadataCommonBase implements DataObjectMetadataInternal
Contains lists of all child elements.
backingObjectName, description, embeddedCommonMetadata, label, mergeAction, name, readOnly, shortLabel
Constructor and Description |
---|
DataObjectMetadataImpl() |
Modifier and Type | Method and Description |
---|---|
DataObjectAttribute |
getAttribute(String attributeName)
Gets attribute metadata.
|
List<DataObjectAttribute> |
getAttributes()
Gets attributes defined on the data object.
|
Collection<UifAutoCreateViewType> |
getAutoCreateUifViewTypes()
BETA: Gets auto create uif view types.
|
List<String> |
getBusinessKeyAttributeNames()
List of attribute names which form a "user friendly" key.
|
DataObjectCollection |
getCollection(String collectionName)
Gets the named collection's metadata from the data object.
|
List<DataObjectCollection> |
getCollections()
Gets child collections.
|
DataObjectMetadataInternal |
getEmbedded()
The embedded DataObjectMetadata which will be used to fill in values not specified by this DataObjectMetadata.
|
List<String> |
getOrderedAttributeList()
Gets sorted attribute list.
|
String |
getPrimaryDisplayAttributeName()
Gets primary display attribute name
|
List<String> |
getPrimaryKeyAttributeNames()
Get the list of primary key attribute names for this data object.
|
String |
getProviderName()
Gets the metadata source.
|
DataObjectRelationship |
getRelationship(String relationshipName)
Gets the named relationship's metadata from the data object.
|
DataObjectRelationship |
getRelationshipByLastAttributeInRelationship(String attributeName)
Gets relationship of last attribute.
|
List<DataObjectRelationship> |
getRelationships()
Gets child relationships.
|
List<DataObjectRelationship> |
getRelationshipsInvolvingAttribute(String attributeName)
Gets attribute relationships.
|
Class<?> |
getType()
Gets metadata object type.
|
String |
getTypeClassName()
Gets type based on unknown class.
|
Object |
getUniqueKeyForMerging()
Returns the object's name without relying on embedded metadata.
|
Boolean |
hasDistinctBusinessKey()
Returns true if the list of primary key names and business key attribute names are different.
|
boolean |
isSupportsOptimisticLocking()
Determines whether optimistic locking is supported.
|
List<DataObjectAttribute> |
orderAttributesByDefinedOrder(List<DataObjectAttribute> attributes)
Orders attributes by defined order.
|
void |
setAttributes(List<DataObjectAttribute> attributes)
Sets attributes.
|
void |
setAutoCreateUifViewTypes(Collection<UifAutoCreateViewType> autoCreateUifViewTypes)
BETA: Sets list of UIF view types that will be auto created.
|
void |
setBusinessKeyAttributeNames(List<String> businessKeyAttributeNames)
Sets list of attribute names that make up business key.
|
void |
setCollections(List<DataObjectCollection> collections)
Sets collections.
|
void |
setEmbedded(DataObjectMetadataInternal embedded)
Sets the embedded DataObjectMetadata.
|
void |
setOrderedAttributeList(List<String> orderedAttributeList)
Sets sorted attribute list.
|
void |
setPrimaryDisplayAttributeName(String primaryDisplayAttributeName)
Sets list of attribute names used for display.
|
void |
setPrimaryKeyAttributeNames(List<String> primaryKeyAttributeNames)
Sets list of primary attribute names which make up key.
|
void |
setProviderName(String providerName)
Sets provider name.
|
void |
setRelationships(List<DataObjectRelationship> relationships)
Sets relationships.
|
void |
setSupportsOptimisticLocking(boolean supportsOptimisticLocking)
Sets whether optimistic locking is supported.
|
void |
setType(Class<?> type)
Sets unknown class to determine type.
|
void |
setTypeClassName(String typeClassName)
This is really a helper method for cases where these objects may need to be built up via Spring XML.
|
boolean |
shouldAutoCreateUifViewOfType(UifAutoCreateViewType viewType)
BETA: Determines where view type should be auto created.
|
String |
toString() |
getBackingObjectName, getDescription, getEmbeddedCommonMetadata, getLabel, getLabelFromPropertyName, getMergeAction, getName, getShortLabel, isReadOnly, mergeLists, setBackingObjectName, setDescription, setEmbeddedCommonMetadata, setLabel, setMergeAction, setName, setReadOnly, setShortLabel
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBackingObjectName, getDescription, getLabel, getMergeAction, getName, getShortLabel, isReadOnly
protected DataObjectMetadataInternal embedded
protected String providerName
protected List<DataObjectAttribute> attributes
protected Map<String,DataObjectAttribute> attributeMap
protected List<String> removedAttributeNames
protected List<String> orderedAttributeList
protected List<DataObjectCollection> collections
protected Map<String,DataObjectCollection> collectionMap
protected List<String> removedCollectionNames
protected List<DataObjectRelationship> relationships
protected Map<String,DataObjectRelationship> relationshipMap
protected List<String> removedRelationshipNames
protected Map<String,List<DataObjectRelationship>> attributeToRelationshipMap
protected Map<String,DataObjectRelationship> lastAttributeToRelationshipMap
protected List<String> primaryKeyAttributeNames
protected List<String> businessKeyAttributeNames
protected String primaryDisplayAttributeName
protected boolean primaryDisplayAttributeSetManually
protected Boolean supportsOptimisticLocking
protected Collection<UifAutoCreateViewType> autoCreateUifViewTypes
public DataObjectMetadataImpl()
public Object getUniqueKeyForMerging()
getUniqueKeyForMerging
in interface MetadataCommonInternal
getUniqueKeyForMerging
in class MetadataCommonBase
public Class<?> getType()
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.
getType
in interface DataObjectMetadata
public void setType(Class<?> type)
type
- unknown classpublic String getTypeClassName()
public void setTypeClassName(String typeClassName)
typeClassName
- class typepublic List<String> getPrimaryKeyAttributeNames()
getPrimaryKeyAttributeNames
in interface DataObjectMetadata
public void setPrimaryKeyAttributeNames(List<String> primaryKeyAttributeNames)
primaryKeyAttributeNames
- list of attribute names.public List<String> getBusinessKeyAttributeNames()
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.
getBusinessKeyAttributeNames
in interface DataObjectMetadata
public void setBusinessKeyAttributeNames(List<String> businessKeyAttributeNames)
businessKeyAttributeNames
- attribute namespublic Boolean hasDistinctBusinessKey()
hasDistinctBusinessKey
in interface DataObjectMetadata
public String getPrimaryDisplayAttributeName()
This 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.
getPrimaryDisplayAttributeName
in interface DataObjectMetadata
public void setPrimaryDisplayAttributeName(String primaryDisplayAttributeName)
primaryDisplayAttributeName
- list of attribute names.public List<DataObjectAttribute> orderAttributesByDefinedOrder(List<DataObjectAttribute> attributes)
First looks to see if attributes are inherited, then looks at the declared fields based on the attribute type.
attributes
- list of data object attributespublic List<DataObjectAttribute> getAttributes()
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).
getAttributes
in interface DataObjectMetadata
public void setAttributes(List<DataObjectAttribute> attributes)
Looks at merge actions when adding, so not all attributes are added.
attributes
- list of data object attributespublic List<DataObjectCollection> getCollections()
Gets all the child collections defined on the data object in the order given by the MetadataProvider.
getCollections
in interface DataObjectMetadata
public void setCollections(List<DataObjectCollection> collections)
Looks at merge actions when adding, so not all collections are added.
collections
- list of data object collections or nullpublic List<DataObjectRelationship> getRelationships()
Gets all the child relationships defined on the data object in the order given by the MetadataProvider.
getRelationships
in interface DataObjectMetadata
public void setRelationships(List<DataObjectRelationship> relationships)
Looks at merge actions and whether the relationship is empty when adding, so not all relationships are added.
relationships
- list of data object relationships or nullpublic DataObjectAttribute getAttribute(String attributeName)
Get the named attribute's metadata from the data object.
getAttribute
in interface DataObjectMetadata
DataObjectAttribute
otherwise.public DataObjectCollection getCollection(String collectionName)
The name is the property on the data object which holds
the Collection
.
getCollection
in interface DataObjectMetadata
DataObjectCollection
otherwise.public DataObjectRelationship getRelationship(String relationshipName)
The name is the property on the data object which holds the related business object's instance.
getRelationship
in interface DataObjectMetadata
DataObjectRelationship
otherwise.public List<DataObjectRelationship> getRelationshipsInvolvingAttribute(String attributeName)
Returns all relationships of which the given attribute is part of the foreign key relationship.
getRelationshipsInvolvingAttribute
in interface DataObjectMetadata
public DataObjectRelationship getRelationshipByLastAttributeInRelationship(String attributeName)
Returns a single relationship for which the given attribute is the last in the foreign key relationship.
getRelationshipByLastAttributeInRelationship
in interface DataObjectMetadata
DataObjectRelationship
otherwise.public DataObjectMetadataInternal getEmbedded()
getEmbedded
in interface DataObjectMetadataInternal
public void setEmbedded(DataObjectMetadataInternal embedded)
setEmbedded
in interface DataObjectMetadataInternal
embedded
- or nullpublic String getProviderName()
Helper property to allow identification of the source of metadata. Value is transient, so it will not survive serialization.
public void setProviderName(String providerName)
providerName
- name of providerpublic String toString()
toString
in class MetadataCommonBase
public boolean isSupportsOptimisticLocking()
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.
isSupportsOptimisticLocking
in interface DataObjectMetadata
public void setSupportsOptimisticLocking(boolean supportsOptimisticLocking)
supportsOptimisticLocking
- whether optimistic locking is supported@Beta public boolean shouldAutoCreateUifViewOfType(UifAutoCreateViewType viewType)
Determines whether the specified uif view type can be auto created.
shouldAutoCreateUifViewOfType
in interface DataObjectMetadata
@Beta public Collection<UifAutoCreateViewType> getAutoCreateUifViewTypes()
Returns collections of uif view types that should be auto created.
getAutoCreateUifViewTypes
in interface DataObjectMetadata
@Beta public void setAutoCreateUifViewTypes(Collection<UifAutoCreateViewType> autoCreateUifViewTypes)
autoCreateUifViewTypes
- UIF view typespublic List<String> getOrderedAttributeList()
public void setOrderedAttributeList(List<String> orderedAttributeList)
orderedAttributeList
- sorted attributesCopyright © 2005–2016 The Kuali Foundation. All rights reserved.