Class DataObjectWrapperBase<T>
- Type Parameters:
T- the type of the data object to wrap.
- All Implemented Interfaces:
DataObjectWrapper<T>,org.springframework.beans.BeanWrapper,org.springframework.beans.ConfigurablePropertyAccessor,org.springframework.beans.PropertyAccessor,org.springframework.beans.PropertyEditorRegistry,org.springframework.beans.TypeConverter
DataObjectWrapper.- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Field Summary
Fields inherited from interface org.springframework.beans.PropertyAccessor
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataObjectWrapperBase(T dataObject, DataObjectMetadata metadata, DataObjectService dataObjectService, ReferenceLinker referenceLinker) Creates a data object wrapper. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether all fields in the primary key are populated with a non-null/non-blank value.booleanReturns whether any fields in the primary key is populated with a non-null/non-blank value.<Y> YconvertIfNecessary(Object value, Class<Y> requiredType) <Y> YconvertIfNecessary(Object value, Class<Y> requiredType, Field field) <Y> YconvertIfNecessary(Object value, Class<Y> requiredType, org.springframework.core.MethodParameter methodParam) booleanequalsByPrimaryKey(T object) Determines if the given data object is equal to the data object wrapped by this accessor based on primary key values only.voidfetchRelationship(String relationshipName) Fetches and populates the value for the relationship with the given name on the wrapped data object.voidfetchRelationship(String relationshipName, boolean useForeignKeyAttribute, boolean nullifyDanglingRelationship) Fetches and populates the value for the relationship with the given name on the wrapped object.protected voidfetchRelationship(MetadataChild relationship, boolean useForeignKeyAttribute, boolean nullifyDanglingRelationship) Fetches and populates the value for the relationship with the given name on the wrapped object.protected voidfetchRelationshipUsingAttributes(MetadataChild relationship, boolean nullifyDanglingRelationship) Fetches the relationship using the foreign key attributes.protected voidfetchRelationshipUsingIdentity(MetadataChild relationship, boolean nullifyDanglingRelationship) Fetches the relationship using the primary key attributes.findCustomEditor(Class<?> requiredType, String propertyPath) intgetChildrenMatchingOptions(MaterializeOption... options) This method retrieves theMetadataChildobjects (DataObjectRelationshiporDataObjectCollection) which match the givenMaterializeOptionoptions.org.springframework.core.convert.ConversionServicegetForeignKeyAttributeMap(String relationshipName) Gets the map of child attribute names to the parent attribute values.getForeignKeyAttributeValue(String relationshipName) AsDataObjectWrapper.getForeignKeyValue(String)except only returns the value for the "attribute" foreign key value.getForeignKeyValue(String relationshipName) Returns the value of the foreign key for the specified relationship on the wrapped data object, or null if the wrapped object has no value for the requested foreign key.Returns the metadata of the data object wrapped by this accessor.Returns the value of the primary key for the wrapped data object, or null if the wrapped object has no value for it's primary key.Returns a map containing the values of the primary keys on this data object.getPropertyDescriptor(String propertyName) Class<?> getPropertyType(String propertyName) org.springframework.core.convert.TypeDescriptorgetPropertyTypeDescriptor(String propertyName) Class<?> getPropertyTypeNullSafe(Class<?> objectType, String propertyName) Get property type for property name on object, this can be a nested property and method will recursively use the metadata to find type.getPropertyValue(String propertyName) getPropertyValueNullSafe(String propertyName) Get the current value of the specified property, but suppresses anyNullValueInNestedPathExceptions that would be thrown if a null value is encountered in a nested path and just returns null instead.Returns the list of field of the primary key which have a null or blank value.Return the type of the wrapped data object.Returns the data object wrapped by this accessor.booleanbooleanbooleanisReadableProperty(String propertyName) booleanisWritableProperty(String propertyName) voidlinkChanges(Set<String> changedPropertyPaths) Executes reference linking using the wrapped object as the root and the set of changed paths.voidlinkForeignKeys(boolean onlyLinkReadOnly) Links foreign key values on the wrapped data object and then recurses through all child relationships and collections which are cascaded during persistence and does the same.voidlinkForeignKeys(String relationshipName, boolean onlyLinkReadOnly) Links foreign keys non-recursively using the relationship with the given name on the wrapped data object.protected voidlinkForeignKeysInternal(Object object, boolean onlyLinkReadOnly, Set<Object> linked) Links all foreign keys on the data object.protected voidlinkForeignKeysInternal(DataObjectWrapper<?> wrapped, MetadataChild relationship, Object relationshipValue, boolean onlyLinkReadOnly) Links foreign keys non-recursively using the relationship with the given name on the wrapped data object.protected voidlinkForeignKeysInternalWrapped(DataObjectWrapper<?> wrapped, boolean onlyLinkReadOnly, Set<Object> linked) Links all foreign keys on the wrapped data object.voidmaterializeReferencedObjects(MaterializeOption... options) Fetches and populates referenced objects within the wrapped object.voidmaterializeReferencedObjectsToDepth(int maxDepth, MaterializeOption... options) Fetches and populates referenced objects within the wrapped object.protected voidpopulateInverseRelationship(MetadataChild relationship, Object propertyValue) Populates the property on the other side of the relationship.voidregisterCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor) voidregisterCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) voidsetAutoGrowCollectionLimit(int autoGrowCollectionLimit) voidsetAutoGrowNestedPaths(boolean autoGrowNestedPaths) voidsetConversionService(org.springframework.core.convert.ConversionService conversionService) voidsetExtractOldValueForEditor(boolean extractOldValueForEditor) voidsetPropertyValue(String propertyName, Object value) voidsetPropertyValue(org.springframework.beans.PropertyValue pv) voidsetPropertyValues(Map<?, ?> map) voidsetPropertyValues(org.springframework.beans.PropertyValues pvs) voidsetPropertyValues(org.springframework.beans.PropertyValues pvs, boolean ignoreUnknown) voidsetPropertyValues(org.springframework.beans.PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.TypeConverter
convertIfNecessary
-
Constructor Details
-
DataObjectWrapperBase
protected DataObjectWrapperBase(T dataObject, DataObjectMetadata metadata, DataObjectService dataObjectService, ReferenceLinker referenceLinker) Creates a data object wrapper.- Parameters:
dataObject- the data object to wrap.metadata- the metadata of the data object.dataObjectService- the data object service to use.referenceLinker- the reference linker implementation.
-
-
Method Details
-
getMetadata
Returns the metadata of the data object wrapped by this accessor.- Specified by:
getMetadatain interfaceDataObjectWrapper<T>- Returns:
- the metadata of the data object wrapped by this accessor
-
getWrappedInstance
Returns the data object wrapped by this accessor.- Specified by:
getWrappedInstancein interfaceorg.springframework.beans.BeanWrapper- Specified by:
getWrappedInstancein interfaceDataObjectWrapper<T>- Returns:
- the data object wrapped by this accessor
-
getPropertyValueNullSafe
public Object getPropertyValueNullSafe(String propertyName) throws org.springframework.beans.BeansException Get the current value of the specified property, but suppresses anyNullValueInNestedPathExceptions that would be thrown if a null value is encountered in a nested path and just returns null instead. This method is essentially a convenience method to prevent calling code from having to wrap calls toPropertyAccessor.getPropertyValue(String)with a try-catch block to check for NullValueInNestedPathExceptions.- Specified by:
getPropertyValueNullSafein interfaceDataObjectWrapper<T>- Parameters:
propertyName- the name of the property to get the value of (may be a nested path and/or an indexed/mapped property)- Returns:
- the value of the property, or null if any null values were encountered in nested paths
- Throws:
org.springframework.beans.BeansException
-
getWrappedClass
Return the type of the wrapped data object.- Specified by:
getWrappedClassin interfaceorg.springframework.beans.BeanWrapper- Specified by:
getWrappedClassin interfaceDataObjectWrapper<T>- Returns:
- the type of the wrapped data instance, or
nullif no wrapped object has been set
-
getPropertyDescriptors
- Specified by:
getPropertyDescriptorsin interfaceorg.springframework.beans.BeanWrapper
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(String propertyName) throws org.springframework.beans.InvalidPropertyException - Specified by:
getPropertyDescriptorin interfaceorg.springframework.beans.BeanWrapper- Throws:
org.springframework.beans.InvalidPropertyException
-
setAutoGrowNestedPaths
public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths) - Specified by:
setAutoGrowNestedPathsin interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
isAutoGrowNestedPaths
public boolean isAutoGrowNestedPaths()- Specified by:
isAutoGrowNestedPathsin interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
setAutoGrowCollectionLimit
public void setAutoGrowCollectionLimit(int autoGrowCollectionLimit) - Specified by:
setAutoGrowCollectionLimitin interfaceorg.springframework.beans.BeanWrapper
-
getAutoGrowCollectionLimit
public int getAutoGrowCollectionLimit()- Specified by:
getAutoGrowCollectionLimitin interfaceorg.springframework.beans.BeanWrapper
-
setConversionService
public void setConversionService(org.springframework.core.convert.ConversionService conversionService) - Specified by:
setConversionServicein interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
getConversionService
public org.springframework.core.convert.ConversionService getConversionService()- Specified by:
getConversionServicein interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
setExtractOldValueForEditor
public void setExtractOldValueForEditor(boolean extractOldValueForEditor) - Specified by:
setExtractOldValueForEditorin interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
isExtractOldValueForEditor
public boolean isExtractOldValueForEditor()- Specified by:
isExtractOldValueForEditorin interfaceorg.springframework.beans.ConfigurablePropertyAccessor
-
isReadableProperty
- Specified by:
isReadablePropertyin interfaceorg.springframework.beans.PropertyAccessor
-
isWritableProperty
- Specified by:
isWritablePropertyin interfaceorg.springframework.beans.PropertyAccessor
-
getPropertyType
public Class<?> getPropertyType(String propertyName) throws org.springframework.beans.BeansException - Specified by:
getPropertyTypein interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
getPropertyTypeDescriptor
public org.springframework.core.convert.TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws org.springframework.beans.BeansException - Specified by:
getPropertyTypeDescriptorin interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
getPropertyValue
- Specified by:
getPropertyValuein interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValue
public void setPropertyValue(String propertyName, Object value) throws org.springframework.beans.BeansException - Specified by:
setPropertyValuein interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValue
public void setPropertyValue(org.springframework.beans.PropertyValue pv) throws org.springframework.beans.BeansException - Specified by:
setPropertyValuein interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValues
- Specified by:
setPropertyValuesin interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValues
public void setPropertyValues(org.springframework.beans.PropertyValues pvs) throws org.springframework.beans.BeansException - Specified by:
setPropertyValuesin interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValues
public void setPropertyValues(org.springframework.beans.PropertyValues pvs, boolean ignoreUnknown) throws org.springframework.beans.BeansException - Specified by:
setPropertyValuesin interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
setPropertyValues
public void setPropertyValues(org.springframework.beans.PropertyValues pvs, boolean ignoreUnknown, boolean ignoreInvalid) throws org.springframework.beans.BeansException - Specified by:
setPropertyValuesin interfaceorg.springframework.beans.PropertyAccessor- Throws:
org.springframework.beans.BeansException
-
registerCustomEditor
- Specified by:
registerCustomEditorin interfaceorg.springframework.beans.PropertyEditorRegistry
-
registerCustomEditor
public void registerCustomEditor(Class<?> requiredType, String propertyPath, PropertyEditor propertyEditor) - Specified by:
registerCustomEditorin interfaceorg.springframework.beans.PropertyEditorRegistry
-
findCustomEditor
- Specified by:
findCustomEditorin interfaceorg.springframework.beans.PropertyEditorRegistry
-
convertIfNecessary
public <Y> Y convertIfNecessary(Object value, Class<Y> requiredType) throws org.springframework.beans.TypeMismatchException - Specified by:
convertIfNecessaryin interfaceorg.springframework.beans.TypeConverter- Throws:
org.springframework.beans.TypeMismatchException
-
convertIfNecessary
public <Y> Y convertIfNecessary(Object value, Class<Y> requiredType, org.springframework.core.MethodParameter methodParam) throws org.springframework.beans.TypeMismatchException - Specified by:
convertIfNecessaryin interfaceorg.springframework.beans.TypeConverter- Throws:
org.springframework.beans.TypeMismatchException
-
convertIfNecessary
public <Y> Y convertIfNecessary(Object value, Class<Y> requiredType, Field field) throws org.springframework.beans.TypeMismatchException - Specified by:
convertIfNecessaryin interfaceorg.springframework.beans.TypeConverter- Throws:
org.springframework.beans.TypeMismatchException
-
getPrimaryKeyValues
Returns a map containing the values of the primary keys on this data object. The key of this map will be the attribute name of the primary key field on the data object and the value will the value of that primary key attribute on the data object wrapped by this accessor. If this data object has no primary key fields, an empty map will be returned.- Specified by:
getPrimaryKeyValuesin interfaceDataObjectWrapper<T>- Returns:
- a map of primary key values where the key is the attribute name of the primary key field and the value is the value of that primary key field on the wrapped data object
-
getPrimaryKeyValue
Returns the value of the primary key for the wrapped data object, or null if the wrapped object has no value for it's primary key.If the primary key consists of multiple values, this method will return an instance of
CompoundKey, otherwise the single primary key value will be returned. If the primary key consists of multiple values but those values are only partially populated, this method will return null.- Specified by:
getPrimaryKeyValuein interfaceDataObjectWrapper<T>- Returns:
- the single primary key value for the wrapped data object, or null if it has no fully-populated primary key value
-
areAllPrimaryKeyAttributesPopulated
public boolean areAllPrimaryKeyAttributesPopulated()Returns whether all fields in the primary key are populated with a non-null/non-blank value.- Specified by:
areAllPrimaryKeyAttributesPopulatedin interfaceDataObjectWrapper<T>
-
areAnyPrimaryKeyAttributesPopulated
public boolean areAnyPrimaryKeyAttributesPopulated()Returns whether any fields in the primary key is populated with a non-null/non-blank value.- Specified by:
areAnyPrimaryKeyAttributesPopulatedin interfaceDataObjectWrapper<T>
-
getUnpopulatedPrimaryKeyAttributeNames
Returns the list of field of the primary key which have a null or blank value.- Specified by:
getUnpopulatedPrimaryKeyAttributeNamesin interfaceDataObjectWrapper<T>
-
equalsByPrimaryKey
Determines if the given data object is equal to the data object wrapped by this accessor based on primary key values only. If the given object is null, then this method will always return false.- Specified by:
equalsByPrimaryKeyin interfaceDataObjectWrapper<T>- Parameters:
object- the object to compare to the data object wrapped by this accessor- Returns:
- true if the primary key values are equal, false otherwise
-
getForeignKeyValue
Returns the value of the foreign key for the specified relationship on the wrapped data object, or null if the wrapped object has no value for the requested foreign key.If the foreign key is a compound/composite and consists of multiple values, this method will return an instance of
CompoundKey, otherwise the single foreign key value will be returned. If the foreign key is compound/composite but those values are only partially populated, this method will return null.It is common that a data object may have more than one field or set of fields that constitute a specific foreign key for the specified relationship. In such cases there would be an attribute (or attributes) which represent the foreign key as well as the related object itself. For example, consider the following scenario:
public class One { String twoId; Two two; }In this case,
twoIdis an attribute that serves as a foreign key toTwo, but thetwoattribute would contain an internaltwoIdattribute which is the primary key value forTwoand represents the foreign key in this case.In cases like above, the
twoIdattribute on theOneclass would take precedence unless it contains a null value, in which case this method will attempt to extract a non-null foreign key value from the related object.- Specified by:
getForeignKeyValuein interfaceDataObjectWrapper<T>- Parameters:
relationshipName- the name of the relationship on the wrapped data object for which to determine the foreign key value- Returns:
- the single foreign key value on the wrapped data object for the given relationship name, or null if it has no fully-populated foreign key value
-
getForeignKeyAttributeValue
AsDataObjectWrapper.getForeignKeyValue(String)except only returns the value for the "attribute" foreign key value. If the wrapped data object has no attribute foreign key for the given relationship, this method will return null.- Specified by:
getForeignKeyAttributeValuein interfaceDataObjectWrapper<T>- Parameters:
relationshipName- the name of the relationship on the wrapped data object for which to determine the foreign key value- Returns:
- the single foreign key attribute value on the wrapped data object for the given relationship name, or null if it has no fully-populated foreign key attribute value
-
getForeignKeyAttributeMap
Gets the map of child attribute names to the parent attribute values.- Parameters:
relationshipName- the name of the relationship for which to get the map.- Returns:
- the map of child attribute names to the parent attribute values.
-
getPropertyTypeNullSafe
Get property type for property name on object, this can be a nested property and method will recursively use the metadata to find type.- Specified by:
getPropertyTypeNullSafein interfaceDataObjectWrapper<T>- Parameters:
objectType- - Root object typepropertyName- - Property name- Returns:
- Class of propertyName
-
linkChanges
Executes reference linking using the wrapped object as the root and the set of changed paths.Executes reference linker as per the algorithm described on
ReferenceLinker- Specified by:
linkChangesin interfaceDataObjectWrapper<T>- Parameters:
changedPropertyPaths- the Set of changed property paths relative to the wrapped object- See Also:
-
linkForeignKeys
public void linkForeignKeys(boolean onlyLinkReadOnly) Links foreign key values on the wrapped data object and then recurses through all child relationships and collections which are cascaded during persistence and does the same.In this context, linking of foreign key values means that on data objects that have both a field (or fields) that represent a foreign key to a relationship as well as an actual reference object for that relationship, if that foreign key field(s) is read only, then it will copy the value of the primary key(s) on the reference object to the associated foreign key field(s).
If onlyLinkReadOnly is true, this method will only link values into foreign keys that are "read-only" according to the metadata of the data object. This is to avoid situations where the foreign key field itself is the "master" value for the key. In those situations you do not want a read-only reference object to obliterate or corrupt the master key.
- Specified by:
linkForeignKeysin interfaceDataObjectWrapper<T>- Parameters:
onlyLinkReadOnly- indicates whether or not only read-only foreign keys should be linked
-
linkForeignKeysInternal
Links all foreign keys on the data object.- Parameters:
object- the object to link.onlyLinkReadOnly- whether to only link read-only objects.linked- the set of currently linked objects, used as a base case to exit out of recursion.
-
linkForeignKeysInternalWrapped
protected void linkForeignKeysInternalWrapped(DataObjectWrapper<?> wrapped, boolean onlyLinkReadOnly, Set<Object> linked) Links all foreign keys on the wrapped data object.- Parameters:
wrapped- the wrapped object to link.onlyLinkReadOnly- whether to only link read-only objects.linked- the set of currently linked objects, used as a base case to exit out of recursion.
-
fetchRelationship
Fetches and populates the value for the relationship with the given name on the wrapped data object.This is done by identifying the current foreign key attribute value for the relationship using the algorithm described on
DataObjectWrapper.getForeignKeyAttributeValue(String)and then loading the related object using that foreign key value, updating the relationship value on the wrapped data object afterward.If the foreign key value is null or the loading of the related object using the foreign key returns a null value, this method will set the relationship value to null.
This method is equivalent to invoking
DataObjectWrapper.fetchRelationship(String, boolean, boolean)passing "true" for bothuseForeignKeyAttributeandnullifyDanglingRelationship.- Specified by:
fetchRelationshipin interfaceDataObjectWrapper<T>- Parameters:
relationshipName- the name of the relationship on the wrapped data object to refresh
-
fetchRelationship
public void fetchRelationship(String relationshipName, boolean useForeignKeyAttribute, boolean nullifyDanglingRelationship) Fetches and populates the value for the relationship with the given name on the wrapped object.The value of
useForeignKeyAttributewill be used to determine whether the foreign key attribute is used to fetch the relationship (if this parameter is "true"), or whether the primary key on the related object itself will be used (if it is false). In the case that the primary key is used, once the relationship has been fetched, the foreign key field value (if one exists) will also be updated to remain in sync with the reference object.If no related object is found when attempting to fetch by the key values, then the behavior of this method will depend upon the value passed for
nullifyDanglingRelationship. If false, this method will not modify the wrapped object. If true, then the related object will be set to null.- Specified by:
fetchRelationshipin interfaceDataObjectWrapper<T>- Parameters:
relationshipName- the name of the relationship on the wrapped data object to refreshuseForeignKeyAttribute- if true, use the foreign key attribute to fetch the relationship, otherwise use the primary key value on the related objectnullifyDanglingRelationship- if true and no relationship value is found for the given key then set the related object to null, otherwise leave the existing object state alone
-
fetchRelationship
protected void fetchRelationship(MetadataChild relationship, boolean useForeignKeyAttribute, boolean nullifyDanglingRelationship) Fetches and populates the value for the relationship with the given name on the wrapped object.- Parameters:
relationship- the relationship on the wrapped data object to refreshuseForeignKeyAttribute- whether to use the foreign key attribute to fetch the relationshipnullifyDanglingRelationship- whether to set the related object to null if no relationship value is found
-
fetchRelationshipUsingAttributes
protected void fetchRelationshipUsingAttributes(MetadataChild relationship, boolean nullifyDanglingRelationship) Fetches the relationship using the foreign key attributes.- Parameters:
relationship- the relationship on the wrapped data object to refreshnullifyDanglingRelationship- whether to set the related object to null if no relationship value is found
-
fetchRelationshipUsingIdentity
protected void fetchRelationshipUsingIdentity(MetadataChild relationship, boolean nullifyDanglingRelationship) Fetches the relationship using the primary key attributes.- Parameters:
relationship- the relationship on the wrapped data object to refreshnullifyDanglingRelationship- whether to set the related object to null if no relationship value is found
-
linkForeignKeys
Links foreign keys non-recursively using the relationship with the given name on the wrapped data object.If onlyLinkReadOnly is true then it will only perform linking for foreign key fields that are "read-only" according to the metadata for the data object. This is to avoid situations where the foreign key field itself is the "master" value for the key. In those situations you do not want a read-only reference object to obliterate or corrupt the master key.
- Specified by:
linkForeignKeysin interfaceDataObjectWrapper<T>- Parameters:
relationshipName- the name of the relationship on the wrapped data object for which to link foreign keys, must not be a nested pathonlyLinkReadOnly- indicates whether or not only read-only foreign keys should be linked
-
materializeReferencedObjects
Fetches and populates referenced objects within the wrapped object. SeeDataObjectWrapper.fetchRelationship(String)for details on how the relationships will be fetched. By default, this method will go through and instantiate all lazy-loaded, non-persisted-with-parent reference objects and collections on the master object. SeeMaterializeOptionfor the available options. This method does not recurse into child objects. For that, use theDataObjectWrapper.materializeReferencedObjectsToDepth(int, MaterializeOption...)method.- Specified by:
materializeReferencedObjectsin interfaceDataObjectWrapper<T>- Parameters:
options- An optional list ofMaterializeOptionobjects which may adjust the behavior of this method.- See Also:
-
materializeReferencedObjectsToDepth
Fetches and populates referenced objects within the wrapped object. SeeDataObjectWrapper.fetchRelationship(String)for details on how the relationships will be fetched. By default, this method will go through and instantiate all lazy-loaded, non-persisted-with-parent reference objects and collections on the master object. SeeMaterializeOptionfor the available options.- Specified by:
materializeReferencedObjectsToDepthin interfaceDataObjectWrapper<T>- Parameters:
maxDepth- The number of levels of child objects to refresh. A value of 1 will only materialize the child object on the wrapped object.options- An optional list ofMaterializeOptionobjects which may adjust the behavior of this method.- See Also:
-
getChildrenMatchingOptions
This method retrieves theMetadataChildobjects (DataObjectRelationshiporDataObjectCollection) which match the givenMaterializeOptionoptions. It utilizes the known information in theDataObjectMetadataand compares the flags there with the options given. If no options are given, this method will return allDataObjectRelationshipandDataObjectCollectionobjects which are not updatable (notMetadataChild.isSavedWithParent()) and are lazily loaded (MetadataChild.isLoadedDynamicallyUponUse()).- Parameters:
options- An optional list ofMaterializeOptionobjects to alter the default behavior.- Returns:
- A non-null collection of
MetadataChildobjects matching the given parameters.
-
linkForeignKeysInternal
protected void linkForeignKeysInternal(DataObjectWrapper<?> wrapped, MetadataChild relationship, Object relationshipValue, boolean onlyLinkReadOnly) Links foreign keys non-recursively using the relationship with the given name on the wrapped data object.- Parameters:
wrapped- the wrapped object to link.relationship- the relationship on the wrapped data object for which to link foreign keys.relationshipValue- the value of the relationship.onlyLinkReadOnly- indicates whether or not only read-only foreign keys should be linked.
-
populateInverseRelationship
Populates the property on the other side of the relationship.- Parameters:
relationship- the relationship on the wrapped data object for which to populate the inverse relationship.propertyValue- the value of the property.
-