public class MapNode<V> extends AbstractNode implements Node, Serializable
Map. It can come in handy sometimes to be able to present any Map as an MMBase Node. E.g. because then it can be accessed in MMBase taglib using
mm:field tags. Don't confuse this with NodeMap.| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
implicitCreate |
protected NodeManager |
nodeManager
This is normally, but not always, a VirtualBuilder.
|
protected Map<String,V> |
originals |
protected Map<String,Long> |
sizes |
protected Map<String,V> |
values |
protected Map<String,V> |
wrapper |
CLOUD_COMMITNODE_KEY| Constructor and Description |
|---|
MapNode(Map<String,V> v)
This allows you to create a Node object even without having a Cloud object.
|
MapNode(Map<String,V> v,
Cloud cloud) |
MapNode(Map<String,V> v,
Cloud cloud,
boolean implicitCreate)
A node with a 'virtual' nodemanager will be constructed.
|
MapNode(Map<String,V> v,
NodeManager nm)
This constructor explicitely specifies the node manager of the Node.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel changes to a node
This fails if the current node is not in edit mode.
|
void |
commit()
Commit the node to the database.
|
int |
countRelatedNodes(NodeManager otherNodeManager,
String role,
String direction) |
int |
countRelatedNodes(String type)
Returns the number of related nodes that have a specific node manager.
|
Relation |
createRelation(Node destinationNode,
RelationManager relationManager)
Adds a relation between this node and a specified node to the cloud.
|
protected static NodeManager |
createVirtualNodeManager(Cloud cloud,
Map map,
boolean implicitCreate) |
void |
delete(boolean deleteRelations)
Removes the Node.
|
void |
deleteRelations(String type)
Removes all relation nodes with a certain relation manager that are
attached to this node.
|
protected void |
edit(int i) |
StringList |
getAliases()
Returns all aliases for this node.
|
Cloud |
getCloud()
Returns the cloud this node belongs to.
|
NodeManager |
getNodeManager()
Returns the node manager for this node.
|
int |
getNumber()
Returns the unique number for this node.
|
NodeList |
getRelatedNodes(NodeManager nodeManager,
String role,
String searchDir)
Returns all related nodes that have a specific node manager and role.
|
RelationList |
getRelations(String role,
NodeManager nodeManager,
String searchDir) |
RelationList |
getRelations(String role,
String nodeManager)
Returns all relation nodes attached to this node that have a specific
role, or refer a node from a specific nodemanager
|
long |
getSize(String fieldName)
Returns the 'size' (e.g.
|
Object |
getValueWithoutProcess(String fieldName)
Like getObjectValue, but skips any processing that MMBase would normally perform on a field.
|
boolean |
hasRelations()
Checks whether this node has any relations.
|
boolean |
isChanged()
Whether field values were changed since the last commit.
|
boolean |
isChanged(String fieldName)
Whether a certain field's value was changed since the last commit.
|
boolean |
isNew()
Whether this Node is new (not yet committed).
|
boolean |
isNull(String fieldName)
Whether the value for the specified field is
null. |
boolean |
mayChangeContext()
Check context-change rights on this node.
|
boolean |
mayWrite()
Check write rights on this node.
|
void |
setNodeManager(NodeManager nm)
Sets the node manager of this node.
|
protected void |
setSize(String fieldName,
long size) |
void |
setValueWithoutChecks(String fieldName,
Object value) |
void |
setValueWithoutProcess(String fieldName,
Object value)
Like setObjectValue, but without processing, this is called by the other set-values.
|
String |
toString()
Converts the node to a string
|
checkWrite, compareTo, countRelations, countRelations, createAlias, createFunctionValue, createParameters, delete, deleteAlias, deleteRelations, equals, getBooleanValue, getByteValue, getChanged, getContext, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctionMap, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeFunction, getNodeValue, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, hashCode, isNodeManager, isRelation, isRelationManager, mayDelete, processNull, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setXMLValue, toNodeManager, toNodeNumber, toRelation, toRelationManager, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitcountRelations, countRelations, createAlias, createParameters, delete, deleteAlias, deleteRelations, getBooleanValue, getByteValue, getChanged, getContext, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, getFunctions, getFunctionValue, getInputStreamValue, getIntValue, getListValue, getLongValue, getNodeValue, getObjectValue, getPossibleContexts, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getStringValue, getValue, getXMLValue, getXMLValue, isNodeManager, isRelation, isRelationManager, mayDelete, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setXMLValue, toNodeManager, toRelation, toRelationManager, validatecompareToprotected transient NodeManager nodeManager
boolean implicitCreate
public MapNode(Map<String,V> v, NodeManager nm)
public MapNode(Map<String,V> v, Cloud cloud, boolean implicitCreate)
protected static NodeManager createVirtualNodeManager(Cloud cloud, Map map, boolean implicitCreate)
public Cloud getCloud()
Nodepublic NodeManager getNodeManager()
NodegetNodeManager in interface Nodepublic int getNumber()
NodegetNumber in interface NodegetNumber in class AbstractNodeNode.createAlias(String alias)public boolean isNew()
NodeisNew in interface NodeisNew in class AbstractNodetrue when newpublic boolean isChanged(String fieldName)
NodeisChanged in interface NodeisChanged in class AbstractNodefieldName - the name of the fieldtrue when field's value was changedpublic boolean isChanged()
NodeisChanged in interface NodeisChanged in class AbstractNodetrue when changedprotected void edit(int i)
public Object getValueWithoutProcess(String fieldName)
NodegetValueWithoutProcess in interface NodefieldName - name of fieldpublic void setValueWithoutProcess(String fieldName, Object value)
AbstractNodesetValueWithoutProcess in interface NodesetValueWithoutProcess in class AbstractNodefieldName - name of fieldvalue - new value of the fieldpublic void setValueWithoutChecks(String fieldName, Object value)
setValueWithoutChecks in class AbstractNodepublic boolean isNull(String fieldName)
Nodenull. This avoids acquiring the
complete value if you only want to check if for emptiness.isNull in interface NodeisNull in class AbstractNodefieldName - the name of the fieldtrue when value is nullprotected void setSize(String fieldName, long size)
setSize in class AbstractNodepublic long getSize(String fieldName)
Nodepublic void commit()
Nodecommit in interface Nodecommit in class AbstractNodepublic void cancel()
Nodecancel in interface Nodecancel in class AbstractNodepublic void delete(boolean deleteRelations)
Nodedelete in interface Nodedelete in class AbstractNodedeleteRelations - a boolean. If true, then first all
existing relations with this node will be removed.public String toString()
Nodepublic void deleteRelations(String type) throws NotFoundException
NodedeleteRelations in interface NodedeleteRelations in class AbstractNodetype - the name of the relation manager the removed
relation nodes should haveNotFoundExceptionpublic RelationList getRelations(String role, NodeManager nodeManager, String searchDir) throws NotFoundException
getRelations in interface NodegetRelations in class AbstractNoderole - forward role of a relationnodeManager - node manager on the other side of the relationsearchDir - the direction of the relationNotFoundExceptionpublic RelationList getRelations(String role, String nodeManager) throws NotFoundException
NodegetRelations in interface NodegetRelations in class AbstractNoderole - the name of the role the returned
relation nodes should havenodeManager - the name of the nodemanager for the nodes the returned
relation nodes should have a relation toNotFoundExceptionpublic boolean hasRelations()
NodehasRelations in interface NodehasRelations in class AbstractNodetrue if the node has relationspublic int countRelatedNodes(NodeManager otherNodeManager, String role, String direction)
countRelatedNodes in interface NodecountRelatedNodes in class AbstractNodeotherNodeManager - the node manager the nodes should haverole - the role of the relationdirection - the direction of the relationpublic NodeList getRelatedNodes(NodeManager nodeManager, String role, String searchDir)
NodegetRelatedNodes in interface NodegetRelatedNodes in class AbstractNodenodeManager - the node manager the returned nodes should haverole - the role of the relationsearchDir - the direction of the relationpublic int countRelatedNodes(String type)
NodecountRelatedNodes in interface NodecountRelatedNodes in class AbstractNodetype - the name of the node manager the counted nodes
should havepublic StringList getAliases()
NodegetAliases in interface NodegetAliases in class AbstractNodepublic Relation createRelation(Node destinationNode, RelationManager relationManager)
NodecreateRelation in interface NodecreateRelation in class AbstractNodedestinationNode - the node to which you want to relate this noderelationManager - the relation manager you want to usepublic boolean mayWrite()
NodemayWrite in interface NodemayWrite in class AbstractNodepublic boolean mayChangeContext()
NodemayChangeContext in interface NodemayChangeContext in class AbstractNodepublic void setNodeManager(NodeManager nm)
NodesetNodeManager in interface NodesetNodeManager in class AbstractNodeMMBase 1.9-SNAPSHOT - ${javadoctimestamp}