public class MMObjectBuilder extends MMTable implements NodeEventListener, RelationEventListener
| Modifier and Type | Field and Description |
|---|---|
static Parameter<?>[] |
AGE_PARAMETERS
Parameters for the age function
|
protected boolean |
broadCastChanges
Determines whether changes to this builder need be broadcast to other known mmbase servers.
|
static String |
DEFAULT_ALINEA
Default replacements for method getHTML()
|
static String |
DEFAULT_EOL |
String |
description
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.
|
protected Map<String,String> |
descriptions
Descriptions of the builder per language
Can be set with the <descriptions> tag in the xml builder file.
|
static int |
EVENT_TYPE_LOCAL |
static int |
EVENT_TYPE_REMOTE |
static String |
FIELD_NUMBER
Name of the field containing the object number, which uniquely identifies the node.
|
static String |
FIELD_OBJECT_TYPE
Name of the field containing the object type number.
|
static String |
FIELD_OWNER
Name of the field containing the owner.
|
protected Map<String,CoreField> |
fields |
protected static BlobCache |
genericBlobCache
The cache for all blobs.
|
protected Function<Collection<? extends Function>> |
getFunctions
Every Function Provider provides least the 'getFunctions' function, which returns a Set of all functions which it provides.
|
static String |
GUI_INDICATOR
Default output when no data is available to determine a node's GUI description
|
static Parameter<?>[] |
GUI_PARAMETERS
Parameters for the GUI function
|
protected Function<String> |
guiFunction
The famous GUI function as a function object.
|
protected Function<Object> |
infoFunction
The info-function is a node-function and a builder-function.
|
protected long |
internalVersion
Internal (instance) version number of this builder.
|
(package private) String |
maintainer
Maintainer information for builder registration
Set with <builder maintainer="mmbase.org" version="0"> in the xml builder file
|
protected static NodeCache |
nodeCache
The cache that contains the X last requested nodes
|
protected int |
oType
The current builder's object type
Retrieved from the TypeDef builder.
|
protected Map<String,String> |
pluralNames
Collections of (GUI) names (plural) for the builder's objects, divided by language
|
String |
searchAge
The default search age for this builder.
|
protected Map<String,String> |
singularNames
Collections of (GUI) names (singular) for the builder's objects, divided by language
|
static String |
SYSTEM_OWNER
Default (system) owner name for the owner field.
|
static int |
TEMPNODE_DEFAULT_SIZE
Default size of the temporary node cache
|
static Map<String,MMObjectNode> |
temporaryNodes
Collection for temporary nodes,
Used by the Temporarynodemanager when working with transactions
The default size is 1024.
|
static String |
TMP_FIELD_EXISTS |
static String |
TMP_FIELD_NUMBER |
(package private) static String |
TMP_FIELD_RESOLVED |
protected boolean |
virtual
Determines whether a builder is virtual (data is not stored in the storage layer).
|
protected static Parameter<?>[] |
WRAP_PARAMETERS
Parameters constants for the NodeFunction
wrapFunction. |
protected Function<String> |
wrapFunction
This function wraps the text of a node's field and returns the result as a String.
|
(package private) String |
xmlPath
Full filename (path + buildername + ".xml") where we loaded the builder from
It is relative from the '/builders/' subdir
|
maxNodesFromQuery, mmb, storageConnector, tableNamefunctions| Constructor and Description |
|---|
MMObjectBuilder()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(EventListener listener)
simple way to register a NodeEvent listener and a RelationEventListener
at the same time.
|
void |
addField(CoreField def)
Add a field to this builder.
|
boolean |
addLocalObserver(MMBaseObserver obs)
Deprecated.
use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)
|
boolean |
addRemoteObserver(MMBaseObserver obs)
Deprecated.
use the new event system as well. check out addEventListener(Object listener) or MMBase.addEventListener(EventListener listener)
|
boolean |
broadcastChanges()
Determines whether changes to this builder need be broadcast to other known mmbase servers.
|
boolean |
checkAddTmpField(String field)
Defines a virtual field to use for temporary nodes.
|
int |
clearBlobCache(int nodeNumber) |
boolean |
commit(MMObjectNode node)
Commit changes to this node to the storage layer.
|
boolean |
create()
Creates a new builder table in the storage layer.
|
boolean |
createAlias(int number,
String alias)
Creates an alias for a node, provided the OAlias builder is loaded.
|
boolean |
createAlias(int number,
String alias,
String owner)
Creates an alias for a node, provided the OAlias builder is loaded.
|
void |
createIfNotExists()
Creates the associated database table, unless it already exists.
|
void |
delete()
Removes the builder from the storage.
|
boolean |
equals(MMObjectNode o1,
MMObjectNode o2)
Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode)
|
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.
|
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)
Deprecated.
|
boolean |
fieldLocalChanged(String number,
String builder,
String field,
String value)
Called when a local field is changed.
|
List<MMObjectBuilder> |
getAncestors()
Gives the list of parent-builders.
|
protected BlobCache |
getBlobCache(String fieldName)
Returns
|
String |
getClassName()
Deprecated.
don't use
|
File |
getConfigFile()
Deprecated.
Need something as getConfigResource in stead.
|
String |
getConfigResource() |
DataTypeCollector |
getDataTypeCollector()
Returns the datatype collector belonging to this buidler.
|
int |
getDBState(String fieldName)
Return a field's storage state.
|
int |
getDBType(String fieldName)
Return a field's storage type.
|
MMObjectNode |
getDefaultTeaser(MMObjectNode node,
MMObjectNode tnode)
Deprecated.
Will be removed?
|
String |
getDefaultUrl(int src)
Return the default url of this object.
|
List<MMObjectBuilder> |
getDescendants()
Returns an (unmodifiable) list of all descendant-builders.
|
String |
getDescription()
Get description of the builder
|
String |
getDescription(String lang)
Gets description of the builder, using the specified language.
|
Map<String,String> |
getDescriptions()
Get descriptions of the builder
|
MMObjectNode |
getEmptyNode(String owner)
Returns a new empty node object.
|
FieldDefs |
getField(String fieldName)
Return a field's definition
|
Set<String> |
getFieldNames()
Return a list of field names of this table.
|
Collection<CoreField> |
getFields()
Return a copy of the list of field definitions of this table.
|
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.
|
protected List<String> |
getFunctionParameters(String fields)
Deprecated.
use executeFunction(node, function, list)
|
protected Collection<Function<?>> |
getFunctions(MMObjectNode node)
Returns all Functions which are available (or at least known to be available) on a Node.
|
(package private) Object |
getFunctionValue(MMObjectNode node,
String functionName,
List<?> parameters)
Executes a 'function' on a MMObjectNode.
|
String |
getGUIIndicator(MMObjectNode node)
What should a GUI display for this node.
|
String |
getGUIIndicator(MMObjectNode node,
Parameters pars)
A complicated default implementation for GUI.
|
String |
getGUIIndicator(String fieldName,
MMObjectNode node)
What should a GUI display for this node/field combo.
|
protected String |
getHTML(String body)
Deprecated.
|
String |
getInitParameter(String name)
Retrieve a specific property.
|
Map<String,String> |
getInitParameters()
Get all builder properties
|
Map<String,String> |
getInitParameters(String contextPath)
Get all builder properties and override properties through application context
|
long |
getInternalVersion()
Returns the builder's internal version number.
|
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,
MMObjectNode node)
The GUIIndicator can depend on the locale.
|
protected String |
getLocaleGUIIndicator(Locale locale,
String field,
MMObjectNode node)
The GUIIndicator can depend on the locale.
|
String |
getMachineName()
Get the name of this mmserver from the MMBase Root
|
String |
getMaintainer()
Retrieves the maintainer of this builder
|
MMObjectNode |
getNewNode(String owner)
Get a new node, using this builder as its parent.
|
protected MMObjectNode |
getNewTmpNode(String owner,
String key)
Create a new temporary node and put it in the temporary _exist
node space
|
FieldDefs |
getNextField(String currentfield)
Deprecated.
use getNextField() with sortorder ORDER_EDIT
|
FieldDefs |
getNextField(String currentfield,
int sortorder)
Returns the next field as defined by its sortorder, according to the specified order.
|
MMObjectNode |
getNode(int number)
Retrieves a node based on it's number (a unique key), retrieving the node
from the node cache if possible.
|
MMObjectNode |
getNode(String key)
Retrieves a node based on a unique key.
|
MMObjectNode |
getNode(String key,
boolean useCache)
Retrieves a node based on a unique key.
|
MMObjectNode |
getNodeFromCache(Integer number)
Retrieves a node from the cache, or
null if it doesn't exist. |
protected String |
getNodeGUIIndicator(MMObjectNode node,
Parameters params)
Returns a GUI-indicator for the node itself.
|
int |
getNumber()
Returns the builder object number, which also functions as the objecttype.
|
int |
getObjectType()
Returns the objecttype (otype).
|
protected Object |
getObjectValue(MMObjectNode node,
String field)
Like getValue, but without the 'old' code (short_ html_ etc).
|
MMObjectBuilder |
getParentBuilder()
Returns the builder that this builder extends.
|
String |
getPluralName()
Gets long name of the builder in the current default language.
|
String |
getPluralName(String lang)
Gets long name of the builder, using the specified language.
|
Map<String,String> |
getPluralNames()
Gets a list of plural names (language - value pairs)
|
Vector<MMObjectNode> |
getRelations_main(int src)
Returns all relations of a node.
|
String |
getSearchAge()
Gets search Age
|
String |
getShort(String str,
int len)
Support routine to return shorter strings.
|
protected byte[] |
getShortedByte(String fieldName,
MMObjectNode node)
|
protected InputStream |
getShortedInputStream(String fieldName,
MMObjectNode node)
Get binary data of a blob field.
|
protected String |
getShortedText(String fieldName,
MMObjectNode node)
Get text from a blob field.
|
String |
getSingularName()
Gets short name of the builder in the current default language.
|
String |
getSingularName(String lang)
Gets short name of the builder, using the specified language.
|
Map<String,String> |
getSingularNames()
Gets a list of singular names (language - value pairs)
|
String |
getSmartPath(String documentRoot,
String path,
String nodeNumber,
String version)
Deprecated.
This method will be finalized in MMBase 1.9 and removed afterwards.
You can implement a new smart-path for your builders, with a class like
SmartPathFunction in stead, and configure it in your builder xml as
the implementation for the 'smartpath' function. This makes extensions less dependent on
precise arguments (e.g. 'documentRoot' is not relevant for 'resourceloader' implementation),
and makes this function pluggable on all builders. See also MMB-1449. |
protected static MMObjectNode |
getTmpNode(String key)
Get nodes from the temporary node space
|
protected static String |
getURLEncode(String body)
Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string.
|
Object |
getValue(MMObjectNode node,
String field)
Provides additional functionality when obtaining field values.
|
int |
getVersion()
Retrieves the version of this builder
|
protected static String |
getWAP(String body)
Returns a WAP-version of a string.
|
String |
getXMLPath()
Retrieves the subpath of the builder's xml configuration file.
|
boolean |
hasField(String fieldName) |
int |
hashCode() |
int |
hashCode(MMObjectNode o)
Implements for MMObjectNode
|
static String |
hostname_function(String url)
Deprecated.
Has nothing to do with mmbase nodes. Should be in org.mmbase.util
|
boolean |
init()
Initializes this builder
The property 'mmb' needs to be set for the builder before this method can be called.
|
int |
insert(int oType,
String owner)
Insert a new, empty, object of a certain type.
|
int |
insert(String owner,
MMObjectNode node)
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided).
|
boolean |
isExtensionOf(MMObjectBuilder o)
Checks wether this builder is an extension of the argument builder
|
boolean |
isNodeCached(Integer number)
Is this node cached at this moment?
|
protected boolean |
isNull(String fieldName,
MMObjectNode node) |
boolean |
isVirtual()
Determine whether this builder is virtual.
|
void |
loadInitParameters()
Override properties through application context
|
protected Function |
newFunctionInstance(String name,
Parameter[] parameters,
ReturnType returnType) |
boolean |
nodeLocalChanged(String machine,
String number,
String builder,
String ctype)
Deprecated.
use notify(NodeEvent) in stead
|
boolean |
nodeRemoteChanged(String machine,
String number,
String builder,
String ctype)
Deprecated.
use notify(NodeEvent) in stead
|
void |
notify(NodeEvent event) |
void |
notify(RelationEvent event) |
MMObjectNode |
preCommit(MMObjectNode node)
This method is called before an actual write to the storage layer is performed.
|
boolean |
process(PageInfo sp,
StringTokenizer command,
Hashtable cmds,
Hashtable vars)
The hook that passes all form related pages to the correct handler.
|
(package private) static void |
putTmpNode(String key,
MMObjectNode node)
Put a Node in the temporary node list
|
void |
removeEventListener(EventListener listener) |
void |
removeField(String fieldName)
Remove a field from this builder.
|
boolean |
removeLocalObserver(MMBaseObserver obs) |
void |
removeNode(MMObjectNode node)
Remove a node from the cloud.
|
void |
removeRelations(MMObjectNode node)
Remove the relations of a node.
|
boolean |
removeRemoteObserver(MMBaseObserver obs) |
protected void |
removeSyncNodes(MMObjectNode node)
Removes the syncnodes to this node.
|
(package private) static void |
removeTmpNode(String key)
Remove a node from the temporary node space
|
String |
replace(PageInfo sp,
StringTokenizer tok)
Obtains a string value by performing the provided command.
|
MMObjectNode |
safeCache(Integer n,
MMObjectNode node)
Stores a node in the cache provided the cache is not write locked.
|
(package private) boolean |
safeCommit(MMObjectNode node)
Locks the node cache during the commit of a node.
|
(package private) int |
safeInsert(MMObjectNode node,
String userName)
Locks the node cache during the insert of a node.
|
boolean |
sendFieldChangeSignal(MMObjectNode node,
String fieldName)
Send a signal to other servers that a field was changed.
|
void |
setDefaults(MMObjectNode node)
Sets defaults for a node.
|
void |
setDescription(String e)
Set description of the builder
|
void |
setDescriptions(Map<String,String> e)
Set descriptions of the builder
|
void |
setFields(List<CoreField> f)
Stores fields information of this table.
|
void |
setInitParameter(String name,
String value)
Set a single builder property
The propertie will not be saved.
|
(package private) void |
setInitParameters(Map<String,String> properties)
Set all builder properties
Changed properties will not be saved.
|
void |
setMaintainer(String m)
Sets the maintainer of this builder
|
(package private) void |
setParentBuilder(MMObjectBuilder parent)
Sets the builder that this builder extends, and registers it in the storage layer.
|
void |
setPluralNames(Map<String,String> names)
Sets a list of plural names (language - value pairs)
|
void |
setSearchAge(String age)
Sets search Age.
|
void |
setSingularNames(Map<String,String> names)
Sets a list of singular names (language - value pairs)
|
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').
|
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').
|
boolean |
setValue(MMObjectNode node,
String fieldName)
Provides additional functionality when setting field values.
|
boolean |
setValue(MMObjectNode node,
String fieldName,
Object originalValue)
Sets a key/value pair in the main values of this node.
|
void |
setVersion(int i)
Sets the version of this builder
|
void |
setXMLPath(String m)
Sets the subpath of the builder's xml configuration file.
|
void |
shutdown()
clean all acquired resources, because system is shutting down
|
void |
testValidData(MMObjectNode node)
Tests whether the data in a node is valid (throws an exception if this is not the case).
|
String |
toString()
Implmenting a sensible toString is usefull for debugging.
|
String |
toString(MMObjectNode n)
Implements for MMObjectNode
|
protected void |
update()
Updates the internal version number of this buidler;
|
protected void |
updateFields()
Clears all field list caches, and recalculates the field list.
|
static String |
wrap(String text,
int width)
Wraps a string.
|
count, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, setTableName, sizeaddFunction, createParameters, getFunction, getFunctions, getFunctionValuepublic static final String FIELD_NUMBER
public static final String FIELD_OWNER
public static final String FIELD_OBJECT_TYPE
public static final String TMP_FIELD_NUMBER
public static final String TMP_FIELD_EXISTS
static final String TMP_FIELD_RESOLVED
public static final String SYSTEM_OWNER
public static final int TEMPNODE_DEFAULT_SIZE
public static final String DEFAULT_ALINEA
public static final String DEFAULT_EOL
public static final int EVENT_TYPE_LOCAL
public static final int EVENT_TYPE_REMOTE
public static final Parameter<?>[] AGE_PARAMETERS
public static Map<String,MMObjectNode> temporaryNodes
public static final String GUI_INDICATOR
protected static final BlobCache genericBlobCache
protected static final NodeCache nodeCache
public String description
protected Map<String,String> descriptions
public String searchAge
protected boolean broadCastChanges
protected long internalVersion
protected int oType
String maintainer
protected Map<String,String> singularNames
protected Map<String,String> pluralNames
String xmlPath
public static final Parameter<?>[] GUI_PARAMETERS
protected Function<String> guiFunction
protected static final Parameter<?>[] WRAP_PARAMETERS
wrapFunction.protected Function<String> wrapFunction
protected Function<Collection<? extends Function>> getFunctions
protected Function<Object> infoFunction
protected boolean virtual
public boolean init()
create()public void createIfNotExists()
init() if you want to use the table already then. This is only possible if
there are not dependencies on other builders which might not yet be initalized (MMB-1991).public void shutdown()
public int getNumber()
public int getObjectType()
getNumber() for future compatibility with the bridge NodeManager methods.protected void update()
public long getInternalVersion()
public boolean create()
public void delete()
public void testValidData(MMObjectNode node) throws InvalidDataException
node - The node whose data to checkInvalidDataException - If the data was unrecoverably invalid (the references did not point to existing objects)public int insert(int oType,
String owner)
oType - The type of object to createowner - The administrator creating the nodeint 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.public int insert(String owner, MMObjectNode node)
preCommit(org.mmbase.module.core.MMObjectNode).owner - The administrator creating the nodenode - The object to insert. The object need be of the same type as the current builder.int value which is the new object's unique number, -1 if the insert failed.public MMObjectNode preCommit(MMObjectNode node)
node - The node to be committed.public boolean commit(MMObjectNode node)
preCommit(org.mmbase.module.core.MMObjectNode).
Use only to commit changes - for adding node, use insert(int, java.lang.String).node - The node to be committedpublic boolean broadcastChanges()
public boolean createAlias(int number,
String alias,
String owner)
number - the to-be-aliased node's unique numberalias - the aliasname to associate with the objectowner - the owner of the aliaspublic boolean createAlias(int number,
String alias)
number - the to-be-aliased node's unique numberalias - the aliasname to associate with the objectpublic MMObjectBuilder getParentBuilder()
public List<MMObjectBuilder> getAncestors()
public List<MMObjectBuilder> getDescendants()
void setParentBuilder(MMObjectBuilder parent)
parent - the extended (parent) builder, or null if not availablepublic DataTypeCollector getDataTypeCollector()
public boolean isExtensionOf(MMObjectBuilder o)
public MMObjectNode getNewNode(String owner)
insert(int, java.lang.String) to add the node to the
cloud).owner - The administrator creating the new node.MMObjectNode.public MMObjectNode getEmptyNode(String owner)
public void setDefaults(MMObjectNode node)
node - The node to set the defaults of.protected String setUniqueValue(MMObjectNode node, String field, String baseValue)
protected int setUniqueValue(MMObjectNode node, String field, int offset)
public void removeNode(MMObjectNode node)
node - The node to remove.protected void removeSyncNodes(MMObjectNode node)
public void removeRelations(MMObjectNode node)
node - The node whose relations to remove.public boolean isNodeCached(Integer number)
number - The number of the node to check.true if the node is in the cache, false otherwisepublic MMObjectNode getNodeFromCache(Integer number)
null if it doesn't exist.number - The number of the node to retrieve.null if the node is not in the cachepublic MMObjectNode safeCache(Integer n, MMObjectNode node)
boolean safeCommit(MMObjectNode node)
int safeInsert(MMObjectNode node, String userName)
public boolean isVirtual()
true if the builder is virtual.public MMObjectNode getNode(String key, boolean useCache)
key - The value to search foruseCache - 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 a
MMObjectNode containing the contents of the requested node.public MMObjectNode getNode(String key)
key - The value to search fornull if the node does not exist or the key is invalid, or a
MMObjectNode containing the contents of the requested node.public MMObjectNode getNode(int number)
number - The number of the node to search fornull if the node does not exist or the key is invalid, or a
MMObjectNode containign the contents of the requested node.protected MMObjectNode getNewTmpNode(String owner, String key)
static void putTmpNode(String key, MMObjectNode node)
key - The (temporary) key under which to store the nodenode - The node to storepublic boolean checkAddTmpField(String field)
field - the name of the temporary fieldprotected static MMObjectNode getTmpNode(String key)
key - The (temporary) key to use under which the node is storedstatic void removeTmpNode(String key)
key - The (temporary) key under which the node is storedpublic Collection<CoreField> getFields()
Collection with the tables fieldspublic Set<String> getFieldNames()
Set with the tables field namespublic FieldDefs getField(String fieldName)
fieldName - the requested field's nameFieldDefs belonging with the indicated fieldpublic boolean hasField(String fieldName)
protected void updateFields()
public void addField(CoreField def)
def - the field definiton to addpublic void removeField(String fieldName)
fieldName - the name of the field to removepublic int getDBType(String fieldName)
fieldName - the requested field's namepublic int getDBState(String fieldName)
fieldName - the requested field's namepublic String getGUIIndicator(MMObjectNode node, Parameters pars)
protected String getNodeGUIIndicator(MMObjectNode node, Parameters params)
public String getGUIIndicator(MMObjectNode node)
getNodeGUIIndicator(org.mmbase.module.core.MMObjectNode, org.mmbase.util.functions.Parameters) for more flexibility.node - The node to displayStringpublic String getGUIIndicator(String fieldName, MMObjectNode node)
node - The node to displayfieldName - the name field of the field to displayString, null if not specifiedprotected String getLocaleGUIIndicator(Locale locale, String field, MMObjectNode node)
protected String getLocaleGUIIndicator(Locale locale, MMObjectNode node)
getNodeGUIIndicator(org.mmbase.module.core.MMObjectNode, org.mmbase.util.functions.Parameters) for more flexibility.public List<CoreField> getFields(int sortOrder)
sortOrder - One of the sortorders defined in
CoreFieldpublic FieldDefs getNextField(String currentfield, int sortorder)
public FieldDefs getNextField(String currentfield)
public int clearBlobCache(int nodeNumber)
public Object getValue(MMObjectNode node, String field)
executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List<?>) 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 FunctionProvider.addFunction(org.mmbase.util.functions.Function<?>) instead. See also the source code for ExampleBuilder.node - the node whos efields are queriesfield - the fieldname that is requestedprotected Object getObjectValue(MMObjectNode node, String field)
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String)protected List<String> getFunctionParameters(String fields)
fields - The string, containing function parameters.final Object getFunctionValue(MMObjectNode node, String functionName, List<?> parameters)
FunctionProvider.addFunction(org.mmbase.util.functions.Function<?>) in your extension if you want to add functions.node - The node on which the function must be executedfunctionName - The string identifying the funcionparameters - The list with function argument or null (which means 'no arguments')executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List<?>)protected Function<?> getFunction(MMObjectNode node, String functionName)
node - The Node for on which the function must workfunctionName - Name of the request function.null if no such function.protected Collection<Function<?>> getFunctions(MMObjectNode node)
protected Function newFunctionInstance(String name, Parameter[] parameters, ReturnType returnType)
newFunctionInstance in class FunctionProviderprotected Object executeFunction(MMObjectNode node, String function, List<?> arguments)
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method.
Derived builders should override this method to provide additional functions.IllegalArgumentException - if the argument List does not
fit the functionexecuteFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List<?>)protected Object executeFunction(MMObjectNode node, String function, String field)
getFunction(MMObjectNode, String)getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method.
current functions are:node - the node whose fields are queriesfield - the fieldname that is requestedpublic Vector<MMObjectNode> getRelations_main(int src)
src - the number of the node to obtain the relations fromVector with InsRel nodespublic String getDefaultUrl(int src)
null.src - the number of the node to obtain the url fromString, or null if unknown.public final String getSmartPath(String documentRoot, String path, String nodeNumber, String version)
SmartPathFunction in stead, and configure it in your builder xml as
the implementation for the 'smartpath' function. This makes extensions less dependent on
precise arguments (e.g. 'documentRoot' is not relevant for 'resourceloader' implementation),
and makes this function pluggable on all builders. See also MMB-1449.public String getMachineName()
String which is the server's namepublic boolean nodeRemoteChanged(String machine, String number, String builder, String ctype)
machine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtruepublic boolean nodeLocalChanged(String machine, String number, String builder, String ctype)
machine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=newtruepublic boolean fieldLocalChanged(String number, String builder, String field, String value)
number - Number of the changed node as a Stringbuilder - type of the changed nodefield - name of the changed fieldvalue - value it changed totruepublic boolean addRemoteObserver(MMBaseObserver obs)
truepublic boolean addLocalObserver(MMBaseObserver obs)
truepublic boolean removeLocalObserver(MMBaseObserver obs)
public boolean removeRemoteObserver(MMBaseObserver obs)
public MMObjectNode getDefaultTeaser(MMObjectNode node, MMObjectNode tnode)
public Vector<String> getList(PageInfo sp, StringTagger tagger, StringTokenizer tok)
sp - The PageInfo (containing http and user info) that calls the functiontagger - a Hashtable of parameters (name-value pairs) for the commandtok - a list of strings that describe the (sub)command to executeVector containing the result values as a Stringpublic String replace(PageInfo sp, StringTokenizer tok)
sp - The PageInfo (containing http and user info) that calls the functiontok - a list of strings that describe the (sub)command to executeStringpublic boolean process(PageInfo sp, StringTokenizer command, Hashtable cmds, Hashtable vars)
sp - The PageInfo (containing http and user info) that calls the functioncommand - a list of strings that describe the (sub)command to execute (the portion after ' PRC-CMD-BUILDER')cmds - the commands (PRC-CMD) that are iurrently being processed, including the current command.vars - variables (PRC-VAR) thatw ere set to be used during processing.Stringpublic void setDescription(String e)
e - the description textpublic void setDescriptions(Map<String,String> e)
e - a Map containing the descriptionspublic String getDescription()
public String getDescription(String lang)
lang - The language requestednull if it is not avaialblepublic Map<String,String> getDescriptions()
Map containing the descriptionspublic void setSearchAge(String age)
age - the search age as a Stringpublic String getSearchAge()
Stringpublic String getSingularName(String lang)
lang - The language requestednull if it is not availablepublic String getSingularName()
public String getPluralName(String lang)
lang - The language requestednull if it is not availablepublic String getPluralName()
public String getClassName()
public boolean sendFieldChangeSignal(MMObjectNode node, String fieldName)
node - the node the field was changed infieldName - the name of the field that was changedtruepublic void setSingularNames(Map<String,String> names)
public Map<String,String> getSingularNames()
public void setPluralNames(Map<String,String> names)
public Map<String,String> getPluralNames()
protected String getShortedText(String fieldName, MMObjectNode node)
fieldName - name of the fieldnode - String containing the complate contents of a field as text.protected byte[] getShortedByte(String fieldName, MMObjectNode node)
fieldName - name of the fieldnode - byte containing the complete contents of the field.protected InputStream getShortedInputStream(String fieldName, MMObjectNode node)
fieldName - name of the fieldnode - public boolean setValue(MMObjectNode node, String fieldName, Object originalValue)
fieldName - the name of the field to changenode - The node on which to change the field (the new value is in this node)originalValue - the value which was original in the fieldtrue When an update is required(when changed),
false if original value was set back into the field.public boolean setValue(MMObjectNode node, String fieldName)
node - the node whose fields are changedfieldName - the fieldname that is changedtrue if the call was handled.protected String getHTML(String body)
body - text to convertprotected static String getWAP(String body)
body - text to convertprotected static String getURLEncode(String body)
body - text to convertpublic String getShort(String str, int len)
str - the string to shortenlen - the maximum lengthpublic void setFields(List<CoreField> f)
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.public void setXMLPath(String m)
public String getXMLPath()
public String getConfigResource()
public File getConfigFile()
void setInitParameters(Map<String,String> properties)
properties - the properties to setpublic Map<String,String> getInitParameters()
Map containing the current propertiespublic void loadInitParameters()
public Map<String,String> getInitParameters(String contextPath)
contextPath - path in application context where properties are locatedMap containing the current propertiespublic void setInitParameter(String name, String value)
name - name of the propertyvalue - value of the propertypublic String getInitParameter(String name)
name - the name of the property to getStringpublic void setVersion(int i)
i - the version numberpublic int getVersion()
public String getMaintainer()
public void setMaintainer(String m)
m - the name of the maintainerpublic static String hostname_function(String url)
public static String wrap(String text, int width)
text - the text to wrapwidth - the maximum width to wrap atpublic String toString()
public final boolean equals(Object o)
public int hashCode()
hashCode in class ObjectObject.hashCode()public String toString(MMObjectNode n)
public boolean equals(MMObjectNode o1, MMObjectNode o2)
public int hashCode(MMObjectNode o)
public void addEventListener(EventListener listener)
listener - MMBase.addNodeRelatedEventsListener(java.lang.String, org.mmbase.core.event.EventListener)public void removeEventListener(EventListener listener)
listener - public void notify(NodeEvent event)
notify in interface NodeEventListenerhere we handle all the backward compatibility stuff.
this method covers for both node and relation events.public void notify(RelationEvent event)
notify in interface RelationEventListenerprotected boolean isNull(String fieldName, MMObjectNode node)
MMBase 1.9-SNAPSHOT - ${javadoctimestamp}