org.mmbase.util.functions
Class ExampleBuilder

java.lang.Object
  extended byorg.mmbase.module.core.MMTable
      extended byorg.mmbase.module.core.MMObjectBuilder
          extended byorg.mmbase.util.functions.ExampleBuilder

public final class ExampleBuilder
extends MMObjectBuilder

Example builder implementation implementing functions. Lots of people are sooner or earlier trying to make their own builder implementation. Especially whith the advent the 'function' tags in 1.7 it would be nice that people could seen an example of how that could be done. To try it out, take a builder xml and add <classfile>org.mmbase.util.functions.ExampleBuilder</classfile> and e.g. a jsp like this:

 <mm:listnodes type="pools" max="1">
  < mm:import id="max">100</mm:import>
   <mm:nodelistfunction referids="max" name="function1">
    -- <mm:field name="number" /><br />
   </mm:nodelistfunction>
 </mm:listnodes>
 

Since:
MMBase-1.7
Version:
$Id: ExampleBuilder.java,v 1.3 2004/02/11 20:43:21 keesj Exp $
Author:
Michiel Meeuwissen

Field Summary
static Parameter[] FUNCTION1_PARAMETERS
           
 
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
ExampleBuilder()
           
 
Method Summary
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.
 Parameter[] getParameterDefinition(java.lang.String function)
          A very crude way to implement getParameterDefinition, using the utitily function in NodeFunction, which uses reflection to find the constant(s) defined in this class.
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, count, create, createAlias, delete, deleteNodeCache, drop, equals, equals, executeFunction, fieldLocalChanged, 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, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getMMBase, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRawNodes, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, init, insert, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, processSearchResults, putTmpNode, readSearchResults, removeField, removeNode, 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
 

Field Detail

FUNCTION1_PARAMETERS

public static final Parameter[] FUNCTION1_PARAMETERS
Constructor Detail

ExampleBuilder

public ExampleBuilder()
Method Detail

getParameterDefinition

public Parameter[] getParameterDefinition(java.lang.String function)
A very crude way to implement getParameterDefinition, using the utitily function in NodeFunction, which uses reflection to find the constant(s) defined in this class. If you prefer you could also use an explicit if/else tree to reach the same goal.

Overrides:
getParameterDefinition in class MMObjectBuilder

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.1.20041002