Class ProfileConditionInfoPO

java.lang.Object
ro.sync.ecss.conditions.ProfileConditionInfoPO
All Implemented Interfaces:
Serializable, Cloneable, PersistentObject

@API(type=EXTENDABLE, src=PRIVATE) public class ProfileConditionInfoPO extends Object implements PersistentObject
Contains information about a condition processing attribute name and possible values.
See Also:
  • Constructor Details

    • ProfileConditionInfoPO

      public ProfileConditionInfoPO()
      Constructor.
    • ProfileConditionInfoPO

      public ProfileConditionInfoPO(String attributeName, String attributeRenderName, boolean allowsMultipleValues, ProfileConditionValuePO[] allowedValues, String valuesSeparator, String documentTypePattern)
      Constructor used only by default values.
      Parameters:
      attributeName - The conditional attribute name.
      attributeRenderName - Attribute render name.
      allowsMultipleValues - True if multiple values are allowed for this attribute
      allowedValues - Allowed values for this attribute.
      valuesSeparator - The condition values separator.
      documentTypePattern - Document type pattern. If specified, the condition will be used only for the document types that match it.
  • Method Details

    • createDefaultProfileConditionInfoPO

      public static ProfileConditionInfoPO createDefaultProfileConditionInfoPO(String attributeName, String attributeRenderName, boolean allowsMultipleValues, String[] allowedValues, String valuesSeparator, String documentTypePattern)
      Creates a default Profile Condition Info.
      Parameters:
      attributeName - The conditional attribute name.
      attributeRenderName - Attribute render name.
      allowsMultipleValues - True if multiple values are allowed for this attribute
      allowedValues - Allowed values for this attribute.
      valuesSeparator - The condition values separator.
      documentTypePattern - Document type pattern. If specified, the condition will be used only for the document types that match it.
      Returns:
      A default Profile Condition Info.
    • setAttributeRenderName

      public void setAttributeRenderName(String attributeRenderName)
      Set the attribute render name.
      Parameters:
      attributeRenderName - The attribute Render Name.
    • getAttributeName

      public String getAttributeName()
      Returns:
      Returns the attribute name.
    • getAttributeRenderName

      public String getAttributeRenderName()
      Returns:
      Returns the attributeRenderName.
    • isAllowsMultipleValues

      public boolean isAllowsMultipleValues()
      Returns:
      Returns true if multiple values are allowed for this attribute
    • getAllowedValues

      public ProfileConditionValuePO[] getAllowedValues()
      Returns:
      Returns the allowed values for this attribute.
    • getValuesSeparator

      public String getValuesSeparator()
      Returns:
      Returns the conditional values separator.
    • getDocumentTypePattern

      public String getDocumentTypePattern()
      Returns:
      Returns the document type pattern.
      If specified, the condition will be used only for the document types that match it.
    • containsValue

      public boolean containsValue(String value)
      Check if a specific value is allowed.
      Parameters:
      value - The value to be checked.
      Returns:
      True if the value is allowed
    • containsGroup

      public boolean containsGroup(String attribute, String value)
      Check if a specific group with the given attribute and value is allowed.
      Parameters:
      attribute - The attribute of the group to be checked.
      value - The value of the group attribute to be checked.
      Returns:
      True if the group is allowed.
    • getAllowedValuesDescription

      public String getAllowedValuesDescription()
      Returns:
      the values composed with the separator
    • checkValid

      public void checkValid() throws InvalidPersistentObjException
      Description copied from interface: PersistentObject
      Check if object is valid to be used. Method is called after it is deserialized from options. If not then throw an InvalidPersistentObjException exception.
      Specified by:
      checkValid in interface PersistentObject
      Throws:
      InvalidPersistentObjException - Thrown when instance is not valid.
      See Also:
    • getNotPersistentFieldNames

      public String[] getNotPersistentFieldNames()
      Specified by:
      getNotPersistentFieldNames in interface PersistentObject
      Returns:
      The names of the field from this object which should not be serialized.
      See Also:
    • clone

      public ProfileConditionInfoPO clone()
      Description copied from interface: PersistentObject
      Forces all the persistent objects to be cloneable.
      Specified by:
      clone in interface PersistentObject
      Overrides:
      clone in class Object
      Returns:
      A clone of this object. The clone and the original are disjunct. They share only immutable objects, like Strings, Integers, etc.
      See Also:
    • setAllowedValues

      public void setAllowedValues(ProfileConditionValuePO[] allowedValues, boolean sort)
      Set the list of allowed values.
      Parameters:
      allowedValues - The allowedValues to set.
      sort - true to sort the allowed values.
    • setAllowsMultipleValues

      public void setAllowsMultipleValues(boolean allowsMultipleValues)
      true if allows or not multiple values.
      Parameters:
      allowsMultipleValues - true if allows or not multiple values.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • getRenderValueName

      public String getRenderValueName(String groupAttribute, String value)
      Get the render name for the given value.
      Parameters:
      groupAttribute - The group attribute name. It can be null if the value is simple.
      value - The value to search.
      Returns:
      The render name for the given value or null if wasn't found a render for value.