org.mmbase.datatypes
Class NodeDataType

java.lang.Object
  extended by org.mmbase.core.AbstractDescriptor
      extended by org.mmbase.datatypes.BasicDataType<Node>
          extended by org.mmbase.datatypes.NodeDataType
All Implemented Interfaces:
Serializable, Cloneable, Comparable<DataType<Node>>, Descriptor, DataType<Node>, PublicCloneable<AbstractDescriptor>
Direct Known Subclasses:
UserNodeDataType

public class NodeDataType
extends BasicDataType<Node>

The Node data type describes a data type which is based on an MMBase 'node' field. So the value is an MMBase node, which can normally be described by a foreign key.

Since:
MMBase-1.8
Version:
$Id: NodeDataType.java 41987 2010-04-20 16:14:35Z michiel $
Author:
Pierre van Rooden, Michiel Meeuwissen
See Also:
Serialized Form

Nested Class Summary
protected  class NodeDataType.MustExistRestriction
           
 
Nested classes/interfaces inherited from class org.mmbase.datatypes.BasicDataType
BasicDataType.AbstractRestriction<D extends Serializable>, BasicDataType.DataTypeComparator<D>, BasicDataType.EnumerationRestriction, BasicDataType.RequiredRestriction, BasicDataType.RestrictedEnumerationIterator, BasicDataType.StaticAbstractRestriction<D extends Serializable>, BasicDataType.TypeRestriction, BasicDataType.UniqueRestriction
 
Nested classes/interfaces inherited from interface org.mmbase.datatypes.DataType
DataType.Restriction<D extends Serializable>
 
Field Summary
protected  NodeDataType.MustExistRestriction mustExistRestriction
           
 
Fields inherited from class org.mmbase.datatypes.BasicDataType
DATATYPE_BUNDLE, defaultValue, enumerationRestriction, origin, requiredRestriction, typeRestriction, uniqueRestriction
 
Fields inherited from class org.mmbase.core.AbstractDescriptor
description, guiName, key
 
Fields inherited from interface org.mmbase.datatypes.DataType
ENFORCE_ABSOLUTE, ENFORCE_ALWAYS, ENFORCE_NEVER, ENFORCE_ONCHANGE, ENFORCE_ONCREATE, ENFORCE_ONVALIDATE, PROCESS_GET, PROCESS_SET, VALID, XMLNS
 
Constructor Summary
NodeDataType(String name)
          Constructor for node field.
 
Method Summary
 Integer castForSearch(Object value, Node node, Field field)
          Sometimes the the representation of the value is a bit different in the database, or has a different type.
protected  Object castToValidate(Object value, Node node, Field field)
          Before validating the value, the value will be 'cast', on default this will be to the 'correct' type, but it can be a more generic type sometimes.
protected  void cloneRestrictions(BasicDataType origin)
          If a datatype is cloned, the restrictions of it (normally implemented as inner classes), must be reinstantiated.
 Comparator<Node> getComparator()
           
 int getEnforceStrength()
          The maximum enforce strength of all restrictions on this datatype.
 NodeDataType.MustExistRestriction getMustExistRestriction()
           
protected  void inheritRestrictions(BasicDataType origin)
          If a datatype inherits from another datatype all its restrictions inherit too.
 boolean mustExist()
          Whether the Node of the value must exist XXX MM: How can you have a non-existing node? I don't really get it.
protected  Collection<LocalizedString> validateCastValue(Collection<LocalizedString> errors, Object castValue, Object value, Node node, Field field)
           
 
Methods inherited from class org.mmbase.datatypes.BasicDataType
addErrorDescription, addRestriction, addRestriction, addStyleClass, cast, cast, castAndValidate, castOrException, castToPresent, checkType, clone, clone, compareTo, edit, equals, finish, finish, getBaseType, getBaseTypeIdentifier, getCloud, getCloud, getCommitProcessor, getDefaultProcessor, getDefaultValue, getDefaultValue, getDeleteProcessor, getElement, getElement, getEnforceString, getEnumerationFactory, getEnumerationRestriction, getEnumerationValue, getEnumerationValues, getHandler, getHandlers, getOrigin, getProcessor, getProcessor, getProcessorWithoutDefault, getRequiredRestriction, getRestrictions, getStyleClasses, getTypeAsClass, getUniqueRestriction, hashCode, inherit, inheritProperties, isCorrectType, isFinished, isRequired, isUnique, preCast, preCast, preCast, rewrite, setCommitProcessor, setDefaultProcessor, setDefaultValue, setDeleteProcessor, setProcessor, setProcessor, setRequired, setUnique, setXml, toString, toStringBuilder, toXml, toXml, validate, validate, validateCastValueOrNull, validateRequired, xmlValue
 
Methods inherited from class org.mmbase.core.AbstractDescriptor
getDefaultLocale, getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName, setLocalizedDescription, setLocalizedGUIName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mmbase.bridge.Descriptor
getDescription, getDescription, getGUIName, getGUIName, getLocalizedDescription, getLocalizedGUIName, getName, setDescription, setDescription, setGUIName, setGUIName
 

Field Detail

mustExistRestriction

protected NodeDataType.MustExistRestriction mustExistRestriction
Constructor Detail

NodeDataType

public NodeDataType(String name)
Constructor for node field.

Method Detail

inheritRestrictions

protected void inheritRestrictions(BasicDataType origin)
Description copied from class: BasicDataType
If a datatype inherits from another datatype all its restrictions inherit too.

Overrides:
inheritRestrictions in class BasicDataType<Node>

cloneRestrictions

protected void cloneRestrictions(BasicDataType origin)
Description copied from class: BasicDataType
If a datatype is cloned, the restrictions of it (normally implemented as inner classes), must be reinstantiated.

Overrides:
cloneRestrictions in class BasicDataType<Node>

castToValidate

protected Object castToValidate(Object value,
                                Node node,
                                Field field)
                         throws CastException
Description copied from class: BasicDataType
Before validating the value, the value will be 'cast', on default this will be to the 'correct' type, but it can be a more generic type sometimes. E.g. for numbers this wil simply cast to Number.

Overrides:
castToValidate in class BasicDataType<Node>
Throws:
CastException

castForSearch

public Integer castForSearch(Object value,
                             Node node,
                             Field field)
Description copied from interface: DataType
Sometimes the the representation of the value is a bit different in the database, or has a different type. So when constraining a search on the value, casting is done by this. This may default to DataType.cast(Object, Node, Field).

Specified by:
castForSearch in interface DataType<Node>
Overrides:
castForSearch in class BasicDataType<Node>

mustExist

public boolean mustExist()
Whether the Node of the value must exist XXX MM: How can you have a non-existing node? I don't really get it. AFAIK all nodes exist. especially since a node field is essentially a foreign key.


getMustExistRestriction

public NodeDataType.MustExistRestriction getMustExistRestriction()

getEnforceStrength

public int getEnforceStrength()
Description copied from interface: DataType
The maximum enforce strength of all restrictions on this datatype. See DataType.ENFORCE_ALWAYS, DataType.ENFORCE_ONCHANGE, DataType.ENFORCE_NEVER.

Specified by:
getEnforceStrength in interface DataType<Node>
Overrides:
getEnforceStrength in class BasicDataType<Node>
Returns:
maximum enforce strength

validateCastValue

protected Collection<LocalizedString> validateCastValue(Collection<LocalizedString> errors,
                                                        Object castValue,
                                                        Object value,
                                                        Node node,
                                                        Field field)
Overrides:
validateCastValue in class BasicDataType<Node>

getComparator

public Comparator<Node> getComparator()
Overrides:
getComparator in class BasicDataType<Node>
Since:
MMBase-1.9.2


MMBase 2.0-SNAPSHOT - null