1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.caleigo.core;
20
21 /*** The IEntityRelationPath interface is used to define a path between two
22 * different IEntityDescriptor objects.
23 *
24 * @author Dennis Zikovic
25 * @version 1.00
26 *
27 *//*
28 *
29 * WHEN WHO WHY & WHAT
30 * -----------------------------------------------------------------------------
31 * 2001-11-28 Dennis Zikovic Creation
32 */
33 public interface IEntityRelationPath
34 {
35
36
37 /*** Constant value returned by the getCardinality methods. The constant
38 * signifies that first/last side of the path can have one and only one
39 * refered entity for a single entity on the other side of the relation path.
40 */
41 public static final int ONE = 1;
42
43 /*** Constant value returned by the getCardinality methods. The constant
44 * signifies that first/last side of the path can have many refered
45 * entities for a single entity on the other side of the relation path.
46 */
47 public static final int MANY = Integer.MAX_VALUE;
48
49
50
51 /*** Returns the IEntityRelation object that marks is the start point
52 * of the relation path.
53 */
54 public IEntityRelation getFirstRelation();
55
56 /*** Returns true if the start relation starts on the reference side.
57 * False would mean that the relation starts on the target side.
58 */
59 public boolean isFirstRelationByReference();
60
61 /*** Returns the IEntityDescriptor object that marks is the start point
62 * of the relation path.
63 */
64 public IEntityDescriptor getFirstEntityDescriptor();
65
66 /*** Returns the IFieldDescriptor objects that marks is the start point
67 * of the relation path. The descriptors are returned as an Iterator.
68 */
69 public java.util.Iterator getFirstFieldDescriptors();
70
71 /*** Returns the IEntityRelation object that marks is the end point
72 * of the relation path.
73 */
74 public IEntityRelation getLastRelation();
75
76 /*** Returns true if the last relation starts on the reference side.
77 * False would mean that the relation ends on the target side.
78 */
79 public boolean isLastRelationByReference();
80
81 /*** Returns the IEntityDescriptor object that marks is the end point
82 * of the relation path.
83 */
84 public IEntityDescriptor getLastEntityDescriptor();
85
86 /*** Returns the IFieldDescriptor objects that marks is the end point
87 * of the relation path. The descriptors are returned as an Iterator.
88 */
89 public java.util.Iterator getLastFieldDescriptors();
90
91 /*** Access method that returns the number of IEntityRelation objects
92 * that defines the relation path.
93 */
94 public int getRelationCount();
95
96 /*** Access method that returns the indexed IEntityRelation object.
97 * The index is related to the begining/first entity of the path
98 * meaning that relation zero is the relation that links to first
99 * entity descriptor in the path.
100 */
101 public IEntityRelation getRelation(int index);
102
103 /*** Returns true if the indexed relation is followed in the forward
104 * directiona long the path by the reference side of the entity relation.
105 * False would mean that the relation is followed by the target side.
106 */
107 public boolean isRelationByReference(int index);
108
109 /*** Access method that returns all IEntityRelation objects in the path
110 * in the form of an Iterator.
111 */
112 public java.util.Iterator getRelations();
113
114 /*** Access method that returns the cardinality for the IEntityDescriptor
115 * object at the begining of the relation path. The returned value is one
116 * of the constants ONE or MANY that signifies the number of entities a
117 * single entity on the end-side of the relation path can refer to.
118 */
119 public int getForwardCardinality();
120
121 /*** Access method that returns the cardinality for the IEntityDescriptor
122 * object at the end of the relation path. The returned value is one
123 * of the constants ONE or MANY that signifies the number of entities a
124 * single entity on the start-side of the relation path can refer to.
125 */
126 public int getReverseCardinality();
127
128 /*** Returns a Qualifier that satisfies all the field requirements that
129 * have to be satisfied to define a relation between the first and last
130 * entity descriptor of the relation path.
131 */
132 public Qualifier getRelationQualifier();
133
134 /*** This help method returns true if the provided entity descriptors are
135 * related "along" the called relation path. The order of the descriptors
136 * are irelevant. The provided entity descriptors does not have to be the
137 * same as the end node descriptors to be related along the path. but they
138 * must atleast partially contain the field descriptors that does define
139 * the start and end connections for the path at the end-nodes.
140 * <p>
141 * Note that the descriptors are are only considered to be related "along
142 * the path" if they satisfies the end-node field requriments for
143 * relationship. In other words the ENTIRE path must followed for this
144 * method to consider the descriptors as related.
145 */
146 public boolean isRelatedByPath(IEntityDescriptor descriptor1, IEntityDescriptor descriptor2);
147
148 /*** Returns a string representation of this IEntirtyRelationPath that can
149 * be used to restore this IEntirtyRelationPath. It is recommended that
150 * implementing classes declares a static factory method that takes this string
151 * as a parameter.
152 */
153 public String convertToString();
154
155 /*** Access method that returns the cardinality for the IEntityDescriptor
156 * object at the end of the relation path. The returned value is one
157 * of the constants ONE or MANY that signifies the number of entities a
158 * single entity on the start-side of the relation path can refer to.
159 * Note that the order is relevant since the cardinality is defined from
160 * start to the end descriptor.
161 */
162
163 }
164