public class AttributeDescriptionModel extends java.lang.Object implements 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.
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>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ADDITIONAL_GROUP
The additional group for attribute descriptions
|
static java.lang.String |
COUNTER_GROUP
The counter group for attribute descriptions
|
static java.lang.String |
DEFAULT_GROUP
The default group for attribute descriptions
|
static java.lang.String |
MAIN_GROUP
The main group for attribute descriptions
|
static int |
NB_ATTRIBUTE_DESCRIPTION_TYPE
The number of attribute description types
|
static int |
NO_TYPE
The no type for attribute descriptions
|
static int |
OPTIONAL_MODE
The optional mode for attribute description
|
static int |
OTHER_TYPE
The other type for attribute description
|
static java.lang.String |
PARAMETER_GROUP
The parameter group for attribute descriptions
|
static int |
REQUIRED_MODE
The required mode for attribute description
|
static java.lang.String |
TAG_NAME
The XML tag name of this data model: "attributeDescription"
|
static int |
TYPE_BOOLEAN
The boolean type for attribute descriptions
|
static int |
TYPE_DATE
The date type for attribute descriptions
|
static int |
TYPE_NUMBER
The number type for attribute descriptions
|
static int |
TYPE_STRING
The string type for attribute descriptions
|
| Constructor and Description |
|---|
AttributeDescriptionModel()
Builds an empty attribute description.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description)
Deprecated.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int type)
Deprecated.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int usingMode,
java.lang.Object defaultValue,
ConstraintObject constraint)
Deprecated.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int type,
java.lang.String defaultGroup)
Builds an attribute description.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int usingMode,
java.lang.String defaultGroup,
java.lang.Object defaultValue,
ConstraintObject constraint)
Builds an attribute description.
|
AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
java.lang.String defaultGroup)
Builds an attribute description.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCharacterData(java.lang.String cData)
Adds character data to the content element.
|
void |
addChild(java.lang.String tagname,
XMLMarshallable child)
Adds a child to the object, the
child representing
the marshallable object which must be added to the element. |
java.lang.Object |
applyFormat(java.lang.Object value)
Returns the formatted object ready to be stored.
|
AttributeDescriptionModel |
duplicate()
Returns a clone of the current instance.
|
java.lang.String |
getAdditionalGroupKey()
If group is
ADDITIONAL_GROUP, provides an optional additional group selection key. |
int |
getAttributeDescriptionType()
Returns the type of this attribute description.
|
ConstraintObject |
getConstraint()
Returns the associated constraint.
|
java.lang.Object |
getDefaultValue()
Returns the default value of this attribute description.
|
java.lang.String |
getDescription()
Returns the textual description of the attribute description.
|
java.lang.String |
getFormat()
Returns the storage format for default number associated to the attribute description.
|
java.lang.String |
getGroup()
Returns the group of the attribute description.
|
java.lang.String |
getName()
Returns the name of the attribute description.
|
int |
getUsingMode()
Returns the using mode of this attribute description.
|
static int |
getValueType(java.lang.Object object)
Returns the type of the value.
|
boolean |
isValid()
Checks if a name exists and the default value respects the constraint.
|
boolean |
isValid(java.lang.Object value)
Checks if the value respects the constraint.
|
boolean |
isValidDefaultValue()
Checks if the default value respects the constraint.
|
boolean |
isValidFormat()
Checks if the storage format is valid.
|
void |
marshal(XMLOutputter output)
Gives an XML representation of this object, including its children.
|
void |
setAdditionalGroupKey(java.lang.String additionalGroupKey)
Sets the optional additional group selection key.
|
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setConstraint(ConstraintObject constraint)
Sets the constraint of the attribute description.
|
void |
setDefaultValue(java.lang.Object o)
Sets the default value of the attribute description.
|
void |
setDescription(java.lang.String description)
Sets the textual description of the attribute description.
|
void |
setForcedType(int type)
Sets the forced type for this AttributeDescriptionModel;
The forced type is used when the defaultValue is null.
|
void |
setFormat(java.lang.String f)
Sets the storage format of the attribute description.
|
void |
setGroup(java.lang.String group)
Sets the group of the attribute description.
|
void |
setName(java.lang.String n)
Sets the name of the attribute description.
|
void |
setUsingMode(int u)
Sets the using mode of this attribute description.
|
public static final java.lang.String TAG_NAME
public static final int NB_ATTRIBUTE_DESCRIPTION_TYPE
public static final int TYPE_BOOLEAN
public static final int TYPE_NUMBER
public static final int TYPE_STRING
public static final int TYPE_DATE
public static final int NO_TYPE
public static final int OTHER_TYPE
public static final int OPTIONAL_MODE
setUsingMode(int),
getUsingMode(),
Constant Field Valuespublic static final int REQUIRED_MODE
setUsingMode(int),
getUsingMode(),
Constant Field Valuespublic static final java.lang.String MAIN_GROUP
public static final java.lang.String ADDITIONAL_GROUP
public static final java.lang.String PARAMETER_GROUP
public static final java.lang.String COUNTER_GROUP
public static final java.lang.String DEFAULT_GROUP
public AttributeDescriptionModel()
@Deprecated
public AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int type)
AttributeDescriptionModel(String, String, int, String) insteadname - The name of the attribute descriptiondescription - A textual description for this attribute descriptiontype - The forced type of the attributepublic AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int type,
java.lang.String defaultGroup)
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".@Deprecated
public AttributeDescriptionModel(java.lang.String name,
java.lang.String description)
AttributeDescriptionModel(String, String, String) insteadname - The name of the attribute descriptiondescription - A textual description for this attribute descriptionpublic AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
java.lang.String defaultGroup)
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"@Deprecated
public AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int usingMode,
java.lang.Object defaultValue,
ConstraintObject constraint)
AttributeDescriptionModel(String, String, int, String, Object, ConstraintObject) insteadname - 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 - ConstraintObject the constraint associated to the default valuepublic AttributeDescriptionModel(java.lang.String name,
java.lang.String description,
int usingMode,
java.lang.String defaultGroup,
java.lang.Object defaultValue,
ConstraintObject constraint)
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 - The ConstraintObject the constraint associated to the default valuepublic AttributeDescriptionModel duplicate()
public java.lang.String getName()
public void setName(java.lang.String n)
n - The name of the attribute descriptionpublic java.lang.String getDescription()
public void setDescription(java.lang.String description)
description - The textual description of the attribute descriptionpublic java.lang.String getGroup()
public void setGroup(java.lang.String group)
group - The group of the attribute descriptionpublic java.lang.String getAdditionalGroupKey()
ADDITIONAL_GROUP, provides an optional additional group selection key.
By default, empty selection key is used.public void setAdditionalGroupKey(java.lang.String additionalGroupKey)
additionalGroupKey - An additional group selection keypublic java.lang.String getFormat()
public void setFormat(java.lang.String f)
f - The storage format of the attribute descriptionpublic java.lang.Object applyFormat(java.lang.Object value)
public int getAttributeDescriptionType()
NO_TYPE,
TYPE_BOOLEAN,
TYPE_NUMBER,
TYPE_STRING,
TYPE_DATE,
OTHER_TYPEpublic void setForcedType(int type)
type - The forced typeNO_TYPE,
TYPE_BOOLEAN,
TYPE_NUMBER,
TYPE_STRING,
TYPE_DATE,
OTHER_TYPEpublic static int getValueType(java.lang.Object object)
NO_TYPE,
TYPE_BOOLEAN,
TYPE_NUMBER,
TYPE_STRING,
TYPE_DATE,
OTHER_TYPEpublic int getUsingMode()
REQUIRED_MODE,
OPTIONAL_MODEpublic void setUsingMode(int u)
AttributeDescriptionModel is 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_MODEOPTIONAL_MODEu - The type of using modepublic java.lang.Object getDefaultValue()
public void setDefaultValue(java.lang.Object o)
o - The default value of the attribute descriptionpublic ConstraintObject getConstraint()
ConstraintModelpublic void setConstraint(ConstraintObject constraint)
constraint - The constraint of the attribute descriptionpublic boolean isValid()
true if the attribute description is valid, false otherwisepublic boolean isValidDefaultValue()
true if the default value is valid, false otherwisepublic boolean isValidFormat()
true if the storage format is valid, false otherwisepublic boolean isValid(java.lang.Object value)
true if value respects the constraint, false otherwisepublic void setAttributes(XMLAttributes atts)
XMLMarshallablesetAttributes in interface XMLMarshallableatts - The XML attributes of the current elementpublic void addChild(java.lang.String tagname,
XMLMarshallable child)
XMLMarshallablechild representing
the marshallable object which must be added to the element.addChild in interface XMLMarshallabletagname - The name of tag for the childchild - The child to be addedpublic void addCharacterData(java.lang.String cData)
XMLMarshallableaddCharacterData in interface XMLMarshallablecData - The character data to be addedpublic void marshal(XMLOutputter output)
XMLMarshallablemarshal in interface XMLMarshallableoutput - The XML output to marshal the object into