org.mmbase.module.corebuilders
Class OAlias

java.lang.Object
  |
  +--org.mmbase.module.core.MMTable
        |
        +--org.mmbase.module.core.MMObjectBuilder
              |
              +--org.mmbase.module.corebuilders.OAlias

public class OAlias
extends MMObjectBuilder

The OAlias builder is an optional corebuilder used to associate aliases with nodes. Each OAlias object contains a name field (the alias), and a destination field (the number of the object referenced). This builder is not used directly. If you add aliases, use MMObjectBuilder.createAlias(int, java.lang.String) instead of the builder's insert method. MMBase will run without this builder, but most applications use aliases.

Version:
$Id: OAlias.java,v 1.10.2.3 2003/03/06 17:47:05 pierre Exp $
Author:
Rico Jansen

Fields inherited from class org.mmbase.module.core.MMObjectBuilder
broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, nodeCache, obj2type, 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
OAlias()
           
 
Method Summary
 java.lang.String getAlias(int number)
          Obtain the alias of a node.
 MMObjectNode getAliasedNode(java.lang.String alias)
          Obtain a node from the cloud through its alias
 int getNumber(java.lang.String name)
          Obtain the number of a node through its alias
 boolean init()
          Initialize this builder.
 void removeNode(MMObjectNode node)
          Remove a node from the cloud and uopdate the cache
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, create, createAlias, created, deleteNodeCache, drop, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAge, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFullTableName, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTableName, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, nodeLocalChanged, nodeRemoteChanged, preCommit, preEdit, process, putTmpNode, readSearchResults, removeField, removeRelations, 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, setValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OAlias

public OAlias()
Method Detail

init

public boolean init()
Initialize this builder. Adds a temporary virtual field "_destination", used for storing a temporary reference value for the destination NODE field.
Overrides:
init in class MMObjectBuilder
Returns:
true if initialization was succesful

getNumber

public int getNumber(java.lang.String name)
Obtain the number of a node through its alias
Parameters:
alias - the alias of the desired node
Returns:
the number of the node, or -1 if the alias does not exist
See Also:
getAliasedNode(java.lang.String)

getAlias

public java.lang.String getAlias(int number)
Obtain the alias of a node. If a node has more aliases, it returns only one. Which one is not specified.
Parameters:
number - the number of the node
Returns:
the alias of the node, or null if it does not exist
See Also:
getNumber(java.lang.String)

getAliasedNode

public MMObjectNode getAliasedNode(java.lang.String alias)
Obtain a node from the cloud through its alias
Overrides:
getAliasedNode in class MMObjectBuilder
Parameters:
alias - the alias of the desired node
Returns:
the node, or null if the alias does not exist
Throws:
java.lang.RuntimeException - if the alias exists but the node itself doesn't (this indicates an inconsistency in the database)
See Also:
getNumber(java.lang.String)

removeNode

public void removeNode(MMObjectNode node)
Remove a node from the cloud and uopdate the cache
Overrides:
removeNode in class MMObjectBuilder
Parameters:
node - The node to remove.


MMBase build 1.6.5.20030923