biz.c24.io.api.data
Class DataComponent

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

public abstract class DataComponent
extends Object
implements ModelComponent

The super class of element and attribute.

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
static int CARDINALITY_UNBOUNDED
          The value of a cardinality that is unbounded.
static String IO_VALIDATE_DATABASE_KEY_PRESENCE
          Deprecated. Use Utils.SYSTEM_PROPERTY_SUPPRESS_DATABASE_KEY_VALIDATION instead.
 
Method Summary
 Object createObject()
          Creates and returns a new object defined by this component.
 Object createObject(String typeName, String typeUri)
          Creates an returns a new object defined by this component and a type derived from this components type.
 boolean equals(Object o)
           
abstract  String formatObject(Object obj)
          Returns a String representation of the supplied Object.
 Annotation getAnnotation()
          Returns the annotation of this component.
 XPathStatement getCardinalityConstraint()
          Returns the cardinality constraint.
 String getCardinalityString()
          Returns a string represntation of the cardinality of this component.
 String getDatabaseColumnName()
          Returns the name of the database column that this component represents.
 String getDefaultValue()
          Returns the default value of this component.
 String getDescription()
          Returns a description of this component.
 String getFixedValue()
          Returns the fixed value.
 FormEnum getForm()
          Returns the form of this component or the model's default.
 FormEnum getForm(boolean deep)
          Returns the form of this component or optionally the model's default.
 XPathStatement getLengthConstraint()
          Returns the length constraint.
 Logger getLog()
          Returns the static singleton log4j Logger object used to log messages for this object.
 int getMaxCardinality()
          Returns the maximum cardinality of this component.
 int getMinCardinality()
          Returns the minimum cardinality of this component.
 DataModel getModel()
          Returns the model.
 String getName()
          Returns the name of this component.
 String getOriginalName()
          Returns the original name if it is different to the name property, otherwise the name is returned.
 DataComponent getRef()
          Returns the component referenced by this component.
 String getSSOffset()
          Returns the R1C1 style offset for SpreadSheet binding.
 DataType getType()
          Returns the type of this component.
 int hashCode()
           
 boolean isFixedCardinality()
          Convenience method to get whether this component is of fixed cardinality (ie getMinCardinality() = getMaxCardinality()).
 boolean isGroup()
          Returns whether this component is a group, i.e. an element group or attribute group.
 boolean isOptional()
          Convenience method to get whether this component is optional (i.e.
 boolean isPrimaryKey()
          Returns whether this element represents a primary key in a database or not.
 boolean isRepeating()
          Convenience method to get whether this component is repeating (ie getMaxCardinality() does not return 1).
abstract  Object parseObject(String str)
          Returns an Object representation of the supplied String data.
 void setAnnotation(Annotation annotation)
          Sets the annotation of this component.
 void setCardinalityConstraint(XPathStatement cardinalityConstraint)
          Sets the cardinality constraint.
 void setDatabaseColumnName(String databaseColumnName)
          Sets the database column name of the component
 void setDefaultValue(String defaultValue)
          Sets the default value.
 void setFixedValue(String fixedValue)
          Sets the fixed value.
 void setForm(FormEnum form)
          Sets the form of this component.
 void setGroup(boolean group)
          Sets whether this component is a group.
 void setLengthConstraint(XPathStatement lengthConstraint)
          Sets the length constraint.
 void setMaxCardinality(int maxCardinality)
          Sets the maximum cardinatlity of this component.
 void setMinCardinality(int minCardinality)
          Sets the minimum cardinality of this component.
 void setModel(DataModel model)
          Sets the model.
 void setName(String name)
          Sets the name of this component.
 void setOriginalName(String originalName)
          Sets the original name of the component.
 void setPrimaryKey(boolean primaryKey)
          Sets whether this element should represent a primary key in a database.
 void setRef(DataComponent ref)
          Sets the ref of this component.
 void setSSOffset(String ssOffset)
          Sets the offset for SpreadSheet binding.
 void setType(DataType type)
          Sets the type of this component.
 String toString()
           
 boolean validate(ComplexDataObject object)
          Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.
 boolean validate(ComplexDataObject object, ValidationConstraints vc)
          Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IO_VALIDATE_DATABASE_KEY_PRESENCE

public static final String IO_VALIDATE_DATABASE_KEY_PRESENCE
Deprecated. Use Utils.SYSTEM_PROPERTY_SUPPRESS_DATABASE_KEY_VALIDATION instead.
The System property key used to determine whether validation should be carried out on the presence of database key fields.

See Also:
Constant Field Values

CARDINALITY_UNBOUNDED

public static final int CARDINALITY_UNBOUNDED
The value of a cardinality that is unbounded.

See Also:
Constant Field Values
Method Detail

getLog

public Logger getLog()
Returns the static singleton log4j Logger object used to log messages for this object. The log returned will be named after this component.

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/

Returns:
The logger.

createObject

public Object createObject()
Creates and returns a new object defined by this component. This method is a shortcut to calling createObject(String,String).

Returns:
A new object.

createObject

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

Parameters:
typeName - The name of the type to use.
typeUri - The URI of the namespace of the type to use.
Returns:
The new object.

parseObject

public abstract Object parseObject(String str)
                            throws ParserException
Returns an Object representation of the supplied String data.

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 abstract String formatObject(Object obj)
Returns a String representation of the supplied Object.

Parameters:
obj - The object representing the instance of this component.
Returns:
The String representation.

getModel

public DataModel getModel()
Returns the model.

Returns:
The model.

setModel

public void setModel(DataModel model)
Sets the model.

Parameters:
model - The model.

getName

public String getName()
Description copied from interface: ModelComponent
Returns the name of this component.

Specified by:
getName in interface ModelComponent
Returns:
The name.

setName

public void setName(String name)
Sets the name of this component.

Parameters:
name - The new name

getOriginalName

public String getOriginalName()
Returns the original name if it is different to the name property, otherwise the name is returned.

Returns:
The original name.

setOriginalName

public void setOriginalName(String originalName)
Sets the original name of the component.

Parameters:
originalName - The new original name.

getDatabaseColumnName

public String getDatabaseColumnName()
Returns the name of the database column that this component represents.

Returns:
The column name.

setDatabaseColumnName

public void setDatabaseColumnName(String databaseColumnName)
Sets the database column name of the component

Parameters:
databaseColumnName - The actual database column name

getAnnotation

public Annotation getAnnotation()
Returns the annotation of this component.

Returns:
The annotation.

setAnnotation

public void setAnnotation(Annotation annotation)
Sets the annotation of this component.

Parameters:
annotation - The new annotation.

isGroup

public boolean isGroup()
Returns whether this component is a group, i.e. an element group or attribute group.

Returns:
Whether this component is a group.

setGroup

public void setGroup(boolean group)
Sets whether this component is a group.

Parameters:
group - The new value.

getType

public DataType getType()
Returns the type of this component.

Returns:
The type

setType

public void setType(DataType type)
Sets the type of this component.

Parameters:
type - The new type.

getRef

public DataComponent getRef()
Returns the component referenced by this component.

Returns:
The reference.

setRef

public void setRef(DataComponent ref)
Sets the ref of this component.

Parameters:
ref - The new ref.

validate

public boolean validate(ComplexDataObject object)
                 throws ValidationException
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.

Validates the supplied object.

Parameters:
object - The object to be validated.
Returns:
true if the validation is successful.
Throws:
ValidationException - If the validation fails and the object is in ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION mode.

validate

public boolean validate(ComplexDataObject object,
                        ValidationConstraints vc)
                 throws ValidationException
Deprecated. Use ValidationManager instead - this method will be removed in the next major version release.

Validates the supplied object with the specifed validation constraints.

Parameters:
object - The object to be valdiated.
vc - The validation constraints to use.
Returns:
true if the validation is successful.
Throws:
ValidationException - If the validation fails and the object is in ValidationMechanismEnum.VALIDATION_MECHANISM_EXCEPTION mode.

getMinCardinality

public int getMinCardinality()
Returns the minimum cardinality of this component.

Returns:
The minimum cardinality.

setMinCardinality

public void setMinCardinality(int minCardinality)
Sets the minimum cardinality of this component.

Parameters:
minCardinality - The new value.
Throws:
IllegalArgumentException - If minCardinality < 0.

getMaxCardinality

public int getMaxCardinality()
Returns the maximum cardinality of this component.

Returns:
The maximum cardinality or CARDINALITY_UNBOUNDED if there is no upper bound.

setMaxCardinality

public void setMaxCardinality(int maxCardinality)
Sets the maximum cardinatlity of this component.

Parameters:
maxCardinality - The new value.
Throws:
IllegalArgumentException - If maxCardinality < 0.

isOptional

public boolean isOptional()
Convenience method to get whether this component is optional (i.e. getMinCardinality() returns 0).

Returns:
Whether this component is optional.

isRepeating

public boolean isRepeating()
Convenience method to get whether this component is repeating (ie getMaxCardinality() does not return 1).

Returns:
Whether this component is optional.

isFixedCardinality

public boolean isFixedCardinality()
Convenience method to get whether this component is of fixed cardinality (ie getMinCardinality() = getMaxCardinality()).

Returns:
Whether this component is optional.

getCardinalityString

public String getCardinalityString()
Returns a string represntation of the cardinality of this component.

Returns:
The string.

getDefaultValue

public String getDefaultValue()
Returns the default value of this component.

Returns:
The default value.

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the default value.

Parameters:
defaultValue - The new default value.

getFixedValue

public String getFixedValue()
Returns the fixed value.

Returns:
The fixed value.

setFixedValue

public void setFixedValue(String fixedValue)
Sets the fixed value.

Parameters:
fixedValue - The new fixed value.

getForm

public FormEnum getForm(boolean deep)
Returns the form of this component or optionally the model's default.

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.

getForm

public FormEnum getForm()
Returns the form of this component or the model's default. This method is equivalent to calling getForm(true).

Returns:
The form of this component or the model's default.
See Also:
getForm(boolean).

setForm

public void setForm(FormEnum form)
Sets the form of this component.

Parameters:
form - The new value.
Throws:
NullPointerException - If form == null.

getLengthConstraint

public XPathStatement getLengthConstraint()
Returns the length constraint. This allows the length of this element's data to be defined at runtime. When an instance of this element is created and associated with the hierarchy tree, it will execute this xpath statement to find a numeric value which will determine it's length.

Returns:
The length constraint.

setLengthConstraint

public void setLengthConstraint(XPathStatement lengthConstraint)
Sets the length constraint.

Parameters:
lengthConstraint - The length constraint.

getCardinalityConstraint

public XPathStatement getCardinalityConstraint()
Returns the cardinality constraint.

This allows the cardinality of this element to be defined at runtime. When an instance of this element is created and associated with the hierarchy tree, it will execute this xpath statement to find a numeric value which will determine it's cardinality.

Returns:
The cardinality constraint.

setCardinalityConstraint

public void setCardinalityConstraint(XPathStatement cardinalityConstraint)
Sets the cardinality constraint.

Parameters:
cardinalityConstraint - The cardinality constraint.

getDescription

public String getDescription()
Returns a description of this component.

The description is taken from the annotation if one is present, otherwise the empty string is returned.

Returns:
The description.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isPrimaryKey

public boolean isPrimaryKey()
Returns whether this element represents a primary key in a database or not.

Returns:
True or False

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)
Sets whether this element should represent a primary key in a database.

Parameters:
primaryKey - True or False

getSSOffset

public String getSSOffset()
Returns the R1C1 style offset for SpreadSheet binding.

Returns:
The offset for SpreadSheet binding.
See Also:
SSSink

setSSOffset

public void setSSOffset(String ssOffset)
Sets the offset for SpreadSheet binding.

Parameters:
ssOffset - The new offset in R1C1 style.
See Also:
getSSOffset()


C24 Technologies © 2002-2012: All Rights Reserved.