org.mmbase.module.corebuilders
Class TypeDef

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.module.corebuilders.TypeDef
Direct Known Subclasses:
ObjectTypes

public class TypeDef
extends MMObjectBuilder

TypeDef, one of the meta stucture nodes it is used to define the object types (builders)

Version:
$Id: TypeDef.java,v 1.38 2003/12/17 21:09:03 michiel Exp $
Author:
Daniel Ockeloen, Pierre van Rooden

Field Summary
 
Fields inherited from class org.mmbase.module.core.MMObjectBuilder
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, GUI_PARAMETERS, listCache, nodeCache, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
TypeDef()
          Constructor
 
Method Summary
 boolean commit(MMObjectNode node)
          Commit changes to this node to the database.
protected  java.lang.Object executeFunction(MMObjectNode node, java.lang.String function, java.util.List args)
          Executes a function on the field of a node, and returns the result.
 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.
 MMObjectBuilder getBuilder(MMObjectNode node)
          Returns the MMObjectBuilder which is represented by the node.
 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.
 int getIntValue(java.lang.String builderName)
          Obtain the type value of the requested builder
 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.
protected  java.util.Map getNameToNumberCache()
           
protected  java.util.Map getNumberToNameCache()
           
 java.lang.String getSingularName(java.lang.String builderName, java.lang.String language)
           
 java.lang.String getValue(int type)
          Obtain the buildername of the requested type
 java.lang.Object getValue(MMObjectNode node, java.lang.String field)
          Provides additional functionality when obtaining field values.
 java.lang.String getValue(java.lang.String type)
          Deprecated. use getValue(int)
 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).
 boolean isRelationTable(java.lang.String name)
           
 void loadTypeDef(java.lang.String name)
           
 boolean reloadBuilder(java.lang.String objectname)
           
 void removeNode(MMObjectNode node)
          Remove a node from the cloud, when the represented builder was active it will also be unloaded
 void unloadTypeDef(java.lang.String name)
           
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, convertMMNode2SQL, count, count, create, createAlias, delete, deleteNodeCache, drop, equals, equals, executeFunction, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFunctionParameters, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getMachineName, getMaintainer, getMMBase, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParameterDefinition, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRawNodes, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getVersion, getWAP, getXMLPath, hashCode, hostname_function, init, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, removeRelations, removeSyncNodes, removeTmpNode, replace, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchList, searchList, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setDBLayout_xml, setDefaults, setDescription, setDescriptions, setInitParameter, setMaintainer, setMMBase, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setTableName, setUniqueValue, setUniqueValue, setValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
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
 

Constructor Detail

TypeDef

public TypeDef()
Constructor

Method Detail

getNumberToNameCache

protected java.util.Map getNumberToNameCache()

getNameToNumberCache

protected java.util.Map getNameToNumberCache()

insert

public 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). This method indirectly calls MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode).

Overrides:
insert in class MMObjectBuilder
Parameters:
owner - The administrator creating the node
node - The object to insert. The object need be of the same type as the current builder.
Returns:
An int value which is the new object's unique number, -1 if the insert failed.

commit

public boolean commit(MMObjectNode node)
Commit changes to this node to the database. This method indirectly calls MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode). Use only to commit changes - for adding node, use insert(java.lang.String, org.mmbase.module.core.MMObjectNode).

Overrides:
commit in class MMObjectBuilder
Parameters:
node - The node to be committed
Returns:
true if commit successful

removeNode

public void removeNode(MMObjectNode node)
Remove a node from the cloud, when the represented builder was active it will also be unloaded

Overrides:
removeNode in class MMObjectBuilder
Parameters:
node - The node to remove.
Throws:
java.lang.RuntimeException - When the operation could not be performed

getIntValue

public int getIntValue(java.lang.String builderName)
Obtain the type value of the requested builder

Parameters:
builderName - name of the builder
Returns:
the object type as an int, -1 if not defined.
To Do:
smarter cache update

getValue

public java.lang.String getValue(int type)
Obtain the buildername of the requested type

Parameters:
type - the object type
Returns:
the name of the builder as a string, null if not found

getValue

public java.lang.String getValue(java.lang.String type)
Deprecated. use getValue(int)

Obtain the buildername of the requested type

Parameters:
type - the object type
Returns:
the name of the builder as a string, "unknown" if not found

getSingularName

public java.lang.String getSingularName(java.lang.String builderName,
                                        java.lang.String language)
Warning: No Java Documentation Available.

isRelationTable

public boolean isRelationTable(java.lang.String name)
Warning: No Java Documentation Available.

getValue

public java.lang.Object getValue(MMObjectNode node,
                                 java.lang.String field)
Description copied from class: MMObjectBuilder
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(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 MMObjectBuilder.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List) instead.

Overrides:
getValue in class MMObjectBuilder
Parameters:
node - the node whos efields are queries
field - the fieldname that is requested
Returns:
the result of the 'function', or null if no valid functions could be determined.
Warning: No Java Documentation Available.

fieldLocalChanged

public boolean fieldLocalChanged(java.lang.String number,
                                 java.lang.String builder,
                                 java.lang.String field,
                                 java.lang.String value)
Description copied from class: MMObjectBuilder
Called when a local field is changed.

Overrides:
fieldLocalChanged in class MMObjectBuilder
Parameters:
number - Number of the changed node as a String
builder - type of the changed node
field - name of the changed field
value - value it changed to
Returns:
always true
Warning: No Java Documentation Available.

getBuilder

public MMObjectBuilder getBuilder(MMObjectNode node)
Returns the MMObjectBuilder which is represented by the node.

Parameters:
node - The node, from which we want to know its MMObjectBuilder
Returns:
The builder which is represented by the node, or null if the builder was not loaded.

reloadBuilder

public boolean reloadBuilder(java.lang.String objectname)
Warning: No Java Documentation Available.

getGUIIndicator

public java.lang.String getGUIIndicator(MMObjectNode node)
What should a GUI display for this node. This method returns the gui name (singular name) of the builder that goes with this node.

Overrides:
getGUIIndicator in class MMObjectBuilder
Parameters:
node - The node to display
Returns:
the display of the node as a String

getGUIIndicator

public java.lang.String getGUIIndicator(java.lang.String field,
                                        MMObjectNode node)
What should a GUI display for this node/field combo. If the field specified is 'name', this method returns the gui name (singular name) of the builder that goes with this node.

Overrides:
getGUIIndicator in class MMObjectBuilder
Parameters:
field - the name field of the field to display
node - The node to display
Returns:
the display of the node's field as a String, null if not specified

getLocaleGUIIndicator

protected java.lang.String getLocaleGUIIndicator(java.util.Locale locale,
                                                 java.lang.String field,
                                                 MMObjectNode node)
The GUIIndicator can depend on the locale. Override this function

Overrides:
getLocaleGUIIndicator in class MMObjectBuilder
Since:
MMBase-1.6

getLocaleGUIIndicator

protected java.lang.String getLocaleGUIIndicator(java.util.Locale locale,
                                                 MMObjectNode node)
Description copied from class: MMObjectBuilder
The GUIIndicator can depend on the locale. Override this function

Overrides:
getLocaleGUIIndicator in class MMObjectBuilder

loadTypeDef

public void loadTypeDef(java.lang.String name)
Warning: No Java Documentation Available.

unloadTypeDef

public void unloadTypeDef(java.lang.String name)
Warning: No Java Documentation Available.

getList

public java.util.Vector getList(scanpage sp,
                                StringTagger tagger,
                                java.util.StringTokenizer tok)
                         throws ParseException
Description copied from class: MMObjectBuilder
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.

Overrides:
getList in class MMObjectBuilder
Parameters:
sp - The scanpage (containing http and user info) that calls the function
tagger - a Hashtable of parameters (name-value pairs) for the command
tok - a list of strings that describe the (sub)command to execute
Returns:
a Vector containing the result values as a String
Throws:
ParseException
Warning: No Java Documentation Available.

executeFunction

protected java.lang.Object executeFunction(MMObjectNode node,
                                           java.lang.String function,
                                           java.util.List args)
Description copied from class: MMObjectBuilder
Executes a function on the field of a node, and returns the result. This method is called by the builder's MMObjectBuilder.getValue(org.mmbase.module.core.MMObjectNode, java.lang.String) method. Derived builders should override this method to provide additional functions.

Overrides:
executeFunction in class MMObjectBuilder
See Also:
MMObjectBuilder.executeFunction(org.mmbase.module.core.MMObjectNode, java.lang.String, java.util.List)


MMBase build 1.7.4.20050922