org.mmbase.bridge.mock
Class MockNodeManager

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

public class MockNodeManager
extends AbstractNodeManager

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

Since:
MMBase-1.9.2
Version:
$Id: MockNodeManager.java 42555 2010-06-15 09:15:44Z michiel $
Author:
Michiel Meeuwissen

Nested Class Summary
protected  class MockNodeManager.SystemField
           
 
Field Summary
protected  String context
           
protected  List<Function<?>> functions
           
protected  Map<String,Field> map
           
protected  String name
           
protected  int oType
           
protected  String parent
           
protected  MockCloud vcloud
           
 
Fields inherited from class org.mmbase.bridge.util.AbstractNodeManager
cloud, values
 
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
MockNodeManager(MockCloud cloud, NodeManagerDescription desc)
           
 
Method Summary
 Node createNode()
          Creates a new node.
 String getContext()
          Get the security context of the current Node
protected  Map<String,Field> getFieldTypes()
           
 Collection<Function<?>> getFunctions()
          This default implementation is based on Node.getNodeManager().Node.getFunctions().
 String getName()
          Returns the name of this node manager.
 NodeManager getParent()
          Retrieve the parent of this NodeManager (the Nodemanager that this nodemanager extends from)
 Map<String,String> getProperties()
          Retrieve a copy of the node manager's properties
 boolean mayCreateNode()
          Check if the current user may create a new node of this type.
 void setContext(String c)
          Sets the security context of this Node (AKA the 'owner' field)
protected  void setDefaultsWithCloud(Node node)
           
 String toString()
          Converts the node to a string
 
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.Node
cancel, commit, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createParameters, createRelation, delete, delete, deleteAlias, deleteRelations, deleteRelations, getAliases, getBooleanValue, getByteValue, getChanged, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeValue, getNumber, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hasRelations, isChanged, isChanged, isNew, isNull, isRelation, isRelationManager, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toRelation, toRelationManager, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

map

protected final Map<String,Field> map

name

protected final String name

parent

protected final String parent

vcloud

protected final MockCloud vcloud

oType

protected final int oType

functions

protected final List<Function<?>> functions

context

protected String context
Constructor Detail

MockNodeManager

public MockNodeManager(MockCloud cloud,
                       NodeManagerDescription desc)
Method Detail

getName

public String getName()
Description copied from interface: NodeManager
Returns the name of this node manager. This name is a unique name.

Specified by:
getName in interface NodeManager
Overrides:
getName in class AbstractNodeManager
Returns:
the name of this node manager.

setDefaultsWithCloud

protected void setDefaultsWithCloud(Node node)

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 AbstractNodeManager
Returns:
the new Node

getProperties

public Map<String,String> getProperties()
Description copied from interface: NodeManager
Retrieve a copy of the node manager's properties

Specified by:
getProperties in interface NodeManager
Overrides:
getProperties in class AbstractNodeManager
Returns:
a map of node manager properties

getFieldTypes

protected Map<String,Field> getFieldTypes()
Specified by:
getFieldTypes in class AbstractNodeManager

getParent

public NodeManager getParent()
                      throws NotFoundException
Description copied from interface: NodeManager
Retrieve the parent of this NodeManager (the Nodemanager that this nodemanager extends from)

Specified by:
getParent in interface NodeManager
Overrides:
getParent in class AbstractNodeManager
Returns:
the NodeManager's parent
Throws:
NotFoundException - if no parent exists (i.e. this nodeManager is "object")

getFunctions

public Collection<Function<?>> getFunctions()
Description copied from class: AbstractNode
This default implementation is based on Node.getNodeManager().Node.getFunctions().

Specified by:
getFunctions in interface Node
Overrides:
getFunctions in class AbstractNodeManager
Returns:
a Collection of Function objects.

getContext

public String getContext()
Description copied from interface: Node
Get the security context of the current Node

Specified by:
getContext in interface Node
Overrides:
getContext in class AbstractNode
Returns:
the current context of the node (as a String)

setContext

public void setContext(String c)
Description copied from interface: Node
Sets the security context of this Node (AKA the 'owner' field)

Specified by:
setContext in interface Node
Overrides:
setContext in class AbstractNode
Parameters:
c - The security context to which this node should belong,

mayCreateNode

public boolean mayCreateNode()
Description copied from interface: NodeManager
Check if the current user may create a new node of this type.

Specified by:
mayCreateNode in interface NodeManager
Overrides:
mayCreateNode in class AbstractNodeManager
Returns:
Check if the current user may create a new node of this type.

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 AbstractNodeManager
Returns:
string representation of a node


MMBase 2.0-SNAPSHOT - null