org.mmbase.bridge
Interface NodeManager

All Known Subinterfaces:
RelationManager
All Known Implementing Classes:
BasicNodeManager, RemoteRelationManager_Impl, RemoteNodeManager_Impl

public interface NodeManager

This interface represents a node's type information object - what used to be the 'builder'. It contains all the field and attribuut information, as well as GUI data for editors and some information on deribed and deriving types. It also contains some maintenance code - code to create new nodes, en code to query objects belonging to the same manager. Since node types are normally maintained through use of config files (and not in the database), as wel as for security issues, the data of a nodetype cannot be changed except through the use of an administration module (which is why we do not include setXXX methods here).

Version:
$Id: NodeManager.java,v 1.12 2002/01/31 10:05:08 pierre Exp $
Author:
Rob Vermeulen, Pierre van Rooden

Field Summary
static int ORDER_CREATE
           
static int ORDER_EDIT
           
static int ORDER_LIST
           
static int ORDER_SEARCH
           
 
Method Summary
 Node createNode()
          Creates a new node.
 Cloud getCloud()
          Returns the cloud to which this manager belongs.
 java.lang.String getDescription()
          Returns the description of this node manager.
 Field getField(java.lang.String name)
          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.
 java.lang.String getGUIName()
          Returns the descriptive name of this node manager.
 java.lang.String getInfo(java.lang.String command)
          Retrieve info from a node manager based on a command string.
 java.lang.String getInfo(java.lang.String command, org.mmbase.bridge.ServletRequest req, org.mmbase.bridge.ServletResponse resp)
          Retrieve info from a node manager based on a command string Similar to the $MOD command in SCAN.
 NodeList getList(java.lang.String command, java.util.Hashtable parameters)
          Retrieve info (as a list of virtual nodes) from a node manager based on a command string.
 NodeList getList(java.lang.String command, java.util.Hashtable parameters, org.mmbase.bridge.ServletRequest req, org.mmbase.bridge.ServletResponse resp)
          Retrieve info from a node manager based on a command string Similar to the LIST command in SCAN.
 NodeList getList(java.lang.String constraints, java.lang.String orderby, java.lang.String directions)
          Returns a list of nodes belonging to this node manager.
 java.lang.String getName()
          Returns the name of this node manager.
 boolean mayCreateNode()
          Check if the current user may create a new node of this type.
 

Field Detail

ORDER_CREATE

public static final int ORDER_CREATE

ORDER_EDIT

public static final int ORDER_EDIT

ORDER_LIST

public static final int ORDER_LIST

ORDER_SEARCH

public static final int ORDER_SEARCH
Method Detail

createNode

public Node createNode()
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.
Returns:
the new Node

getCloud

public Cloud getCloud()
Returns the cloud to which this manager belongs.
Returns:
the cloud to which this manager belongs

getName

public java.lang.String getName()
Returns the name of this node manager. This name is a unique name.
Returns:
the name of this node manager.

getGUIName

public java.lang.String getGUIName()
Returns the descriptive name of this node manager. This name will be in the default language (defined in mmbaseroot.xml).
Returns:
the descriptive name of this node manager

getDescription

public java.lang.String getDescription()
Returns the description of this node manager.
Returns:
the description of this node manager

getFields

public FieldList getFields()
Returns a list of all fields defined for this node manager.
Returns:
a list of all fields defined for this node manager

getFields

public FieldList getFields(int order)
Retrieve a subset of field types of this NodeManager, depending on a given order.
Parameters:
order - the order in which to list the fields
Returns:
a List of FieldType objects

getField

public Field getField(java.lang.String name)
Returns the field with the specified name.
Parameters:
name - the name of the field to be returned
Returns:
the field with the requested name

getList

public NodeList getList(java.lang.String constraints,
                        java.lang.String orderby,
                        java.lang.String directions)
Returns a list of nodes belonging to this node manager. Constraints can be given to exclude nodes from the returned list. These constraints follow the syntax of the SQL where clause. It's a good practice to use uppercase letters for the operators and lowercase letters for the fieldnames. Example constraints are:
 "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 this one.
Parameters:
constraints - Contraints to prevent nodes from being included in the resulting list which would normally by included or null if no contraints should be applied .
orderby - 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.
Returns:
a list of nodes belonging to this node manager

getInfo

public java.lang.String getInfo(java.lang.String command)
Retrieve info from a node manager based on a command string. Similar to the $MOD command in SCAN.
Parameters:
command - the info to obtain, i.e. "USER-OS".

getInfo

public java.lang.String getInfo(java.lang.String command,
                                org.mmbase.bridge.ServletRequest req,
                                org.mmbase.bridge.ServletResponse resp)
Retrieve info from a node manager based on a command string Similar to the $MOD command in SCAN.
Parameters:
command - 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.

getList

public NodeList getList(java.lang.String command,
                        java.util.Hashtable parameters)
Retrieve info (as a list of virtual nodes) from a node manager based on a command string. Similar to the LIST command in SCAN. The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..
Parameters:
command - the info to obtain, i.e. "USER-OS".
parameters - a hashtable containing the named parameters of the list.

getList

public NodeList getList(java.lang.String command,
                        java.util.Hashtable parameters,
                        org.mmbase.bridge.ServletRequest req,
                        org.mmbase.bridge.ServletResponse resp)
Retrieve info from a node manager based on a command string Similar to the LIST command in SCAN. The values retrieved are represented as fields of a virtual node, named following the fieldnames listed in the fields paramaters..
Parameters:
command - 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.

mayCreateNode

public boolean mayCreateNode()
Check if the current user may create a new node of this type.
Returns:
Check if the current user may create a new node of this type.


MMBase 2002