org.caleigo.core
Class Relations

java.lang.Object
  extended byorg.caleigo.core.Relations

public final class Relations
extends java.lang.Object

Version:
1.00
Author:
Dennis Zikovic

Method Summary
static int getIdentityFieldCount(IEntityDescriptor entityDescriptor)
           
static IFieldDescriptor[] getIdentityFields(IEntityDescriptor entityDescriptor)
           
static IEntityRelationPath getSubRelationPath(IEntityRelationPath path, int start)
          creates a subpath of the provided entity relation path starting at the provided index to the end of the provided path.
static IEntityRelationPath getSubRelationPath(IEntityRelationPath path, int start, int end)
          creates a subpath of the provided entity relation path starting at the start-index and ending at tha end-index.
static boolean isIdentityIntersection(IEntityDescriptor descriptor1, IEntityDescriptor descriptor2)
           
static boolean isIntersection(IEntityDescriptor descriptor1, IEntityDescriptor descriptor2)
           
static boolean isLinkRelation(IEntityRelationPath relationPath)
          Returns true if the provided relation path is a "link" relation meaning that the path is defined by two and only two entity relations with an entity descriptor of the type LINK_ENTITY between the relations.
static boolean isReferenceRelated(IEntityDescriptor startDescriptor, IEntityDescriptor endDescriptor)
          Returns true if the provided entity descriptors are reference related, meaning that there can be endDescriptor entity for any given startDescriptor entity.
static boolean isReferenceTarget(IEntityDescriptor descriptor)
          Returns true if the provided entity descriptor is related to other entity descriptors as the target of the relation.
static boolean isRelated(IEntityDescriptor startDescriptor, IEntityDescriptor endDescriptor)
          Returns true if the provided entity descriptors are related.
static IEntity loadIntersectEntity(IEntity sourceEntity, IEntityDescriptor targetDescriptor)
          Loads an uniquely identifiable entity based on the data in the source.
static IEntity loadReferredEntity(IEntity sourceEntity, IFieldDescriptor referenceFieldDescriptor)
           
static ISelection loadRelatedEntities(IEntity sourceEntity, IEntityDescriptor targetDescriptor)
           
static ISelection loadRelatedEntities(IEntity sourceEntity, IEntityDescriptor targetDescriptor, IFieldDescriptor[] wayPoints)
           
static Qualifier makeFieldQualifier(IFieldDescriptor[] descriptors, IEntity entity)
          Makes a qualifer of the provided field descriptors and entity.
static Qualifier makeIdentityQualifier(IEntity sourceEntity, IEntityDescriptor targetDescriptor)
          Makes an identity qualifier for an entity of the targetDescriptor type using the fields in the sourceEntity.
static Qualifier makeRelationQualifier(IEntity sourceEntity, IEntityRelation entityRelation)
          Makes a qualifier that qualifies entities of the oposite end of the provided relation object.
static void setReferenceData(IEntity dataTargetEntity, IEntity dataSourceEntity, IEntityRelation relation)
          Sets all field data that can be extracted from the source data entity using the provided relation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isIntersection

public static boolean isIntersection(IEntityDescriptor descriptor1,
                                     IEntityDescriptor descriptor2)

isIdentityIntersection

public static boolean isIdentityIntersection(IEntityDescriptor descriptor1,
                                             IEntityDescriptor descriptor2)

isRelated

public static boolean isRelated(IEntityDescriptor startDescriptor,
                                IEntityDescriptor endDescriptor)
Returns true if the provided entity descriptors are related.


isReferenceRelated

public static boolean isReferenceRelated(IEntityDescriptor startDescriptor,
                                         IEntityDescriptor endDescriptor)
Returns true if the provided entity descriptors are reference related, meaning that there can be endDescriptor entity for any given startDescriptor entity.


isReferenceTarget

public static boolean isReferenceTarget(IEntityDescriptor descriptor)
Returns true if the provided entity descriptor is related to other entity descriptors as the target of the relation. The method can used to determine if it is safe to delete or change an etity's identity fields whitout the risk of causing a foreign key violation in slave entities.


isLinkRelation

public static boolean isLinkRelation(IEntityRelationPath relationPath)
Returns true if the provided relation path is a "link" relation meaning that the path is defined by two and only two entity relations with an entity descriptor of the type LINK_ENTITY between the relations.


getIdentityFieldCount

public static int getIdentityFieldCount(IEntityDescriptor entityDescriptor)

getIdentityFields

public static IFieldDescriptor[] getIdentityFields(IEntityDescriptor entityDescriptor)

getSubRelationPath

public static IEntityRelationPath getSubRelationPath(IEntityRelationPath path,
                                                     int start)
creates a subpath of the provided entity relation path starting at the provided index to the end of the provided path.


getSubRelationPath

public static IEntityRelationPath getSubRelationPath(IEntityRelationPath path,
                                                     int start,
                                                     int end)
creates a subpath of the provided entity relation path starting at the start-index and ending at tha end-index.


loadReferredEntity

public static IEntity loadReferredEntity(IEntity sourceEntity,
                                         IFieldDescriptor referenceFieldDescriptor)

loadRelatedEntities

public static ISelection loadRelatedEntities(IEntity sourceEntity,
                                             IEntityDescriptor targetDescriptor)

loadRelatedEntities

public static ISelection loadRelatedEntities(IEntity sourceEntity,
                                             IEntityDescriptor targetDescriptor,
                                             IFieldDescriptor[] wayPoints)

loadIntersectEntity

public static IEntity loadIntersectEntity(IEntity sourceEntity,
                                          IEntityDescriptor targetDescriptor)
Loads an uniquely identifiable entity based on the data in the source. entity. If no such entity can logicaly be identified null is rerturned.


makeFieldQualifier

public static Qualifier makeFieldQualifier(IFieldDescriptor[] descriptors,
                                           IEntity entity)
Makes a qualifer of the provided field descriptors and entity. The qualifier will use relation qualifers using EQUAL to qualify the field data. The relation qualifiers will be placed in a composite qualifier using INTERSECTION. If not all fields could be qualified by the provided entity null is returned.

The fields must be directly conatined in the entity or have refernece fields in the entity that directly refers to a provided field.


makeIdentityQualifier

public static Qualifier makeIdentityQualifier(IEntity sourceEntity,
                                              IEntityDescriptor targetDescriptor)
Makes an identity qualifier for an entity of the targetDescriptor type using the fields in the sourceEntity. If not all identity fields can be satisfied a null value is returned.


makeRelationQualifier

public static Qualifier makeRelationQualifier(IEntity sourceEntity,
                                              IEntityRelation entityRelation)
Makes a qualifier that qualifies entities of the oposite end of the provided relation object. Qualification data will be taken from the provided source entity. The method can be used to resolve single step relations by direclty qualifiyng qualifier.


setReferenceData

public static void setReferenceData(IEntity dataTargetEntity,
                                    IEntity dataSourceEntity,
                                    IEntityRelation relation)
Sets all field data that can be extracted from the source data entity using the provided relation. If the provided relation is null then the first usable direct relation between the entities is used.



Copyright © 2005 Caleigo. All Rights Reserved.