|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.module.core.MMTable
org.mmbase.module.core.MMObjectBuilder
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).
| Field Summary | |
static Parameter[] |
AGE_PARAMETERS
Parameters for the age function |
boolean |
broadcastChanges
Determines whether changes to this builder need be broadcasted to other known mmbase servers. |
static MMJdbc2NodeInterface |
database
Deprecated. use MMBase.getMMBase().getDatabase() or mmb.getDatabase() instead |
static java.lang.String |
DEFAULT_ALINEA
Default replacements for method getHTML() |
static java.lang.String |
DEFAULT_EOL
|
java.lang.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. |
java.util.Hashtable |
descriptions
Descriptions of the builder per language Can be set with the <descriptions> tag in the xml builder file. |
protected java.util.Hashtable |
fields
|
static Parameter[] |
GUI_PARAMETERS
Parameters for the GUI function |
protected static NodeListCache |
listCache
Results of getNodes |
static NodeCache |
nodeCache
The cache that contains the X last requested nodes |
static int |
OBJ2TYPE_MAX_SIZE
Max size of the object type cache |
int |
oType
The current builder's object type Retrieved from the TypeDef builder. |
static boolean |
REPLACE_CACHE
Determines whether the cache need be refreshed. |
java.lang.String |
searchAge
The default search age for this builder. |
java.util.Vector |
sortedDBLayout
Deprecated. this vector should not be used - if the order of the fields is an issue, use getFields(sortorder). |
static int |
TEMPNODE_DEFAULT_SIZE
Default size of the temporary node cache |
static java.util.Hashtable |
TemporaryNodes
Collection for temporary nodes, Used by the Temporarynodemanager when working with transactions The default size is 1024. |
protected boolean |
virtual
Determines whether a builder is virtual (data is not stored in a database). |
| Fields inherited from class org.mmbase.module.core.MMTable |
mmb, tableName |
| Constructor Summary | |
MMObjectBuilder()
Constructor. |
|
| Method Summary | |
void |
addField(FieldDefs def)
Add a field to this builder. |
boolean |
addLocalObserver(MMBaseObserver obs)
Adds a local observer to this builder. |
boolean |
addRemoteObserver(MMBaseObserver obs)
Adds a remote observer to this builder. |
java.lang.String |
buildSet(java.util.Vector nodes,
java.lang.String fieldName)
Build a set command string from a set nodes ( should be moved ) |
boolean |
checkAddTmpField(java.lang.String field)
Defines a virtual field to use for temporary nodes. |
boolean |
commit(MMObjectNode node)
Commit changes to this node to the database. |
java.lang.String |
convertMMNode2SQL(java.lang.String where)
Converts an MMNODE expression to an SQL expression. |
int |
count(NodeSearchQuery query)
Counts number of nodes matching a specified constraint. |
int |
count(java.lang.String where)
Deprecated. Use count(NodeSearchQuery)
instead. |
boolean |
create()
Creates a new builder table in the current database. |
boolean |
createAlias(int number,
java.lang.String alias)
Creates an alias for a node, provided the OAlias builder is loaded. |
void |
delete()
Removes the builder from the storage. |
void |
deleteNodeCache()
Delete the nodes cache. |
boolean |
drop()
Deprecated. use delete() |
boolean |
equals(MMObjectNode o1,
MMObjectNode o2)
Implements equals for nodes (this is in MMObjectBuilder because you cannot override MMObjectNode) |
boolean |
equals(java.lang.Object o)
Equals must be implemented because of the list of MMObjectBuilder which is used for ancestors |
protected java.lang.Object |
executeFunction(MMObjectNode node,
java.lang.String function,
java.util.List arguments)
Executes a function on the field of a node, and returns the result. |
protected java.lang.Object |
executeFunction(MMObjectNode node,
java.lang.String function,
java.lang.String field)
Deprecated. use executeFunction(MMObjectNode, String, List) |
boolean |
fieldLocalChanged(java.lang.String number,
java.lang.String builder,
java.lang.String field,
java.lang.String value)
Called when a local field is changed. |
int |
getAge(MMObjectNode node)
Return the age of the node, determined using the daymarks builder. |
MMObjectNode |
getAliasedNode(java.lang.String key)
Deprecated. Use getNode(java.lang.String) instead. |
protected java.util.List |
getAncestors()
Gives the list of parent-builders. |
java.lang.String |
getCacheNumbers()
Get the numbers of the nodes cached (will be removed). |
int |
getCacheSize()
Gets the number of nodes currently in the cache. |
int |
getCacheSize(java.lang.String type)
Return the number of nodes in the cache of one objecttype. |
java.lang.String |
getClassName()
Deprecated. don't use |
java.io.File |
getConfigFile()
Gets the file that contains the configuration of this builder |
byte[] |
getDBByte(java.sql.ResultSet rs,
int idx)
Get binary data of a database blob field. |
int |
getDBKey()
Get the next database key (unique index for an object). |
int |
getDBState(java.lang.String fieldName)
Return a field's database state. |
java.lang.String |
getDBText(java.sql.ResultSet rs,
int idx)
Get text from a blob field. |
int |
getDBType(java.lang.String fieldName)
Return a field's database type. |
MMObjectNode |
getDefaultTeaser(MMObjectNode node,
MMObjectNode tnode)
Deprecated. Will be removed? |
java.lang.String |
getDefaultUrl(int src)
Return the default url of this object. |
java.util.List |
getDescendants()
Creates list of descendant-builders. |
java.lang.String |
getDescription()
Get description of the builder |
java.lang.String |
getDescription(java.lang.String lang)
Gets description of the builder, using the specified language. |
java.util.Hashtable |
getDescriptions()
Get descriptions of the builder |
java.util.Vector |
getEditFields()
Deprecated. use getFields() with sortorder ORDER_SEARCH |
FieldDefs |
getField(java.lang.String fieldName)
Return a field's definition |
java.util.Vector |
getFieldNames()
Return a list of field names of this table. |
java.util.Vector |
getFields()
Return a copy of the list of field definitions of this table. |
java.util.List |
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 java.util.Vector |
getFunctionParameters(java.lang.String fields)
Deprecated. use executeFunction(node, function, list) |
java.lang.String |
getGUIIndicator(MMObjectNode node)
What should a GUI display for this node. |
java.lang.String |
getGUIIndicator(java.lang.String field,
MMObjectNode node)
What should a GUI display for this node/field combo. |
MMObjectNode |
getHardNode(int number)
Retrieves a node based on it's number (a unique key), directly from the database, not using the node cache. |
MMObjectNode |
getHardNode(java.lang.String key)
Retrieves a node based on a unique key. |
protected java.lang.String |
getHTML(java.lang.String body)
Returns a HTML-version of a string. |
java.lang.String |
getInitParameter(java.lang.String name)
Retrieve a specific property. |
java.util.Hashtable |
getInitParameters()
Get all builder properties |
java.util.Vector |
getList(scanpage sp,
StringTagger tagger,
java.util.StringTokenizer tok)
Obtains a list of string values by performing the provided command and parameters. |
protected java.lang.String |
getLocaleGUIIndicator(java.util.Locale locale,
MMObjectNode node)
The GUIIndicator can depend on the locale. |
protected java.lang.String |
getLocaleGUIIndicator(java.util.Locale locale,
java.lang.String field,
MMObjectNode node)
The GUIIndicator can depend on the locale. |
java.lang.String |
getMachineName()
Get the name of this mmserver from the MMBase Root |
java.lang.String |
getMaintainer()
Retrieves the maintainer of this builder |
MMBase |
getMMBase()
Return the MMBase object |
MMObjectNode |
getNewNode(java.lang.String owner)
Get a new node, using this builder as its parent. |
MMObjectNode |
getNewTmpNode(java.lang.String owner,
java.lang.String key)
Create a new temporary node and put it in the temporary _exist node space |
FieldDefs |
getNextField(java.lang.String currentfield)
Deprecated. use getNextField() with sortorder ORDER_EDIT |
FieldDefs |
getNextField(java.lang.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(int number,
boolean useCache)
Retrieves a node based on it's number (a unique key). |
MMObjectNode |
getNode(java.lang.String key)
Retrieves a node based on a unique key. |
MMObjectNode |
getNode(java.lang.String key,
boolean usecache)
Retrieves a node based on a unique key. |
protected java.util.List |
getNodes(java.util.Collection virtuals)
Convert virtual nodes to real nodes based on their otype Normally a multirelations-search will return virtual nodes. |
java.util.List |
getNodes(NodeSearchQuery query)
Returns nodes matching a specified constraint. |
int |
getNodeType(int number)
Retrieves an object's type. |
java.lang.String |
getNumberFromName(java.lang.String name)
Returns the number of the node with the specified name. |
int |
getObjectType()
Returns the objecttype (otype). |
protected java.lang.Object |
getObjectValue(MMObjectNode node,
java.lang.String field)
Like getValue, but without the 'old' code (short_ html_ etc). |
Parameter[] |
getParameterDefinition(java.lang.String function)
perhaps we need something like this |
MMObjectBuilder |
getParentBuilder()
Returns the builder that this builder extends. |
java.lang.String |
getPluralName()
Gets long name of the builder in the current default language. |
java.lang.String |
getPluralName(java.lang.String lang)
Gets long name of the builder, using the specified language. |
java.util.Hashtable |
getPluralNames()
Gets a list of plural names (language - value pairs) |
protected java.lang.String |
getQuery(java.lang.String where)
Deprecated. Use getSearchQuery(String) instead. |
protected java.lang.String |
getQuery(java.lang.String where,
java.lang.String sorted,
boolean direction)
Deprecated. Use getSearchQuery(String,String,String)
instead - specifying direction "UP" or
"DOWN" as appropriate. |
protected java.lang.String |
getQuery(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
Deprecated. Use getSearchQuery(String,String,String)
instead. |
protected java.util.List |
getRawNodes(NodeSearchQuery query)
Returns nodes matching a specified constraint. |
java.util.Vector |
getRelations_main(int src)
Returns all relations of a node. |
java.lang.String |
getSearchAge()
Gets search Age |
java.lang.String |
getShort(java.lang.String str,
int len)
Support routine to return shorter strings. |
byte[] |
getShortedByte(java.lang.String fieldname,
int number)
Get binary data of a database blob field. |
java.lang.String |
getShortedText(java.lang.String fieldname,
int number)
Get text from a blob field. |
java.lang.String |
getSingularName()
Gets short name of the builder in the current default language. |
java.lang.String |
getSingularName(java.lang.String lang)
Gets short name of the builder, using the specified language. |
java.util.Hashtable |
getSingularNames()
Gets a list of singular names (language - value pairs) |
java.lang.String |
getSmartPath(java.lang.String documentRoot,
java.lang.String path,
java.lang.String nodeNumber,
java.lang.String version)
Returns the path to use for TREEPART, TREEFILE, LEAFPART and LEAFFILE. |
java.util.Vector |
getSortedFields()
Deprecated. use getFields() with sortorder ORDER_EDIT |
java.util.Vector |
getSortedListFields()
Deprecated. use getFields() with sortorder ORDER_LIST |
MMObjectNode |
getTmpNode(java.lang.String key)
Get nodes from the temporary node space |
protected java.lang.String |
getURLEncode(java.lang.String body)
Returns a URLEncoded-version (MIME x-www-form-urlencoded) of a string. |
java.lang.Object |
getValue(MMObjectNode node,
java.lang.String field)
Provides additional functionality when obtaining field values. |
int |
getVersion()
Retrieves the version of this builder |
protected java.lang.String |
getWAP(java.lang.String body)
Returns a WAP-version of a string. |
java.lang.String |
getXMLPath()
Retrieves the subpath of the builder's xml configuration file. |
int |
hashCode(MMObjectNode o)
Implements for MMObjectNode |
java.lang.String |
hostname_function(java.lang.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,
java.lang.String owner)
Insert a new, empty, object of a certain type. |
int |
insert(java.lang.String owner,
MMObjectNode node)
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided). |
int |
insertDone(EditState ed,
MMObjectNode node)
Deprecated. This method doesn't seem to fit here, as it references a gui/html object ( EditState),
endangering the separation between content and layout, and has an undefined return value. |
boolean |
isExtensionOf(MMObjectBuilder o)
Checks wether this builder is an extension of the argument builder |
boolean |
isNodeCached(int number)
Is this node cached at this moment? |
boolean |
isVirtual()
Determinw ehether this builder is virtual. |
boolean |
nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a local node is changed. |
boolean |
nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a remote node is changed. |
MMObjectNode |
preCommit(MMObjectNode node)
This method is called before an actual write to the database is performed. |
int |
preEdit(EditState ed,
MMObjectNode node)
Deprecated. This method doesn't seem to fit here, as it references a gui/html object ( EditState),
endangering the separation between content and layout. It also has an undefined return value. |
boolean |
process(scanpage sp,
java.util.StringTokenizer command,
java.util.Hashtable cmds,
java.util.Hashtable vars)
The hook that passes all form related pages to the correct handler. |
void |
processSearchResults(java.util.List results)
Performs some necessary postprocessing on nodes retrieved from a search query. |
void |
putTmpNode(java.lang.String key,
MMObjectNode node)
Put a Node in the temporary node list |
SortedVector |
readSearchResults(java.sql.ResultSet rs,
SortedVector sv)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
void |
removeField(java.lang.String fieldname)
Remove a field from this builder. |
void |
removeNode(MMObjectNode node)
Remove a node from the cloud. |
void |
removeRelations(MMObjectNode node)
Remove the relations of a node. |
protected void |
removeSyncNodes(MMObjectNode node)
Removes the syncnodes to this node. |
void |
removeTmpNode(java.lang.String key)
Remove a node from the temporary node space |
java.lang.String |
replace(scanpage sp,
java.util.StringTokenizer tok)
Obtains a string value by performing the provided command. |
void |
safeCache(java.lang.Integer n,
MMObjectNode node)
Stores a node in the cache provided the cache is not locked. |
boolean |
safeCommit(MMObjectNode node)
Locks the node cache during the commit of a node. |
int |
safeInsert(MMObjectNode node,
java.lang.String userName)
Locks the node cache during the insert of a node. |
java.util.Enumeration |
search(java.lang.String where)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
search(java.lang.String where,
java.lang.String sort)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
search(java.lang.String where,
java.lang.String sort,
boolean direction)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
searchIn(java.lang.String where,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
searchIn(java.lang.String where,
java.lang.String sort,
boolean direction,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
searchIn(java.lang.String where,
java.lang.String sort,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.List |
searchList(java.lang.String where)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.List |
searchList(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchNumbers(java.lang.String where)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVector(java.lang.String where)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVector(java.lang.String where,
java.lang.String sorted)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVector(java.lang.String where,
java.lang.String sorted,
boolean direction)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVector(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVectorIn(java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVectorIn(java.lang.String where,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVectorIn(java.lang.String where,
java.lang.String sorted,
boolean direction,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Vector |
searchVectorIn(java.lang.String where,
java.lang.String sorted,
java.lang.String in)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search. |
java.util.Enumeration |
searchWithWhere(java.lang.String where)
Deprecated. Use getNodes(NodeSearchQuery to perform a node search.
The performance gain is negligible and does not justify
another method. |
boolean |
sendFieldChangeSignal(MMObjectNode node,
java.lang.String fieldname)
Send a signal to other servers that a field was changed. |
void |
setDBLayout_xml(java.util.Hashtable fields)
Deprecated. sortedDBLayout should not be used any more. use the getFields(sortorder) method instead |
void |
setDefaults(MMObjectNode node)
Sets defaults for a node. |
void |
setDescription(java.lang.String e)
Set description of the builder |
void |
setDescriptions(java.util.Hashtable e)
Set descriptions of the builder |
void |
setInitParameter(java.lang.String name,
java.lang.String value)
Set a single builder property The propertie will not be saved. |
void |
setMaintainer(java.lang.String m)
Sets the maintainer of this builder |
void |
setMMBase(MMBase m)
Set the MMBase object, and retrieve the database lasyer. |
void |
setParentBuilder(MMObjectBuilder parent)
Sets the builder that this builder extends, and registers it in the database layer. |
void |
setPluralNames(java.util.Hashtable names)
Sets a list of plural names (language - value pairs) |
void |
setSearchAge(java.lang.String age)
Sets search Age. |
void |
setSingularNames(java.util.Hashtable names)
Sets a list of singular names (language - value pairs) |
void |
setTableName(java.lang.String tableName)
Set tablename of the builder. |
protected int |
setUniqueValue(MMObjectNode node,
java.lang.String field,
int offset)
In setDefault you could want to generate unique values for fields (if the field is 'unique'). |
protected java.lang.String |
setUniqueValue(MMObjectNode node,
java.lang.String field,
java.lang.String baseValue)
In setDefault you could want to generate unique values for fields (if the field is 'unique'). |
boolean |
setValue(MMObjectNode node,
java.lang.String fieldname)
Provides additional functionality when setting field values. |
boolean |
setValue(MMObjectNode node,
java.lang.String fieldName,
java.lang.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(java.lang.String m)
Sets the subpath of the builder's xml configuration file. |
void |
setXMLValues(java.util.Vector xmlfields)
Stores fields information of this table. |
boolean |
signalNewObject(java.lang.String tableName,
int number)
Send a signal to other servers that a new node was created. |
void |
testValidData(MMObjectNode node)
Tests whether the data in a node is valid (throws an exception if this is not the case). |
java.lang.String |
toString()
Implmenting a sensible toString is usefull for debugging. |
java.lang.String |
toString(MMObjectNode n)
Implements for MMObjectNode |
java.lang.String |
toXML(MMObjectNode node)
Converts a node to XML. |
protected void |
updateFields()
Clears all field list caches, and recalculates the database field list. |
boolean |
waitUntilNodeChanged(MMObjectNode node)
Waits until a node is changed (multicast). |
java.lang.String |
wrap(java.lang.String text,
int width)
Wraps a string. |
| Methods inherited from class org.mmbase.module.core.MMTable |
created, getFullTableName, getTableName, size |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int OBJ2TYPE_MAX_SIZE
public static final int TEMPNODE_DEFAULT_SIZE
public static final java.lang.String DEFAULT_ALINEA
public static final java.lang.String DEFAULT_EOL
public static final Parameter[] GUI_PARAMETERS
public static final Parameter[] AGE_PARAMETERS
protected static NodeListCache listCache
public static NodeCache nodeCache
public static java.util.Hashtable TemporaryNodes
public static MMJdbc2NodeInterface database
public int oType
public java.lang.String description
public java.util.Hashtable descriptions
public java.util.Vector sortedDBLayout
public java.lang.String searchAge
public static final boolean REPLACE_CACHE
processSearchResults(java.util.List),
Constant Field Valuespublic boolean broadcastChanges
protected java.util.Hashtable fields
protected boolean virtual
| Constructor Detail |
public MMObjectBuilder()
| Method Detail |
public boolean init()
create()public boolean create()
public boolean drop()
delete()
public void delete()
public void testValidData(MMObjectNode node)
throws InvalidDataException
node - The node whose data to check
InvalidDataException - If the data was unrecoverably invalid (the references did not point to existing objects)
public int insert(int oType,
java.lang.String owner)
oType - The type of object to createowner - The administrator creating the node
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.
public int insert(java.lang.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 int insertDone(EditState ed,
MMObjectNode node)
EditState),
endangering the separation between content and layout, and has an undefined return value.
ed - Contains the current edit state (editor info). The main function of this object is to pass
'settings' and 'parameters' - value pairs that have been the during the edit process.node - The node thatw as inserted
int value. It's meaning is undefined.
The basic routine returns -1.
public int preEdit(EditState ed,
MMObjectNode node)
EditState),
endangering the separation between content and layout. It also has an undefined return value.
commit(org.mmbase.module.core.MMObjectNode) or insert(int, java.lang.String).
This method is called by the editor. This differs from preCommit(org.mmbase.module.core.MMObjectNode), which is called by the database system
during the call to commit or insert.
ed - Contains the current edit state (editor info). The main function of this object is to pass
'settings' and 'parameters' - value pairs that have been the during the edit process.node - The node that was inserted
int value. It's meaning is undefined.
The basic routine returns -1.public MMObjectNode preCommit(MMObjectNode node)
preEdit(org.mmbase.module.gui.html.EditState, org.mmbase.module.core.MMObjectNode), which is called by the editor.
That is, preCommit is enforced, while preEdit is not (depending on the editor used).
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 committed
public boolean createAlias(int number,
java.lang.String alias)
number - the to-be-aliased node's unique numberalias - the aliasname to associate with the object
public MMObjectBuilder getParentBuilder()
protected java.util.List getAncestors()
public java.util.List getDescendants()
public void setParentBuilder(MMObjectBuilder parent)
throws StorageException
parent - the extended (parent) builder, or null if not available
StorageExceptionpublic boolean isExtensionOf(MMObjectBuilder o)
public MMObjectNode getNewNode(java.lang.String owner)
insert(int, java.lang.String) to add the node to the
cloud). This method is also called inside database operations, so it may not do new database
operations itself (that might cause dead-locks).
owner - The administrator creating the new node.
MMObjectNode.public void setDefaults(MMObjectNode node)
node - The node to set the defaults of.
protected java.lang.String setUniqueValue(MMObjectNode node,
java.lang.String field,
java.lang.String baseValue)
protected int setUniqueValue(MMObjectNode node,
java.lang.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(int number)
number - The number of the node to check.
true if the node is in the cache, false otherwise.public boolean isVirtual()
true if the builder is virtual.public int getObjectType()
public void safeCache(java.lang.Integer n,
MMObjectNode node)
public boolean safeCommit(MMObjectNode node)
public int safeInsert(MMObjectNode node,
java.lang.String userName)
public int getNodeType(int number)
number - The number of the node to search for
int value which is the object type (otype) of the node.public MMObjectNode getAliasedNode(java.lang.String key)
getNode(java.lang.String) instead.
key - The value to search for
null if the node does not exist or the key is invalid, or a
MMObjectNode containing the contents of the requested node.protected java.util.List getNodes(java.util.Collection virtuals)
public MMObjectNode getNode(java.lang.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(java.lang.String key)
key - The value to search for
null if the node does not exist or the key is invalid, or a
MMObjectNode containing the contents of the requested node.public MMObjectNode getHardNode(java.lang.String key)
key - The value to search for
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(int number,
boolean useCache)
number - The number of the node to search foruseCache - If true, the node is retrieved from the node cache if possible.
null if the node does not exist, the key is invalid,or a
MMObjectNode containing the contents of the requested node.
java.lang.RuntimeException - If the node does not exist (not always true!)public MMObjectNode getNode(int number)
number - The number of the node to search for
null if the node does not exist or the key is invalid, or a
MMObjectNode containign the contents of the requested node.public MMObjectNode getHardNode(int number)
number - The number of the node to search for
null if the node does not exist or the key is invalid, or a
MMObjectNode containign the contents of the requested node.
public MMObjectNode getNewTmpNode(java.lang.String owner,
java.lang.String key)
public void putTmpNode(java.lang.String key,
MMObjectNode node)
key - The (temporary) key under which to store the nodenode - The node to storepublic boolean checkAddTmpField(java.lang.String field)
field - the name of the temporary field
public MMObjectNode getTmpNode(java.lang.String key)
key - The (temporary) key to use under which the node is storedpublic void removeTmpNode(java.lang.String key)
key - The (temporary) key under which the node is storedpublic int count(java.lang.String where)
count(NodeSearchQuery)
instead.
where - The constraint, can be a SQL where-clause, a MMNODE
expression or an altavista-formatted expression.
public int count(NodeSearchQuery query)
throws SearchQueryException
query - The query.
java.lang.IllegalArgumentException - when an invalid argument is supplied.
SearchQueryException - when failing to retrieve the data.public java.util.Enumeration search(java.lang.String where)
getNodes(NodeSearchQuery to perform a node search.
where - scan expression that the objects need to fulfill
Enumeration containing all the objects that apply.
public java.util.Enumeration search(java.lang.String where,
java.lang.String sort)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfill
Enumeration containing all the objects that apply.
public java.util.Enumeration search(java.lang.String where,
java.lang.String sort,
boolean direction)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfilldirection - sorts ascending if true, descending if false.
Only applies if a sorted order is given.
Enumeration containing all the objects that apply.public java.util.Vector searchVector(java.lang.String where)
getNodes(NodeSearchQuery to perform a node search.
where - scan expression that the objects need to fulfill
public java.util.Vector searchVector(java.lang.String where,
java.lang.String sorted)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillsorted - a comma separated list of field names on wich the
returned list should be sorted
public java.util.Vector searchVector(java.lang.String where,
java.lang.String sorted,
boolean direction)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillsorted - order in which to return the objectsdirection - sorts ascending if true, descending if false.
Only applies if a sorted order is given.
public java.util.Vector searchVector(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillsorted - a comma separated list of field names on wich the
returned list should be sorteddirections - A comma separated list of the values indicating wether
to sort up (ascending) or down (descending) on the
corresponding field in the sorted
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
sorted parameter, all fields that
don't have a corresponding direction value are
sorted according to the last specified direction
value.
public java.util.List searchList(java.lang.String where)
throws java.sql.SQLException
getNodes(NodeSearchQuery to perform a node search.
java.sql.SQLException
public java.util.List searchList(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
throws java.sql.SQLException
getNodes(NodeSearchQuery to perform a node search.
where - Constraint, represented by scan MMNODE expression,
AltaVista format or SQL "where"-clause.sorted - Comma-separated list of names of fields to sort on.directions - Comma-separated list of sorting directions ("UP"
or "DOWN") of the fields to sort on.
java.sql.SQLExceptionprotected java.lang.String getQuery(java.lang.String where)
getSearchQuery(String) instead.
protected java.util.List getRawNodes(NodeSearchQuery query)
throws SearchQueryException
query - The query.
java.lang.IllegalArgumentException - When the nodetype specified
by the query is not the nodetype corresponding to this builder.
SearchQueryException
public java.util.List getNodes(NodeSearchQuery query)
throws SearchQueryException
query - The query.
java.lang.IllegalArgumentException - When the nodetype specified
by the query is not the nodetype corresponding to this builder.
SearchQueryExceptionpublic java.util.Vector searchNumbers(java.lang.String where)
getNodes(NodeSearchQuery to perform a node search.
where - scan expression that the objects need to fulfill
Vector containing all the object numbers that apply, null if en error occurred.
public java.util.Enumeration searchIn(java.lang.String where,
java.lang.String sort,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillin - lost of node numbers to filter on
Enumeration containing all the objects that apply.
public java.util.Enumeration searchIn(java.lang.String where,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillin - lost of node numbers to filter on
Enumeration containing all the objects that apply.
public java.util.Enumeration searchIn(java.lang.String where,
java.lang.String sort,
boolean direction,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillin - lost of node numbers to filter ondirection - sorts ascending if true, descending if false.
Only applies if a sorted order is given.
Enumeration containing all the objects that apply.public java.util.Vector searchVectorIn(java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
in - either a set of object numbers (in comma-separated string format), or a sub query
returning a set of object numbers.
public java.util.Vector searchVectorIn(java.lang.String where,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillin - either a set of object numbers (in comma-separated string format), or a sub query
returning a set of object numbers.
public java.util.Vector searchVectorIn(java.lang.String where,
java.lang.String sorted,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillsorted - order in which to return the objectsin - either a set of object numbers (in comma-separated string format), or a sub query
returning a set of object numbers.
public java.util.Vector searchVectorIn(java.lang.String where,
java.lang.String sorted,
boolean direction,
java.lang.String in)
getNodes(NodeSearchQuery to perform a node search.
where - where clause that the objects need to fulfillsorted - order in which to return the objectsin - either a set of object numbers (in comma-separated string format), or a sub query
returning a set of object numbers.direction - sorts ascending if true, descending if false.
Only applies if a sorted order is given.
protected java.lang.String getQuery(java.lang.String where,
java.lang.String sorted,
boolean direction)
getSearchQuery(String,String,String)
instead - specifying direction "UP" or
"DOWN" as appropriate.
protected java.lang.String getQuery(java.lang.String where,
java.lang.String sorted,
java.lang.String directions)
getSearchQuery(String,String,String)
instead.
public java.util.Enumeration searchWithWhere(java.lang.String where)
getNodes(NodeSearchQuery to perform a node search.
The performance gain is negligible and does not justify
another method.
where - SQL WHERE-clause without the leading "WHERE ".
Enumeration containing all the objects that apply.public void processSearchResults(java.util.List results)
nodecache, or
REPACE_CACHE is set to false).
results - The nodes. After returning, partially retrieved nodes
in the result are replaced in place by complete nodes.
public SortedVector readSearchResults(java.sql.ResultSet rs,
SortedVector sv)
getNodes(NodeSearchQuery to perform a node search.
rs - The resultset containing the nodes
public java.lang.String buildSet(java.util.Vector nodes,
java.lang.String fieldName)
nodes - Vector containg the nodes to put in the setfieldName - fieldname whsoe values should be put in the set
Stringpublic java.util.Vector getFields()
Vector with the tables fields (FieldDefs)public java.util.Vector getFieldNames()
Vector with the tables field anmes (String)public FieldDefs getField(java.lang.String fieldName)
FieldDefs belonging with the indicated fieldprotected void updateFields()
public void addField(FieldDefs def)
def - the field definiton to addpublic void removeField(java.lang.String fieldname)
fieldname - the name of the field to removepublic int getDBType(java.lang.String fieldName)
public int getDBState(java.lang.String fieldName)
public java.lang.String getGUIIndicator(MMObjectNode node)
node - The node to display
String
public java.lang.String getGUIIndicator(java.lang.String field,
MMObjectNode node)
node - The node to displayfield - the name field of the field to display
String, null if not specified
protected java.lang.String getLocaleGUIIndicator(java.util.Locale locale,
java.lang.String field,
MMObjectNode node)
protected java.lang.String getLocaleGUIIndicator(java.util.Locale locale,
MMObjectNode node)
public java.util.List getFields(int sortorder)
sortorder - One of the sortorders defined in
FieldDefs
public java.util.Vector getEditFields()
public java.util.Vector getSortedListFields()
public java.util.Vector getSortedFields()
public FieldDefs getNextField(java.lang.String currentfield,
int sortorder)
public FieldDefs getNextField(java.lang.String currentfield)
public java.lang.Object getValue(MMObjectNode node,
java.lang.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 addiitonal functions,
override executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List) instead.
node - the node whos efields are queriesfield - the fieldname that is requested
protected java.lang.Object getObjectValue(MMObjectNode node,
java.lang.String field)
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String)protected java.util.Vector getFunctionParameters(java.lang.String fields)
fields - The string, containing function parameters.
public Parameter[] getParameterDefinition(java.lang.String function)
protected java.lang.Object executeFunction(MMObjectNode node,
java.lang.String function,
java.util.List arguments)
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method.
Derived builders should override this method to provide additional functions.
java.lang.IllegalArgumentException - if the argument List does not
fit the functionexecuteFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List)
protected java.lang.Object executeFunction(MMObjectNode node,
java.lang.String function,
java.lang.String field)
getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method.
Derived builders should override this method to provide additional functions.
current functions are:
node - the node whose fields are queriesfield - the fieldname that is requested
public java.util.Vector getRelations_main(int src)
src - the number of the node to obtain the relations from
Vector with InsRel nodespublic java.lang.String getDefaultUrl(int src)
null.
src - the number of the node to obtain the url from
String, or null if unknown.
public java.lang.String getSmartPath(java.lang.String documentRoot,
java.lang.String path,
java.lang.String nodeNumber,
java.lang.String version)
documentRoot - the root of the path to searchpath - the subpath of the path to searchnodeNumber - the numbve ror alias of the node to filter onversion - the version number (or null if not applicable) to filter on
String, or null if not found
This method should be added to the bridge so jsp can make use of it.
This method can be overriden to make an even smarter search possible.public int getCacheSize()
public int getCacheSize(java.lang.String type)
type - the object type to count
public java.lang.String getCacheNumbers()
public void deleteNodeCache()
public int getDBKey()
int value that is the next available key for an object.public int getAge(MMObjectNode node)
node - The node whose age to determine
public java.lang.String getMachineName()
String which is the server's name
public boolean nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.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'=new
true
public boolean nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.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'=new
true
public boolean fieldLocalChanged(java.lang.String number,
java.lang.String builder,
java.lang.String field,
java.lang.String value)
number - Number of the changed node as a Stringbuilder - type of the changed nodefield - name of the changed fieldvalue - value it changed to
truepublic boolean addRemoteObserver(MMBaseObserver obs)
truepublic boolean addLocalObserver(MMBaseObserver obs)
true
public MMObjectNode getDefaultTeaser(MMObjectNode node,
MMObjectNode tnode)
public boolean waitUntilNodeChanged(MMObjectNode node)
node - the node to wait for
public java.util.Vector getList(scanpage sp,
StringTagger tagger,
java.util.StringTokenizer tok)
throws ParseException
sp - The scanpage (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 execute
Vector containing the result values as a String
ParseException
public java.lang.String replace(scanpage sp,
java.util.StringTokenizer tok)
sp - The scanpage (containing http and user info) that calls the functiontok - a list of strings that describe the (sub)command to execute
String
public boolean process(scanpage sp,
java.util.StringTokenizer command,
java.util.Hashtable cmds,
java.util.Hashtable vars)
sp - The scanpage (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. the variable 'EDITSTATE' accesses the
EditState object (if applicable).
Stringpublic java.lang.String convertMMNode2SQL(java.lang.String where)
The syntax of an MMNODE expression is defined as follows:
where - the MMNODE expression
public void setMMBase(MMBase m)
m - the MMBase object to set as owner of this builderpublic MMBase getMMBase()
public void setDBLayout_xml(java.util.Hashtable fields)
fields - A list of the builder's FieldDefspublic void setTableName(java.lang.String tableName)
public void setDescription(java.lang.String e)
public void setDescriptions(java.util.Hashtable e)
public java.lang.String getDescription()
public java.lang.String getDescription(java.lang.String lang)
lang - The language requested
null if it is not avaialblepublic java.util.Hashtable getDescriptions()
Hashtable containing the descriptionspublic void setSearchAge(java.lang.String age)
age - the search age as a Stringpublic java.lang.String getSearchAge()
Stringpublic java.lang.String getSingularName(java.lang.String lang)
lang - The language requested
null if it is not availablepublic java.lang.String getSingularName()
public java.lang.String getPluralName(java.lang.String lang)
lang - The language requested
null if it is not availablepublic java.lang.String getPluralName()
public java.lang.String getClassName()
public boolean sendFieldChangeSignal(MMObjectNode node,
java.lang.String fieldname)
node - the node the field was changed infieldname - the name of the field that was changed
true
public boolean signalNewObject(java.lang.String tableName,
int number)
tableName - the table in which a node was edited (?)number - the number of the new node
truepublic java.lang.String toXML(MMObjectNode node)
node - the node to convert
Stringpublic void setSingularNames(java.util.Hashtable names)
public java.util.Hashtable getSingularNames()
public void setPluralNames(java.util.Hashtable names)
public java.util.Hashtable getPluralNames()
public java.lang.String getShortedText(java.lang.String fieldname,
int number)
fieldname - name of the fieldnumber - number of the object in the table
String containing the contents of a field as text
public byte[] getShortedByte(java.lang.String fieldname,
int number)
fieldname - name of the fieldnumber - number of the object in the table
byte containing the contents of a field as text
public byte[] getDBByte(java.sql.ResultSet rs,
int idx)
byte containing the contents of a field as text
public java.lang.String getDBText(java.sql.ResultSet rs,
int idx)
String containing the contents of a field as textpublic java.lang.String getNumberFromName(java.lang.String name)
true if the table exists, false otherwise
public boolean setValue(MMObjectNode node,
java.lang.String fieldName,
java.lang.Object originalValue)
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.
public boolean setValue(MMObjectNode node,
java.lang.String fieldname)
node - the node whose fields are changed
true if the call was handled.protected java.lang.String getHTML(java.lang.String body)
body - text to convert
protected java.lang.String getWAP(java.lang.String body)
body - text to convert
protected java.lang.String getURLEncode(java.lang.String body)
body - text to convert
public java.lang.String getShort(java.lang.String str,
int len)
str - the string to shortenlen - the maximum length
public void setXMLValues(java.util.Vector xmlfields)
setDBLayout_xml(java.util.Hashtable) to create a fieldnames list.
xmlfields - A Vector with fields as they appear in the current table.
This data is retrieved from an outside source (such as an xml file), and thus
may be incorrect.public void setXMLPath(java.lang.String m)
public java.lang.String getXMLPath()
public java.io.File getConfigFile()
public java.util.Hashtable getInitParameters()
Hashtable containing the current properties
public void setInitParameter(java.lang.String name,
java.lang.String value)
name - name of the propertyvalue - value of the propertypublic java.lang.String getInitParameter(java.lang.String name)
name - the name of the property to get
Stringpublic void setVersion(int i)
i - the version numberpublic int getVersion()
public java.lang.String getMaintainer()
public void setMaintainer(java.lang.String m)
m - the name of the maintainerpublic java.lang.String hostname_function(java.lang.String url)
public java.lang.String wrap(java.lang.String text,
int width)
text - the text to wrapwidth - the maximum width to wrap at
public java.lang.String toString()
public boolean equals(java.lang.Object o)
public java.lang.String toString(MMObjectNode n)
public boolean equals(MMObjectNode o1,
MMObjectNode o2)
public int hashCode(MMObjectNode o)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||