|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiz.c24.io.api.data.ComplexDataObject
public class ComplexDataObject
A data object constructed from other simple and complex objects manifested as elements and attributes.
The resulting structure is a hierarchy of complex objects with 'simple' leaf nodes represented by (generally) immutable
value classes such as String
, Integer
, Boolean
etc.
This class is the super class of deployed C24 Integration Objects bean classes and provides a common interface by which deployed classes
can be addressed. This interface is similar to DOM in providing methods to recurse over the structure. A common recursive
method using the interface would be similar to the following:
public int countLeafNodes(ComplexDataObject obj) { int count = 0; for (int i=0; i<obj.getElementDeclCount(); i++) // for all the different elements present { Element e = obj.getElementDecl(i); for (int j=0; j<obj.getElementCount(e.getName()); j++) // for all repeats of element 'e' { Object child = obj.getElement(e.getName(), j); if (child instanceof ComplexDataObject) count += countLeafNodes((ComplexDataObject) child); // a branch node else count++; // a leaf node } } for (int i=0; i<obj.getAttrDeclCount(); i++) // for all the different attributes present { Attribute a = obj.getAttrDecl(i); if (obj.isAttrPresent(a.getName())) // if attribute 'a' is present (attributes can not repeat) { Object child = obj.getAttr(a.getName()); count++; // attributes can not be complex data objects hence they are always leaf nodes } } }
All instances of this class have a reference to a ComplexDataType
, accessible via getType()
, which stores
the meta-data of the data object hierarchy (ie data describing the instance data). This class also provides direct access
to this meta-data via the getElementDeclCount()
, getElementDecl(int)
, getAttrDeclCount()
and
getAttrDecl(int)
methods. It is possible build up the data object structure 'on the fly' using the addElementDecl(Element)
and addAttrDecl(Attribute)
methods in which case the object's structure will differ from it's type. This is required
behaviour for parsing certain XML structures, such as ANY elements, but in general is not recommended since it reduces code
portability.
Instances of this class can also have an optional reference to a defining element declaration, accessible via the
getDefiningElementDecl()
method. Among other things this element defines the name that will be used by the
root element when expressed in XML.
Warning: Serialized objects of this class or of a deployed class which is derived from it may not be compatible with future releases of C24 Integreation Objects. The current serialization support is appropriate for short term storage or RMI between applications running the same version of C24 Integreation Objects.
In particular, since version 3.6, serialisation of validation listeners and validation mechanism is no longer supported. These settings are now considered part of theValidationManager
and should be treated as such.
ComplexDataType
,
Element
,
Attribute
,
Serialized FormConstructor Summary | |
---|---|
ComplexDataObject()
Constructs a new empty instance. |
|
ComplexDataObject(ComplexDataObject clone)
Constructs a new instance cloned from clone . |
|
ComplexDataObject(Element definingElementDecl)
Constructs a new instance defined by the specified element. |
|
ComplexDataObject(Element definingElementDecl,
ComplexDataType type)
Constructs a new instance defined by the specified element but with the specified type. |
Method Summary | |
---|---|
void |
addAttrDecl(Attribute attr)
Adds a meta-data attribute declaration to this object. |
void |
addAttrDecl(Attribute attr,
int index)
Adds a meta-data attribute declaration to this object at the specified index. |
void |
addComment(String comment)
Adds a comment. |
void |
addElement(String name,
Object value)
Adds value as an instance of the element called name . |
void |
addElementDecl(Element element)
Adds a meta-data element declaration to this object. |
void |
addElementDecl(Element element,
int index)
Adds a meta-data element declaration to this object at the specified index. |
void |
addNamespaceMapping(NamespaceMapping nm)
Adds a namespace mapping - a mapping from a prefix to a namespace URI. |
void |
addValidationListener(ValidationListener listener)
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
void |
clear()
Clears all data from this object. |
void |
clearAttrs(String name)
Removes all attributes called name . |
void |
clearClientProperties()
Clears all client properties. |
void |
clearContent()
Clears the content from this object recursivley. |
void |
clearElements(String name)
Removes all instances of the element called name . |
Iterator |
clientPropertyKeysIterator()
Returns an iterator over the keys of the client properties. |
Object |
clone()
|
ComplexDataObject |
cloneDeep()
Returns a deep clone of this object. |
boolean |
containsAttrDecl(String name)
Returns whether this object contains a meta-data attribute declaration called name . |
boolean |
containsChild(DataComponent child)
Returns whether this object contains an element or attribute child . |
boolean |
containsElementDecl(String name)
Returns whether this object contains an element declaration called name . |
Object |
createContentObject()
Creates and sets an object as the content of this object. |
boolean |
equalContents(ComplexDataObject obj,
boolean deep,
boolean checkContent,
boolean checkAttributes,
boolean checkElements)
Checks whether the data contained in obj is equal to the data contained in this object. |
boolean |
equals(Object obj)
|
ValidationMechanismEnum |
getActualValidationMechanism()
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
Object |
getAttr(String name)
Returns the instance of the attribute called name . |
Attribute |
getAttrDecl(int index)
Returns the meta-data attribute declaration at index . |
Attribute |
getAttrDecl(String name)
Returns the meta-data attribute declaration called name . |
int |
getAttrDeclCount()
Returns the number of different meta-data attribute declarations held by this object. |
int |
getAttrDeclIndex(Attribute attr)
Returns the index of the specified meta-data attribute declaration. |
Object |
getChild(DataComponent child,
int index)
Returns the instance at index of the element or attribute child . |
int |
getChildCount(DataComponent child)
Returns the number of instances of the element or attribute child . |
int |
getChildDeclIndex(DataComponent child)
Returns the index of the element or attribute child declaration. |
int |
getChildIndex(DataComponent child,
Object value)
Returns the index of value of the element or attribute child . |
Object |
getClientProperty(Object key)
Returns the value of the property with the specified key. |
String |
getComment(int index)
Returns the comment at index . |
int |
getCommentCount()
Returns the number of comments held by this object. |
Object |
getContent()
Returns the content of this object. |
Element |
getDefiningElementDecl()
Returns the meta-data element declaration that defines this object. |
DocumentRoot |
getDocumentRoot()
Returns the document root of this object hierarchy if one is present. |
Object |
getElement(String name)
Returns the 1st instance of the element called name . |
Object |
getElement(String name,
int index)
Returns the instance at index of the element called name . |
int |
getElementCount(String name)
Returns the number of instances of the element called name . |
Element |
getElementDecl(int index)
Returns the meta-data element declaration at index . |
Element |
getElementDecl(String name)
Returns the meta-dataelement declaration called name . |
Element |
getElementDecl(String name,
int index)
Returns the meta-data element declaration called name at index . |
int |
getElementDeclCount()
Returns the number of meta-data different element declarations held by this object. |
int |
getElementDeclIndex(Element element)
Returns the index of the specified meta-data element declaration. |
int |
getElementIndex(String name,
Object value)
Returns the index of value of the element called name . |
Object[] |
getElements(String name)
Returns a new array containing all of the elements called name . |
int |
getIdKey()
Returns the database primary key. |
Logger |
getLog()
Returns the static singleton log4j Logger used to log messages for this object. |
String |
getMixedContent(int index)
Returns the item of mixed content at index . |
int |
getMixedContentCount()
Returns the number of mixed content items. |
DataModel |
getModel()
Returns the model (the root of the meta-data) which defines this object. |
String |
getName()
Returns the name of this object which will be taken from the defining element declaration. |
NamespaceMapping |
getNamespaceMapping(int index)
Return the namespace mapping at index . |
int |
getNamespaceMappingCount()
Returns the number of namespace mappings present in this object. |
NamespaceMapping |
getNamespaceMappingForPrefix(String prefix,
boolean deep)
Return the namespace mapping for prefix . |
NamespaceMapping |
getNamespaceMappingForUri(String uri,
boolean deep)
Return the namespace mapping for uri . |
NamespaceMapping[] |
getNamespaceMappings()
Returns a newly created array of the namespace mappings held by this object. |
ComplexDataObject |
getParent()
Returns the object containing this object or null if this object is the root of the object hierarchy. |
String |
getProcessingInstruction(String target)
Returns the value of the processing instruction with the specified target. |
String |
getQualifiedName()
Returns a '/' separated path from this node to the root of the object hierarchy. |
ComplexDataObject |
getRoot()
Returns the root of this object hierarchy. |
String |
getSubstitute(String name)
Gets the name of the element that was substitued by the name . |
protected String |
getTargetNamespace()
|
int |
getTotalAttrCount()
Returns the total number of attribute instances that this object contains. |
int |
getTotalElementCount()
Returns the total number of element instances that this object contains. |
ComplexDataType |
getType()
Returns the meta-data type that defines this object. |
ValidationListener[] |
getValidationListeners()
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
ValidationMechanismEnum |
getValidationMechanism()
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
int |
hashCode()
|
void |
initAttrsFromType(boolean clear)
Deprecated. |
void |
initElementsFromType(boolean clear)
Deprecated. |
void |
initToMinCardinality()
Initializes this object recursively so that there are at least the minimum cardinality of all required elements and attributes. |
boolean |
isAttrPresent(String name)
Returns whether an attribute instance called name is present. |
boolean |
isContentAllowed()
Returns whether the meta-data defines this object as containg simple content. |
boolean |
isMixedContentAllowed()
Returns whether the meta-data defines this object as containing mixed content. |
boolean |
isRoot()
Returns whether this node is the root of the object hierarhcy. |
Object |
locateAncestorOfType(DataType type)
Locates an ancestor of this object with the specified type. |
protected String |
makeSubstitution(String name,
int index)
Called by deployed subclasses to substitute an element. |
Iterator |
processingInstructionTargetsIterator()
Returns an iterator over the targets of the processing instructions. |
void |
putClientProperty(Object key,
Object value)
Stores the client property with the specified key and value. |
void |
putProcessingInstruction(String target,
String value)
Stores the processing instruction with the specified target and value. |
void |
removeAttr(String name)
Removes the instance at position index of the attribute called name . |
void |
removeClientProperty(Object key)
Removes the client property with the specified key value. |
void |
removeComment(String comment)
Removes a comment. |
void |
removeElement(String name,
int index)
Removes the instance at position index of the element called name . |
void |
removeElements(String name)
Removes all the instance of the element called name . |
void |
removeNamespaceMapping(NamespaceMapping nm)
Removes the specfied namespace mapping. |
void |
removeProcessingInstruction(String target)
Removes the processing instruction with the specified target. |
void |
removeValidationListener(ValidationListener listener)
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
void |
setAttr(String name,
Object value)
Sets value as the instance of the attribute called name . |
void |
setChild(DataComponent child,
int index,
Object value)
Sets the instance at index of the element or attribute child . |
void |
setComment(String comment,
int index)
Sets the comment at index . |
void |
setContent(Object content)
Sets the content of this object. |
void |
setDefiningElementDecl(Element definingElementDecl)
Sets the meta-data element declaration that defines this object. |
void |
setDefiningElementDecl(Element definingElementDecl,
ComplexDataType type)
Sets the meta-data element declaration that defines this object but with the specified type. |
void |
setElement(String name,
int index,
Object value)
Sets value as the instance (in position index ) of the element called name . |
void |
setElements(String name,
Object[] values)
Clears any instances of the element called name and adds the contents of |
void |
setIdKey(int idKey)
Sets the database primary key. |
void |
setMixedContent(String mixedContent,
int index)
Sets the mixed content item at index . |
void |
setName(String name)
Sets the name of this object on the defining element declaration. |
void |
setNamespaceMapping(NamespaceMapping nm,
int index)
Sets the namespace mapping at index . |
void |
setOrder(int originalIndex,
int newIndex)
Changes the order of this objects elements (applies only when ContentModelEnum.ALL is used by this object's type). |
void |
setParent(ComplexDataObject parent)
Sets the parent of this object. |
void |
setParent(ComplexDataObject parent,
String elementDeclName)
Sets the parent and possibly changes the defining element declaration of this object to one contained by the specfied parent . |
void |
setType(ComplexDataType type)
Internal method to set the meta-data type that defines this object. |
void |
setValidationMechanism(ValidationMechanismEnum validationMechanism)
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
String |
toAttrNamesString()
Returns a string containing the names of the attribute declarations in this object. |
String |
toElementNamesString()
Returns a string containing the names of the element declarations in this object. |
String |
toString()
Creates a String representation of this object using the models sink. |
protected String |
unmakeSubstitution(String name,
int index)
Called by subclasses to unmake a substitution and return an elements type to the type of its substitution group head element. |
boolean |
validate()
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
boolean |
validate(ValidationConstraints constraints)
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ComplexDataObject()
This contructor is supplied for bean style instantiation, for safety reasons either ComplexDataObject(Element)
or ComplexDataObject(Element, ComplexDataType)
should be preferred.
Instances created via this constructor must be initialized by calling either setDefiningElementDecl(Element)
or setDefiningElementDecl(Element, ComplexDataType)
before any other methods are called. Failure to do so
may result in unpredicitable behaviour and unchecked exceptions.
public ComplexDataObject(Element definingElementDecl)
definingElementDecl
- The element defining the new object.
NullPointerException
- If definingElementDecl == null
.
IllegalArgumentException
- If definingElementDecl
is abstract.
IllegalArgumentException
- If the type of definingElementDecl
is not complex.
IllegalArgumentException
- If the type of definingElementDecl
is abstract.
IllegalArgumentException
- If this is not a valid class of the type of definingElementDecl
.public ComplexDataObject(Element definingElementDecl, ComplexDataType type)
This constructor should be used to create object representations of substituted elements.
definingElementDecl
- The element defining the new object.type
- The type of the object.
IllegalArgumentException
- If definingElementDecl
is abstract.
IllegalArgumentException
- If type == null
and the type of definingElementDecl
is not complex.
IllegalArgumentException
- If type
or the type of definingElementDecl
is abstract.
IllegalArgumentException
- If this is not a valid class of the type
or the type of definingElementDecl
.public ComplexDataObject(ComplexDataObject clone)
clone
.
This method performs a shallow clone - i.e. the resulting object will contain the same objects as the argument.
To perform a deep clone use the cloneDeep()
method instead.
clone
- The object to clone.cloneDeep()
Method Detail |
---|
public void initToMinCardinality()
If the content model of this object is ContentModelEnum.CHOICE
then the first element declaration will
be initialized to it's minimum cardinality.
If an element or attribute has a fixed or default value then it will be used as the value of new object.
If the type of an element or attribute has an enumeration then the first value from the enumeration will be used as the value of new object.
In the case where none of the above hold, a default object will be created from the type.
public DataModel getModel()
The model is a deployed version of the origianl .dod file and is therefore analogous to an XML schema.
public final ComplexDataType getType()
The returned type will be different from the type of the defining element declaraction if this object uses a derived type - in XML this is modelled as an xsi:type.
public void setType(ComplexDataType type)
This method is provided for use immediatley after instantiation via the ComplexDataObject()
constructor.
Any further calls to this method will result in an IllegalStateException being thrown
type
- The new type.
IllegalStateException
- If the new type of this object is not derived from the old type.public Element getDefiningElementDecl()
public void setDefiningElementDecl(Element definingElementDecl)
This method is provided for use immediatley after instantiation via the ComplexDataObject()
constructor.
Any further calls to this method may result in unpredicitable behaviour and unchecked exceptions
definingElementDecl
- The new element.
NullPointerException
- If definingElementDecl == null
.
IllegalArgumentException
- If definingElementDecl
is abstract.
IllegalArgumentException
- If type == null
and the type of definingElementDecl
is not complex.
IllegalArgumentException
- If type
or the type of definingElementDecl
is abstract.
IllegalArgumentException
- If this is not a valid class of the type
or the type of definingElementDecl
.public void setDefiningElementDecl(Element definingElementDecl, ComplexDataType type)
This method should be used to create object representations of substituted elements.
This method is provided for use immediatley after instantiation via the ComplexDataObject()
constructor.
Any further calls to this method may result in unpredicitable behaviour and unchecked exceptions
definingElementDecl
- The new element.type
- The type.
NullPointerException
- If definingElementDecl == null
.
IllegalArgumentException
- If definingElementDecl
is abstract.
IllegalArgumentException
- If type == null
and the type of definingElementDecl
is not complex.
IllegalArgumentException
- If type
or the type of definingElementDecl
is abstract.
IllegalArgumentException
- If this is not a valid class of the type
or the type of definingElementDecl
.public boolean isMixedContentAllowed()
public String getMixedContent(int index)
index
.Index 0 will return the mixed content before the first element, index 1 will return the mixed content between the first and second etc. It is therefore always possible for there to be one more item of mixed content than there are element values present in the object.
index
- The index of the mixed content to return.
index
.
IllegalArgumentException
- if this object is not allowed mixed content, i.e. isMixedContentAllowed()
returns false.
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getMixedContentCount()).public int getMixedContentCount()
IllegalArgumentException
- if this object is not allowed mixed content, i.e. isMixedContentAllowed()
returns false.public void setMixedContent(String mixedContent, int index)
index
.
mixedContent
- The new value.index
- The index to set.
IllegalArgumentException
- if this object is not allowed mixed content, i.e. isMixedContentAllowed()
returns false.
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getMixedContentCount()).getMixedContent(int)
public boolean isContentAllowed()
This will return true
if this object's type had a simple base type.
public Object getContent()
IllegalArgumentException
- if this object is not allowed content, i.e. isContentAllowed()
returns false.public void setContent(Object content)
The class of content
should be compatible with the simple base type of this object's type.
content
- The new value.
IllegalArgumentException
- if this object is not allowed content, i.e. isContentAllowed()
returns false.public Object createContentObject()
public void setOrder(int originalIndex, int newIndex)
ContentModelEnum.ALL
is used by this object's type).This method can be used to control the order in which the elements of an 'ALL' group are formatted. If this object has been located as the 'ordering object' of another complex data object then rearranging the elements via this method will cause the other complex data objects elements to be rearranged as well.
originalIndex
- The index of the element to be moved.newIndex
- The index to move to.public String getSubstitute(String name)
name
.
name
- The substitues name.
protected String makeSubstitution(String name, int index)
name
- The name to substitute.index
- The index of the substitute.
IllegalArgumentException
- If no valid substitute called name
could be found.protected String unmakeSubstitution(String name, int index)
name
- The name of the substituted element.index
- The index of the substitute.
public void initElementsFromType(boolean clear)
Note: this method should be called when ad-hoc elements have been added to the type and they are need to be reproduced in this object.
clear
- Whether to first clear any current element declarations set up in this object.public void addElementDecl(Element element)
Note: this method should only be called when ad-hoc elements need to be added to an object. In general to provide greater portability, the elements should be added in the Designer and the model redeployed.
element
- The new element.
IllegalArgumentException
- If an element with the same name is already present.public void addElementDecl(Element element, int index)
Note: this method should only be called when ad-hoc elements need to be added to an object. In general to provide greater portability, the elements should be added in the Designer and the model redeployed.
element
- The new element.index
- The index at which the element should be added.
IllegalArgumentException
- If an element with the same name is already present.public final int getElementDeclCount()
public Element getElementDecl(int index)
index
.
index
- The index of the element to return.
public Element getElementDecl(String name, int index)
name
at index
.
This method may return different elements for different indicies if substitution groups have been applied.
name
- The name of the element.index
- The index in the array of substituted elements.
public Element getElementDecl(String name)
name
.
name
- The name of the element.
IllegalArgumentException
- If name
is not recognised as the name of an element.public int getElementDeclIndex(Element element)
element
- The element declaration.
public boolean containsElementDecl(String name)
name
.
name
- The name of the element.
name
exsits.public int getElementCount(String name)
name
.
name
- The name of the element.
IllegalArgumentException
- If name
is not recognised as the name of an element.public Object getElement(String name, int index)
index
of the element called name
.
name
- The name of the element.index
- The index to return.
IllegalArgumentException
- If name
is not recognised as the name of an element.public Object[] getElements(String name)
name
.The arrays runtime type will be taken from the element.
name
- The name of the element.
public int getElementIndex(String name, Object value)
value
of the element called name
.
name
- The name of the element.value
- The object whose index is to be returned.
IllegalArgumentException
- If name
is not recognised as the name of an element.public void addElement(String name, Object value)
value
as an instance of the element called name
.
name
- The name of the element.value
- The new object.
IllegalArgumentException
- If name
is not recognised as the name of an element.public void setElement(String name, int index, Object value)
value
as the instance (in position index
) of the element called name
.
name
- The name of the element.index
- The index of the instance to set.value
- The new object.
IllegalArgumentException
- If name
is not recognised as the name of an element.public void setElements(String name, Object[] values)
name
and adds the contents of
name
- The name of the element.values
- The new objects, or null if this field is to be cleared.
IllegalArgumentException
- If name
is not recognised as the name of an element.public void removeElement(String name, int index)
index
of the element called name
.
name
- The name of the element.index
- The index of the instance to remove.
IllegalArgumentException
- If name
is not recognised as the name of an element.public void removeElements(String name)
name
.
name
- The name of the element.
IllegalArgumentException
- If name
is not recognised as the name of an element.public Object getElement(String name)
name
.
This method is a shortcut to calling getElement(String, int)
.
name
- The name of the element.
IllegalArgumentException
- If name
is not recognised as the name of an element.public int getTotalElementCount()
public void clearElements(String name)
name
.
name
- The name of the element to clear.public void initAttrsFromType(boolean clear)
Note: this method should be called when ad-hoc attributes have been added to the type and they are need to be reproduced in this object.
clear
- Whether to first clear any current attribute declarations set up in this object.public void addAttrDecl(Attribute attr)
Note: this method should only be called when ad-hoc attributes need to be added to an object. In general to provide greater portability, the attributes should be added in the Designer and the model redeployed.
attr
- The new attribute.
IllegalArgumentException
- If an attribute with the same name is already present.public void addAttrDecl(Attribute attr, int index)
Note: this method should only be called when ad-hoc attributes need to be added to an object. In general to provide greater portability, the attributes should be added in the Designer and the model redeployed.
attr
- The new attribute.index
- The index at which the attribute should be added.
IllegalArgumentException
- If an attribute with the same name is already present.public int getAttrDeclCount()
public Attribute getAttrDecl(int index)
index
.
index
- The index of the attribute to return.
public Attribute getAttrDecl(String name)
name
.
name
- The name of the attribute.
IllegalArgumentException
- If name
is not recognised as the name of an attribute.public int getAttrDeclIndex(Attribute attr)
attr
- The attribute declaration.
public boolean containsAttrDecl(String name)
name
.
name
- The name of the attribute.
name
exsits.public boolean isAttrPresent(String name)
name
is present.
name
- The name of the attribute.
IllegalArgumentException
- If name
is not recognised as the name of an attribute.public Object getAttr(String name)
name
.
name
- The name of the attribute.
IllegalArgumentException
- If name
is not recognised as the name of an attribute.public void setAttr(String name, Object value)
value
as the instance of the attribute called name
.
name
- The name of the attribute.value
- The new object.
IllegalArgumentException
- If name
is not recognised as the name of an attribute.public void removeAttr(String name)
index
of the attribute called name
.
name
- The name of the attribute.
IllegalArgumentException
- If name
is not recognised as the name of an attribute.public int getTotalAttrCount()
public void clearAttrs(String name)
name
.
name
- The name of the attributes to remove.public boolean containsChild(DataComponent child)
child
.
child
- The element or attribute.
public void setChild(DataComponent child, int index, Object value)
index
of the element or attribute child
.
child
- The element or attribute.index
- The index to return.value
- The value to set.
IllegalArgumentException
- If child
is not recognised as an element or attribute in this object.public Object getChild(DataComponent child, int index)
index
of the element or attribute child
.
child
- The element or attribute.index
- The index to return.
IllegalArgumentException
- If child
is not recognised as an element or attribute in this object.public int getChildCount(DataComponent child)
child
.
child
- The element or attribute.
IllegalArgumentException
- If child
is not recognised as an element or attribute in this object.public int getChildIndex(DataComponent child, Object value)
value
of the element or attribute child
.
child
- The element or attribute.value
- The object whose index is to be returned.
IllegalArgumentException
- If child
is not recognised as an element or attribute in this object.public int getChildDeclIndex(DataComponent child)
child
declaration.
child
- The element or attribute.
IllegalArgumentException
- If child
is not recognised as an element or attribute in this object.public void clear()
public void clearContent()
This method removes all atomic data from the object, leaving an empty 'shell' of nested complex objects.
public Object clone()
clone
in class Object
public ComplexDataObject cloneDeep() throws CloneNotSupportedException
CloneNotSupportedException
- If the profile used to deploy the bean classed had it's "Generate Deep Clone Methods" property disabled.public String getName()
public void setName(String name)
name
- The new name.public String getQualifiedName()
public final Logger getLog()
The log returned will be retrieved from and named after the root object.
Care should be taken not to add log4j appenders to the returned Logger object from within a loop since they
will never be garbage collected. Since the returned Logger is a static singleton, well written code should leave
the Logger in the exact same state they found it. Better still, all Logger configuration should be done via
log4j.properties files or static intializers/
public ComplexDataObject getRoot()
This will be the ancestor for which getParent() == null
.
public DocumentRoot getDocumentRoot()
This will be the ancestor for which getParent() instanceof DocumentRoot
.
null
if this object hierarchy is not rooted within one.public boolean isRoot()
This will be where getParent() == null
.
public ComplexDataObject getParent()
null
if this object is the root of the object hierarchy.
null otherwise.
public void setParent(ComplexDataObject parent)
This method should not generally be called directly since the parent child relationships are automatically assigned when adding complex objects as elements to a parent.
parent
- The parent, or null
to break any existing relationship.setParent(ComplexDataObject, String)
public void setParent(ComplexDataObject parent, String elementDeclName)
parent
.This method should not generally be called directly since the parent child relationships are automatically assigned when adding complex objects as elements to a parent.
parent
- The parent, or null
to break any existing relationship.elementDeclName
- The name of the defining element declaration of this object or null
if it is not to be changed.setParent(ComplexDataObject)
public Object locateAncestorOfType(DataType type)
type
- The type of the ancestor to be located.
null
otherwise.public boolean validate() throws ValidationException
ValidationManager
instead - this method will be removed in the next major version release.
validate(ValidationConstraints)
with a new ValidationConstraints
object.
true
if the validation was successful.
ValidationException
- if the the validation fails and the validation mechanism is ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
.public boolean validate(ValidationConstraints constraints) throws ValidationException
ValidationManager
instead - this method will be removed in the next major version release.
constraints
- The validation constraints.
true
is the validation was successful.
ValidationException
- if the the validation fails and the validation mechanism is ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
.public void setValidationMechanism(ValidationMechanismEnum validationMechanism)
ValidationManager
instead - this method will be removed in the next major version release.
If validationMechanism =
ValidationMechanismEnum.VALIDATION_MECHANISM_PARENT
then this object's parent will be used
to determine the validation mechanism. Note: if this node is the root then ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
will be used by default. If validationMechanism =
ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
then
ValidationException
s will be thrown. If validationMechanism =
ValidationMechanismEnum.VALIDATION_MECHANISM_SYNCHRONOUS_EVENT
then synchronous ValidationEvent
s will be created. If validationMechanism =
ValidationMechanismEnum.VALIDATION_MECHANISM_ASYNCHRONOUS_EVENT
then asynchronous ValidationEvent
s will be created.
Note: when this property is changed any elements and attributes of this object (recursively) whose respective validation
mechanism properties are set to ValidationMechanismEnum.VALIDATION_MECHANISM_PARENT
will use the new value as well.
validationMechanism
- The validation mechanism to use.
NullPointerException
- If validationMechanism
is null.public ValidationMechanismEnum getValidationMechanism()
ValidationManager
instead - this method will be removed in the next major version release.
If the result of getActualValidationMechanism()
is ValidationMechanismEnum.VALIDATION_MECHANISM_PARENT
this method will
return the validation mechanism of its parent (unless it is the root in which case it will default to
ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
. Therefore exception processing is the default validation mechanism.
ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
, ValidationMechanismEnum.VALIDATION_MECHANISM_SYNCHRONOUS_EVENT
or ValidationMechanismEnum.VALIDATION_MECHANISM_ASYNCHRONOUS_EVENT
).public ValidationMechanismEnum getActualValidationMechanism()
ValidationManager
instead - this method will be removed in the next major version release.
getValidationMechanism()
because it will not defer calls to its parent.
ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION
, ValidationMechanismEnum.VALIDATION_MECHANISM_SYNCHRONOUS_EVENT
, ValidationMechanismEnum.VALIDATION_MECHANISM_ASYNCHRONOUS_EVENT
or ValidationMechanismEnum.VALIDATION_MECHANISM_PARENT
).public void addValidationListener(ValidationListener listener)
ValidationManager
instead - this method will be removed in the next major version release.
getValidationMechanism()
must return either ValidationMechanismEnum.VALIDATION_MECHANISM_SYNCHRONOUS_EVENT
or ValidationMechanismEnum.VALIDATION_MECHANISM_ASYNCHRONOUS_EVENT
for events to be propagated to listeners.
listener
- The validation listener to be added.public void removeValidationListener(ValidationListener listener)
ValidationManager
instead - this method will be removed in the next major version release.
listener
- The validation listener to be removed.public ValidationListener[] getValidationListeners()
ValidationManager
instead - this method will be removed in the next major version release.
public String toString()
The format of the returned string representation can be customized by changing the "Output Mask" property on the associated data model in the Designer and redeploying the code.
toString
in class Object
public Object getClientProperty(Object key)
key
- The key being queried/
null
if none exists.putClientProperty(java.lang.Object, java.lang.Object)
public Iterator clientPropertyKeysIterator()
putClientProperty(java.lang.Object, java.lang.Object)
.
public void putClientProperty(Object key, Object value)
key
- The key.value
- The value.public void removeClientProperty(Object key)
key
- The key to remove.public void clearClientProperties()
protected String getTargetNamespace()
public void addNamespaceMapping(NamespaceMapping nm)
nm
- The new namespace mapping.
NullPointerException
- If nm == null
.public void setNamespaceMapping(NamespaceMapping nm, int index)
index
.
nm
- The new namespace mapping.index
- The index.
NullPointerException
- If nm == null
.
IndexOutOfBoundsException
- If index > getNamespaceMappingCount()
public void removeNamespaceMapping(NamespaceMapping nm)
nm
- The namespace mapping to remove.
NullPointerException
- If nm == null
.public int getNamespaceMappingCount()
public NamespaceMapping getNamespaceMapping(int index)
index
.
index
- The index of the namespace mapping to return.
IndexOutOfBoundsException
- If index > getNamespaceMappingCount()
public NamespaceMapping[] getNamespaceMappings()
public NamespaceMapping getNamespaceMappingForUri(String uri, boolean deep)
uri
.
uri
- The uri of the namespace mapping to return.deep
- Whether to look up the object hierarchy for a suitable mapping.
null if none was found.
public NamespaceMapping getNamespaceMappingForPrefix(String prefix, boolean deep)
prefix
.
prefix
- The prefix of the namespace mapping to return.deep
- Whether to look up the object hierarchy for a suitable mapping.
null if none was found.
public int getCommentCount()
public String getComment(int index)
index
.
index
- The index of the comment to return.
IndexOutOfBoundsException
- If index > getCommentCount()
.public void setComment(String comment, int index)
index
.
comment
- The new value.index
- The index to set.
NullPointerException
- If comment is null.
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getCommentCount()).public void addComment(String comment)
comment
- The new comment.
NullPointerException
- If comment is null.public void removeComment(String comment)
comment
- The comment to bew removed.
NullPointerException
- If comment is null.public String getProcessingInstruction(String target)
target
- The target of the processing instruction to return.
null
putProcessingInstruction(java.lang.String, java.lang.String)
public Iterator processingInstructionTargetsIterator()
public void putProcessingInstruction(String target, String value)
target
- The target.value
- The value.
NullPointerException
- If target or value is null.public void removeProcessingInstruction(String target)
target
- The target to remove.
NullPointerException
- If target is null.public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public boolean equalContents(ComplexDataObject obj, boolean deep, boolean checkContent, boolean checkAttributes, boolean checkElements)
obj
is equal to the data contained in this object.
obj
- The object to query.deep
- Whether to check for equality at all levels in the hierarchy.checkContent
- Whether to check for content equality.checkAttributes
- Whether to check for attribute equality.checkElements
- Whether to check for element equality.
public String toElementNamesString()
public String toAttrNamesString()
public int getIdKey()
public void setIdKey(int idKey)
idKey
- The key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |