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
Modifier and TypeFieldDescriptionstatic final int
The attribute type instances can not be created, updated or removed using management API (there are specialized methods to manipulate such attributes).static final int
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
ConstructorDescriptionAttributeType
(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
Modifier and TypeMethodDescriptionclone()
boolean
void
fromJsonBase
(com.fasterxml.jackson.databind.node.ObjectNode main) Initializes base state from JSON everything besides name and syntaxint
getFlags()
int
int
getName()
com.fasterxml.jackson.databind.JsonNode
int
hashCode()
boolean
isGlobal()
boolean
boolean
boolean
boolean
void
setFlags
(int flags) void
setGlobal
(boolean global) void
setMaxElements
(int maxElements) void
setMetadata
(Map<String, String> metadata) void
setMinElements
(int minElements) void
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
Serializes to JSON without syntax ID and nametoString()
void
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 Details
-
TYPE_IMMUTABLE_FLAG
public static final int TYPE_IMMUTABLE_FLAGThe attribute type can not be changed using management API (it is created internally).- See Also:
-
INSTANCES_IMMUTABLE_FLAG
public static final int INSTANCES_IMMUTABLE_FLAGThe 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
-
AttributeType
public AttributeType(String name, String valueSyntax, I18nString displayedName, I18nString description) -
AttributeType
public AttributeType(com.fasterxml.jackson.databind.node.ObjectNode root) -
AttributeType
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
- Specified by:
getName
in interfaceNamedObject
- Returns:
- human readable name of the object. Must be unique for the object class.
-
setName
-
getValueSyntax
-
setValueSyntax
-
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
Description copied from interface:InitializationValidator
Throws exception if some of the fields are null or incomplete.- Specified by:
validateInitialization
in interfaceInitializationValidator
- Throws:
IllegalAttributeTypeException
-
getMetadata
-
setMetadata
-
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
-
toString
-
hashCode
public int hashCode()- Overrides:
hashCode
in classI18nDescribedObject
-
equals
- Overrides:
equals
in classI18nDescribedObject
-