|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.caleigo.core.AbstractEntityDescriptor
org.caleigo.core.CompositeEntityDescriptor
The CompositeEntityDescriptor can be used to make composite entities based on fields in base entity descriptors or another composite entity descriptor. The entities will be Creatable, Delatable & Editable according to this scheme: An entity is: -Deletable if the root group's primary key is present and the root field group's entity descriptor is deletable. -Creatable if the root group's primary key is present and all required fields in the root group are present and the root group's entity descriptor is creatable. -Editable if any of the field group's primary key is present and there is, in that group, at least one field that isn't read only. Deleting an entity will delete the root field group's "base entity". Creating a new entity will fill the new entity with default values. Editing of a field is allowed if the field's composite field descriptor isn't a read only field (the READ_ONLY_FIELD-flag) and the field group that the field belongs to has a primary key present and that field group's base entity descriptor is editable. Therefor this CompositeEntityDescriptor is editable if any of it's field is editable. Upon saving each field group is saved separately, this is done by copying the data to new entities that has the field group's underlying base entity descriptor as entity descriptor.
Nested Class Summary | |
static class |
CompositeEntityDescriptor.Builder
The FieldGroupBuilder is a builder that builds a tree (of fields- and field-groups) in a top-down manner. |
static class |
CompositeEntityDescriptor.CompositeDeleteEntityAction
The default delete action used by the CompositeEntityDescriptor class. |
static class |
CompositeEntityDescriptor.CompositeFieldGroup
The ICompositeFieldGroup is used to group sets of fields belonging to a single entity-descriptor (of the class ICompositeEntityDescriptor) together and to define their relation with each other. |
protected static class |
CompositeEntityDescriptor.CompositeFieldRelation
Basic implementation of the IFieldRelation for Composite Field Relations. |
static class |
CompositeEntityDescriptor.CompositeStoreEntityAction
The default store action used by the CompositeEntityDescriptor class. |
Nested classes inherited from class org.caleigo.core.AbstractEntityDescriptor |
AbstractEntityDescriptor.DeleteEntityAction, AbstractEntityDescriptor.Dezerializer, AbstractEntityDescriptor.StoreEntityAction |
Nested classes inherited from class org.caleigo.core.ICompositeEntityDescriptor |
ICompositeEntityDescriptor.ICompositeFieldDescriptor, ICompositeEntityDescriptor.ICompositeFieldGroup |
Field Summary |
Fields inherited from class org.caleigo.core.AbstractEntityDescriptor |
CACHEABLE, CREATABLE, DELETABLE, EDITABLE, LISTABLE, SCANABLE, SELECTABLE |
Fields inherited from interface org.caleigo.core.IEntityDescriptor |
CUSTOM_ENTITY, DELETE_ACTION, LINK_ENTITY, MASTER_ENTITY, NO_TIME_LIMIT, SLAVE_ENTITY, STATIC_ENTITY, STORE_ACTION |
Constructor Summary | |
CompositeEntityDescriptor(java.lang.String displayName,
java.lang.String dataSourceClassName,
IEntityDescriptor entityDescriptor,
IFieldDescriptor[] joinedFieldDescriptors)
This constructor make joins with an entity descriptor and fields. |
|
CompositeEntityDescriptor(java.lang.String displayName,
java.lang.String dataSourceClassName,
IFieldDescriptor[] fieldDescriptors)
This constructor creates a CompositeEntityDescriptor from a fieldArray. |
|
CompositeEntityDescriptor(java.lang.String codeName,
java.lang.String displayName,
java.lang.String dataSourceClassName,
int entityType,
IFieldDescriptor[] fieldDescriptors)
|
Method Summary | |
protected static ICompositeEntityDescriptor.ICompositeFieldDescriptor[] |
buildFieldArray(ICompositeEntityDescriptor.ICompositeFieldGroup rootFieldGroup)
Builds an array of all fields in the root field group and it's descendent children. |
protected static java.util.List |
buildFieldArray(ICompositeEntityDescriptor.ICompositeFieldGroup fieldGroup,
java.util.List fieldList)
Help-method, call the tree's nodes recursively. |
protected static IEntityRelation[] |
buildRelationArray(CompositeEntityDescriptor.CompositeFieldGroup rootFieldGroup)
Builds all relations that a composite entity desriptor should have. |
protected static void |
buildRelationForIdFieldsList(CompositeEntityDescriptor.CompositeFieldGroup fieldGroup,
java.util.Map referenceFieldMap,
java.util.List relationList)
Method makes recursive call to itself and make reference relation for id fields from the composite to the field group's base entity descriptor. |
protected static void |
buildRelationList(CompositeEntityDescriptor.CompositeFieldGroup fieldGroup,
java.util.List referenceRelationList,
java.util.List targetRelationList)
Recursive method for collecting relations. |
protected static int |
calculateEntityDescriptorFlags(IEntityDescriptor entityDescriptor)
Calculate which flag's are set. |
static int |
calculateFieldDescriptorFlags(IFieldDescriptor field)
|
protected static int |
calculateSizeTypeFlags(IEntityDescriptor entityDescriptor)
Calculate which of the size type flag's that are set. |
protected IEntityAction |
createDeleteAction()
Creates and returns the delete action for composite entity objects of the custom type: composite entity descriptor. |
IEntity |
createEntity()
Creates an entity of the type described by this descriptor and loads it with default data. |
IEntity |
createEntity(IDataProvider propertySource)
Creates an entity of the type described by this descriptor and loads it with data from the provided property source. |
protected IEntityAction |
createStoreAction()
Creates and returns the store action for composite entity objects of the custom type: composite entity descriptor. |
IDataSourceDescriptor |
getDataSourceDescriptor()
Returns the data source descriptor that this entity is a part of. |
Qualifier |
getDefaultQualifier()
Returns a qualifier that defines the default filter for this entity. |
static CompositeQualifier |
getKeyForFieldGroup(ICompositeEntityDescriptor.ICompositeFieldGroup group,
IEntity iEntity)
|
ICompositeEntityDescriptor.ICompositeFieldGroup |
getRootFieldGroup()
Returns the root field group for the tree of field groups that defines this CompositeEntityDescriptor. |
static java.lang.String |
increaseStringEndingWithNumber(java.lang.String anIdentity)
Increases (+1) the last number (if any) in a String. |
boolean |
isCreatable()
Returns true if entities described by the called descriptor may be created. |
boolean |
isDeletable()
Returns true if entities described by the called descriptor may be deleted. |
boolean |
isEditable()
Returns true if entities described by the called descriptor may be updated. |
static java.lang.String |
makeLogString(IEntity entity)
Makes a descriptive log string for the provided entity object. |
static java.lang.String |
printFlags(IEntityDescriptor entityDescriptor)
Makes a descriptive log string that tells what flags are set on the provided entity object. |
void |
setDefaultQualifier(Qualifier defaultQualifier)
This method sets the default qualifer for this composite entity descriptor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.caleigo.core.IEntityDescriptor |
contains, getAction, getAction, getActionCount, getActions, getCacheTime, getCodeName, getDataFieldCount, getDisplayName, getEntityClass, getEntityRelation, getEntityRelationCount, getEntityRelationIndex, getEntityRelations, getEntityType, getFieldCount, getFieldDescriptor, getFieldDescriptor, getFieldDescriptors, getFieldIndex, getFieldIndex, getHomeClass, getJNDIName, getNaturalOrder, getRemoteClass, getSourceName, isCacheable, isListable, isScanable, isSelectable, loadEntity, loadSelection |
Constructor Detail |
public CompositeEntityDescriptor(java.lang.String displayName, java.lang.String dataSourceClassName, IEntityDescriptor entityDescriptor, IFieldDescriptor[] joinedFieldDescriptors)
displayName
- screen name.dataSourceClassName
- the class name of the underlying data source
that this composite entity descriptor use.entityDescriptor
- all fields from this will be included if the
parameter joinedFieldDescriptors doesn't contain fields belonging to this
entity descriptor.joinedFieldDescriptors
- an array of fields to join with and make
a selection from.public CompositeEntityDescriptor(java.lang.String displayName, java.lang.String dataSourceClassName, IFieldDescriptor[] fieldDescriptors)
displayName
- screen name.dataSourceClassName
- the class name of the underlying data source
that this composite entity descriptor use.fieldDescriptors
- fields that are to be joined/selected.public CompositeEntityDescriptor(java.lang.String codeName, java.lang.String displayName, java.lang.String dataSourceClassName, int entityType, IFieldDescriptor[] fieldDescriptors)
codeName
- the code name should be used for programitic
identification.entityType
- the entity type entities of this descriptor should have.CompositeEntityDescriptor(String displayName, String dataSourceClassName, IFieldDescriptor[] fieldDescriptors)
,
entityType.
Method Detail |
public void setDefaultQualifier(Qualifier defaultQualifier)
setDefaultQualifier
in interface ICompositeEntityDescriptor
defaultQualifier
- the qualifer that directly qualifies this
composite entity descriptorprotected static ICompositeEntityDescriptor.ICompositeFieldDescriptor[] buildFieldArray(ICompositeEntityDescriptor.ICompositeFieldGroup rootFieldGroup)
rootFieldGroup
- the root in the ICompositeEntityDescriptor-object.
protected static java.util.List buildFieldArray(ICompositeEntityDescriptor.ICompositeFieldGroup fieldGroup, java.util.List fieldList)
protected static IEntityRelation[] buildRelationArray(CompositeEntityDescriptor.CompositeFieldGroup rootFieldGroup)
rootFieldGroup
- the root of the wrapped field group tree.
protected static void buildRelationList(CompositeEntityDescriptor.CompositeFieldGroup fieldGroup, java.util.List referenceRelationList, java.util.List targetRelationList)
fieldGroup
- the field group to get relation's from.referenceRelationList
- the list that holds and get matching field
groups and their belonging reference entity relation's.targetRelationList
- the list that holds and get matching field
groups and their belonging target entity relation's.protected static void buildRelationForIdFieldsList(CompositeEntityDescriptor.CompositeFieldGroup fieldGroup, java.util.Map referenceFieldMap, java.util.List relationList)
fieldGroup
- field group to look for exactly one id field in.referenceFieldMap
- map containing composite field descriptors that
already are referencefields.relationList
- the list to append the found relations to.protected static int calculateEntityDescriptorFlags(IEntityDescriptor entityDescriptor)
entityDescriptor
- the IEntityDescriptor that are examined.
protected static int calculateSizeTypeFlags(IEntityDescriptor entityDescriptor)
entityDescriptor
- the IEntityDescriptor that are examined.
public static int calculateFieldDescriptorFlags(IFieldDescriptor field)
public static java.lang.String increaseStringEndingWithNumber(java.lang.String anIdentity)
public static java.lang.String makeLogString(IEntity entity)
public static java.lang.String printFlags(IEntityDescriptor entityDescriptor)
entityDescriptor
- public IEntity createEntity()
createEntity
in interface IEntityDescriptor
createEntity
in class AbstractEntityDescriptor
public IEntity createEntity(IDataProvider propertySource)
createEntity
in interface IEntityDescriptor
createEntity
in class AbstractEntityDescriptor
public IDataSourceDescriptor getDataSourceDescriptor()
getDataSourceDescriptor
in interface IEntityDescriptor
getDataSourceDescriptor
in class AbstractEntityDescriptor
protected IEntityAction createStoreAction()
createStoreAction
in class AbstractEntityDescriptor
protected IEntityAction createDeleteAction()
createDeleteAction
in class AbstractEntityDescriptor
public boolean isCreatable()
isCreatable
in interface IEntityDescriptor
isCreatable
in class AbstractEntityDescriptor
public boolean isEditable()
isEditable
in interface IEntityDescriptor
isEditable
in class AbstractEntityDescriptor
public boolean isDeletable()
isDeletable
in interface IEntityDescriptor
isDeletable
in class AbstractEntityDescriptor
public ICompositeEntityDescriptor.ICompositeFieldGroup getRootFieldGroup()
getRootFieldGroup
in interface ICompositeEntityDescriptor
public Qualifier getDefaultQualifier()
getDefaultQualifier
in interface ICompositeEntityDescriptor
public static CompositeQualifier getKeyForFieldGroup(ICompositeEntityDescriptor.ICompositeFieldGroup group, IEntity iEntity)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |