biz.c24.io.api.data
Class Element

java.lang.Object
  extended by biz.c24.io.api.data.DataComponent
      extended by biz.c24.io.api.data.Element
All Implemented Interfaces:
ModelComponent, Serializable
Direct Known Subclasses:
AnyElement

public class Element
extends DataComponent

A declaration of an element. Instances of this class are used to build up the structure of a ComplexDataType. This class encapsulates a type and the minimum and maximum cardinality of objects of that type WITHIN a particular scope. This class is responsible for the validation of cardinalities.

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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class biz.c24.io.api.data.DataComponent
CARDINALITY_UNBOUNDED, IO_VALIDATE_DATABASE_KEY_PRESENCE
 
Constructor Summary
Element()
          Constructs a new instance which will require subsequent initilisation.
Element(String name, int minCardinality, int maxCardinality, Class typeClass, DataModel model)
          Constructs a new lazily initalised instance with the specified type class and other values.
Element(String name, int minCardinality, int maxCardinality, DataType type, DataModel model)
          Constructs a new instance with the specified type and other values.
Element(String name, int minCardinality, int maxCardinality, Element ref, DataModel model)
          Constructs a new instance with the specified reference and other values.
 
Method Summary
 void addDatabaseKeyRef(DatabaseKeyRef databaseKeyRef)
          Adds a new database key reference that will allow for correct construction of database relationships between parent and child objects.
 void addSubstitution(Element substitution)
          Adds an element to this elements substitution group.
 Object createObject(String typeName, String typeUri)
          Creates an returns a new object defined by this component and a type derived from this components type.
 String formatObject(Object obj)
          Returns a String representation of the supplied Object.
 BitMapIndex getBitMapIndex()
           
 ElementBlockEnum getBlock()
          Returns the block value of this element.
 DatabaseKeyRef getDatabaseKeyRef(int index)
          Returns the database key reference at the specified index.
 int getDatabaseKeyRefCount()
          Returns the number of database key references on this element.
 DatabaseKeyRef[] getDatabaseKeyRefs()
          Returns all database key references specified on this element.
 Element getElementRef()
          Returns the element ref.
 FinalEnum getFinal()
          Returns the final value of this element.
 FormEnum getForm(boolean deep)
          Returns the form of this component or optionally the model's default.
 Element getSubstitution(int index)
          Returns the substitution at index.
 Element getSubstitution(String name)
          Returns the substitution called name.
 Element getSubstitution(String name, String namespace)
          Returns the substitution called name from namespace.
 int getSubstitutionCount()
          Returns the number of substitions in this elements substitution group.
 Element getSubstitutionGroup()
          Returns the head of this elements substitution group.
 boolean isAbstract()
          Returns whether this element is abstract.
 boolean isComposition()
          Returns whether this element represents a composition (strong) relationship or an aggregation (weak) relationship.
 boolean isIdentifier()
           
 boolean isNillable()
          Returns whether this element permits nill objects.
 Object parseObject(String str)
          Returns an Object representation of the supplied String data.
 void removeDatabaseKeyRef(DatabaseKeyRef databaseKeyRef)
          Removes a specified database key reference from this element.
 void removeSubstitution(Element substitution)
          Removes an element from this elements substitution group.
 void setAbstract(boolean abstracT)
          Sets whether this element is abstract.
 void setBitMapIndex(BitMapIndex bitMapIndex)
           
 void setBlock(ElementBlockEnum block)
          Sets the block value of this element.
 void setComposition(boolean composition)
          Sets whether this element represents a composition (strong) relationship or an aggregation (weak) relationship.
 void setDatabaseKeyRefs(DatabaseKeyRef[] databaseKeyRefs)
          Sets the database key references on this element.
 void setFinal(FinalEnum finaL)
          Sets the final value of this element.
 void setIdentifier(boolean identifier)
           
 void setNillable(boolean nillable)
          Sets whether this element permits nill objects.
 void setSubstitutionGroup(Element substitutionGroup)
          Sets the head of this elements substitution group.
 
Methods inherited from class biz.c24.io.api.data.DataComponent
createObject, equals, getAnnotation, getCardinalityConstraint, getCardinalityString, getDatabaseColumnName, getDefaultValue, getDescription, getFixedValue, getForm, getLengthConstraint, getLog, getMaxCardinality, getMinCardinality, getModel, getName, getOriginalName, getRef, getSSOffset, getType, hashCode, isFixedCardinality, isGroup, isOptional, isPrimaryKey, isRepeating, setAnnotation, setCardinalityConstraint, setDatabaseColumnName, setDefaultValue, setFixedValue, setForm, setGroup, setLengthConstraint, setMaxCardinality, setMinCardinality, setModel, setName, setOriginalName, setPrimaryKey, setRef, setSSOffset, setType, toString, validate, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Element

public Element()
Constructs a new instance which will require subsequent initilisation.


Element

public Element(String name,
               int minCardinality,
               int maxCardinality,
               Class typeClass,
               DataModel model)
Constructs a new lazily initalised instance with the specified type class and other values.

Parameters:
name - The name of the element.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
typeClass - The class of the type of the element.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.

Element

public Element(String name,
               int minCardinality,
               int maxCardinality,
               DataType type,
               DataModel model)
Constructs a new instance with the specified type and other values.

Parameters:
name - The name of the element.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
type - The type of the element.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.

Element

public Element(String name,
               int minCardinality,
               int maxCardinality,
               Element ref,
               DataModel model)
Constructs a new instance with the specified reference and other values.

Parameters:
name - The name of the element.
minCardinality - The minimum cardinality.
maxCardinality - The maximum cardinality or DataComponent.CARDINALITY_UNBOUNDED.
ref - The element to refer to.
model - The model.
Throws:
NullPointerException - if name or model are null.
IllegalArgumentException - if minimum or maximum cardinality are less than zero or greater than one or if minimum cardinality is greater than maximum cardinality.
Method Detail

createObject

public Object createObject(String typeName,
                           String typeUri)
Description copied from class: DataComponent
Creates an returns a new object defined by this component and a type derived from this components type.

Overrides:
createObject in class DataComponent
Parameters:
typeName - The name of the type to use.
typeUri - The URI of the namespace of the type to use.
Returns:
The new object.

getElementRef

public Element getElementRef()
Returns the element ref.

Returns:
The element ref.

getForm

public FormEnum getForm(boolean deep)
Description copied from class: DataComponent
Returns the form of this component or optionally the model's default.

Overrides:
getForm in class DataComponent
Parameters:
deep - Whether to return the model's default form if this component's form is FormEnum.UNSPECIFIED.
Returns:
The form of this component or the model's default.

isAbstract

public boolean isAbstract()
Returns whether this element is abstract. Abstract elements can not instantiate object directly.

Returns:
Whether this element is abstract.

setAbstract

public void setAbstract(boolean abstracT)
Sets whether this element is abstract.

Parameters:
abstracT - The new value.

getBlock

public ElementBlockEnum getBlock()
Returns the block value of this element.

Returns:
The block value.

setBlock

public void setBlock(ElementBlockEnum block)
Sets the block value of this element.

Parameters:
block - The new block value.

getFinal

public FinalEnum getFinal()
Returns the final value of this element.

Returns:
The final value.

setFinal

public void setFinal(FinalEnum finaL)
Sets the final value of this element.

Parameters:
finaL - The new final value.

isNillable

public boolean isNillable()
Returns whether this element permits nill objects.

Returns:
Whether this element permits nill objects.

setNillable

public void setNillable(boolean nillable)
Sets whether this element permits nill objects.

Parameters:
nillable - The new value.

getSubstitutionGroup

public Element getSubstitutionGroup()
Returns the head of this elements substitution group.

Returns:
The substitution group.

setSubstitutionGroup

public void setSubstitutionGroup(Element substitutionGroup)
Sets the head of this elements substitution group.

Parameters:
substitutionGroup - The substitution group.

addSubstitution

public void addSubstitution(Element substitution)
Adds an element to this elements substitution group.

Parameters:
substitution - The new substition.

removeSubstitution

public void removeSubstitution(Element substitution)
Removes an element from this elements substitution group.

Parameters:
substitution - The substitution to be removed.

getSubstitution

public Element getSubstitution(String name)
Returns the substitution called name.
The returned object is assumed to in the same namespace at this element.
This is a convenience method for calling getSubstitution(String, String) with null as the second argument.

Parameters:
name - The name of the substitution.
Returns:
The substitution.

getSubstitution

public Element getSubstitution(String name,
                               String namespace)
Returns the substitution called name from namespace.

Parameters:
name - The name of the substitution.
namespace - The namespace URI of the substitutions model.
Returns:
The substitution.

getSubstitution

public Element getSubstitution(int index)
Returns the substitution at index.

Parameters:
index - The index.
Returns:
The substitution.

getSubstitutionCount

public int getSubstitutionCount()
Returns the number of substitions in this elements substitution group.

Returns:
The number of substitutions present.

isComposition

public boolean isComposition()
Returns whether this element represents a composition (strong) relationship or an aggregation (weak) relationship.

Returns:
The nature of this relationship.

setComposition

public void setComposition(boolean composition)
Sets whether this element represents a composition (strong) relationship or an aggregation (weak) relationship.

Parameters:
composition - The new value.

isIdentifier

public boolean isIdentifier()

setIdentifier

public void setIdentifier(boolean identifier)

getDatabaseKeyRefs

public DatabaseKeyRef[] getDatabaseKeyRefs()
Returns all database key references specified on this element.

Returns:
The database key references.

setDatabaseKeyRefs

public void setDatabaseKeyRefs(DatabaseKeyRef[] databaseKeyRefs)
Sets the database key references on this element.

Parameters:
databaseKeyRefs - The new database key references.

getDatabaseKeyRefCount

public int getDatabaseKeyRefCount()
Returns the number of database key references on this element.

Returns:
The number present.

getDatabaseKeyRef

public DatabaseKeyRef getDatabaseKeyRef(int index)
Returns the database key reference at the specified index.

Parameters:
index - The index.
Returns:
The database key reference.

addDatabaseKeyRef

public void addDatabaseKeyRef(DatabaseKeyRef databaseKeyRef)
Adds a new database key reference that will allow for correct construction of database relationships between parent and child objects.

Parameters:
databaseKeyRef - The database key reference to be added.

getBitMapIndex

public BitMapIndex getBitMapIndex()

setBitMapIndex

public void setBitMapIndex(BitMapIndex bitMapIndex)

removeDatabaseKeyRef

public void removeDatabaseKeyRef(DatabaseKeyRef databaseKeyRef)
Removes a specified database key reference from this element.

Parameters:
databaseKeyRef - The database key reference to be removed.

parseObject

public Object parseObject(String str)
                   throws ParserException
Description copied from class: DataComponent
Returns an Object representation of the supplied String data.

Specified by:
parseObject in class DataComponent
Parameters:
str - The data to be parsed.
Returns:
The object.
Throws:
ParserException - If the data in the supplied String cannot be suitably rendered according to the type of this component.

formatObject

public String formatObject(Object obj)
Description copied from class: DataComponent
Returns a String representation of the supplied Object.

Specified by:
formatObject in class DataComponent
Parameters:
obj - The object representing the instance of this component.
Returns:
The String representation.


C24 Technologies © 2002-2012: All Rights Reserved.