Class DataObjectAttributeImpl

java.lang.Object
org.kuali.rice.krad.data.metadata.impl.MetadataCommonBase
org.kuali.rice.krad.data.metadata.impl.DataObjectAttributeImpl
All Implemented Interfaces:
Serializable, DataObjectAttribute, DataObjectAttributeInternal, MetadataCommonInternal, MetadataCommon

public class DataObjectAttributeImpl extends MetadataCommonBase implements DataObjectAttributeInternal
Base implementation class for attribute metadata for data object classes.

This implementation supports "chaining" for most attributes. That is, if the value for a property is defined locally, it will me used. If unset (null) it will, if there is an embeddedAttribute, request it from that DataObjectAttribute. (This could be a recursive operation if multiple metadata providers are chained.)

If the value is unset and there is no embedded attribute, most methods will return a non-null default value.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
  • Field Details

    • embeddedAttribute

      protected DataObjectAttribute embeddedAttribute
    • owningType

      protected Class<?> owningType
    • inheritedFromType

      protected Class<?> inheritedFromType
    • inheritedFromAttributeName

      protected String inheritedFromAttributeName
    • inheritedFromParentAttributeName

      protected String inheritedFromParentAttributeName
    • displayAttributeName

      protected String displayAttributeName
    • caseInsensitive

      protected Boolean caseInsensitive
    • forceUppercase

      protected Boolean forceUppercase
    • required

      protected Boolean required
    • persisted

      protected Boolean persisted
    • sensitive

      protected Boolean sensitive
    • maxLength

      protected Long maxLength
    • minLength

      protected Long minLength
    • validCharactersConstraintBeanName

      protected String validCharactersConstraintBeanName
    • propertyEditor

      protected PropertyEditor propertyEditor
    • validValues

      protected KeyValuesFinder validValues
    • dataType

      protected DataType dataType
    • type

      protected Class<?> type
  • Constructor Details

    • DataObjectAttributeImpl

      public DataObjectAttributeImpl()
  • Method Details

    • getDisplayAttributeName

      public String getDisplayAttributeName()
      Gets the display attribute name.

      To be used on attributes which have an associated business key that is shown to users rather than the "internal" key which is likely a meaningless (to the users) sequence number.

      Specified by:
      getDisplayAttributeName in interface DataObjectAttribute
      Returns:
      user friendly business key
    • setDisplayAttributeName

      public void setDisplayAttributeName(String displayAttributeName)
      Sets the attribute display name.
      Parameters:
      displayAttributeName - the attribute name.
    • isCaseInsensitive

      public boolean isCaseInsensitive()
      Determines if attribute is case insensitive.

      Whether this attribute should be treated as case insensitive when performing lookups and searches.

      Specified by:
      isCaseInsensitive in interface DataObjectAttribute
      Returns:
      attribute case insensitive
    • setCaseInsensitive

      public void setCaseInsensitive(boolean caseInsensitive)
      Sets value that determines whether attribute is case insensitive.
      Parameters:
      caseInsensitive - whether attribute is case insensitive.
    • isForceUppercase

      public boolean isForceUppercase()
      Determines if attribute should be forced to upper case.

      Whether this attribute should be forced to upper case before being sent to the PersistenceProvider.

      Specified by:
      isForceUppercase in interface DataObjectAttribute
      Returns:
      attribute forced upper case
    • setForceUppercase

      public void setForceUppercase(boolean forceUppercase)
      Determines if attribute should be forced to upper case.
      Parameters:
      forceUppercase - whether attribute should be forced to upper.
    • getPropertyEditor

      public PropertyEditor getPropertyEditor()
      Gets the property editor.

      To be used by the persistence layer when loading and persisting the data. (E.g., strip extra characters from phone numbers to leave only the digits for storage in the database.).

      Specified by:
      getPropertyEditor in interface DataObjectAttribute
      Returns:
      property editor
    • setPropertyEditor

      public void setPropertyEditor(PropertyEditor propertyEditor)
      Sets the property editor used when loading data.
      Parameters:
      propertyEditor - determines formats when loading data.
    • getValidValues

      public KeyValuesFinder getValidValues()
      Gets the values if a drop-down.

      If this field should be rendered using a drop-down list, specify the instance on this property.

      Specified by:
      getValidValues in interface DataObjectAttribute
      Returns:
      drop-down values
    • setValidValues

      public void setValidValues(KeyValuesFinder validValues)
      Sets keyValueFinder used for dropdown.
      Parameters:
      validValues - dropdown keyValueFinder.
    • getDataType

      public DataType getDataType()
      Gets the derived krad data type.

      The derived krad-data data type used by the UIF to help generate the appropriate control and perform default validation.

      Specified by:
      getDataType in interface DataObjectAttribute
      Returns:
      derived keard data type
    • setDataType

      public void setDataType(DataType dataType)
      Sets KRAD data type.
      Parameters:
      dataType - KRAD derived data type.
    • toString

      public String toString()
      Overrides:
      toString in class MetadataCommonBase
    • getMaxLength

      public Long getMaxLength()
      Gets the maximum length.

      The maximum length value which will be accepted into this field.

      Specified by:
      getMaxLength in interface DataObjectAttribute
      Returns:
      maximum length
    • setMaxLength

      public void setMaxLength(Long maxLength)
      Sets max length of attribute.
      Parameters:
      maxLength - attribute max length.
    • getEmbeddedAttribute

      public DataObjectAttribute getEmbeddedAttribute()
      If this data object attribute is wrapping another (generated by a lower metadata provider), return that.
      Specified by:
      getEmbeddedAttribute in interface DataObjectAttributeInternal
      Returns:
      null if this attribute is not wrapping another.
    • setEmbeddedAttribute

      public void setEmbeddedAttribute(DataObjectAttribute embeddedAttribute)
      Sets embedded attribute.
      Specified by:
      setEmbeddedAttribute in interface DataObjectAttributeInternal
      Parameters:
      embeddedAttribute - embedded attribute.
    • isRequired

      public boolean isRequired()
      Determines if attribute is required.

      Whether (at the data level) this attribute must have a non-null value.

      Specified by:
      isRequired in interface DataObjectAttribute
      Returns:
      attribute is required
    • setRequired

      public void setRequired(boolean required)
      Set whether attribute is required.
      Parameters:
      required - attribute required flag.
    • getValidCharactersConstraintBeanName

      @Beta public String getValidCharactersConstraintBeanName()
      BETA: Gets the bean name.

      The bean name (in the UIF data dictionary), which checks the entered value's characters for correctness.

      Specified by:
      getValidCharactersConstraintBeanName in interface DataObjectAttribute
      Returns:
      bean name
    • setValidCharactersConstraintBeanName

      @Beta public void setValidCharactersConstraintBeanName(String validCharactersConstraintBeanName)
      BETA: Sets valid character constraint bean name.
      Parameters:
      validCharactersConstraintBeanName - character constraint bean name.
    • getOwningType

      public Class<?> getOwningType()
      Gets the data object type

      Gets the data object type to which this attribute belongs.

      Specified by:
      getOwningType in interface DataObjectAttribute
      Returns:
      class type
    • setOwningType

      public void setOwningType(Class<?> owningType)
      Sets the data object type to which this attribute belongs.
      Parameters:
      owningType - data object type to which this attribute belongs.
    • isPersisted

      public boolean isPersisted()
      Determines whether data object is persistent.

      Whether or not this attribute of the data object is saved to persistent storage when saved via the DataObjectService.

      Specified by:
      isPersisted in interface DataObjectAttribute
      Returns:
      whether data object is persistent
    • setPersisted

      public void setPersisted(boolean persisted)
      Sets flag whether object is persisted.
      Parameters:
      persisted - flag whether object is persisted.
    • getType

      public Class<?> getType()
      Determines type of class.
    • setType

      public void setType(Class<?> javaType)
      Sets unknown class in order to determine type.
      Parameters:
      javaType - unknown class.
    • getInheritedFromType

      public Class<?> getInheritedFromType()
      Gets class type object is inherited from.

      If this attribute is inherited from a different data object, that object's type. Otherwise null.

      Specified by:
      getInheritedFromType in interface DataObjectAttribute
      Returns:
      class type inherited from
    • setInheritedFromType

      public void setInheritedFromType(Class<?> inheritedFromType)
      Sets unknown class to determine if inherited.
      Parameters:
      inheritedFromType - unknown class.
    • getInheritedFromAttributeName

      public String getInheritedFromAttributeName()
      Gets inherited attribute name.

      If this attribute is inherited from a different data object, the source attribute name. Otherwise null.

      Specified by:
      getInheritedFromAttributeName in interface DataObjectAttribute
      Returns:
      inherited attribute name
    • setInheritedFromAttributeName

      public void setInheritedFromAttributeName(String inheritedFromAttributeName)
      Sets data object name to determine if inherited.
      Parameters:
      inheritedFromAttributeName - name of attribute.
    • getInheritedFromParentAttributeName

      public String getInheritedFromParentAttributeName()
      Gets inherited parent attribute name.

      If this attribute is inherited from a different data object, the attribute name on the parent object. Otherwise null.

      Specified by:
      getInheritedFromParentAttributeName in interface DataObjectAttribute
      Returns:
      inherited parent attribute name
    • setInheritedFromParentAttributeName

      public void setInheritedFromParentAttributeName(String inheritedFromParentAttributeName)
      Sets parent data object name to determine if inherited.
      Parameters:
      inheritedFromParentAttributeName - name of attribute.
    • isInherited

      public boolean isInherited()
      Determines whether attribute is inherited.

      Whether this attribute is inherited from a different data object.

      Specified by:
      isInherited in interface DataObjectAttribute
      Returns:
      whether attribute is inherited
    • getOriginalDataObjectAttribute

      public DataObjectAttribute getOriginalDataObjectAttribute()
      Gets original data object.

      Obtains the "original" data object attribute in a chain of embedded attribute definitions.

      Specified by:
      getOriginalDataObjectAttribute in interface DataObjectAttribute
      Returns:
      original data object
    • getMinLength

      public Long getMinLength()
      Gets the minimum length.

      The minimum length value which will be accepted into this field.

      Specified by:
      getMinLength in interface DataObjectAttribute
      Returns:
      minimum length
    • setMinLength

      public void setMinLength(Long minLength)
      Sets minimum length of attribute.
      Parameters:
      minLength - minimum length value.
    • isSensitive

      public boolean isSensitive()
      Determines attribute case insensitivity.

      Whether this attribute is protected at the persistence level and should be protected by default when included on user interfaces.

      Specified by:
      isSensitive in interface DataObjectAttribute
      Returns:
      attribute case insensitivity
    • setSensitive

      public void setSensitive(boolean sensitive)
      Sets whether sensitive.
      Parameters:
      sensitive - whether attribute is sensitive.