View Javadoc

1   /* (c) Copyright 2003 Caleigo AB, All rights reserved. 
2    * 
3    * This library is free software; you can redistribute it and/or
4    * modify it under the terms of the GNU Lesser General Public
5    * License as published by the Free Software Foundation; either
6    * version 2.1 of the License, or (at your option) any later version.
7    * 
8    * This library is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   * Lesser General Public License for more details.
12   * 
13   * You should have received a copy of the GNU Lesser General Public
14   * License along with this library; if not, write to the Free Software
15   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   *  
17   */
18  
19  package org.caleigo.core;
20  
21  /*** The IEntityRelation interface defines a link between two different entity 
22   * descriptors. An IEntityRelation does allways consist of one or more
23   * IFieldRelation objects. The relation objects does combined with the 
24   * descriptor objects form a traversable graph.
25   *
26   * @author  Dennis Zikovic
27   * @version 1.00
28   *
29   *//* 
30   *
31   * WHEN        WHO               WHY & WHAT
32   * -----------------------------------------------------------------------------
33   * 2001-11-13  Dennis Zikovic    Creation
34   */
35  public interface IEntityRelation extends java.io.Serializable
36  {
37      // Access Methods ----------------------------------------------------------
38      
39      /*** Access method that returns the number of IFieldRelation:s that defines 
40       * the entity relation. 
41       */ 
42      public int getFieldCount();
43      
44      /*** Access method that returns the indexed contained IFieldRelation.
45       */
46      public IFieldRelation getFieldRelation(int index);
47      
48      /*** Access method that returns an iterator for all contained 
49       * IFieldRelation objects.
50       */
51      public java.util.Iterator getFieldRelations();
52      
53      /*** Access method that returns the referenced IEntityDescriptor.
54       */
55      public IEntityDescriptor getReferenceEntityDescriptor();
56      
57      /*** Access method that returns an iterator containing all the 
58       * IFieldDescriptors from the reference/source descriptor.
59       */
60      public java.util.Iterator getReferenceFieldDescriptors();
61      
62      /*** Access method that returns the tageteted IEntityDescriptor.
63       */
64      public IEntityDescriptor getTargetEntityDescriptor();
65      
66      /*** Access method that returns an iterator containing all the 
67       * IFieldDescriptors from the targeted descriptor.
68       */
69      public java.util.Iterator getTargetFieldDescriptors();
70      
71      /*** Returns an identifying name that can be used to address the relation in
72       * client software.
73       */
74      public String getCodeName();
75          
76      /*** Returns a displayable name for the relation in the forward direction.
77       */
78      public String getForwardDisplayName();
79      
80      /*** Returns a displayable name for the relation in the reverse direction.
81       */
82      public String getReverseDisplayName();
83      
84      // Help Methods ------------------------------------------------------------
85      
86      /*** Help method that returns true if the provided entity descriptor is one 
87       * of the fysical node descriptors of the relation objects. Custom entities
88       * that contains the fields that are a part of the relation will not qualify
89       * by this method.
90       */
91      public boolean isRelationNode(IEntityDescriptor entityDescriptor);
92      
93      /*** Help method that returns true if the provided field descriptor exists
94       * as a part of one of the entity relations contained field relations.
95       */
96      public boolean isRelationField(IFieldDescriptor fieldDescriptor);
97      
98      /*** Returns true if the relation is required. Required relation does 
99       * allways for each entity instance of the reference node side in 
100      * the relation.
101      */
102     public boolean isRequired();
103     
104     /*** Boolean help method that returns true if the provided IEntityDescriptor
105      * can act as a reference object according to the relation object. Either
106      * fully or partially that is if the descriptor can adreess one ore more 
107      * of the targetet entity type.
108      */
109     public boolean canBeReference(IEntityDescriptor entityDescriptor);
110     
111     /*** Boolean help method that returns true if the provided IEntityDescriptor
112      * can act as a complete reference object according to the relation object. 
113      * Complete/full reference means that all the reference field descriptors 
114      * are satisfied and that a single entity instance of the targeted entity
115      * type can be addressed.
116      */
117     public boolean canBeFullReference(IEntityDescriptor entityDescriptor);
118     
119     /*** Boolean help method that returns true if the provided IEntityDescriptor
120      * can be a targeted entity type according to the relation object. 
121      */
122     public boolean canBeTarget(IEntityDescriptor entityDescriptor);
123     
124     /*** Help method that returns that returns "the other" entity descriptor
125      * that link together by the relation object. If the provided descriptor
126      * is not a node in the realtion then null is returned.
127      */
128     public IEntityDescriptor getRelatedEntityDescriptor(IEntityDescriptor entityDescriptor);
129     
130     /*** Returns a Qualifier that specifies the requirements to satisfy all
131      * field relations for the entity relation.
132      */
133     public Qualifier getRelationQualifier();
134 }
135