org.mmbase.bridge.implementation
Class BasicRelationManager

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractNode
      extended by org.mmbase.bridge.implementation.BasicNode
          extended by org.mmbase.bridge.implementation.BasicNodeManager
              extended by org.mmbase.bridge.implementation.BasicRelationManager
All Implemented Interfaces:
Comparable<Node>, Node, NodeManager, RelationManager, SizeMeasurable

public class BasicRelationManager
extends BasicNodeManager
implements RelationManager

Version:
$Id: BasicRelationManager.java 40572 2010-01-14 15:27:41Z michiel $
Author:
Rob Vermeulen, Pierre van Rooden
Javadoc:

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mmbase.bridge.implementation.BasicNodeManager
BasicNodeManager.NodeAndId
 
Field Summary
(package private)  MMObjectNode relDefNode
           
 
Fields inherited from class org.mmbase.bridge.implementation.BasicNodeManager
builder, fieldTypes
 
Fields inherited from class org.mmbase.bridge.implementation.BasicNode
cloud, nodeManager, noderef, originalNoderef, temporaryNodeId
 
Fields inherited from interface org.mmbase.bridge.RelationManager
BIDIRECTIONAL, UNIDIRECTIONAL
 
Fields inherited from interface org.mmbase.bridge.NodeManager
GUI_PLURAL, GUI_SINGULAR, ORDER_CREATE, ORDER_EDIT, ORDER_LIST, ORDER_NONE, ORDER_SEARCH
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
BasicRelationManager(MMObjectNode node, BasicCloud cloud)
          Creates a new instance of Relation manager.
BasicRelationManager(MMObjectNode node, BasicCloud cloud, int nodeId)
          Creates a new Relation manager (for insert).
 
Method Summary
protected  BasicNode createBasicNode()
          BasicNodeManager is garantueed to return BasicNode's.
protected  BasicRelation createBasicRelation()
          BasicRelationManager is garantueed to create BasicRelations.
 Relation createRelation(Node sourceNode, Node destinationNode)
          Adds a relation from this type.
(package private)  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).
 String getForwardGUIName()
          Retrieves the gui name (prompt) of the role from source to destination
 String getForwardRole()
          Retrieves the role of the source to the destination
 String getReciprocalGUIName()
          Retrieves the gui name (prompt) of the role from destination to source
 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 fills temporary variables to maintain status.
 boolean isRelationManager()
          Determine whether this Node is a RelationManager.
 boolean mayCreateRelation(Node sourceNode, Node destinationNode)
          Check if the current user may create a new relation of this type between the specified nodes.
protected  void setNodeManager(MMObjectNode node)
          Set nodemanager for node
 RelationManager toRelationManager()
          Returns this as a RelationManager.
 String toString()
          Converts the node to a string
 
Methods inherited from class org.mmbase.bridge.implementation.BasicNodeManager
commit, createFieldList, createMMObjectNode, createNode, createNodeList, createQuery, createRelationList, delete, finalize, getAllowedRelations, getAllowedRelations, getAllowedRelations, getDescendants, getDescription, getDescription, getField, getFields, getFields, getFieldTypes, getFunctions, getGUIName, getGUIName, getGUIName, getInfo, getInfo, getList, getList, getList, getList, getMMObjectBuilder, getName, getNodeFunction, getParent, getProperties, getProperty, hasField, isNodeManager, mayCreateNode, setDefaultsWithCloud, sync, toNodeManager
 
Methods inherited from class org.mmbase.bridge.implementation.BasicNode
cancel, checkAccount, checkCommit, checkCreate, checkDelete, checkWrite, countRelatedNodes, countRelatedNodes, createAlias, createFunctionValue, createParameters, deleteAlias, deleteRelations, getAliases, getBooleanValue, getByteSize, getByteSize, getByteValue, getChanged, getCloud, getContext, getDateValue, getDoubleValue, getFloatValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNode, getNodeManager, getNodeValue, getNumber, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getSize, getStringValue, getValueWithoutProcess, getXMLValue, hasRelations, init, invalidateNode, isChanged, isChanged, isNew, isNull, mayChangeContext, mayDelete, mayWrite, setContext, setNode, setNodeManager, setSize, setValueWithoutChecks, toNodeNumber
 
Methods inherited from class org.mmbase.bridge.util.AbstractNode
compareTo, countRelations, countRelations, createRelation, delete, deleteRelations, equals, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionMap, getFunctionValue, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getValue, getXMLValue, hashCode, isRelation, processNull, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toRelation, validate
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.RelationManager
createRelation
 
Methods inherited from interface org.mmbase.bridge.NodeManager
createFieldList, createNode, createNodeList, createQuery, createRelationList, getAllowedRelations, getAllowedRelations, getAllowedRelations, getCloud, getDescendants, getDescription, getDescription, getField, getFields, getFields, getGUIName, getGUIName, getGUIName, getInfo, getInfo, getList, getList, getList, getList, getName, getParent, getProperties, getProperty, hasField, mayCreateNode
 
Methods inherited from interface org.mmbase.bridge.Node
cancel, commit, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createParameters, delete, delete, deleteAlias, deleteRelations, deleteRelations, getAliases, getBooleanValue, getByteValue, getChanged, getContext, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeManager, getNodeValue, getNumber, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getSize, getStringValue, getValue, getValueWithoutProcess, getXMLValue, getXMLValue, hasRelations, isChanged, isChanged, isNew, isNodeManager, isNull, isRelation, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeManager, toRelation, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

relDefNode

MMObjectNode relDefNode
Constructor Detail

BasicRelationManager

BasicRelationManager(MMObjectNode node,
                     BasicCloud cloud,
                     int nodeId)
Creates a new Relation manager (for insert). The type of manager (a strictly constrained manager or a role manager) is dependend on the type of the passed node (from either the reldef of typerel builder).

Parameters:
node - the node on which to base the relation manager
cloud - the cloud for which to create the manager
id - the id of the node in the temporary cloud

BasicRelationManager

BasicRelationManager(MMObjectNode node,
                     BasicCloud cloud)
Creates a new instance of Relation manager. The type of manager (a strictly constrained manager or a role manager) is dependend on the type of the passed node (from either the reldef of typerel builder).

Parameters:
node - the node on which to base the relation manager
cloud - the cloud for which to create the manager
Method Detail

isRelationManager

public final boolean isRelationManager()
Description copied from interface: Node
Determine whether this Node is a RelationManager.

Specified by:
isRelationManager in interface Node
Overrides:
isRelationManager in class AbstractNode
Returns:
true if this Node is a RelationManager.

toRelationManager

public final RelationManager toRelationManager()
Description copied from interface: Node
Returns this as a RelationManager.

Specified by:
toRelationManager in interface Node
Overrides:
toRelationManager in class AbstractNode
Returns:
a NodeManager object

initManager

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

Overrides:
initManager in class BasicNodeManager

setNodeManager

protected void setNodeManager(MMObjectNode node)
Description copied from class: BasicNode
Set nodemanager for node

Overrides:
setNodeManager in class BasicNodeManager
Parameters:
node - node to derive nodemanager from.

getForwardRole

public String getForwardRole()
Description copied from interface: RelationManager
Retrieves the role of the source to the destination

Specified by:
getForwardRole in interface RelationManager
Returns:
the role as a String

getReciprocalRole

public String getReciprocalRole()
Description copied from interface: RelationManager
Retrieves the role of the destination to the source

Specified by:
getReciprocalRole in interface RelationManager
Returns:
the role as a String

getForwardGUIName

public 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
Returns:
the name as a String

getReciprocalGUIName

public 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
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
Returns:
one of the directionality constants

getBuilder

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
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
Returns:
the destination NodeManager

createBasicNode

protected final BasicNode createBasicNode()
Description copied from class: BasicNodeManager
BasicNodeManager is garantueed to return BasicNode's. So extendsion must override this, and not BasicNodeManager.createNode()

Overrides:
createBasicNode in class BasicNodeManager

createBasicRelation

protected BasicRelation createBasicRelation()
BasicRelationManager is garantueed to create BasicRelations. Extension therefore most override this and not createBasicNode().

Since:
MMBase-1.8

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
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. This method returns all relations of a certain node not considering role, source manager and destination manager, but only the builder of relation (e.g. it queries either insrel, or an extension thereof). See Node.getRelations(String, NodeManager, String).

Specified by:
getRelations in interface 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
Parameters:
sourceNode - source node of the relation
destinationNode - destination node of the relation
Returns:
Check if the current user may create a new relation of this type between the specified nodes.

toString

public String toString()
Description copied from interface: Node
Converts the node to a string

Specified by:
toString in interface Node
Overrides:
toString in class BasicNode
Returns:
string representation of a node


MMBase 2.0-SNAPSHOT - null