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
22 /*** The ICompositeEntityDescriptor interface defines how multiple entity types
23 * can be joined and handled as a single new entity type.
24 *
25 * A common use would also be to do a selection from only one
26 * base entity descriptor for performance reasons, another to make a join-tree
27 * of field groups with selections from different base entity descriptors.
28 *
29 * @author Dennis Zikovic
30 * @author Niklas Norberg
31 * @version 1.00
32 *
33 *//*
34 *
35 * WHEN WHO WHY & WHAT
36 * -----------------------------------------------------------------------------
37 * 2003-09-29 Dennis Zikovic Creation
38 * 2003-11-30 Niklas Norberg added method: public boolean getRequired();
39 * 2004-06-01 Niklas Norberg added method setDefaultQualifier()
40 * 2004-07-09 Niklas Norberg "Frozen".
41 */
42 public interface ICompositeEntityDescriptor extends IEntityDescriptor
43 {
44
45
46 /*** Returns the root field group that is used as the base for the tree of
47 * field groups that defines the called ICompositeEntityDescriptor.
48 */
49 public ICompositeFieldGroup getRootFieldGroup();
50
51 /*** This method sets the default qualifer for this composite entity
52 * descriptor. The default value is null i.e. don't discard any of the
53 * entities.
54 *
55 * It's maybe not nice to have a set method in an interface but it's the
56 * solution for now. A better way would be to set the default qualifier in
57 * the implementing class constructor, this however means a lot of work
58 * to transform and validate and the choices of parameters are not obvious
59 * either!
60 *
61 * @param defaultQualifier the qualifer that directly qualifies this
62 * composite entity descriptor should be validated.
63 */
64 public void setDefaultQualifier(Qualifier defaultQualifier);
65
66 /*** Returns a qualifier that defineas the default filter for this entity.
67 * Setting is done with a set method. The default value is null i.e. don't
68 * discard any of the entities.
69 * It might make sence e.g. to filter out all orders older than a
70 * discontinued date.
71 */
72 public Qualifier getDefaultQualifier();
73
74
75
76
77 /*** The ICompositeFieldDescriptor wraps another field descriptor and in
78 * many ways acts as a proxy for it. It can be used to alter properties
79 * such as code and display names.
80 */
81 public interface ICompositeFieldDescriptor extends IFieldDescriptor
82 {
83 /*** Access method to the wrapped/remote field descriptor.
84 // */
85
86
87 /*** Access method to the source field descriptor. This corresponds to
88 // * looping through all remotes to the first non composite field.
89 // */
90
91
92 /*** Access method to the source field descriptor.
93 */
94 public IFieldDescriptor getSourceFieldDescriptor();
95
96 /*** @return The ICompositeFieldGroup this composite field descriptor
97 * belongs to.
98 */
99 public ICompositeFieldGroup getFieldGroup();
100 }
101
102 /*** The IFieldGroup is used to group sets of fields belonging to a single
103 * entitydescriptor together and to define their relation to each other
104 * within the composite entity descriptor. Note that several field groups
105 * may have the same entity descriptor but represent different records in
106 * the data space.
107 */
108 public interface ICompositeFieldGroup
109 {
110 /*** @return the entity descriptor of the field group. All fields must
111 * belong to that entity descriptor. A composite entity may however
112 * have several fieldgroups with the same entity descriptor, but all
113 * must have unique entity identity strings.
114 */
115 public IBaseEntityDescriptor getBaseEntityDescriptor();
116
117 /*** @return the named identity of the called field groups entity
118 * descriptor. This will normally be the code name of the entity
119 * descriptor unless multiple instances of the descriptor exists.
120 * It is used as alias in sql-select-questions.
121 */
122 public String getEntityIdentity();
123
124 /*** @return the relation path that goes <em>from</em> the parent field
125 * group to this child field group. */
126 public IEntityRelationPath getParentRelationPath();
127
128 /*** @return the number of field descriptors that the called field group
129 * contains. This includes both data and calculated field descriptors.
130 */
131 public int getFieldCount();
132
133 /*** @return a specific field descriptor from the the called field group
134 * by its ordial index. May cast OutOfBoundException.
135 */
136 public ICompositeFieldDescriptor getFieldDescriptor(int index);
137
138 /*** @return the number of field groups that the called field group
139 * contains. This includes both data and calculated field descriptors.
140 */
141 public int getChildFieldGroupCount();
142
143 /*** @return a specific field group from the the called field group
144 * by its ordial index. May cast OutOfBoundException.
145 */
146 public ICompositeFieldGroup getChildFieldGroup(int index);
147
148 /*** @return an iterator (deapfirst-order) that iterates over all field
149 * group's that has this field group as root. The order should be
150 * deapfirst i.e. a field group tree with selected fields from base
151 * entity descriptors should be iterated in a way that corresponds
152 * with the order one expects in a SQL-select command.
153 */
154 public java.util.Iterator getFieldGroups();
155
156 /*** @return a boolean that determine if this field group's fields should
157 * be required in joins or not (joins according to SQL92).</br>
158 *
159 * true: Inner join.</br>
160 * false: Outer join, null-value might be displayed.</br>
161 * </br>
162 * If two groups are related in a parent-child relation the parent is
163 * seen as the LEFT and the children as the RIGHT (table).
164 * A parent and a child can thus have one of the following four
165 * combination resulting in a belonging SQL join-clause:</br>
166 *
167 * parent.getRequired()==true & child.getRequired()==true
168 * -> inner join</br>
169 *
170 * parent.getRequired()==true & child.getRequired()==false
171 * -> right outer join</br>
172 *
173 * parent.getRequired()==false & child.getRequired()==true
174 * -> left outer join</br>
175 *
176 * parent.getRequired()==false & child.getRequired()==false
177 * -> full outer join</br>
178 * </br>
179 * OBS:</br>
180 * Field Group siblings relation doesn't affect the join-clause.
181 * The default value should be false resulting in full outer joins
182 * between field groups and it's children.
183 */
184 public boolean getRequired();
185
186 }
187 }