Class AttributeType

java.lang.Object
pl.edu.icm.unity.types.I18nDescribedObject
pl.edu.icm.unity.types.basic.AttributeType
All Implemented Interfaces:
InitializationValidator, NamedObject

public class AttributeType extends I18nDescribedObject implements InitializationValidator, NamedObject
Attribute type defines rules for handling attributes. This class provides universal configuration: descriptions, values cardinality limits and more.
  • Field Details

    • TYPE_IMMUTABLE_FLAG

      public static final int TYPE_IMMUTABLE_FLAG
      The attribute type can not be changed using management API (it is created internally).
      See Also:
    • INSTANCES_IMMUTABLE_FLAG

      public static final int INSTANCES_IMMUTABLE_FLAG
      The attribute type instances can not be created, updated or removed using management API (there are specialized methods to manipulate such attributes). This flag rather makes sense only in combination with TYPE_IMMUTABLE_FLAG.
      See Also:
  • Constructor Details

    • AttributeType

      public AttributeType()
    • AttributeType

      public AttributeType(String name, String valueSyntax)
    • AttributeType

      public AttributeType(String name, String valueSyntax, I18nString displayedName, I18nString description)
    • AttributeType

      public AttributeType(com.fasterxml.jackson.databind.node.ObjectNode root)
    • AttributeType

      public AttributeType(String name, String valueSyntax, MessageSource msg)
      This version resolves the descriptions of the attribute from the message bundles. The key must be AttrType.ATTR_NAME.desc.
    • AttributeType

      public AttributeType(String name, String valueSyntax, MessageSource msg, String msgKey, Object[] args)
      This version resolves the descriptions of the attribute from the message bundles. The key must be AttrType.msgKey.desc. It is possible to provide message arguments
  • Method Details

    • isTypeImmutable

      public boolean isTypeImmutable()
    • isInstanceImmutable

      public boolean isInstanceImmutable()
    • getName

      public String getName()
      Specified by:
      getName in interface NamedObject
      Returns:
      human readable name of the object. Must be unique for the object class.
    • setName

      public void setName(String name)
    • getValueSyntax

      public String getValueSyntax()
    • setValueSyntax

      public void setValueSyntax(String valueSyntax)
    • getValueSyntaxConfiguration

      public com.fasterxml.jackson.databind.JsonNode getValueSyntaxConfiguration()
    • setValueSyntaxConfiguration

      public void setValueSyntaxConfiguration(com.fasterxml.jackson.databind.JsonNode valueSyntaxConfiguration)
    • getMinElements

      public int getMinElements()
    • setMinElements

      public void setMinElements(int minElements)
    • getMaxElements

      public int getMaxElements()
    • setMaxElements

      public void setMaxElements(int maxElements)
    • isSelfModificable

      public boolean isSelfModificable()
    • setSelfModificable

      public void setSelfModificable(boolean selfModificable)
    • isUniqueValues

      public boolean isUniqueValues()
    • setUniqueValues

      public void setUniqueValues(boolean uniqueValues)
    • getFlags

      public int getFlags()
    • setFlags

      public void setFlags(int flags)
    • isGlobal

      public boolean isGlobal()
    • setGlobal

      public void setGlobal(boolean global)
    • validateInitialization

      public void validateInitialization() throws IllegalAttributeTypeException
      Description copied from interface: InitializationValidator
      Throws exception if some of the fields are null or incomplete.
      Specified by:
      validateInitialization in interface InitializationValidator
      Throws:
      IllegalAttributeTypeException
    • getMetadata

      public Map<String,String> getMetadata()
    • setMetadata

      public void setMetadata(Map<String,String> metadata)
    • toJsonBase

      public com.fasterxml.jackson.databind.node.ObjectNode toJsonBase()
      Serializes to JSON without syntax ID and name
    • toJson

      public com.fasterxml.jackson.databind.node.ObjectNode toJson()
      As #toJsonBase(AttributeType) but also adds information about attribute type name and syntax
    • fromJsonBase

      public void fromJsonBase(com.fasterxml.jackson.databind.node.ObjectNode main)
      Initializes base state from JSON everything besides name and syntax
    • clone

      public AttributeType clone()
      Overrides:
      clone in class Object
    • toString

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

      public int hashCode()
      Overrides:
      hashCode in class I18nDescribedObject
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class I18nDescribedObject