org.caleigo.core
Class EntityRelationPath

java.lang.Object
  extended byorg.caleigo.core.EntityRelationPath
All Implemented Interfaces:
IEntityRelationPath

public class EntityRelationPath
extends java.lang.Object
implements IEntityRelationPath

Version:
1.00
Author:
Dennis Zikovic

Nested Class Summary
protected static class EntityRelationPath.PathFinderVisitor
           
 
Field Summary
 
Fields inherited from interface org.caleigo.core.IEntityRelationPath
MANY, ONE
 
Constructor Summary
EntityRelationPath(IEntityDescriptor descriptor)
          Creates new EntityRelationPath as a "null" path.
EntityRelationPath(IEntityRelation relation, boolean byReference)
          Creates new EntityRelationPath.
EntityRelationPath(IEntityRelationPath relationPath)
          Creates new EntityRelationPath as a copy of another IRelationPath.
 
Method Summary
 void appendRelation(IEntityRelation relation)
          Access method that returns the cardinality for the IEntityDescriptor object at the end of the relation path.
 void appendRelation(IEntityRelation relation, boolean byReference)
           
 void appendRelationPath(IEntityRelationPath path)
           
 java.lang.String convertToString()
          Returns a string representation of this IEntirtyRelationPath that can be used to restore this IEntirtyRelationPath.
static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor, IEntityDescriptor endEntityDescriptor)
          Static help method that creates a new path between the submited entity descriptors.
static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor, IFieldDescriptor[] fieldWayPoints, IEntityDescriptor endEntityDescriptor)
          Static help method that creates a new path between the submited entity descriptors.
static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor, IFieldDescriptor fieldWayPoint, IEntityDescriptor endEntityDescriptor)
          Static help method that creates a new path between the submited entity descriptors.
static EntityRelationPath create(IEntityDescriptor startEntityDescriptor, java.lang.String configurationString)
          Factory method for creating an EntityRelationPath from a string that has been returned by convertToString.
 boolean equals(java.lang.Object obj)
           
 IEntityDescriptor getFirstEntityDescriptor()
          Returns the IEntityDescriptor object that marks is the start point of the relation path.
 java.util.Iterator getFirstFieldDescriptors()
          Returns the IFieldDescriptor objects that marks is the start point of the relation path.
 IEntityRelation getFirstRelation()
          Returns the IEntityRelation object that marks is the start point of the relation path.
 int getForwardCardinality()
          Access method that returns the cardinality for the IEntityDescriptor object at the begining of the relation path.
 IEntityDescriptor getLastEntityDescriptor()
          Returns the IEntityDescriptor object that marks is the end point of the relation path.
 java.util.Iterator getLastFieldDescriptors()
          Returns the IFieldDescriptor objects that marks is the end point of the relation path.
 IEntityRelation getLastRelation()
          Returns the IEntityRelation object that marks is the end point of the relation path.
 IEntityRelation getRelation(int index)
          Access method that returns the indexed IEntityRelation object.
 int getRelationCount()
          Access method that returns the number of IEntityRelation objects that defines the relation path.
 Qualifier getRelationQualifier()
          Returns a Qualifier that satisfies all the field requirements that have to be satisfied to define a relation between the first and last entity descriptor of the relation path.
 java.util.Iterator getRelations()
          Access method that returns all IEntityRelation objects in the path in the form of an Iterator.
 int getReverseCardinality()
          Access method that returns the cardinality for the IEntityDescriptor object at the end of the relation path.
 int hashCode()
           
 boolean isFirstRelationByReference()
          Returns true if the start relation starts on the reference side.
 boolean isLastRelationByReference()
          Returns true if the last relation starts on the reference side.
 boolean isRelatedByPath(IEntityDescriptor descriptor1, IEntityDescriptor descriptor2)
          This help method returns true if the provided entity descriptors are related "along" the called relation path.
 boolean isRelationByReference(int relationIndex)
          Returns true if the indexed relation is followed in the forward directiona long the path by the reference side of the entity relation.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityRelationPath

public EntityRelationPath(IEntityRelation relation,
                          boolean byReference)
Creates new EntityRelationPath.


EntityRelationPath

public EntityRelationPath(IEntityRelationPath relationPath)
Creates new EntityRelationPath as a copy of another IRelationPath.


EntityRelationPath

public EntityRelationPath(IEntityDescriptor descriptor)
Creates new EntityRelationPath as a "null" path. This is usable to define "no path" between two entities of the same descriptor wich is necessary to differentiate against a path an none empty path.

Method Detail

create

public static EntityRelationPath create(IEntityDescriptor startEntityDescriptor,
                                        java.lang.String configurationString)
Factory method for creating an EntityRelationPath from a string that has been returned by convertToString.

Parameters:
configurationString - the string that should be used to create the relation.

create

public static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor,
                                         IEntityDescriptor endEntityDescriptor)
Static help method that creates a new path between the submited entity descriptors. The method will try to make a "smart" descision if there are multiple possible paths between the descriptors. No guranties can made however about the returned path except that the same path allways will be returned for the same entity descriptors. If no path exists between the two entities then null is returned.


create

public static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor,
                                         IFieldDescriptor fieldWayPoint,
                                         IEntityDescriptor endEntityDescriptor)
Static help method that creates a new path between the submited entity descriptors. The method will try to make a "smart" descision if there are multiple possible paths between the descriptors. No guranties can made however about the returned path except that the same path allways will be returned for the same entity descriptors. If no path exists between the two entities then null is returned.

The fieldWayPoint parameter can be used to guide the method in choosing a specific path.


create

public static IEntityRelationPath create(IEntityDescriptor startEntityDescriptor,
                                         IFieldDescriptor[] fieldWayPoints,
                                         IEntityDescriptor endEntityDescriptor)
Static help method that creates a new path between the submited entity descriptors. The method will try to make a "smart" descision if there are multiple possible paths between the descriptors. No guranties can made however about the returned path except that the same path allways will be returned for the same entity descriptors. If no path exists between the two entities then null is returned.

The fieldWayPoint parameter can be used to guide the method in choosing a specific path.


hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)

getFirstRelation

public IEntityRelation getFirstRelation()
Returns the IEntityRelation object that marks is the start point of the relation path.

Specified by:
getFirstRelation in interface IEntityRelationPath

isFirstRelationByReference

public boolean isFirstRelationByReference()
Returns true if the start relation starts on the reference side. False would mean that the relation starts on the target side.

Specified by:
isFirstRelationByReference in interface IEntityRelationPath

getFirstEntityDescriptor

public IEntityDescriptor getFirstEntityDescriptor()
Returns the IEntityDescriptor object that marks is the start point of the relation path.

Specified by:
getFirstEntityDescriptor in interface IEntityRelationPath

getFirstFieldDescriptors

public java.util.Iterator getFirstFieldDescriptors()
Returns the IFieldDescriptor objects that marks is the start point of the relation path. The descriptors are returned as an Iterator.

Specified by:
getFirstFieldDescriptors in interface IEntityRelationPath

getLastRelation

public IEntityRelation getLastRelation()
Returns the IEntityRelation object that marks is the end point of the relation path.

Specified by:
getLastRelation in interface IEntityRelationPath

isLastRelationByReference

public boolean isLastRelationByReference()
Returns true if the last relation starts on the reference side. False would mean that the relation ends on the target side.

Specified by:
isLastRelationByReference in interface IEntityRelationPath

getLastEntityDescriptor

public IEntityDescriptor getLastEntityDescriptor()
Returns the IEntityDescriptor object that marks is the end point of the relation path.

Specified by:
getLastEntityDescriptor in interface IEntityRelationPath

getLastFieldDescriptors

public java.util.Iterator getLastFieldDescriptors()
Returns the IFieldDescriptor objects that marks is the end point of the relation path. The descriptors are returned as an Iterator.

Specified by:
getLastFieldDescriptors in interface IEntityRelationPath

getRelationCount

public int getRelationCount()
Access method that returns the number of IEntityRelation objects that defines the relation path.

Specified by:
getRelationCount in interface IEntityRelationPath

isRelationByReference

public boolean isRelationByReference(int relationIndex)
Returns true if the indexed relation is followed in the forward directiona long the path by the reference side of the entity relation. False would mean that the relation is followed by the target side.

Specified by:
isRelationByReference in interface IEntityRelationPath

getRelation

public IEntityRelation getRelation(int index)
Access method that returns the indexed IEntityRelation object. The index is related to the begining/first entity of the path meaning that relation zero is the relation that links to first entity descriptor in the path.

Specified by:
getRelation in interface IEntityRelationPath

getRelations

public java.util.Iterator getRelations()
Access method that returns all IEntityRelation objects in the path in the form of an Iterator.

Specified by:
getRelations in interface IEntityRelationPath

getForwardCardinality

public int getForwardCardinality()
Access method that returns the cardinality for the IEntityDescriptor object at the begining of the relation path. The returned value is one of the constants ONE or MANY that signifies the number of entities a single entity on the end-side of the relation path can refer to.

Specified by:
getForwardCardinality in interface IEntityRelationPath

getReverseCardinality

public int getReverseCardinality()
Access method that returns the cardinality for the IEntityDescriptor object at the end of the relation path. The returned value is one of the constants ONE or MANY that signifies the number of entities a single entity on the start-side of the relation path can refer to.

Specified by:
getReverseCardinality in interface IEntityRelationPath

getRelationQualifier

public Qualifier getRelationQualifier()
Returns a Qualifier that satisfies all the field requirements that have to be satisfied to define a relation between the first and last entity descriptor of the relation path.

Specified by:
getRelationQualifier in interface IEntityRelationPath

isRelatedByPath

public boolean isRelatedByPath(IEntityDescriptor descriptor1,
                               IEntityDescriptor descriptor2)
This help method returns true if the provided entity descriptors are related "along" the called relation path. The order of the descriptors are irelevant. The provided entity descriptors does not have to be the same as the end node descriptors to be related along the path. but they must atleast partially contain the field descriptors that does define the start and connections for the path at the end-nodes.

Note that the descriptors are are only considered to be related "along the path" if they satisfies the end-node field requriments for relationship. In other words the entire path must "followed" for this method to consider the descriptors as related.

Specified by:
isRelatedByPath in interface IEntityRelationPath

convertToString

public java.lang.String convertToString()
Returns a string representation of this IEntirtyRelationPath that can be used to restore this IEntirtyRelationPath. It is recommended that implementing classes declares a static factory method that takes this string as a parameter.

Specified by:
convertToString in interface IEntityRelationPath

appendRelation

public void appendRelation(IEntityRelation relation)
Access method that returns the cardinality for the IEntityDescriptor object at the end of the relation path. The returned value is one of the constants ONE or MANY that signifies the number of entities a single entity on the start-side of the relation path can refer to. Note that the order is relevant since the cardinality is defined from start to the end descriptor.


appendRelation

public void appendRelation(IEntityRelation relation,
                           boolean byReference)

appendRelationPath

public void appendRelationPath(IEntityRelationPath path)

toString

public java.lang.String toString()


Copyright © 2005 Caleigo. All Rights Reserved.