org.caleigo.core
Class CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor

java.lang.Object
  extended byorg.caleigo.core.CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor
All Implemented Interfaces:
ICompositeEntityDescriptor.ICompositeFieldDescriptor, IFieldDescriptor, java.io.Serializable
Enclosing class:
CompositeEntityDescriptor.CompositeFieldGroup

protected class CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor
extends java.lang.Object
implements ICompositeEntityDescriptor.ICompositeFieldDescriptor

The ICompositeFieldDescriptor wraps another field descriptor and in many ways acts as a proxy for it. It can be used to alter properties such as code and display names.

See Also:
Serialized Form

Nested Class Summary
protected  class CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor.FieldRelationIterator
           
 
Field Summary
 
Fields inherited from interface org.caleigo.core.IFieldDescriptor
AUTOGEN, HIDDEN_FIELD, HINT_FIELD, IDENTITY_FIELD, INDEXED, NAME_FIELD, NATURAL_ORDER, OVERVIEW_FIELD, READ_ONLY_FIELD, REQUIRED
 
Constructor Summary
protected CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor(IFieldDescriptor field, java.lang.String codeName, java.lang.String displayName, int flags)
           
 
Method Summary
 boolean canValidate(IDataProvider dataProvider)
          This method returns true if the called field descriptor can validate data described by the field in the context of the provided IDataProvider object.
 java.lang.String getCodeName()
          Return the code name for the field.
 DataType getDataType()
          Returns the data type for the field.
 java.lang.Object getDefaultValue()
          Return the default value for the field or null if none is set.
 java.lang.String getDisplayName()
          Returns the display name for the field.
 IEntityDescriptor getEntityDescriptor()
          Access method that returns the entity descriptor that the described field is part of.
 ICompositeEntityDescriptor.ICompositeFieldGroup getFieldGroup()
           
 java.util.Iterator getFieldRelations()
          Access method that returns an iterator for all IFieldRelation objects that the called field descriptor is part of.
 int getLength()
          Returns the length of the data type if the type is a scalar type.
 IFieldRelation getReferenceFieldRelation()
          Access method that returns the field relation that the called field is a reference to.
 IFieldDescriptor getRemoteFieldDescriptor()
          Access method to the wrapped/remote field descriptor.
 IFieldDescriptor getSourceFieldDescriptor()
          Access method to the source field descriptor.
 java.lang.String getSourceName()
          Returns the source name for the field.
 boolean isAutoGenerated()
          Access method that returns true if the field is autogenerated or not.
 boolean isHiddenField()
          Access method that returns true if the field is hidden, meaning that data of the fields type should never be displayed for the end-user.
 boolean isHintField()
          Access method that returns true if the field is a suitable hint field for the entity it is a part of for the end-user.
 boolean isIdentityField()
          Access method that returns true if the field is a part of the entity´s identity (primary key in a relational database).
 boolean isIndexed()
          Access method that returns true if the field is a preferred field to qualify on.
 boolean isNameField()
          Access method that returns true if the field is suitable name field to define the identify of the entity it is a part of for the end-user.
 boolean isNaturalOrder()
          Access method that returns true if the field is the natural order field for the entities it is a part of.
 boolean isOverviewField()
          Access method that returns true if the field is suitable for limited overview of the entity it is a part of.
 boolean isReadOnly()
          Access method that returns true if the field as read-only meaning that data of the fields type should never be edited by the end-user.
 boolean isReferenceField()
          Access method that returns true if the field is apart of an entity reference.
 boolean isRequired()
          Access method that returns true if the field is required and allows null values or not.
 ValidationResult performBaseValidation(java.lang.Object dataValue)
          Performs basic validations that are relevant for all fields like checking for null values in reguired field data.
 java.lang.String toString()
           
 ValidationResult validateData(java.lang.Object data, IDataProvider dataProvider)
          This method validates the provided data object as described by the called field descriptor in the context of the provided IDataProvider object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor

protected CompositeEntityDescriptor.CompositeFieldGroup.CompositeFieldDescriptor(IFieldDescriptor field,
                                                                                 java.lang.String codeName,
                                                                                 java.lang.String displayName,
                                                                                 int flags)
Method Detail

getCodeName

public java.lang.String getCodeName()
Return the code name for the field. The code name should be used for programatic identification. This is safer and recommended compared to the use of field indexes. The code name is also the name of the data property for the field in entities.

Specified by:
getCodeName in interface IFieldDescriptor

getSourceName

public java.lang.String getSourceName()
Returns the source name for the field. The source name is an identifier for the field in the data service layer.

Specified by:
getSourceName in interface IFieldDescriptor

getDisplayName

public java.lang.String getDisplayName()
Returns the display name for the field. The reurned value has been passed through the ResourceProvider to allow localisation.

Specified by:
getDisplayName in interface IFieldDescriptor

getDataType

public DataType getDataType()
Returns the data type for the field.

Specified by:
getDataType in interface IFieldDescriptor

getLength

public int getLength()
Returns the length of the data type if the type is a scalar type.

Specified by:
getLength in interface IFieldDescriptor

getDefaultValue

public java.lang.Object getDefaultValue()
Return the default value for the field or null if none is set. This default value will automaticalli be set as the default value for created entities that the field is part of.

Specified by:
getDefaultValue in interface IFieldDescriptor

isIdentityField

public boolean isIdentityField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is a part of the entity´s identity (primary key in a relational database). Note that an entity can have multiple identity fields. All entities in the cel framework must have atleast one identity field.

Specified by:
isIdentityField in interface IFieldDescriptor

isReferenceField

public boolean isReferenceField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is apart of an entity reference.

Specified by:
isReferenceField in interface IFieldDescriptor

isRequired

public boolean isRequired()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is required and allows null values or not. The view layer will for instance use this flag to validate the data null values according to this flag.

Specified by:
isRequired in interface IFieldDescriptor

isIndexed

public boolean isIndexed()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is a preferred field to qualify on. It is normally used to state if the underlaying database has an index on the field.

Specified by:
isIndexed in interface IFieldDescriptor

isAutoGenerated

public boolean isAutoGenerated()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is autogenerated or not. Fields with this flag should never have values edited by the end-user.

Specified by:
isAutoGenerated in interface IFieldDescriptor

isNameField

public boolean isNameField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is suitable name field to define the identify of the entity it is a part of for the end-user. If no name field is defined the identity field then no reference mapping will be done for the end-user in the view layer. An etity may only have one name field.

Specified by:
isNameField in interface IFieldDescriptor

isOverviewField

public boolean isOverviewField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is suitable for limited overview of the entity it is a part of. It is used in the view layer to define what fields that by default should be displayed in lists and in qualifier views. An entity should normally have less the five overview fields.

Specified by:
isOverviewField in interface IFieldDescriptor

isHintField

public boolean isHintField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is a suitable hint field for the entity it is a part of for the end-user. If no hint field is defined then no hints will be automatically displayed for the end-user in the view layer. An etity may only have one hint field.

Specified by:
isHintField in interface IFieldDescriptor

isHiddenField

public boolean isHiddenField()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field is hidden, meaning that data of the fields type should never be displayed for the end-user.

Specified by:
isHiddenField in interface IFieldDescriptor

isReadOnly

public boolean isReadOnly()
Description copied from interface: IFieldDescriptor
Access method that returns true if the field as read-only meaning that data of the fields type should never be edited by the end-user.

Specified by:
isReadOnly in interface IFieldDescriptor
Returns:
true if the the read only flag (READ_ONLY_FIELD) is set for this field OR if the field's field group's EntityDescriptor isn't editable OR if the field's field group's primary key isn't present among the fields. OBS, Watch out the behaviour when this method are called before the field descriptor's field group's base entity descriptor's data source descriptor has been initialized!

isNaturalOrder

public boolean isNaturalOrder()
Access method that returns true if the field is the natural order field for the entities it is a part of. If no natural order field is defined the identity field will be used for natural order.

Specified by:
isNaturalOrder in interface IFieldDescriptor

getEntityDescriptor

public IEntityDescriptor getEntityDescriptor()
Access method that returns the entity descriptor that the described field is part of.

Specified by:
getEntityDescriptor in interface IFieldDescriptor

canValidate

public boolean canValidate(IDataProvider dataProvider)
This method returns true if the called field descriptor can validate data described by the field in the context of the provided IDataProvider object. The minimum requiriment is that described field data can be provided but in some cases other data resources is also required.

Specified by:
canValidate in interface IFieldDescriptor

validateData

public ValidationResult validateData(java.lang.Object data,
                                     IDataProvider dataProvider)
This method validates the provided data object as described by the called field descriptor in the context of the provided IDataProvider object.

Specified by:
validateData in interface IFieldDescriptor

performBaseValidation

public ValidationResult performBaseValidation(java.lang.Object dataValue)
Performs basic validations that are relevant for all fields like checking for null values in reguired field data.


getReferenceFieldRelation

public IFieldRelation getReferenceFieldRelation()
Access method that returns the field relation that the called field is a reference to. If the called field descriptor is not a reference field then null is returned.

Specified by:
getReferenceFieldRelation in interface IFieldDescriptor

getFieldRelations

public java.util.Iterator getFieldRelations()
Access method that returns an iterator for all IFieldRelation objects that the called field descriptor is part of.

Specified by:
getFieldRelations in interface IFieldDescriptor

getRemoteFieldDescriptor

public IFieldDescriptor getRemoteFieldDescriptor()
Access method to the wrapped/remote field descriptor.


getSourceFieldDescriptor

public IFieldDescriptor getSourceFieldDescriptor()
Access method to the source field descriptor. This corresponds to looping through all remotes to the first non composite field.

Specified by:
getSourceFieldDescriptor in interface ICompositeEntityDescriptor.ICompositeFieldDescriptor

getFieldGroup

public ICompositeEntityDescriptor.ICompositeFieldGroup getFieldGroup()
Specified by:
getFieldGroup in interface ICompositeEntityDescriptor.ICompositeFieldDescriptor
Returns:
The ICompositeFieldGroup this composite field descriptor belongs to.

toString

public java.lang.String toString()


Copyright © 2005 Caleigo. All Rights Reserved.