org.mmbase.bridge.mock
Class MockNode

java.lang.Object
  extended by org.mmbase.bridge.util.AbstractNode
      extended by org.mmbase.bridge.util.MapNode<Object>
          extended by org.mmbase.bridge.mock.MockNode
All Implemented Interfaces:
Serializable, Comparable<Node>, Node
Direct Known Subclasses:
MockRelation

public class MockNode
extends MapNode<Object>
implements Node

MockNodes belong to a MockCloud. They represent data in memory of a MockCloudContext. An even simpler Node mocker is MapNode. This one is a bit more sophisticated because it does actually implement methods commit() and isNew too.

Since:
MMBase-1.9.2
Version:
$Id: MockNode.java 42554 2010-06-15 09:15:18Z michiel $
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
protected  MockCloud cloud
           
 
Fields inherited from class org.mmbase.bridge.util.MapNode
nodeManager, originals, sizes, values, wrapper
 
Fields inherited from interface org.mmbase.bridge.Node
CLOUD_COMMITNODE_KEY
 
Constructor Summary
MockNode(MockCloudContext.NodeDescription nodeDescription, MockCloud cloud, boolean isNew)
           
 
Method Summary
 void commit()
          Commit the node to the database.
 void createAlias(String aliasName)
          Create an alias for this node.
 void delete(boolean deleteRelations)
          Removes the Node.
 void deleteAlias(String aliasName)
          Delete an alias for this node.
 StringList getAliases()
          Returns all aliases for this node.
 String getContext()
          Get the security context of the current Node
 StringList getPossibleContexts()
          Contacts the security implementation to find out to which other possible contexts the context of this node may be set.
 Object getValueWithoutProcess(String fieldName)
          Like getObjectValue, but skips any processing that MMBase would normally perform on a field.
 boolean isNew()
          Whether this Node is new (not yet committed).
 void setContext(String c)
          Sets the security context of this Node (AKA the 'owner' field)
 String toString()
          Converts the node to a string
 
Methods inherited from class org.mmbase.bridge.util.MapNode
cancel, countRelatedNodes, countRelatedNodes, createRelation, createVirtualNodeManager, deleteRelations, edit, getCloud, getNodeManager, getNumber, getRelatedNodes, getRelations, getRelations, getSize, hasRelations, isChanged, isChanged, isNull, mayChangeContext, mayWrite, setNodeManager, setSize, setValueWithoutChecks, setValueWithoutProcess
 
Methods inherited from class org.mmbase.bridge.util.AbstractNode
checkWrite, compareTo, countRelations, countRelations, createFunctionValue, createParameters, delete, deleteRelations, equals, getBooleanValue, getByteValue, getChanged, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctionMap, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeFunction, getNodeValue, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hashCode, isNodeManager, isRelation, isRelationManager, mayDelete, processNull, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setXMLValue, toNodeManager, 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, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createParameters, createRelation, delete, deleteRelations, deleteRelations, getBooleanValue, getByteValue, getChanged, getCloud, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeManager, getNodeValue, getNumber, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getRelations, getRelations, getSize, getStringValue, getValue, getXMLValue, getXMLValue, hasRelations, isChanged, isChanged, isNodeManager, isNull, isRelation, isRelationManager, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toNodeManager, toRelation, toRelationManager, validate
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

cloud

protected final MockCloud cloud
Constructor Detail

MockNode

MockNode(MockCloudContext.NodeDescription nodeDescription,
         MockCloud cloud,
         boolean isNew)
Method Detail

commit

public void commit()
Description copied from interface: Node
Commit the node to the database. Prior to committing, the values are processed by any commit-processors associated with the datatype of the node's fields), then validated. Makes this node and/or the changes made to this node visible to the cloud. If this method is called for the first time on this node it will make this node visible to the cloud, otherwise the modifications made to this node using the set methods will be made visible to the cloud. This action fails if the current node is not in edit mode. If the node is in a transaction, nothing happens - actual committing occurs through the transaction.

Specified by:
commit in interface Node
Overrides:
commit in class MapNode<Object>

getValueWithoutProcess

public Object getValueWithoutProcess(String fieldName)
Description copied from interface: Node
Like getObjectValue, but skips any processing that MMBase would normally perform on a field. You can use this to get data from a field for validation purposes.

Specified by:
getValueWithoutProcess in interface Node
Overrides:
getValueWithoutProcess in class MapNode<Object>
Parameters:
fieldName - name of field
Returns:
value without processing

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,

getPossibleContexts

public StringList getPossibleContexts()
Description copied from interface: Node
Contacts the security implementation to find out to which other possible contexts the context of this node may be set.

Specified by:
getPossibleContexts in interface Node
Overrides:
getPossibleContexts in class AbstractNode
Returns:
A StringList containing the contexts which can be used in setContext on this node.

isNew

public boolean isNew()
Description copied from interface: Node
Whether this Node is new (not yet committed).

Specified by:
isNew in interface Node
Overrides:
isNew in class MapNode<Object>
Returns:
true when new

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

getAliases

public StringList getAliases()
Description copied from interface: Node
Returns all aliases for this node.

Specified by:
getAliases in interface Node
Overrides:
getAliases in class MapNode<Object>
Returns:
a list of alias names for this node

createAlias

public void createAlias(String aliasName)
Description copied from interface: Node
Create an alias for this node. An alias can be used to refer to a node in addition to his number.

Specified by:
createAlias in interface Node
Overrides:
createAlias in class AbstractNode
Parameters:
aliasName - the alias to be created for this node

deleteAlias

public void deleteAlias(String aliasName)
Description copied from interface: Node
Delete an alias for this node.

Specified by:
deleteAlias in interface Node
Overrides:
deleteAlias in class AbstractNode
Parameters:
aliasName - the alias to be removed for this node

delete

public void delete(boolean deleteRelations)
Description copied from interface: Node
Removes the Node.

Specified by:
delete in interface Node
Overrides:
delete in class MapNode<Object>
Parameters:
deleteRelations - a boolean. If true, then first all existing relations with this node will be removed.


MMBase 2.0-SNAPSHOT - null