Class AttributeDescriptionModel
- All Implemented Interfaces:
XMLMarshallable
Java class represents the description of an attribute as seen by your client application
and can represent a basic search criterion; An attribute
description has a type (boolean, number, string, date) and can have a default value, a storage format, and
a constraint.
Important Note
You use some attribute descriptions when implementing some search filters in
search operations. Consider the search filter dedicated to your search operation.
The storage format respects the following syntax: X.Y where X represents the total number of digits
and Y the number of digits in the fractionnal part.
Note
For example, if storage format "5.3" is applied to the decimal value 2.34567 then the stored value will be 2.345.
The stored value is an integer value if format storage has no fractionnal part otherwise the stored value is a bigdecimal value.
XML API for HCI
The XML APIs specify the following XSD fragment:
XSD Fragment
<xs:element name="attributeDescription">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="type" type="DefaultValueType"/>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="usingMode" type="UsingMode" />
<xs:attribute name="defaultValue" type="xs:string"/>
<xs:attribute name="format" type="xs:string"/>
<xs:attribute name="constraint" type="xs:string"/>
<xs:attribute name="group" type="GroupType" default="main"/>
<xs:attribute name="additionalGroupKey" type="xs:string" use="optional" default="" />
</xs:complexType>
</xs:element><xs:simpleType name="DefaultValueType">
<xs:restriction base="xs:string">
<xs:enumeration value="boolean"/>
<xs:enumeration value="number"/>
<xs:enumeration value="string"/>
<xs:enumeration value="date"/>
</xs:restriction>
</xs:simpleType><xs:simpleType name="UsingMode">
<xs:restriction base="xs:string">
<xs:enumeration value="required"/>
<xs:enumeration value="optional"/>
</xs:restriction>
</xs:simpleType><xs:simpleType name="GroupType">
<xs:restriction base="xs:string">
<xs:enumeration value="main"/>
<xs:enumeration value="additional"/>
<xs:enumeration value="parameter"/>
<xs:enumeration value="counter"/>
</xs:restriction>
</xs:simpleType>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe additional group for attribute descriptionsstatic final StringThe counter group for attribute descriptionsstatic final StringThe default group for attribute descriptionsstatic final StringThe main group for attribute descriptionsstatic final intThe number of attribute description typesstatic final intThe no type for attribute descriptionsstatic final intThe optional mode for attribute descriptionstatic final intThe other type for attribute descriptionstatic final StringThe parameter group for attribute descriptionsstatic final intThe required mode for attribute descriptionstatic final StringThe XML tag name of this data model: "attributeDescription"static final intThe boolean type for attribute descriptionsstatic final intThe date type for attribute descriptionsstatic final intThe number type for attribute descriptionsstatic final intThe string type for attribute descriptions -
Constructor Summary
ConstructorsConstructorDescriptionBuilds an empty attribute description.AttributeDescriptionModel(String name, String description) Deprecated.AttributeDescriptionModel(String name, String description, int type) Deprecated.AttributeDescriptionModel(String name, String description, int usingMode, Object defaultValue, ConstraintObject constraint) Deprecated.AttributeDescriptionModel(String name, String description, int type, String defaultGroup) Builds an attribute description.AttributeDescriptionModel(String name, String description, int usingMode, String defaultGroup, Object defaultValue, ConstraintObject constraint) Builds an attribute description.AttributeDescriptionModel(String name, String description, String defaultGroup) Builds an attribute description. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String tagname, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.applyFormat(Object value) Returns the formatted object ready to be stored.Returns a clone of the current instance.If group isADDITIONAL_GROUP, provides an optional additional group selection key.intReturns the type of this attribute description.Returns the associated constraint.Returns the default value of this attribute description.Returns the textual description of the attribute description.Returns the storage format for default number associated to the attribute description.getGroup()Returns the group of the attribute description.getName()Returns the name of the attribute description.intReturns the using mode of this attribute description.static intgetValueType(Object object) Returns the type of the value.booleanisValid()Checks if a name exists and the default value respects the constraint.booleanChecks if the value respects the constraint.booleanChecks if the default value respects the constraint.booleanChecks if the storage format is valid.voidmarshal(XMLOutputter output) Gives an XML representation of this object, including its children.voidsetAdditionalGroupKey(String additionalGroupKey) Sets the optional additional group selection key.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidsetConstraint(ConstraintObject constraint) Sets the constraint of the attribute description.voidSets the default value of the attribute description.voidsetDescription(String description) Sets the textual description of the attribute description.voidsetForcedType(int type) Sets the forced type for this AttributeDescriptionModel; The forced type is used when the defaultValue is null.voidSets the storage format of the attribute description.voidSets the group of the attribute description.voidSets the name of the attribute description.voidsetUsingMode(int u) Sets the using mode of this attribute description.
-
Field Details
-
TAG_NAME
The XML tag name of this data model: "attributeDescription"- See Also:
-
NB_ATTRIBUTE_DESCRIPTION_TYPE
public static final int NB_ATTRIBUTE_DESCRIPTION_TYPEThe number of attribute description types- See Also:
-
TYPE_BOOLEAN
public static final int TYPE_BOOLEANThe boolean type for attribute descriptions- See Also:
-
TYPE_NUMBER
public static final int TYPE_NUMBERThe number type for attribute descriptions- See Also:
-
TYPE_STRING
public static final int TYPE_STRINGThe string type for attribute descriptions- See Also:
-
TYPE_DATE
public static final int TYPE_DATEThe date type for attribute descriptions- See Also:
-
NO_TYPE
public static final int NO_TYPEThe no type for attribute descriptions- See Also:
-
OTHER_TYPE
public static final int OTHER_TYPEThe other type for attribute description- See Also:
-
OPTIONAL_MODE
public static final int OPTIONAL_MODEThe optional mode for attribute description -
REQUIRED_MODE
public static final int REQUIRED_MODEThe required mode for attribute description -
MAIN_GROUP
The main group for attribute descriptions- See Also:
-
ADDITIONAL_GROUP
The additional group for attribute descriptions- See Also:
-
PARAMETER_GROUP
The parameter group for attribute descriptions- See Also:
-
COUNTER_GROUP
The counter group for attribute descriptions- See Also:
-
DEFAULT_GROUP
The default group for attribute descriptions- See Also:
-
-
Constructor Details
-
AttributeDescriptionModel
public AttributeDescriptionModel()Builds an empty attribute description. -
AttributeDescriptionModel
Deprecated.Builds an attribute description.- Parameters:
name- The name of the attribute descriptiondescription- A textual description for this attribute descriptiontype- The forced type of the attribute
-
AttributeDescriptionModel
Builds an attribute description.- Parameters:
name- The name of the attribute descriptiondescription- A textual description for this attribute descriptiontype- The forced type of the attributedefaultGroup- The default group to use. Possible values are "main", "additional", "parameter", or "counter".
-
AttributeDescriptionModel
Deprecated.Builds an attribute description.- Parameters:
name- The name of the attribute descriptiondescription- A textual description for this attribute description
-
AttributeDescriptionModel
Builds an attribute description.- Parameters:
name- The name of the attribute descriptiondescription- A textual description for this attribute descriptiondefaultGroup- The default group to use. Possible values are "main" or "additional" or "parameter" or "counter"
-
AttributeDescriptionModel
@Deprecated public AttributeDescriptionModel(String name, String description, int usingMode, Object defaultValue, ConstraintObject constraint) Deprecated.Builds an attribute description.- Parameters:
name- The name of the attribute description (must be unique inside a user defined record)description- A textual description of the attribute descriptionusingMode- The type of using mode (required, optional) for default valuedefaultValue- The default valueconstraint-ConstraintObjectthe constraint associated to the default value
-
AttributeDescriptionModel
public AttributeDescriptionModel(String name, String description, int usingMode, String defaultGroup, Object defaultValue, ConstraintObject constraint) Builds an attribute description.- Parameters:
name- The name of the attribute description; it must be unique inside a user defined record.description- A textual description of the attribute descriptionusingMode- The type of using mode (required, optional) for default valuedefaultGroup- The default group to use. Possible values are "main" or "additional" or "parameter" or "counter"defaultValue- The default valueconstraint- TheConstraintObjectthe constraint associated to the default value
-
-
Method Details
-
duplicate
Returns a clone of the current instance.- Returns:
- A clone of the current instance
-
getName
Returns the name of the attribute description.- Returns:
- The name of the attribute description
-
setName
Sets the name of the attribute description.- Parameters:
n- The name of the attribute description
-
getDescription
Returns the textual description of the attribute description.- Returns:
- The textual description
-
setDescription
Sets the textual description of the attribute description.- Parameters:
description- The textual description of the attribute description
-
getGroup
Returns the group of the attribute description.- Returns:
- The group
-
setGroup
Sets the group of the attribute description.- Parameters:
group- The group of the attribute description
-
getAdditionalGroupKey
If group isADDITIONAL_GROUP, provides an optional additional group selection key. By default, empty selection key is used.- Returns:
- An additional group selection key
-
setAdditionalGroupKey
Sets the optional additional group selection key.- Parameters:
additionalGroupKey- An additional group selection key
-
getFormat
Returns the storage format for default number associated to the attribute description.- Returns:
- The textual storage format
-
setFormat
Sets the storage format of the attribute description.- Parameters:
f- The storage format of the attribute description
-
applyFormat
Returns the formatted object ready to be stored.- Returns:
- The formatted object; This object can be an integer or Bigdecimal according to storage format value (null if object cannot be formatted).
-
getAttributeDescriptionType
public int getAttributeDescriptionType()Returns the type of this attribute description.- See Also:
-
setForcedType
public void setForcedType(int type) Sets the forced type for this AttributeDescriptionModel; The forced type is used when the defaultValue is null.- Parameters:
type- The forced type- See Also:
-
getValueType
Returns the type of the value.- See Also:
-
getUsingMode
public int getUsingMode()Returns the using mode of this attribute description.- See Also:
-
setUsingMode
public void setUsingMode(int u) Sets the using mode of this attribute description. The using mode indicates if the described attribute is mandatory or not. The using mode is usefull only if theAttributeDescriptionModelis used inside a templateModel. Otherwise the value is ignored.Each attribute description specifies a using mode for the attribute description. The permitted types are:
REQUIRED_MODE- The described attribute must be filled (e.g. in a GUI)
OPTIONAL_MODE- The described attribute may be filled (e.g. in a GUI)
- Parameters:
u- The type of using mode
-
getDefaultValue
Returns the default value of this attribute description.- Returns:
- The default value
-
setDefaultValue
Sets the default value of the attribute description.- Parameters:
o- The default value of the attribute description
-
getConstraint
Returns the associated constraint.- Returns:
- The associated
ConstraintModel
-
setConstraint
Sets the constraint of the attribute description.- Parameters:
constraint- The constraint of the attribute description
-
isValid
public boolean isValid()Checks if a name exists and the default value respects the constraint.- Returns:
trueif the attribute description is valid,falseotherwise
-
isValidDefaultValue
public boolean isValidDefaultValue()Checks if the default value respects the constraint.- Returns:
trueif the default value is valid,falseotherwise
-
isValidFormat
public boolean isValidFormat()Checks if the storage format is valid.- Returns:
trueif the storage format is valid,falseotherwise
-
isValid
Checks if the value respects the constraint.- Returns:
trueif value respects the constraint,falseotherwise
-
setAttributes
Description copied from interface:XMLMarshallableSets the attributes of the XML representation of the element being processed.- Specified by:
setAttributesin interfaceXMLMarshallable- Parameters:
atts- TheXML attributesof the current element
-
addChild
Description copied from interface:XMLMarshallableAdds a child to the object, thechildrepresenting the marshallable object which must be added to the element.- Specified by:
addChildin interfaceXMLMarshallable- Parameters:
tagname- The name of tag for the childchild- The child to be added
-
addCharacterData
Description copied from interface:XMLMarshallableAdds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
marshal
Description copied from interface:XMLMarshallableGives an XML representation of this object, including its children.- Specified by:
marshalin interfaceXMLMarshallable- Parameters:
output- TheXML outputto marshal the object into
-
AttributeDescriptionModel(String, String, String)instead