| java.lang.Object org.mmbase.util.functions.FunctionProvider org.mmbase.module.core.MMTable org.mmbase.module.core.MMObjectBuilder
All known Subclasses: org.mmbase.module.builders.MMServers, org.mmbase.module.corebuilders.OAlias, org.mmbase.module.corebuilders.InsRel, org.mmbase.module.builders.Properties, org.mmbase.module.builders.MMEvents, org.mmbase.module.corebuilders.RelDef, org.mmbase.module.corebuilders.TypeDef, org.mmbase.module.core.VirtualBuilder, org.mmbase.module.builders.Dummy, org.mmbase.util.functions.ExampleBuilder, org.mmbase.module.corebuilders.TypeRel, org.mmbase.module.builders.Versions, org.mmbase.module.builders.AbstractServletBuilder, org.mmbase.module.builders.DayMarkers,
MMObjectBuilder | public class MMObjectBuilder extends MMTable implements NodeEventListener,RelationEventListener(Code) | | This class is the base class for all builders.
It offers a list of routines which are useful in maintaining the nodes in the MMBase
object cloud.
Builders are the core of the MMBase system. They create, delete and search the MMObjectNodes.
Most manipulations concern nodes of that builders type. However, a number of retrieval routines extend
beyond a builders scope and work on the cloud in general, allowing some ease in retrieval of nodes.
The basic routines in this class can be extended to handle more specific demands for nodes.
Most of these 'extended builders' will be stored in mmbase.org.builders or mmbase.org.corebuilders.
Examples include relation builders or builders for handling binary data such as images.
The various builders are registered by the 'TypeDef' builder class (one of the core builders, itself
an extension of this class).
author: Daniel Ockeloen author: Rob Vermeulen author: Pierre van Rooden author: Eduard Witteveen author: Johannes Verelst author: Rob van Maris author: Michiel Meeuwissen author: Ernst Bunders version: $Id: MMObjectBuilder.java,v 1.421 2007/11/16 09:47:34 michiel Exp $ |
Method Summary | |
public void | addEventListener(org.mmbase.core.event.EventListener listener) simple way to register a NodeEvent listener and a RelationEventListener
at the same time. | public void | addField(CoreField def) Add a field to this builder. | public boolean | addLocalObserver(MMBaseObserver obs) Adds a local observer to this builder. | public boolean | addRemoteObserver(MMBaseObserver obs) Adds a remote observer to this builder. | public boolean | broadcastChanges() Determines whether changes to this builder need be broadcast to other known mmbase servers.
This setting also governs whether the cache for relation builders is emptied when a relation changes.
Actual broadcasting (and cache emptying) is initiated in the storage layer, when
changes are commited.
By default, all builders broadcast their changes, with the exception of the TypeDef builder.
MM: Can somebody please explain _why_ typedef node changes, like e.g. | public boolean | checkAddTmpField(String field) Defines a virtual field to use for temporary nodes. | public int | clearBlobCache(int nodeNumber) | public boolean | commit(MMObjectNode node) Commit changes to this node to the storage layer. | public boolean | create() Creates a new builder table in the storage layer. | public boolean | createAlias(int number, String alias, String owner) Creates an alias for a node, provided the OAlias builder is loaded. | public boolean | createAlias(int number, String alias) Creates an alias for a node, provided the OAlias builder is loaded. | public void | delete() Removes the builder from the storage. | final public boolean | equals(Object o) Equals must be implemented because of the list of MMObjectBuilder which is used for ancestors
Declared the method final, because the instanceof operator is used. | public boolean | equals(MMObjectNode o1, MMObjectNode o2) | protected Object | executeFunction(MMObjectNode node, String function, List> arguments) Executes a function on the field of a node, and returns the result. | protected Object | executeFunction(MMObjectNode node, String function, String field) Executes a function on the field of a node, and returns the result. | public boolean | fieldLocalChanged(String number, String builder, String field, String value) Called when a local field is changed. | public List<MMObjectBuilder> | getAncestors() Gives the list of parent-builders. | protected BlobCache | getBlobCache(String fieldName) | public String | getClassName() | public File | getConfigFile() | public String | getConfigResource() | public int | getDBState(String fieldName) Return a field's storage state. | public int | getDBType(String fieldName) Return a field's storage type. | public DataTypeCollector | getDataTypeCollector() Returns the datatype collector belonging to this buidler. | public MMObjectNode | getDefaultTeaser(MMObjectNode node, MMObjectNode tnode) | public String | getDefaultUrl(int src) Return the default url of this object. | public List<MMObjectBuilder> | getDescendants() Creates list of descendant-builders. | public String | getDescription() | public String | getDescription(String lang) Gets description of the builder, using the specified language. | public Hashtable<String, String> | getDescriptions() | public MMObjectNode | getEmptyNode(String owner) Returns a new empty node object. | public FieldDefs | getField(String fieldName) | public Set<String> | getFieldNames() Return a list of field names of this table. | public Collection<CoreField> | getFields() Return a copy of the list of field definitions of this table. | public List<CoreField> | getFields(int sortOrder) Gets the field definitions for the editor, sorted according
to the specified order, and excluding the fields that have
not been assigned a valid position (valid is >= 0). | protected Function> | getFunction(MMObjectNode node, String functionName) Instantiates a Function object for a certain function on a certain node of this type.
Parameters: node - The Node for on which the function must work Parameters: functionName - Name of the request function. | protected Vector<String> | getFunctionParameters(String fields) Parses string containing function parameters.
The parameters must be separated by ',' or ';' and may be functions
themselves (i.e. | final Object | getFunctionValue(MMObjectNode node, String functionName, List> parameters) Executes a 'function' on a MMObjectNode. | protected Collection<Function<?>> | getFunctions(MMObjectNode node) Returns all Functions which are available (or at least known to be available) on a Node. | public String | getGUIIndicator(MMObjectNode node, Parameters pars) A complicated default implementation for GUI. | public String | getGUIIndicator(MMObjectNode node) What should a GUI display for this node. | public String | getGUIIndicator(String fieldName, MMObjectNode node) What should a GUI display for this node/field combo. | protected String | getHTML(String body) Returns a HTML-version of a string. | public String | getInitParameter(String name) Retrieve a specific property. | public Map<String, String> | getInitParameters() | public Map | getInitParameters(String contextPath) | public long | getInternalVersion() Returns the builder's internal version number.
This number can be used to sync wrapper classes. | public Vector<String> | getList(PageInfo sp, StringTagger tagger, StringTokenizer tok) Obtains a list of string values by performing the provided command and parameters. | protected String | getLocaleGUIIndicator(Locale locale, String field, MMObjectNode node) The GUIIndicator can depend on the locale. | protected String | getLocaleGUIIndicator(Locale locale, MMObjectNode node) The GUIIndicator can depend on the locale. | public String | getMachineName() | public String | getMaintainer() | public MMObjectNode | getNewNode(String owner) Get a new node, using this builder as its parent. | protected MMObjectNode | getNewTmpNode(String owner, String key) | public FieldDefs | getNextField(String currentfield, int sortorder) Returns the next field as defined by its sortorder, according to the specified order. | public FieldDefs | getNextField(String currentfield) Returns the next field as defined by its sortorder, according to it's GUIPos property (as set in the builder xml file). | public MMObjectNode | getNode(String key, boolean useCache) Retrieves a node based on a unique key. | public MMObjectNode | getNode(String key) Retrieves a node based on a unique key. | public MMObjectNode | getNode(int number) Retrieves a node based on it's number (a unique key), retrieving the node
from the node cache if possible. | public MMObjectNode | getNodeFromCache(Integer number) Retrieves a node from the cache, or null if it doesn't exist.
Parameters: number - The number of the node to retrieve. | protected String | getNodeGUIIndicator(MMObjectNode node, Parameters params) Returns a GUI-indicator for the node itself. | public int | getNumber() Returns the builder object number, which also functions as the objecttype. | public int | getObjectType() Returns the objecttype (otype). | protected Object | getObjectValue(MMObjectNode node, String field) Like getValue, but without the 'old' code (short_ html_ etc). | public MMObjectBuilder | getParentBuilder() Returns the builder that this builder extends. | public String | getPluralName(String lang) Gets long name of the builder, using the specified language. | public String | getPluralName() Gets long name of the builder in the current default language. | public Hashtable<String, String> | getPluralNames() | public Vector<MMObjectNode> | getRelations_main(int src) Returns all relations of a node. | public String | getSearchAge() | public String | getShort(String str, int len) Support routine to return shorter strings. | protected byte[] | getShortedByte(String fieldName, MMObjectNode node) Get binary data of a blob field. | protected String | getShortedText(String fieldName, MMObjectNode node) Get text from a blob field. | public String | getSingularName(String lang) Gets short name of the builder, using the specified language. | public String | getSingularName() Gets short name of the builder in the current default language. | public Hashtable<String, String> | getSingularNames() | public String | getSmartPath(String documentRoot, String path, String nodeNumber, String version) | protected static MMObjectNode | getTmpNode(String key) | protected static String | getURLEncode(String body) Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string. | public Object | getValue(MMObjectNode node, String field) Provides additional functionality when obtaining field values.
This method is called whenever a Node of the builder's type fails at evaluating a getValue() request
(generally when a fieldname is supplied that doesn't exist).
It allows the system to add 'functions' to be included with a field name, such as 'html(body)' or 'time(lastmodified)'.
This method will parse the fieldname, determining functions and calling the
MMObjectBuilder.executeFunction method to handle it.
Functions in fieldnames can be given in the format 'functionname(fieldname)'. | public int | getVersion() | protected static String | getWAP(String body) Returns a WAP-version of a string. | public String | getXMLPath() Retrieves the subpath of the builder's xml configuration file. | public boolean | hasField(String fieldName) | public int | hashCode() | public int | hashCode(MMObjectNode o) | public static String | hostname_function(String url) | public boolean | init() Initializes this builder
The property 'mmb' needs to be set for the builder before this method can be called. | public int | insert(int oType, String owner) Insert a new, empty, object of a certain type. | public int | insert(String owner, MMObjectNode node) Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided).
This method indirectly calls
MMObjectBuilder.preCommit .
Parameters: owner - The administrator creating the node Parameters: node - The object to insert. | public boolean | isExtensionOf(MMObjectBuilder o) | public boolean | isNodeCached(Integer number) Is this node cached at this moment?
Parameters: number - The number of the node to check. | public boolean | isVirtual() Determine whether this builder is virtual. | public void | loadInitParameters() | protected Function | newFunctionInstance(String name, Parameter[] parameters, ReturnType returnType) | public boolean | nodeLocalChanged(String machine, String number, String builder, String ctype) Called when a local node is changed. | public boolean | nodeRemoteChanged(String machine, String number, String builder, String ctype) Called when a remote node is changed. | public void | notify(NodeEvent event) | public void | notify(RelationEvent event) | public MMObjectNode | preCommit(MMObjectNode node) This method is called before an actual write to the storage layer is performed.
Parameters: node - The node to be committed. | public boolean | process(PageInfo sp, StringTokenizer command, Hashtable cmds, Hashtable vars) The hook that passes all form related pages to the correct handler.
This method is SCAN related and may fail if called outside the context of the SCAN servlet.
The methood is currentkly called by the MMEDIT module, whenever a 'PRC-CMD-BUILDER-...' command
is encountered in the list of commands to be processed.
Parameters: sp - The PageInfo (containing http and user info) that calls the function Parameters: command - a list of strings that describe the (sub)command to execute (the portion after ' PRC-CMD-BUILDER') Parameters: cmds - the commands (PRC-CMD) that are iurrently being processed, including the current command. Parameters: vars - variables (PRC-VAR) thatw ere set to be used during processing. | static void | putTmpNode(String key, MMObjectNode node) | public void | removeEventListener(org.mmbase.core.event.EventListener listener) | public void | removeField(String fieldName) Remove a field from this builder. | public boolean | removeLocalObserver(MMBaseObserver obs) | public void | removeNode(MMObjectNode node) Remove a node from the cloud. | public void | removeRelations(MMObjectNode node) Remove the relations of a node. | public boolean | removeRemoteObserver(MMBaseObserver obs) | protected void | removeSyncNodes(MMObjectNode node) Removes the syncnodes to this node. | static void | removeTmpNode(String key) | public String | replace(PageInfo sp, StringTokenizer tok) Obtains a string value by performing the provided command. | public MMObjectNode | safeCache(Integer n, MMObjectNode node) Stores a node in the cache provided the cache is not write locked.
a valid node. | boolean | safeCommit(MMObjectNode node) Locks the node cache during the commit of a node. | int | safeInsert(MMObjectNode node, String userName) Locks the node cache during the insert of a node. | public boolean | sendFieldChangeSignal(MMObjectNode node, String fieldName) Send a signal to other servers that a field was changed. | public void | setDefaults(MMObjectNode node) Sets defaults for a node. | public void | setDescription(String e) | public void | setDescriptions(Hashtable<String, String> e) | public void | setFields(List<CoreField> f) Stores fields information of this table.
Asside from the fields supplied by the caller, a field 'otype' is added (if missing).
Parameters: f - A List with fields (as CoreField objects) as defined by MMBase. | public void | setInitParameter(String name, String value) Set a single builder property
The propertie will not be saved. | void | setInitParameters(Hashtable<String, String> properties) Set all builder properties
Changed properties will not be saved. | public void | setMaintainer(String m) | public void | setParentBuilder(MMObjectBuilder parent) Sets the builder that this builder extends, and registers it in the storage layer. | public void | setPluralNames(Hashtable<String, String> names) | public void | setSearchAge(String age) Sets search Age. | public void | setSingularNames(Hashtable<String, String> names) | protected String | setUniqueValue(MMObjectNode node, String field, String baseValue) In setDefault you could want to generate unique values for fields (if the field is 'unique'). | protected int | setUniqueValue(MMObjectNode node, String field, int offset) In setDefault you could want to generate unique values for fields (if the field is 'unique'). | public boolean | setValue(MMObjectNode node, String fieldName, Object originalValue) Sets a key/value pair in the main values of this node. | public boolean | setValue(MMObjectNode node, String fieldName) Provides additional functionality when setting field values. | public void | setVersion(int i) | public void | setXMLPath(String m) Sets the subpath of the builder's xml configuration file. | public void | testValidData(MMObjectNode node) Tests whether the data in a node is valid (throws an exception if this is not the case). | public String | toString() Implmenting a sensible toString is usefull for debugging. | public String | toString(MMObjectNode n) | protected void | update() | protected void | updateFields() Clears all field list caches, and recalculates the field list. | public static String | wrap(String text, int width) Wraps a string. |
AGE_PARAMETERS | final public static Parameter>[] AGE_PARAMETERS(Code) | | Parameters for the age function
since: MMBase-1.7 |
DEFAULT_ALINEA | final public static String DEFAULT_ALINEA(Code) | | Default replacements for method getHTML()
|
EVENT_TYPE_LOCAL | final public static int EVENT_TYPE_LOCAL(Code) | | |
EVENT_TYPE_REMOTE | final public static int EVENT_TYPE_REMOTE(Code) | | |
FIELD_NUMBER | final public static String FIELD_NUMBER(Code) | | Name of the field containing the object number, which uniquely identifies the node.
since: MMBase-1.8 |
FIELD_OBJECT_TYPE | final public static String FIELD_OBJECT_TYPE(Code) | | Name of the field containing the object type number. This refers to an entry in the 'typedef' builder table.
since: MMBase-1.8 |
FIELD_OWNER | final public static String FIELD_OWNER(Code) | | Name of the field containing the owner. The owner field is used for security implementations.
since: MMBase-1.8 |
GUI_INDICATOR | final public static String GUI_INDICATOR(Code) | | Default output when no data is available to determine a node's GUI description
|
GUI_PARAMETERS | final public static Parameter>[] GUI_PARAMETERS(Code) | | Parameters for the GUI function
since: MMBase-1.7 |
SYSTEM_OWNER | final public static String SYSTEM_OWNER(Code) | | Default (system) owner name for the owner field.
since: MMBase-1.8 |
TEMPNODE_DEFAULT_SIZE | final public static int TEMPNODE_DEFAULT_SIZE(Code) | | Default size of the temporary node cache
|
TMP_FIELD_EXISTS | final public static String TMP_FIELD_EXISTS(Code) | | |
TMP_FIELD_NUMBER | final public static String TMP_FIELD_NUMBER(Code) | | since: MMBase-1.8 |
broadCastChanges | protected boolean broadCastChanges(Code) | | Determines whether changes to this builder need be broadcast to other known mmbase servers.
|
description | public String description(Code) | | Description of the builder in the currently selected language
Not that the first time the builder is created, this value is what is stored in the TypeDef table.
|
descriptions | public Hashtable<String, String> descriptions(Code) | | Descriptions of the builder per language
Can be set with the <descriptions> tag in the xml builder file.
|
genericBlobCache | protected static BlobCache genericBlobCache(Code) | | The cache for all blobs.
since: 1.8.0 |
getFunctions | protected Function<Collection<? extends Function>> getFunctions(Code) | | Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides.
This is overridden from FunctionProvider, because this one needs to be (also) a NodeFunction
since: MMBase-1.8 |
guiFunction | protected Function<String> guiFunction(Code) | | The famous GUI function as a function object.
since: MMBase-1.8 |
infoFunction | protected Function<Object> infoFunction(Code) | | The info-function is a node-function and a builder-function. Therefore it is defined as a node-function, but also overidesd getFunctionValue(Parameters).
since: MMBase-1.8 |
internalVersion | protected long internalVersion(Code) | | Internal (instance) version number of this builder.
|
maintainer | String maintainer(Code) | | Maintainer information for builder registration
Set with <builder maintainer="mmbase.org" version="0"> in the xml builder file
|
oType | protected int oType(Code) | | The current builder's object type
Retrieved from the TypeDef builder.
|
pluralNames | Hashtable<String, String> pluralNames(Code) | | Collections of (GUI) names (plural) for the builder's objects, divided by language
|
searchAge | public String searchAge(Code) | | The default search age for this builder.
Used for intializing editor search forms (see HtmlBase)
Default value is 31. Can be changed with the <searchage> tag in the xml builder file.
|
singularNames | Hashtable<String, String> singularNames(Code) | | Collections of (GUI) names (singular) for the builder's objects, divided by language
|
temporaryNodes | public static Map<String, MMObjectNode> temporaryNodes(Code) | | Collection for temporary nodes,
Used by the Temporarynodemanager when working with transactions
The default size is 1024.
|
virtual | protected boolean virtual(Code) | | Determines whether a builder is virtual (data is not stored in the storage layer).
|
wrapFunction | protected Function<String> wrapFunction(Code) | | This function wraps the text of a node's field and returns the result as a String.
It takes as parameters a fieldname, the line length to wrap, and the Node containing the data.
This function can be called through the function framework.
since: MMBase-1.8 |
xmlPath | String xmlPath(Code) | | Full filename (path + buildername + ".xml") where we loaded the builder from
It is relative from the '/builders/' subdir
|
MMObjectBuilder | public MMObjectBuilder()(Code) | | Constructor.
|
addField | public void addField(CoreField def)(Code) | | Add a field to this builder.
This does not affect the builder config file, nor the table used.
Parameters: def - the field definiton to add |
addLocalObserver | public boolean addLocalObserver(MMBaseObserver obs)(Code) | | Adds a local observer to this builder.
The observer is notified whenever an object of this builder is changed, added, or removed.
always true |
addRemoteObserver | public boolean addRemoteObserver(MMBaseObserver obs)(Code) | | Adds a remote observer to this builder.
The observer is notified whenever an object of this builder is changed, added, or removed.
always true |
broadcastChanges | public boolean broadcastChanges()(Code) | | Determines whether changes to this builder need be broadcast to other known mmbase servers.
This setting also governs whether the cache for relation builders is emptied when a relation changes.
Actual broadcasting (and cache emptying) is initiated in the storage layer, when
changes are commited.
By default, all builders broadcast their changes, with the exception of the TypeDef builder.
MM: Can somebody please explain _why_ typedef node changes, like e.g. creating a new node type are _not_ broadcast.
since: MMBase-1.8 |
checkAddTmpField | public boolean checkAddTmpField(String field)(Code) | | Defines a virtual field to use for temporary nodes. If the given field-name does not start
with underscore ('_'), wich it usually does, then the field does also get a 'dbpos' (1000) as if it
was actually present in the builder's XML as a virtual field (this is accompanied with a log
message).
Normally this is used to add 'tmp' fields like _number, _exists and _snumber which are system
fields which are normally invisible.
Parameters: field - the name of the temporary field true if the field was added, false if it already existed. |
clearBlobCache | public int clearBlobCache(int nodeNumber)(Code) | | since: MMBase-1.8 |
create | public boolean create()(Code) | | Creates a new builder table in the storage layer.
|
createAlias | public boolean createAlias(int number, String alias, String owner)(Code) | | Creates an alias for a node, provided the OAlias builder is loaded.
Parameters: number - the to-be-aliased node's unique number Parameters: alias - the aliasname to associate with the object Parameters: owner - the owner of the alias since: MMBase-1.8 if the alias could be created |
createAlias | public boolean createAlias(int number, String alias)(Code) | | Creates an alias for a node, provided the OAlias builder is loaded.
Parameters: number - the to-be-aliased node's unique number Parameters: alias - the aliasname to associate with the object if the alias could be created |
delete | public void delete()(Code) | | Removes the builder from the storage.
since: MMBase-1.7 |
equals | final public boolean equals(Object o)(Code) | | Equals must be implemented because of the list of MMObjectBuilder which is used for ancestors
Declared the method final, because the instanceof operator is used. This is the only
MMObjectBuilder is frequently extended and subclasses will always break
the equals contract.
When subclasses require to implement the equals method then we should use
getClass() == o.getClass(), but this has its own issues. For more info, search for equality in Java
since: MMBase-1.6.2 |
equals | public boolean equals(MMObjectNode o1, MMObjectNode o2)(Code) | | Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)
since: MMBase-1.6.2 |
executeFunction | protected Object executeFunction(MMObjectNode node, String function, String field)(Code) | | Executes a function on the field of a node, and returns the result.
This method is called by the builder's
MMObjectBuilder.getValue method.
current functions are:
on dates: date, time, timesec, longmonth, month, monthnumber, weekday, shortday, day, yearhort year
on text: wap, html, shorted, uppercase, lowercase
on node: age()
on numbers: wrap_<int>, currency_euro
Parameters: node - the node whose fields are queries Parameters: field - the fieldname that is requested the result of the 'function', or null if no valid functions could be determined.MMObjectBuilder.getFunction(MMObjectNode,String) |
fieldLocalChanged | public boolean fieldLocalChanged(String number, String builder, String field, String value)(Code) | | Called when a local field is changed.
Parameters: number - Number of the changed node as a String Parameters: builder - type of the changed node Parameters: field - name of the changed field Parameters: value - value it changed to always true |
getClassName | public String getClassName()(Code) | | Returns the classname of this builder
|
getConfigFile | public File getConfigFile()(Code) | | Gets the file that contains the configuration of this builder
the builders configuration File object |
getConfigResource | public String getConfigResource()(Code) | | since: MMBase-1.8 |
getDBState | public int getDBState(String fieldName)(Code) | | Return a field's storage state. The returned value is one of the following values
declared in Field:
STATE_VIRTUAL,
STATE_PERSISTENT,
STATE_SYSTEM,
STATE_UNKNOWN
Parameters: fieldName - the requested field's name the field's state. |
getDBType | public int getDBType(String fieldName)(Code) | | Return a field's storage type. The returned value is one of the following values
declared in Field:
TYPE_STRING,
TYPE_INTEGER,
TYPE_BINARY,
TYPE_FLOAT,
TYPE_DOUBLE,
TYPE_LONG,
TYPE_NODE,
TYPE_UNKNOWN
Parameters: fieldName - the requested field's name the field's type. |
getDataTypeCollector | public DataTypeCollector getDataTypeCollector()(Code) | | Returns the datatype collector belonging to this buidler.
A datatype collector contains the datatypes that are local to this builder.
since: MMBase-1.8 |
getDefaultUrl | public String getDefaultUrl(int src)(Code) | | Return the default url of this object.
The basic value returned is null .
Parameters: src - the number of the node to obtain the url from the basic url as a String , or null if unknown. |
getDescription | public String getDescription()(Code) | | Get description of the builder
the description text |
getDescription | public String getDescription(String lang)(Code) | | Gets description of the builder, using the specified language.
Parameters: lang - The language requested the descriptions in that language, or null if it is not avaialble |
getDescriptions | public Hashtable<String, String> getDescriptions()(Code) | | Get descriptions of the builder
a Hashtable containing the descriptions |
getEmptyNode | public MMObjectNode getEmptyNode(String owner)(Code) | | Returns a new empty node object. This is used by Storage to create a non-new node object (isNew is false), which is then
be filled with actual values from storage.
since: MMBase-1.8. |
getField | public FieldDefs getField(String fieldName)(Code) | | Return a field's definition
Parameters: fieldName - the requested field's name a FieldDefs belonging with the indicated field |
getFieldNames | public Set<String> getFieldNames()(Code) | | Return a list of field names of this table.
a unmodifiable Set with the tables field names |
getFields | public Collection<CoreField> getFields()(Code) | | Return a copy of the list of field definitions of this table.
An unmodifiable Collection with the tables fields |
getFields | public List<CoreField> getFields(int sortOrder)(Code) | | Gets the field definitions for the editor, sorted according
to the specified order, and excluding the fields that have
not been assigned a valid position (valid is >= 0).
This method makes an explicit sort (it does not use a cached list).
Parameters: sortOrder - One of the sortorders defined inorg.mmbase.core.CoreField CoreField The ordered list of field definitions. |
getFunction | protected Function> getFunction(MMObjectNode node, String functionName)(Code) | | Instantiates a Function object for a certain function on a certain node of this type.
Parameters: node - The Node for on which the function must work Parameters: functionName - Name of the request function. a Function object or null if no such function. since: MMBase-1.8 |
getFunctionParameters | protected Vector<String> getFunctionParameters(String fields)(Code) | | Parses string containing function parameters.
The parameters must be separated by ',' or ';' and may be functions
themselves (i.e. a functionname, followed by a parameter list between
parenthesis).
Parameters: fields - The string, containing function parameters. List of function parameters (may be functions themselves). |
getFunctionValue | final Object getFunctionValue(MMObjectNode node, String functionName, List> parameters)(Code) | | Executes a 'function' on a MMObjectNode. The function is
identified by a string, and its arguments are passed by a List.
The function 'info' should exist, and this will return a Map
with descriptions of the possible functions.
Call
MMObjectBuilder.addFunction in your extension if you want to add functions.
Parameters: node - The node on which the function must be executed Parameters: functionName - The string identifying the funcion Parameters: parameters - The list with function argument or null (which means 'no arguments') See Also: MMObjectBuilder.executeFunction since: MMBase-1.6 |
getFunctions | protected Collection<Function<?>> getFunctions(MMObjectNode node)(Code) | | Returns all Functions which are available (or at least known to be available) on a Node.
since: MMBase-1.8 |
getGUIIndicator | public String getGUIIndicator(MMObjectNode node)(Code) | | What should a GUI display for this node.
Default the value returned is GUI_INDICATOR ('no info').
Override this to display your own choice (see Images.java).
You may want to override
MMObjectBuilder.getNodeGUIIndicator for more flexibility.
Parameters: node - The node to display the display of the node as a String |
getGUIIndicator | public String getGUIIndicator(String fieldName, MMObjectNode node)(Code) | | What should a GUI display for this node/field combo.
Default is null (indicating to display the field as is)
Override this to display your own choice.
Parameters: node - The node to display Parameters: fieldName - the name field of the field to display the display of the node's field as a String , null if not specified |
getHTML | protected String getHTML(String body)(Code) | | Returns a HTML-version of a string.
This replaces a number of tokens with HTML sequences.
The default output does not match well with the new xhtml standards (ugly html), nor does it replace all tokens.
Default replacements can be overridden by setting the builder properties in your .xml:
html.alinea
html.endofline
Example:
<br /> <br />
<br />
Parameters: body - text to convert the convert text |
getInitParameter | public String getInitParameter(String name)(Code) | | Retrieve a specific property.
Parameters: name - the name of the property to get the value of the property as a String |
getInitParameters | public Map<String, String> getInitParameters()(Code) | | Get all builder properties
a Map containing the current properties |
getInitParameters | public Map getInitParameters(String contextPath)(Code) | | Get all builder properties and override properties through application context
Parameters: contextPath - path in application context where properties are located a Map containing the current properties since: MMBase 1.8.2 |
getInternalVersion | public long getInternalVersion()(Code) | | Returns the builder's internal version number.
This number can be used to sync wrapper classes. I.e. to make sure that a
nodemanager's fieldlist is the same as that of the wrapped builder.
|
getList | public Vector<String> getList(PageInfo sp, StringTagger tagger, StringTokenizer tok)(Code) | | Obtains a list of string values by performing the provided command and parameters.
This method is SCAN related and may fail if called outside the context of the SCAN servlet.
Parameters: sp - The PageInfo (containing http and user info) that calls the function Parameters: tagger - a Hashtable of parameters (name-value pairs) for the command Parameters: tok - a list of strings that describe the (sub)command to execute a Vector containing the result values as a String |
getLocaleGUIIndicator | protected String getLocaleGUIIndicator(Locale locale, String field, MMObjectNode node)(Code) | | The GUIIndicator can depend on the locale. Override this function
since: MMBase-1.6 |
getMachineName | public String getMachineName()(Code) | | Get the name of this mmserver from the MMBase Root
a String which is the server's name |
getMaintainer | public String getMaintainer()(Code) | | Retrieves the maintainer of this builder
the name of the maintainer |
getNewNode | public MMObjectNode getNewNode(String owner)(Code) | | Get a new node, using this builder as its parent. The new node is not a part of the cloud
yet, and thus has the value -1 as a number. (Call
MMObjectBuilder.insert to add the node to the
cloud).
Parameters: owner - The administrator creating the new node. A newly initialized MMObjectNode . |
getNewTmpNode | protected MMObjectNode getNewTmpNode(String owner, String key)(Code) | | Create a new temporary node and put it in the temporary _exist
node space
|
getNextField | public FieldDefs getNextField(String currentfield, int sortorder)(Code) | | Returns the next field as defined by its sortorder, according to the specified order.
|
getNextField | public FieldDefs getNextField(String currentfield)(Code) | | Returns the next field as defined by its sortorder, according to it's GUIPos property (as set in the builder xml file).
Used for moving between fields in an edit-form.
|
getNode | public MMObjectNode getNode(String key, boolean useCache)(Code) | | Retrieves a node based on a unique key. The key is either an entry from the OAlias table
or the string-form of an integer value (the number field of an object node).
Note that the OAlias builder needs to be active for the alias to be used
(otherwise using an alias is concidered invalid).
Parameters: key - The value to search for Parameters: useCache - If true, the node is retrieved from the node cache if possible. null if the node does not exist or the key is invalid, or aMMObjectNode containing the contents of the requested node. |
getNode | public MMObjectNode getNode(String key)(Code) | | Retrieves a node based on a unique key. The key is either an entry from the OAlias table
or the string-form of an integer value (the number field of an object node).
Retrieves a node from the node cache if possible.
Parameters: key - The value to search for null if the node does not exist or the key is invalid, or aMMObjectNode containing the contents of the requested node. |
getNode | public MMObjectNode getNode(int number)(Code) | | Retrieves a node based on it's number (a unique key), retrieving the node
from the node cache if possible.
Parameters: number - The number of the node to search for null if the node does not exist or the key is invalid, or aMMObjectNode containign the contents of the requested node. |
getNodeFromCache | public MMObjectNode getNodeFromCache(Integer number)(Code) | | Retrieves a node from the cache, or null if it doesn't exist.
Parameters: number - The number of the node to retrieve. an MMObjectNode or null if the node is not in the cache since: MMBase-1.8 |
getNumber | public int getNumber()(Code) | | Returns the builder object number, which also functions as the objecttype.
This is the same value as the value of the 'otype' field of objects created by this builder
(rather than created by its descendants).
the builder number since: MMBase-1.8 |
getObjectType | public int getObjectType()(Code) | | Returns the objecttype (otype).
By preference, use
MMObjectBuilder.getNumber() for future compatibility with the bridge NodeManager methods.
the objecttype |
getObjectValue | protected Object getObjectValue(MMObjectNode node, String field)(Code) | | Like getValue, but without the 'old' code (short_ html_ etc). This is for
protected use, when you are sure this is not used, and you can
avoid the overhead.
since: MMBase-1.6 See Also: MMObjectBuilder.getValue |
getParentBuilder | public MMObjectBuilder getParentBuilder()(Code) | | Returns the builder that this builder extends.
since: MMBase-1.6 the extended (parent) builder, or null if not available |
getPluralName | public String getPluralName(String lang)(Code) | | Gets long name of the builder, using the specified language.
Parameters: lang - The language requested the long name in that language, or null if it is not available |
getPluralName | public String getPluralName()(Code) | | Gets long name of the builder in the current default language.
If the current language is not available, the "en" version is returned instead.
If that name is not available, the singular name is returned.
the long name in either the default language or in "en" |
getRelations_main | public Vector<MMObjectNode> getRelations_main(int src)(Code) | | Returns all relations of a node.
This returns the relation objects, not the objects related to.
Note that the relations returned are always of builder type 'InsRel', even if they are really from a derived builser such as AuthRel.
Parameters: src - the number of the node to obtain the relations from a Vector with InsRel nodes |
getSearchAge | public String getSearchAge()(Code) | | Gets search Age
the search age as a String |
getShort | public String getShort(String str, int len)(Code) | | Support routine to return shorter strings.
Cuts a string to a amximum length if it exceeds the length specified.
Parameters: str - the string to shorten Parameters: len - the maximum length the (possibly shortened) string |
getShortedByte | protected byte[] getShortedByte(String fieldName, MMObjectNode node)(Code) | | Get binary data of a blob field. This function is called to 'load' a field into the node, because
it was not loaded together with the node, because it is supposed to be too big.
Parameters: fieldName - name of the field Parameters: node - an array of byte containing the complete contents of the field. since: MMBase-1.8 |
getShortedText | protected String getShortedText(String fieldName, MMObjectNode node)(Code) | | Get text from a blob field. This function is called to 'load' a field into the node, because
it was not loaded together with the node, because it is supposed to be too big.
Parameters: fieldName - name of the field Parameters: node - a String containing the complate contents of a field as text. since: MMBase-1.8 |
getSingularName | public String getSingularName(String lang)(Code) | | Gets short name of the builder, using the specified language.
Parameters: lang - The language requested the short name in that language, or null if it is not available |
getSingularName | public String getSingularName()(Code) | | Gets short name of the builder in the current default language.
If the current language is not available, the "en" version is returned instead.
If that name is not available, the internal builder name (table name) is returned.
the short name in either the default language or in "en" |
getTmpNode | protected static MMObjectNode getTmpNode(String key)(Code) | | Get nodes from the temporary node space
Parameters: key - The (temporary) key to use under which the node is stored |
getURLEncode | protected static String getURLEncode(String body)(Code) | | Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string.
This version uses the java.net.URLEncoder class to encode it.
Parameters: body - text to convert the URLEncoded text |
getValue | public Object getValue(MMObjectNode node, String field)(Code) | | Provides additional functionality when obtaining field values.
This method is called whenever a Node of the builder's type fails at evaluating a getValue() request
(generally when a fieldname is supplied that doesn't exist).
It allows the system to add 'functions' to be included with a field name, such as 'html(body)' or 'time(lastmodified)'.
This method will parse the fieldname, determining functions and calling the
MMObjectBuilder.executeFunction method to handle it.
Functions in fieldnames can be given in the format 'functionname(fieldname)'. An old format allows 'functionname_fieldname' instead,
though this only applies to the text functions 'short', 'html', and 'wap'.
Functions can be nested, i.e. 'html(shorted(body))'.
Derived builders should override this method only if they want to provide virtual fieldnames. To provide additonal functions,
call
MMObjectBuilder.addFunction instead. See also the source code for
org.mmbase.util.functions.ExampleBuilder .
Parameters: node - the node whos efields are queries Parameters: field - the fieldname that is requested the result of the 'function', or null if no valid functions could be determined. |
getVersion | public int getVersion()(Code) | | Retrieves the version of this builder
the version number |
getWAP | protected static String getWAP(String body)(Code) | | Returns a WAP-version of a string.
This replaces a number of tokens with WAP sequences.
Parameters: body - text to convert the convert text |
getXMLPath | public String getXMLPath()(Code) | | Retrieves the subpath of the builder's xml configuration file.
Needed for builders that reside in subdirectories in the builder configuration file directory.
|
hasField | public boolean hasField(String fieldName)(Code) | | since: MMBase-1.8 |
hashCode | public int hashCode(MMObjectNode o)(Code) | | Implements for MMObjectNode
since: MMBase-1.6.2 |
hostname_function | public static String hostname_function(String url)(Code) | | hostname, parses the hostname from a url, so http://www.mmbase.org/bug
becomed www.mmbase.org
|
init | public boolean init()(Code) | | Initializes this builder
The property 'mmb' needs to be set for the builder before this method can be called.
The method retrieves data from the TypeDef builder, or adds data to that builder if the
current builder is not yet registered.
true if init was completed, false if uncompleted. See Also: MMObjectBuilder.create |
insert | public int insert(int oType, String owner)(Code) | | Insert a new, empty, object of a certain type.
Parameters: oType - The type of object to create Parameters: owner - The administrator creating the node An int value which is the new object's unique number, -1 if the insert failed.The basic routine does not create any nodes this way and always fails. |
insert | public int insert(String owner, MMObjectNode node)(Code) | | Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided).
This method indirectly calls
MMObjectBuilder.preCommit .
Parameters: owner - The administrator creating the node Parameters: node - The object to insert. The object need be of the same type as the current builder. An int value which is the new object's unique number, -1 if the insert failed. |
isExtensionOf | public boolean isExtensionOf(MMObjectBuilder o)(Code) | | Checks wether this builder is an extension of the argument builder
since: MMBase-1.6.2 |
isNodeCached | public boolean isNodeCached(Integer number)(Code) | | Is this node cached at this moment?
Parameters: number - The number of the node to check. true if the node is in the cache, false otherwise |
isVirtual | public boolean isVirtual()(Code) | | Determine whether this builder is virtual.
A virtual builder represents nodes that are not stored or retrieved directly
from storage, but are created as needed.
true if the builder is virtual. |
loadInitParameters | public void loadInitParameters()(Code) | | Override properties through application context
Parameters: contextPath - path in application context where properties are located since: MMBase 1.8.5 |
nodeLocalChanged | public boolean nodeLocalChanged(String machine, String number, String builder, String ctype)(Code) | | Called when a local node is changed.
Should be called by subclasses if they override it.
Parameters: machine - Name of the machine that changed the node. Parameters: number - Number of the changed node as a String Parameters: builder - type of the changed node Parameters: ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new always true |
nodeRemoteChanged | public boolean nodeRemoteChanged(String machine, String number, String builder, String ctype)(Code) | | Called when a remote node is changed.
Should be called by subclasses if they override it.
Parameters: machine - Name of the machine that changed the node. Parameters: number - Number of the changed node as a String Parameters: builder - type of the changed node Parameters: ctype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new always true |
preCommit | public MMObjectNode preCommit(MMObjectNode node)(Code) | | This method is called before an actual write to the storage layer is performed.
Parameters: node - The node to be committed. the node to be committed (possibly after changes have been made). |
process | public boolean process(PageInfo sp, StringTokenizer command, Hashtable cmds, Hashtable vars)(Code) | | The hook that passes all form related pages to the correct handler.
This method is SCAN related and may fail if called outside the context of the SCAN servlet.
The methood is currentkly called by the MMEDIT module, whenever a 'PRC-CMD-BUILDER-...' command
is encountered in the list of commands to be processed.
Parameters: sp - The PageInfo (containing http and user info) that calls the function Parameters: command - a list of strings that describe the (sub)command to execute (the portion after ' PRC-CMD-BUILDER') Parameters: cmds - the commands (PRC-CMD) that are iurrently being processed, including the current command. Parameters: vars - variables (PRC-VAR) thatw ere set to be used during processing. the result value as a String |
putTmpNode | static void putTmpNode(String key, MMObjectNode node)(Code) | | Put a Node in the temporary node list
Parameters: key - The (temporary) key under which to store the node Parameters: node - The node to store |
removeField | public void removeField(String fieldName)(Code) | | Remove a field from this builder.
This does not affect the builder config file, nor the table used.
Parameters: fieldName - the name of the field to remove |
removeNode | public void removeNode(MMObjectNode node)(Code) | | Remove a node from the cloud.
Parameters: node - The node to remove. |
removeRelations | public void removeRelations(MMObjectNode node)(Code) | | Remove the relations of a node.
Parameters: node - The node whose relations to remove. |
removeSyncNodes | protected void removeSyncNodes(MMObjectNode node)(Code) | | Removes the syncnodes to this node. This is logical, but also needed to maintain storage
integrety.
since: MMBase-1.7 |
removeTmpNode | static void removeTmpNode(String key)(Code) | | Remove a node from the temporary node space
Parameters: key - The (temporary) key under which the node is stored |
replace | public String replace(PageInfo sp, StringTokenizer tok)(Code) | | Obtains a string value by performing the provided command.
The command can be called:
- by SCAN : $MOD-MMBASE-BUILDER-[buildername]-[command]
- in jsp : cloud.getNodeManager(buildername).getInfo(command);
This method is SCAN related and some commands may fail if called outside the context of the SCAN servlet.
Parameters: sp - The PageInfo (containing http and user info) that calls the function Parameters: tok - a list of strings that describe the (sub)command to execute the result value as a String |
safeCache | public MMObjectNode safeCache(Integer n, MMObjectNode node)(Code) | | Stores a node in the cache provided the cache is not write locked.
a valid node. If the node already was in the cache, the cached node is returned.In that case the node given as parameter should become invalid |
safeCommit | boolean safeCommit(MMObjectNode node)(Code) | | Locks the node cache during the commit of a node. This prevents the cache from gaining an
invalid state during the commit.
Basicly the goals is to ensure that nothing is put into the cache during a commit of a node,
because that may be the wrong node then.
|
safeInsert | int safeInsert(MMObjectNode node, String userName)(Code) | | Locks the node cache during the insert of a node.
This prevents the cache from adding the node, which
means that the next time the node is read it is 'refreshed'
from the storage
|
sendFieldChangeSignal | public boolean sendFieldChangeSignal(MMObjectNode node, String fieldName)(Code) | | Send a signal to other servers that a field was changed.
Parameters: node - the node the field was changed in Parameters: fieldName - the name of the field that was changed always true |
setDefaults | public void setDefaults(MMObjectNode node)(Code) | | Sets defaults for a node. Fields "number", "owner" and "otype" are not set by this method.
Parameters: node - The node to set the defaults of. |
setDescription | public void setDescription(String e)(Code) | | Set description of the builder
Parameters: e - the description text |
setDescriptions | public void setDescriptions(Hashtable<String, String> e)(Code) | | Set descriptions of the builder
Parameters: e - a Hashtable containing the descriptions |
setFields | public void setFields(List<CoreField> f)(Code) | | Stores fields information of this table.
Asside from the fields supplied by the caller, a field 'otype' is added (if missing).
Parameters: f - A List with fields (as CoreField objects) as defined by MMBase. This may not be in sync with the actual database table, about which Storage will report then. |
setInitParameter | public void setInitParameter(String name, String value)(Code) | | Set a single builder property
The propertie will not be saved.
Parameters: name - name of the property Parameters: value - value of the property |
setInitParameters | void setInitParameters(Hashtable<String, String> properties)(Code) | | Set all builder properties
Changed properties will not be saved.
Parameters: properties - the properties to set |
setMaintainer | public void setMaintainer(String m)(Code) | | Sets the maintainer of this builder
Parameters: m - the name of the maintainer |
setParentBuilder | public void setParentBuilder(MMObjectBuilder parent)(Code) | | Sets the builder that this builder extends, and registers it in the storage layer.
Parameters: parent - the extended (parent) builder, or null if not available since: MMBase-1.6 |
setSearchAge | public void setSearchAge(String age)(Code) | | Sets search Age.
Parameters: age - the search age as a String |
setSingularNames | public void setSingularNames(Hashtable<String, String> names)(Code) | | Sets a list of singular names (language - value pairs)
|
setUniqueValue | protected String setUniqueValue(MMObjectNode node, String field, String baseValue)(Code) | | In setDefault you could want to generate unique values for fields (if the field is 'unique').
since: MMBase-1.7 |
setUniqueValue | protected int setUniqueValue(MMObjectNode node, String field, int offset)(Code) | | In setDefault you could want to generate unique values for fields (if the field is 'unique').
since: MMBase-1.7 |
setValue | public boolean setValue(MMObjectNode node, String fieldName, Object originalValue)(Code) | | Sets a key/value pair in the main values of this node.
Note that if this node is a node in cache, the changes are immediately visible to
everyone, even if the changes are not committed.
The fieldname is added to the (public) 'changed' vector to track changes.
Parameters: fieldName - the name of the field to change Parameters: node - The node on which to change the field (the new value is in this node) Parameters: originalValue - the value which was original in the field true When an update is required(when changed),false if original value was set back into the field. |
setValue | public boolean setValue(MMObjectNode node, String fieldName)(Code) | | Provides additional functionality when setting field values.
This method is called whenever a Node of the builder's type tries to change a value.
It allows the system to add functionality such as checking valid data.
Derived builders should override this method if they want to add functionality.
Parameters: node - the node whose fields are changed Parameters: fieldName - the fieldname that is changed true if the call was handled. |
setVersion | public void setVersion(int i)(Code) | | Sets the version of this builder
Parameters: i - the version number |
setXMLPath | public void setXMLPath(String m)(Code) | | Sets the subpath of the builder's xml configuration file.
|
toString | public String toString()(Code) | | Implmenting a sensible toString is usefull for debugging.
since: MMBase-1.6.2 |
update | protected void update()(Code) | | Updates the internal version number of this buidler;
|
updateFields | protected void updateFields()(Code) | | Clears all field list caches, and recalculates the field list.
|
wrap | public static String wrap(String text, int width)(Code) | | Wraps a string.
Inserts newlines (\n) into a string at periodic intervals, to simulate wrapping.
This also removes whitespace to the start of a line.
Parameters: text - the text to wrap Parameters: width - the maximum width to wrap at the wrapped tekst |
|
|