public class BasicNodeManager extends BasicNode implements NodeManager
| Modifier and Type | Class and Description |
|---|---|
protected class |
BasicNodeManager.NodeAndId
Structure to temporary contain an MMObjectNode and a
BasicCloud.uniqueId() |
| Modifier and Type | Field and Description |
|---|---|
protected MMObjectBuilder |
builder |
protected Map<String,Field> |
fieldTypes |
cloud, nodeManager, noderef, originalNoderef, temporaryNodeIdGUI_PLURAL, GUI_SINGULAR, ORDER_CREATE, ORDER_EDIT, ORDER_LIST, ORDER_NONE, ORDER_SEARCHCLOUD_COMMITNODE_KEY| Constructor and Description |
|---|
BasicNodeManager(MMObjectBuilder builder,
BasicCloud cloud)
Instantiates a NodeManager based on a builder.
|
BasicNodeManager(MMObjectNode node,
BasicCloud cloud)
Instantiates a NodeManager based on a node which either represents or references a builder.
|
BasicNodeManager(MMObjectNode node,
BasicCloud cloud,
int nodeid)
Instantiates a new NodeManager (for insert) based on a newly created node which either represents or references a builder.
|
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
Commit the node to the database.
|
protected BasicNode |
createBasicNode()
BasicNodeManager is garantueed to return BasicNode's.
|
FieldList |
createFieldList()
Returns a new, empty field list for this nodemanager
|
protected BasicNodeManager.NodeAndId |
createMMObjectNode()
Creates new MMObjectNode for the current node manager.
|
Node |
createNode()
Creates a new node.
|
NodeList |
createNodeList()
Returns a new, empty node list for this nodemanager
|
NodeQuery |
createQuery()
Creates a query for this NodeNanager.
|
RelationList |
createRelationList()
Returns a new, empty relation list for this nodemanager
|
void |
delete(boolean deleteRelations)
Removes the Node.
|
protected void |
finalize()
Reverse the buffers, when changed and not stored...
|
RelationManagerList |
getAllowedRelations()
Retrieve all relation managers that can be used to create relations for objects of this nodemanager.
|
RelationManagerList |
getAllowedRelations(NodeManager nodeManager,
String role,
String direction)
Retrieve all relation managers that can be used to create relations for objects from this nodemanager,
to the specified manager, using the specified role and direction.
|
RelationManagerList |
getAllowedRelations(String nodeManager,
String role,
String direction)
Retrieve all relation managers that can be used to create relations for objects from this nodemanager,
to the specified manager, using the specified role and direction.
|
NodeManagerList |
getDescendants()
Retrieve a list of descendant nodemanagers (the nodemanagers that - possibly indirectly - extend from this nodemanager)
|
String |
getDescription()
Returns the description of this node manager.
|
String |
getDescription(Locale locale)
Returns the description of this node manager in a specified language.
|
Field |
getField(String fieldName)
Returns the field with the specified name.
|
FieldList |
getFields()
Returns a list of all fields defined for this node manager.
|
FieldList |
getFields(int order)
Retrieve a subset of field types of this NodeManager, depending on a given order.
|
protected Map<String,Field> |
getFieldTypes()
Returns the fieldlist of this nodemanager after making sure the manager is synced with the builder.
|
Collection<Function<?>> |
getFunctions()
This default implementation is based on
Node.getNodeManager().Node.getFunctions(). |
String |
getGUIName()
Returns the descriptive name of this node manager.
|
String |
getGUIName(int plurality)
Returns the descriptive name of this node manager.
|
String |
getGUIName(int plurality,
Locale locale)
Returns the descriptive name of this node manager ina a specified language.
|
String |
getInfo(String command)
Retrieve info from a node manager based on a command string.
|
String |
getInfo(String command,
javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp)
Retrieve info from a node manager based on a command string
Similar to the $MOD command in SCAN.
|
NodeList |
getList(NodeQuery query)
Executes a query and returns the result as nodes of this NodeManager (or of extensions)
|
NodeList |
getList(String command,
Map parameters)
Retrieve info (as a list of virtual nodes) from a node manager based on a command string.
|
NodeList |
getList(String command,
Map parameters,
javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp)
Retrieve info from a node manager based on a command string
Similar to the LIST command in SCAN.
|
NodeList |
getList(String constraints,
String sorted,
String directions)
Returns a list of nodes belonging to this node manager.
|
(package private) MMObjectBuilder |
getMMObjectBuilder() |
String |
getName()
Returns the name of this node manager.
|
protected Function |
getNodeFunction(String functionName)
Based on
AbstractNode.getFunctions(). |
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
|
String |
getProperty(String name)
Retrieve a property of the node manager.
|
boolean |
hasField(String fieldName)
Tests whether the field with the specified name exists in this nodemanager.
|
protected void |
initManager()
Initializes the NodeManager: determines the MMObjectBuilder if it was not already known,
and fills the fields list.
|
boolean |
isNodeManager()
Determine whether this Node is a NodeManager.
|
boolean |
mayCreateNode()
Check if the current user may create a new node of this type.
|
protected void |
setDefaultsWithCloud(MMObjectNode node)
Sometimes default values can only be filled if a cloud is present, hence only in the bridge.
|
protected void |
setNodeManager(MMObjectNode node)
Set nodemanager for node
|
protected static void |
sync(MMObjectBuilder builder,
Map<String,Field> fieldTypes,
NodeManager nodeManager) |
NodeManager |
toNodeManager()
Returns this as a NodeManager.
|
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, toStringcompareTo, countRelations, countRelations, createRelation, delete, deleteRelations, equals, getDecimalValue, getFieldValue, getFieldValue, getFunction, getFunctionMap, getFunctionValue, getObjectValue, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelatedNodes, getRelations, getRelations, getRelations, getValue, getXMLValue, hashCode, isRelation, isRelationManager, processNull, setBooleanValue, setByteValue, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toRelation, toRelationManager, validategetCloudcancel, countRelatedNodes, countRelatedNodes, countRelations, countRelations, createAlias, createParameters, createRelation, delete, deleteAlias, deleteRelations, deleteRelations, getAliases, getBooleanValue, getByteValue, getChanged, getContext, getDateValue, getDecimalValue, getDoubleValue, getFieldValue, getFieldValue, getFloatValue, getFunction, 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, isNull, isRelation, isRelationManager, mayChangeContext, mayDelete, mayWrite, setBooleanValue, setByteValue, setContext, setDateValue, setDecimalValue, setDoubleValue, setFloatValue, setInputStreamValue, setIntValue, setListValue, setLongValue, setNodeManager, setNodeValue, setObjectValue, setStringValue, setValue, setValueWithoutProcess, setXMLValue, toRelation, toRelationManager, toString, validatecompareToprotected MMObjectBuilder builder
BasicNodeManager(MMObjectNode node, BasicCloud cloud, int nodeid)
node - the MMObjectNode to base the NodeManager on.Cloud - the cloud to which this node belongsid - the id of the node in the temporary cloudBasicNodeManager(MMObjectNode node, BasicCloud cloud)
node - the MMObjectNode to base the NodeManager on.Cloud - the cloud to which this node belongsBasicNodeManager(MMObjectBuilder builder, BasicCloud cloud)
builder - the MMObjectBuilder to base the NodeManager on.Cloud - the cloud to which this node belongsprotected void setNodeManager(MMObjectNode node)
BasicNodesetNodeManager in class BasicNodenode - node to derive nodemanager from.public final boolean isNodeManager()
NodeisNodeManager in interface NodeisNodeManager in class AbstractNodetrue if this Node is a NodeManager.public final NodeManager toNodeManager()
NodetoNodeManager in interface NodetoNodeManager in class AbstractNodeNodeManager objectprotected void initManager()
protected static void sync(MMObjectBuilder builder, Map<String,Field> fieldTypes, NodeManager nodeManager)
protected Map<String,Field> getFieldTypes()
protected BasicNodeManager.NodeAndId createMMObjectNode()
BasicNodeManager.NodeAndIdprotected void setDefaultsWithCloud(MMObjectNode node)
protected BasicNode createBasicNode()
createNode()public final Node createNode()
NodeManagercreateNode in interface NodeManagerNodepublic NodeManager getParent() throws NotFoundException
NodeManagergetParent in interface NodeManagerNotFoundException - if no parent exists (i.e. this nodeManager is "object")public NodeManagerList getDescendants()
NodeManagergetDescendants in interface NodeManagerpublic String getName()
NodeManagergetName in interface NodeManagerpublic String getProperty(String name)
NodeManagergetProperty in interface NodeManagername - the name of the propertypublic Map<String,String> getProperties()
NodeManagergetProperties in interface NodeManagerpublic String getGUIName()
NodeManagergetGUIName in interface NodeManagerpublic String getGUIName(int plurality)
NodeManagergetGUIName in interface NodeManagerplurality - the plurality (number of objects) for which to return a description
(NodeManager.GUI_SINGULAR or NodeManager.GUI_PLURAL)public String getGUIName(int plurality, Locale locale)
NodeManagergetGUIName in interface NodeManagerplurality - the plurality (number of objects) for which to return a description
(NodeManager.GUI_SINGULAR or NodeManager.GUI_PLURAL)locale - the locale that determines the language for the GUI namepublic String getDescription()
NodeManagergetDescription in interface NodeManagerpublic String getDescription(Locale locale)
NodeManagergetDescription in interface NodeManagerlocale - the locale that determines the language for the descriptionpublic FieldList getFields()
NodeManagergetFields in interface NodeManagerpublic FieldList getFields(int order)
NodeManagergetFields in interface NodeManagerorder - the order in which to list the fieldsFieldList object, which is a specialized List of Field objects.NodeManager.ORDER_NONE,
NodeManager.ORDER_CREATE,
NodeManager.ORDER_EDIT,
NodeManager.ORDER_LIST,
NodeManager.ORDER_SEARCHpublic Field getField(String fieldName) throws NotFoundException
NodeManagergetField in interface NodeManagerfieldName - the name of the field to be returnedNotFoundException - is the field does not existpublic boolean hasField(String fieldName)
NodeManagerhasField in interface NodeManagerfieldName - the name of the field to be returnedtrue if the field with the requested name existspublic NodeQuery createQuery()
NodeManagercreateQuery in interface NodeManagerNodeManager.getList(NodeQuery),
Cloud.createNodeQuery()public NodeList getList(NodeQuery query)
NodeManagergetList in interface NodeManagerquery - query to executepublic NodeList getList(String constraints, String sorted, String directions)
NodeManager
"number = 100" (!=, <, >, <= and >= can also be used)
"name = 'admin'",
"email IS NULL" (indicating the email field is empty)
"email LIKE '%.org'" (indication the email should end with .org)
"number BETWEEN 99 AND 101"
"name IN ('admin', 'anonymous')"
The NOT operator can be used to get the opposite result like:
"NOT (number = 100)"
"NOT (name = 'admin')",
"email IS NOT NULL"
"email NOT LIKE '%.org'" (indication the email should not end with .org)
"number NOT BETWEEN 99 AND 101"
"name NOT IN ('admin', 'anonymous')"
Some special functions (not part of standard SQL, but most databases
support them) can be used like:
"LOWER(name) = 'admin'" (to also allow 'Admin' to be selected) "LENGTH(name) > 5" (to only select names longer then 5 characters)Constraints can be linked together using AND and OR:
"((number=100) OR (name='admin') AND email LIKE '%.org')"The single quote can be escaped using it twice for every single occurence:
"name='aaa''bbb'" (if we want to find the string aaa'bbb)For more info consult a SQL tutorial like Jim Hoffman's introduction to Structured Query Language.
getList in interface NodeManagerconstraints - Constraints to prevent nodes from being
included in the resulting list which would normally
by included or null if no constraints
should be applied .sorted - A comma separated list of field names on which the
returned list should be sorted or null
if the order of the returned virtual nodes doesn't
matter.directions - A comma separated list of values indicating wether
to sort up (ascending) or down (descending) on the
corresponding field in the orderby
parameter or null if sorting on all
fields should be up.
The value DOWN (case insensitive) indicates
that sorting on the corresponding field should be
down, all other values (including the
empty value) indicate that sorting on the
corresponding field should be up.
If the number of values found in this parameter are
less than the number of fields in the
orderby parameter, all fields that
don't have a corresponding direction value are
sorted according to the last specified direction
value.public RelationManagerList getAllowedRelations()
NodeManagergetAllowedRelations in interface NodeManagerpublic RelationManagerList getAllowedRelations(String nodeManager, String role, String direction)
NodeManagergetAllowedRelations in interface NodeManagernodeManager - the name of the nodemanger with which to make a relation, can be nullrole - the role with which to make a relation, can be nulldirection - the search direction ("source", "destination", "both"), can be nullpublic RelationManagerList getAllowedRelations(NodeManager nodeManager, String role, String direction)
NodeManagergetAllowedRelations in interface NodeManagernodeManager - the nodemanger with which to make a relation, can be nullrole - the role with which to make a relation, can be nulldirection - the search direction ("source", "destination", "both"), can be nullpublic String getInfo(String command)
NodeManagergetInfo in interface NodeManagercommand - the info to obtain, i.e. "USER-OS".public String getInfo(String command, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)
NodeManagergetInfo in interface NodeManagercommand - the info to obtain, i.e. "USER-OS".req - the Request item to use for obtaining user information. For backward compatibility.resp - the Response item to use for redirecting users. For backward compatibility.public NodeList getList(String command, Map parameters)
NodeManagergetList in interface NodeManagercommand - the info to obtain, i.e. "USER-OS".parameters - a hashtable containing the named parameters of the list.public NodeList getList(String command, Map parameters, javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)
NodeManagergetList in interface NodeManagercommand - the info to obtain, i.e. "USER-OS".parameters - a hashtable containing the named parameters of the list.req - the Request item to use for obtaining user information. For backward compatibility.resp - the Response item to use for redirecting users. For backward compatibility.public boolean mayCreateNode()
NodeManagermayCreateNode in interface NodeManagerMMObjectBuilder getMMObjectBuilder()
public void commit()
BasicNodeBasicCloud.afterCommit(BasicNode)public void delete(boolean deleteRelations)
Nodepublic Collection<Function<?>> getFunctions()
AbstractNodeNode.getNodeManager().Node.getFunctions().getFunctions in interface NodegetFunctions in class BasicNodeFunction objects.protected Function getNodeFunction(String functionName)
AbstractNodeAbstractNode.getFunctions().getNodeFunction in class BasicNodepublic FieldList createFieldList()
NodeManagercreateFieldList in interface NodeManagerpublic NodeList createNodeList()
NodeManagercreateNodeList in interface NodeManagerpublic RelationList createRelationList()
NodeManagercreateRelationList in interface NodeManagerMMBase 1.9-SNAPSHOT - ${javadoctimestamp}