org.mmbase.bridge.implementation
Class BasicRelationManager

java.lang.Object
  |
  +--org.mmbase.bridge.implementation.BasicNode
        |
        +--org.mmbase.bridge.implementation.BasicNodeManager
              |
              +--org.mmbase.bridge.implementation.BasicRelationManager
All Implemented Interfaces:
java.lang.Comparable, Node, NodeManager, RelationManager, SizeMeasurable

public class BasicRelationManager
extends BasicNodeManager
implements RelationManager

Version:
$Id: BasicRelationManager.java,v 1.19.2.2 2003/04/08 14:32:23 pierre Exp $
Author:
Rob Vermeulen, Pierre van Rooden

Field Summary
 MMObjectNode relDefNode
           
 
Fields inherited from class org.mmbase.bridge.implementation.BasicNodeManager
builder, fieldTypes
 
Fields inherited from class org.mmbase.bridge.implementation.BasicNode
account, ACTION_COMMIT, ACTION_CREATE, ACTION_DELETE, ACTION_EDIT, cloud, isnew, mmb, nodeManager, noderef, temporaryNodeId
 
Fields inherited from interface org.mmbase.bridge.RelationManager
BIDIRECTIONAL, UNIDIRECTIONAL
 
Fields inherited from interface org.mmbase.bridge.NodeManager
ORDER_CREATE, ORDER_EDIT, ORDER_LIST, ORDER_NONE, ORDER_SEARCH
 
Method Summary
 Node createNode()
          Creates a new node.
 Relation createRelation(Node sourceNode, Node destinationNode)
          Adds a relation from this type.
 Relation createRelation(Node sourceNode, RelationManager relationManager)
          This method from Node is redeclared here to prevent an ambiguous invocation of method.
 int getBuilder()
           
 NodeManager getDestinationManager()
          Retrieves the type of node that can act as the destination of a relation of this type.
 int getDirectionality()
          Retrieves the directionality for this type (the default assigned to a new relation).
 java.lang.String getForwardGUIName()
          Retrieves the gui name (prompt) of the role from source to destination
 java.lang.String getForwardRole()
          Retrieves the role of the source to the destination
 java.lang.String getReciprocalGUIName()
          Retrieves the gui name (prompt) of the role from destination to source
 java.lang.String getReciprocalRole()
          Retrieves the role of the destination to the source
 RelationList getRelations(Node node)
          Retrieves all the relations of this type from a given node.
 NodeManager getSourceManager()
          Retrieves the NodeManager of node that can act as the source of a relation of this type.
protected  void initManager()
          Initializes the NodeManager: determines the MMObjectBuilder from the passed node (reldef or typerel), and fillls temporary variables to maintain status.
 boolean mayCreateRelation(Node sourceNode, Node destinationNode)
          Check if the current user may create a new relation of this type between the specified nodes.
 
Methods inherited from class org.mmbase.bridge.implementation.BasicNodeManager
commit, delete, getAllowedRelations, getAllowedRelations, getAllowedRelations, getDescription, getField, getFields, getFields, getGUIName, getGUIName, getInfo, getInfo, getList, getList, getList, getName, getParent, hasField, mayCreateNode
 
Methods inherited from class org.mmbase.bridge.implementation.BasicNode
_setValue, cancel, compareTo, countRelatedNodes, countRelations, countRelations, createAlias, delete, deleteAlias, deleteRelations, deleteRelations, edit, equals, finalize, getAliases, getBooleanValue, getByteSize, getByteSize, getByteValue, getCloud, getContext, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunctionValue, getIntValue, getLongValue, getNode, getNodeManager, getNodeValue, getNumber, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hashCode, hasRelations, init, invalidateNode, isNodeManager, isRelation, isRelationManager, mayChangeContext, mayDelete, mayLink, mayWrite, setBooleanValue, setByteValue, setContext, setDoubleValue, setFloatValue, setIntValue, setLongValue, setNode, setNodeValue, setStringValue, setValue, setXMLValue, toNodeManager, toRelation, toRelationManager, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.NodeManager
getAllowedRelations, getAllowedRelations, getAllowedRelations, getCloud, getDescription, getField, getFields, getFields, getGUIName, getGUIName, getInfo, getInfo, getList, getList, getList, getName, getParent, hasField, mayCreateNode
 
Methods inherited from interface org.mmbase.bridge.Node
cancel, commit, countRelatedNodes, countRelations, countRelations, createAlias, delete, delete, deleteAlias, deleteRelations, deleteRelations, getAliases, getBooleanValue, getByteValue, getContext, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunctionValue, getIntValue, getLongValue, getNodeManager, getNodeValue, getNumber, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hasRelations, isNodeManager, isRelation, isRelationManager, mayChangeContext, mayDelete, mayLink, mayWrite, setBooleanValue, setByteValue, setContext, setDoubleValue, setFloatValue, setIntValue, setLongValue, setNodeValue, setStringValue, setValue, setXMLValue, toNodeManager, toRelation, toRelationManager, toString
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

relDefNode

public MMObjectNode relDefNode
Method Detail

initManager

protected void initManager()
Initializes the NodeManager: determines the MMObjectBuilder from the passed node (reldef or typerel), and fillls temporary variables to maintain status.
Overrides:
initManager in class BasicNodeManager

createNode

public Node createNode()
Description copied from interface: NodeManager
Creates a new node. The returned node will not be visible in the cloud until the commit() method is called on this node. Until then it will have a temporary node number.
Specified by:
createNode in interface NodeManager
Overrides:
createNode in class BasicNodeManager
Following copied from interface: org.mmbase.bridge.NodeManager
Returns:
the new Node

getForwardRole

public java.lang.String getForwardRole()
Description copied from interface: RelationManager
Retrieves the role of the source to the destination
Specified by:
getForwardRole in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the role as a String

getReciprocalRole

public java.lang.String getReciprocalRole()
Description copied from interface: RelationManager
Retrieves the role of the destination to the source
Specified by:
getReciprocalRole in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the role as a String

getForwardGUIName

public java.lang.String getForwardGUIName()
Description copied from interface: RelationManager
Retrieves the gui name (prompt) of the role from source to destination
Specified by:
getForwardGUIName in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the name as a String

getReciprocalGUIName

public java.lang.String getReciprocalGUIName()
Description copied from interface: RelationManager
Retrieves the gui name (prompt) of the role from destination to source
Specified by:
getReciprocalGUIName in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the name as a String

getDirectionality

public int getDirectionality()
Description copied from interface: RelationManager
Retrieves the directionality for this type (the default assigned to a new relation).
Specified by:
getDirectionality in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
one of the directionality constants

getBuilder

public int getBuilder()

getSourceManager

public NodeManager getSourceManager()
Description copied from interface: RelationManager
Retrieves the NodeManager of node that can act as the source of a relation of this type.
Specified by:
getSourceManager in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the source NodeManager

getDestinationManager

public NodeManager getDestinationManager()
Description copied from interface: RelationManager
Retrieves the type of node that can act as the destination of a relation of this type.
Specified by:
getDestinationManager in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
the destination NodeManager

createRelation

public Relation createRelation(Node sourceNode,
                               RelationManager relationManager)
Description copied from interface: RelationManager
This method from Node is redeclared here to prevent an ambiguous invocation of method. reson: the the method in the base class (Node) is more specific than the one in the RelationManager (RelationManager extends Node).
Specified by:
createRelation in interface RelationManager
Overrides:
createRelation in class BasicNode
Following copied from interface: org.mmbase.bridge.Node
Parameters:
destinationNode - the node to which you want to relate this node
relationManager - the relation manager you want to use
Returns:
the added relation
Throws:
BridgeException - if the relation manager is not the right one for this type of relation

createRelation

public Relation createRelation(Node sourceNode,
                               Node destinationNode)
Description copied from interface: RelationManager
Adds a relation from this type.
Specified by:
createRelation in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Parameters:
sourceNode - the node from which you want to relate
destinationNode - the node to which you want to relate
Returns:
the added relation

getRelations

public RelationList getRelations(Node node)
Description copied from interface: RelationManager
Retrieves all the relations of this type from a given node.
Specified by:
getRelations in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Parameters:
node - the node from which to give the relations
Returns:
a list of relations

mayCreateRelation

public boolean mayCreateRelation(Node sourceNode,
                                 Node destinationNode)
Description copied from interface: RelationManager
Check if the current user may create a new relation of this type between the specified nodes.
Specified by:
mayCreateRelation in interface RelationManager
Following copied from interface: org.mmbase.bridge.RelationManager
Returns:
Check if the current user may create a new relation of this type between the specified nodes.


MMBase build 1.6.5.20030923