org.mmbase.bridge.mock
Class MockRelationManager

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractNode
      extended by org.mmbase.bridge.util.AbstractNodeManager
          extended by org.mmbase.bridge.mock.MockNodeManager
              extended by org.mmbase.bridge.mock.MockRelationManager
All Implemented Interfaces:
Comparable<Node>, Node, NodeManager, RelationManager

public class MockRelationManager
extends MockNodeManager
implements RelationManager

Straight-forward implementation of NodeManager based on a Map with DataType's.

Since:
MMBase-2.0
Version:
$Id: MockRelationManager.java 42556 2010-06-15 09:17:05Z michiel $
Author:
Michiel Meeuwissen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.mmbase.bridge.mock.MockNodeManager
MockNodeManager.SystemField
 
Field Summary
protected  String destination
           
protected  String role
           
protected  String source
           
 
Fields inherited from class org.mmbase.bridge.mock.MockNodeManager
context, functions, map, name, oType, parent, vcloud
 
Fields inherited from class org.mmbase.bridge.util.AbstractNodeManager
cloud, values
 
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
MockRelationManager(MockCloud cloud, String r, String source, String destination)
           
 
Method Summary
 Relation createRelation(Node sourceNode, Node destinationNode)
          Adds a relation from this type.
 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.
 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.mock.MockNodeManager
createNode, getContext, getFieldTypes, getFunctions, getName, getParent, getProperties, mayCreateNode, setContext, setDefaultsWithCloud, toString
 
Methods inherited from class org.mmbase.bridge.util.AbstractNodeManager
createFieldList, createNodeList, createQuery, createRelationList, edit, getAllowedRelations, getAllowedRelations, getAllowedRelations, getCloud, getDescendants, getDescription, getDescription, getField, getFields, getFields, getGUIName, getGUIName, getGUIName, getInfo, getInfo, getList, getList, getList, getList, getNodeManager, getProperty, getSize, getValueWithoutProcess, hasField, isNodeManager, setNodeManager, setSize, setValueWithoutChecks, toNodeManager
 
Methods inherited from class org.mmbase.bridge.util.AbstractNode
cancel, checkWrite, commit, compareTo, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createFunctionValue, createParameters, createRelation, delete, delete, deleteAlias, deleteRelations, deleteRelations, equals, getAliases, getBooleanValue, getByteValue, getChanged, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctionMap, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeFunction, getNodeValue, getNumber, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hashCode, hasRelations, isChanged, isChanged, isNew, isNull, isRelation, isRelationManager, mayChangeContext, mayDelete, mayWrite, processNull, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeNumber, toRelation, toRelationManager, validate
 
Methods inherited from class java.lang.Object
clone, finalize, 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, isRelationManager, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeManager, toRelation, toRelationManager, toString, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

role

protected final String role

source

protected final String source

destination

protected final String destination
Constructor Detail

MockRelationManager

public MockRelationManager(MockCloud cloud,
                           String r,
                           String source,
                           String destination)
Method Detail

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

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

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.


MMBase 2.0-SNAPSHOT - null