public class AttributeModificationModel extends java.lang.Object implements XMLMarshallable
Attribute Description
to identify the attribute which must be modified.
This class will describe the operator and store the operand which must be applied.
Available operators:
UPDATE: Updates only existing attributes UNSET: Clears the specified attributes SET: Creates the "additionnal" or "parameter" attribute if it does not exist and sets the operand value REMOVE (forbidden with "main" group attribute
- see AttributeDescriptionModel) ADD (with number attribute only) SUBTRACT (with number attribute only) MULTIPLY (with number attribute only) DIVIDE (with number attribute only) Available operand types:
BigDecimal for a TYPE_NUMBER attribute Date for a TYPE_DATE attribute String for a TYPE_STRING attribute BigDecimal.valueOf(0) or
BigDecimal.valueOf(1) for
a TYPE_BOOLEAN attribute ModificationModel,
AttributeDescriptionModelThe XML APIs specify the following XSD fragment:
XSD Fragment
<xs:element name="attributeModification">
<xs:complexType>
<xs:sequence>
<xs:element ref="attributeDescription" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="operandType" type="OperandTypeType" use="required"/>
<xs:attribute name="operator" type="OperatorType" use="required"/>
<xs:attribute name="operand" type="xs:string"/>
</xs:complexType>
</xs:element><xs:simpleType name="OperandTypeType">
<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="OperatorType">
<xs:restriction base="xs:string">
<xs:enumeration value="add"/> <!-- Can be apply only on NUMBER attribute -->
<xs:enumeration value="subtract"/> <!-- Can be apply only on NUMBER attribute -->
<xs:enumeration value="multiply"/> <!-- Can be apply only on NUMBER attribute -->
<xs:enumeration value="divide"/> <!-- Can be apply only on NUMBER attribute -->
<xs:enumeration value="update"/> <!-- Updates the attribute only if it exists -->
<xs:enumeration value="set"/> <!-- Like an update but creates it if it does not exist -->
<xs:enumeration value="remove"/> <!-- Removes the attribute (reserved for additional attributes -->
<xs:enumeration value="unset"/> <!-- Sets no value to the attribute (attribute is null) -->
</xs:restriction>
</xs:simpleType>
| Modifier and Type | Field and Description |
|---|---|
static int |
ADD
Constant for ADD operator.
|
static int |
DIVIDE
Constant for DIVIDE operator.
|
static int |
MULTIPLY
Constant for MULTIPLY operator.
|
static int |
REMOVE
Constant for REMOVE operator.
|
static int |
SET
Constant for SET operator.
|
static int |
SUBTRACT
Constant for SUBTRACT operator.
|
static int |
TYPE_BOOLEAN
The boolean type for attribute description.
|
static int |
TYPE_DATE
The date type for attribute description.
|
static int |
TYPE_NUMBER
The number type for attribute description.
|
static int |
TYPE_STRING
The string type for attribute description.
|
static int |
UNSET
Constant for UNSET operator.
|
static int |
UPDATE
Constant for UPDATE operator.
|
| Constructor and Description |
|---|
AttributeModificationModel()
Empty constructor.
|
AttributeModificationModel(AttributeDescriptionModel att,
java.lang.String description,
java.lang.Object operand,
int operator)
Builds a complete AttributeModificationModel.
|
| 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. |
AttributeDescriptionModel |
getAttributeDescription()
Gets the description of the related attribute.
|
java.lang.String |
getDescription()
Gets the description.
|
java.lang.Object |
getOperand()
Gets the operand.
|
int |
getOperandType()
Gets the operand type.
|
int |
getOperator()
Gets the operator.
|
boolean |
isValid()
Checks if types are valid and compatible with operator.
|
void |
marshal(XMLOutputter output)
Gives an XML representation of this object, including its children.
|
void |
setAttributeDescription(AttributeDescriptionModel ad)
Set the description of the related attribute.
|
void |
setAttributes(XMLAttributes atts)
Sets the attributes of the XML representation of the element being
processed.
|
void |
setDescription(java.lang.String desc)
Sets the description.
|
void |
setOperand(java.lang.Object op)
Sets the operand.
|
void |
setOperator(int op)
Sets the operator.
|
public static final int SET
public static final int UPDATE
public static final int ADD
public static final int SUBTRACT
public static final int MULTIPLY
public static final int DIVIDE
public static final int REMOVE
public static final int UNSET
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 AttributeModificationModel()
public AttributeModificationModel(AttributeDescriptionModel att, java.lang.String description, java.lang.Object operand, int operator)
public boolean isValid()
public AttributeDescriptionModel getAttributeDescription()
public void setAttributeDescription(AttributeDescriptionModel ad)
ad - an attribute description.public java.lang.Object getOperand()
public void setOperand(java.lang.Object op)
op - the operand.public int getOperandType()
operand object class name.
Default value is string type.TYPE_BOOLEAN,
TYPE_NUMBER,
TYPE_STRING,
TYPE_DATEpublic java.lang.String getDescription()
public void setDescription(java.lang.String desc)
desc - the description.public int getOperator()
public void setOperator(int op)
op - the operator.public 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