Package pl.edu.icm.unity.types.basic
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 Summary
Fields Modifier and Type Field Description static 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).static int
TYPE_IMMUTABLE_FLAG
The attribute type can not be changed using management API (it is created internally).-
Fields inherited from class pl.edu.icm.unity.types.I18nDescribedObject
description, displayedName
-
-
Constructor Summary
Constructors Constructor Description AttributeType()
AttributeType(com.fasterxml.jackson.databind.node.ObjectNode root)
AttributeType(String name, String valueSyntax)
AttributeType(String name, String valueSyntax, MessageSource msg)
This version resolves the descriptions of the attribute from the message bundles.AttributeType(String name, String valueSyntax, MessageSource msg, String msgKey, Object[] args)
This version resolves the descriptions of the attribute from the message bundles.AttributeType(String name, String valueSyntax, I18nString displayedName, I18nString description)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributeType
clone()
boolean
equals(Object obj)
void
fromJsonBase(com.fasterxml.jackson.databind.node.ObjectNode main)
Initializes base state from JSON everything besides name and syntaxint
getFlags()
int
getMaxElements()
Map<String,String>
getMetadata()
int
getMinElements()
String
getName()
String
getValueSyntax()
com.fasterxml.jackson.databind.JsonNode
getValueSyntaxConfiguration()
int
hashCode()
boolean
isGlobal()
boolean
isInstanceImmutable()
boolean
isSelfModificable()
boolean
isTypeImmutable()
boolean
isUniqueValues()
void
setFlags(int flags)
void
setGlobal(boolean global)
void
setMaxElements(int maxElements)
void
setMetadata(Map<String,String> metadata)
void
setMinElements(int minElements)
void
setName(String name)
void
setSelfModificable(boolean selfModificable)
void
setUniqueValues(boolean uniqueValues)
void
setValueSyntax(String valueSyntax)
void
setValueSyntaxConfiguration(com.fasterxml.jackson.databind.JsonNode valueSyntaxConfiguration)
com.fasterxml.jackson.databind.node.ObjectNode
toJson()
As#toJsonBase(AttributeType)
but also adds information about attribute type name and syntaxcom.fasterxml.jackson.databind.node.ObjectNode
toJsonBase()
Serializes to JSON without syntax ID and nameString
toString()
void
validateInitialization()
Throws exception if some of the fields are null or incomplete.-
Methods inherited from class pl.edu.icm.unity.types.I18nDescribedObject
getDescription, getDisplayedName, setDescription, setDisplayedName
-
-
-
-
Field Detail
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Constructor Detail
-
AttributeType
public AttributeType()
-
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 Detail
-
isTypeImmutable
public boolean isTypeImmutable()
-
isInstanceImmutable
public boolean isInstanceImmutable()
-
getName
public String getName()
- Specified by:
getName
in interfaceNamedObject
- 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 interfaceInitializationValidator
- Throws:
IllegalAttributeTypeException
-
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()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classI18nDescribedObject
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classI18nDescribedObject
-
-