KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > RelationManager


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge;
12
13 /**
14  * This interface represents a relation constraint (or contex, if you like).
15  * More specifically, it represents a relation manager (itself a node manager) as it applies between bnode belonging to
16  * two other node managers.
17  * Some of the information here is retrieved from the NodeManager used to build the catual relation node
18  * (the data as described in the xml builder config file). This NodeManager is also referred to as the parent.
19  * Other data is retrieved from a special (hidden) object that decsribes what relations apply between two nodes.
20  * (formerly known as the TypeRel builder).
21  * This includes direction and cardinality, and the NodeManagers of nodes itself. These fields cannot be changed
22  * except through the use of an administration module.
23  * This interface is therefor not a real mmbase 'object' in itself - it exists of two objects joined together.
24  *
25  * @author Rob Vermeulen
26  * @author Pierre van Rooden
27  * @version $Id: RelationManager.java,v 1.8 2004/10/09 09:39:32 nico Exp $
28  */

29 public interface RelationManager extends NodeManager {
30     /**
31      * Directionality constant : uni-directional
32      */

33     public final static int UNIDIRECTIONAL = 1;
34
35     /**
36      * Directionality constant : bi-directional
37      */

38     public final static int BIDIRECTIONAL = 2;
39
40     /**
41      * Retrieves the role of the source to the destination
42      * @return the role as a <code>String</code>
43      */

44     public String JavaDoc getForwardRole();
45
46     /**
47      * Retrieves the role of the destination to the source
48      * @return the role as a <code>String</code>
49      */

50     public String JavaDoc getReciprocalRole();
51
52     /**
53      * Retrieves the gui name (prompt) of the role from source to destination
54      * @return the name as a <code>String</code>
55      */

56     public String JavaDoc getForwardGUIName();
57
58     /**
59      * Retrieves the gui name (prompt) of the role from destination to source
60      * @return the name as a <code>String</code>
61      */

62     public String JavaDoc getReciprocalGUIName();
63
64     /**
65      * Retrieves the directionality for this type (the default assigned to a new relation).
66      * @return one of the directionality constants
67      */

68     public int getDirectionality();
69
70     /**
71      * Retrieves the NodeManager of node that can act as the source of a relation of this type.
72      * @return the source NodeManager
73      */

74     public NodeManager getSourceManager();
75
76     /**
77      * Retrieves the type of node that can act as the destination of a relation of this type.
78      * @return the destination NodeManager
79      */

80     public NodeManager getDestinationManager();
81
82     /**
83      * Adds a relation from this type.
84      * @param sourceNode the node from which you want to relate
85      * @param destinationNode the node to which you want to relate
86      * @return the added relation
87      */

88     public Relation createRelation(Node sourceNode, Node destinationNode);
89
90     /**
91      * This method from Node is redeclared here to prevent an ambiguous invocation of method.
92      * reson: the the method in the base class (Node) is more specific than the one in the RelationManager
93      * (RelationManager extends Node).
94      * @param sourceNode source node of the relation
95      * @param relationManager relation manager of the relation
96      * @return new Relation
97      **/

98     public Relation createRelation(Node sourceNode, RelationManager relationManager);
99
100     /**
101      * Retrieves all the relations of this type from a given node.
102      * @param node the node from which to give the relations
103      * @return a list of relations
104      */

105     public RelationList getRelations(Node node);
106
107     /**
108      * Check if the current user may create a new relation of this type between
109      * the specified nodes.
110      * @param sourceNode source node of the relation
111      * @param destinationNode destination node of the relation
112      *
113      * @return Check if the current user may create a new relation of this type
114      * between the specified nodes.
115      */

116     public boolean mayCreateRelation(Node sourceNode, Node destinationNode);
117
118 }
119
Popular Tags