Class AttributeValue

java.lang.Object
mc.core.domain.generic.AttributeValue
All Implemented Interfaces:
Serializable

public class AttributeValue extends Object implements Serializable
this class is a data container for bracing data for an logical attribute assignment to an object (ComplexEntity). it collects the EntityToAttribute objects for the assignment, where we have the following information:
  • object (ComplexEntity)
  • attribute (Attribute)
  • list of (EntityToAttribute entities, each with filter data like territory, valid date and prio for sort
  • list of data values from the EntityToAttribute entities
also this object serves as a container for transporting this information from backend to frontend (GUI) and (export) channels. it can be enhanced with additional data like:
  • alternative attribute name for displaying
  • attribute description for displaying
  • mandatory flag
  • filter for enum attribute standard values
See Also:
  • Constructor Details

  • Method Details

    • copyFor

      public AttributeValue copyFor(ComplexEntity object)
      creates a copy of this AttributeValue with given object but without EntityToAttributes
      Parameters:
      object - optional
      Returns:
      a new AttributeValue
    • getAttributeDisplayName

      public String getAttributeDisplayName(Locale locale)
      Parameters:
      locale - Locale to use for translating attribute and appended territory (if any).
      Returns:
      Localized representation of Attribute. Does not include attribute value.
    • getAttributeDisplayDescription

      public String getAttributeDisplayDescription(Locale locale)
    • setAttributeDisplayName

      public void setAttributeDisplayName(String attributeDisplayName)
      Force attribute given representation.
      Parameters:
      attributeDisplayName - Text to use instead of getAttributeDisplayName(Locale)'s default implementation.
    • setAttributeDisplayDescription

      public void setAttributeDisplayDescription(String attributeDisplayDescription)
      Parameters:
      attributeDisplayDescription - Tooltip/Infobox for attribute.
    • getObject

      public ComplexEntity getObject()
      object of AV. may be null
    • getAttribute

      public Attribute getAttribute()
      attribute of AV. never null
    • getCurrentTerritory

      public Territory getCurrentTerritory()
    • setCurrentTerritory

      public AttributeValue setCurrentTerritory(Territory currentTerritory)
    • setEntityToAttributes

      public void setEntityToAttributes(List<EntityToAttribute> entityToAttributes)
      EXPERT: reset internal e2a list
    • removeEntityToAttribute

      public void removeEntityToAttribute(EntityToAttribute entityToAttribute)
      EXPERT: remove entityToAttribute from internal e2a list
    • addEntityToAttribute

      public void addEntityToAttribute(EntityToAttribute entityToAttribute)
      INTERNAL: add to internal e2a list
    • getEntityToAttributes

      public List<EntityToAttribute> getEntityToAttributes()
      Returns:
      all e2a (copy of internal list). no filtering through setCurrentTerritory(Territory)
    • getEntityToAttributes

      public List<EntityToAttribute> getEntityToAttributes(Territory territory)
      Returns:
      INTERNAL e2a list reduced on a territory. all if territory is null
    • getEntityToAttributeForDV

      public EntityToAttribute getEntityToAttributeForDV(DataValue dataValue)
      Returns:
      e2a for given dataValue if it is part of this AV. filtered through setCurrentTerritory(Territory)
    • getEntityToAttributeForDVSet

      public EntityToAttribute getEntityToAttributeForDVSet(DataValueSet dataValueSet)
      Returns:
      e2a for given dataValueSet if it is part of this AV. filtered through setCurrentTerritory(Territory)
    • getDataValueSets

      public List<DataValueSet> getDataValueSets()
      Returns:
      all dataValueSets. filtered through setCurrentTerritory(Territory)
    • getDataValueSets

      public List<DataValueSet> getDataValueSets(Territory territory)
      Returns:
      all dataValueSets for territory. all if territory is null
    • getDataValues

      public List<DataValue> getDataValues()
      Returns:
      all dataValues. filtered through setCurrentTerritory(Territory)
    • getDataValues

      public List<DataValue> getDataValues(Locale locale)
      Returns:
      all dataValues for locale. filtered through setCurrentTerritory(Territory)
    • getDataValues

      public List<DataValue> getDataValues(Territory territory, Locale locale)
      Returns:
      all dataValues for locale. all if territory is null
    • getSingleDataValue

      public DataValue getSingleDataValue(Locale locale)
      For single value: retrieve the single dataValue in given locale. filtered through setCurrentTerritory(Territory)
      Parameters:
      locale - optional, mandatory for locale dependent dataTypes
      Returns:
      dataValue if exists or null
      Throws:
      IllegalStateException - if attribute has more than one dataValues in given locale (multivalue or current territory not set)
    • getSingleDataValue

      public <T extends DataValue> T getSingleDataValue(Class<T> dvClass, Locale locale)
      For single value: retrieve the single dataValue in given locale and subclass of actual dataValue. filtered through setCurrentTerritory(Territory)
      Parameters:
      dvClass - mandatory, subclass of dataValue matching this AttributeValue
      locale - optional, mandatory for locale dependent dataTypes
      Returns:
      DataValue subclass if exists and is the same as given dvClass, otherwise null
      Throws:
      IllegalStateException - if attribute has more than one dataValues in given locale (multivalue or current territory not set)
    • setReadonly

      public void setReadonly(boolean readonly)
    • isReadonly

      public boolean isReadonly()
      Returns:
      value of readonly flag if flag has been set.
    • isReadonlyByAssignment

      public boolean isReadonlyByAssignment()
      Returns:
      value of readonly flag of assignment if assignment is present.
    • isMandatory

      public boolean isMandatory()
      Returns:
      value of mandatory flag of assignment (if assignment is present) or mandatory flag set.
    • setMandatory

      public void setMandatory(boolean mandatory)
    • getFilter

      public Set<String> getFilter()
      Returns:
      additional filter values of explicit filter or assignment if set. else null
    • isInherited

      @Deprecated public boolean isInherited()
      Deprecated.
      work not correct for object list with parent and children (MC-23341)
      use isInheritedBy() instead
      Returns:
      value of inherited flag.
    • setInherited

      public AttributeValue setInherited(ComplexEntity heir)
    • isInheritedBy

      public boolean isInheritedBy(ComplexEntity entity)
      in case of inherited AV (not overwritten) this checks the entity for which AVs have been built while getObject() returns parent
    • removeInheritance

      public void removeInheritance(ComplexEntity heir)
      INTERNAL
    • getOverwritten

      public AttributeValue getOverwritten()
    • setOverwritten

      public void setOverwritten(AttributeValue overwritten)
      INTERNAL
    • isInheritanceDisabled

      public boolean isInheritanceDisabled()
    • inheritanceDisabled

      public AttributeValue inheritanceDisabled(boolean inheritanceDisabled)
      INTERNAL
    • getPrio

      public int getPrio()
      get prio from additional EntityToAttributePrio (OA or CA), assignment (TA or CA), or EntityToAttribute
    • prio

      public AttributeValue prio(int prio)
      INTERNAL
    • setAssignment

      public void setAssignment(EntityToAttributePrio assignment)
      INTERNAL
    • setAssignment

      public void setAssignment(IAttributeAssignment assignment)
      INTERNAL
    • setAssignment

      public void setAssignment(IAttributeAssignment assignment, Set<String> filter)
      INTERNAL
    • getAssignment

      public IAttributeAssignment getAssignment()
      display as parent if assignment is a classification (MC-7669)
    • getDisplayString

      public String getDisplayString(Locale locale)
      Parameters:
      locale - Locale in which to return the value.
      Returns:
      Textual representation of attribute's value.
    • getDisplayString

      public String getDisplayString(Locale locale, List<Territory> territories)
      Parameters:
      locale - Locale in which to return the value.
      territories - Territories for which to show values. Given an empty list, result in displaying values for all territories.
      Returns:
      Textual representation of attribute's value.
    • getValidationInfo

      public AttributeValue.ValidationInfo getValidationInfo()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object another)
      Overrides:
      equals in class Object
      Returns:
      true according to the business logic, by which AttributeValues with the same attribute and, if present, object are identical. Ignores entityToAttributes and currentTerritory
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object