|
Nuxeo Enterprise Platform 5.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuxeo.ecm.core.api.model.impl.AbstractProperty
public abstract class AbstractProperty
| Field Summary | |
|---|---|
protected Object |
data
|
protected int |
flags
|
static int |
IS_READONLY
Whether or not this property is read only. |
static int |
IS_VALIDATING
Whether or not this property is validating values when they are set. |
static int |
KEYED_DATA
Whether ot not the data field contains keyed data. |
protected Property |
parent
|
| Fields inherited from interface org.nuxeo.ecm.core.api.model.Property |
|---|
DIRTY_MASK, IS_DIRTY, IS_MODIFIED, IS_MOVED, IS_NEW, IS_PHANTOM, IS_REMOVED, NONE |
| Constructor Summary | |
|---|---|
protected |
AbstractProperty(Property parent)
|
protected |
AbstractProperty(Property parent,
int flags)
|
| Method Summary | ||
|---|---|---|
protected void |
appendDirtyFlags(int dirtyFlags)
|
|
boolean |
areFlagsSet(long flags)
|
|
void |
clearDirtyFlags()
Notify the property that its changes was stored so it can safely remove dirty flags. |
|
void |
clearFlags(long flags)
|
|
protected Path |
collectPath(Path path)
|
|
|
convertTo(Serializable value,
Class<T> toType)
Converts the given normalized value to the given type. |
|
Object |
getData()
application data impl. |
|
Object |
getData(String key)
Returns the application defined data associated with the receiver under the given key, or null if it has not been set. |
|
int |
getDirtyFlags()
Get the dirty flags that are set on this property |
|
Property |
getParent()
Gets the property parent. |
|
String |
getPath()
Gets the path of this property relative to the owner document. |
|
DocumentPart |
getRoot()
Gets the root property. |
|
Schema |
getSchema()
Gets the document schema defining the property tree from which the property belongs. |
|
Serializable |
getValue()
Gets the property normalized value. |
|
|
getValue(Class<T> type)
Gets the property value as the given type. |
|
|
getValue(Class<T> type,
String path)
Gets the value of the property resolved using the given path. |
|
Serializable |
getValue(String path)
Gets the value of the property resolved using the given path. |
|
void |
init(Serializable value)
Intializes the property with the given normalized value. |
|
abstract Serializable |
internalGetValue()
|
|
abstract void |
internalSetValue(Serializable value)
Sets the given normalized value. |
|
boolean |
isComplex()
Tests whether this property is of a map (complex) type. |
|
boolean |
isDirty()
Tests whether a property is dirty. |
|
boolean |
isList()
Tests whether this property is of a list type. |
|
boolean |
isModified()
Tests if a property value was modified |
|
boolean |
isMoved()
Tests if a property value was moved to another index in the parent list if any |
|
boolean |
isNew()
Tests if this property is new (just created but not yet stored). |
|
boolean |
isNormalized(Object value)
Checks if the given value is a normalized one. |
|
boolean |
isPhantom()
Tests if the property is a phantom. |
|
boolean |
isReadOnly()
Whether the property is read only |
|
boolean |
isRemoved()
Tests if a property is flagged as removed. |
|
boolean |
isScalar()
Tests whether this property is of a scalar type. |
|
boolean |
isValidating()
Check whether this propertty is validating values when set |
|
Iterator<Property> |
iterator()
|
|
void |
moveTo(int index)
Moves a property position into the parent container list. |
|
Object |
newInstance()
Creates a new and empty instance of a normalized value. |
|
Serializable |
normalize(Object value)
Normalizes the given value as dictated by the property type. |
|
Serializable |
remove()
Remove this property from the tree. |
|
void |
removePhantomFlag()
|
|
Property |
resolvePath(Path path)
Resolves the given path relative to the current property and return the property if any is found otherwise throws an exception. |
|
Property |
resolvePath(String path)
Same as Property.resolvePath(Path) but with a string path as argument. |
|
Property |
set(int index,
Object value)
Sets a child property value given its index. |
|
void |
setData(Object value)
Sets the application-defined data to associated it with the receiver property. |
|
void |
setData(String key,
Object value)
Sets the application defined data associated with the receiver under the given key. |
|
protected void |
setDirtyFlags(int dirtyFlags)
|
|
void |
setFlags(long flags)
|
|
void |
setIsModified()
THis method is public because of DataModelimpl which use it TODO after removing DataModelImpl make it protected |
|
protected void |
setIsMoved()
|
|
protected void |
setIsNew()
|
|
protected void |
setIsRemoved()
|
|
void |
setReadOnly(boolean value)
Set the read only flag |
|
void |
setValidating(boolean value)
Set the validating flag |
|
void |
setValue(Object value)
Sets this property value. |
|
void |
setValue(String path,
Object value)
Sets the value of the property resolved using the given path. |
|
int |
size()
Get the count of the children properties. |
|
String |
toString()
|
|
boolean |
validate(Serializable value)
Validates the given normalized value. |
|
boolean |
validateType(Class<?> type)
Validates the given value type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.nuxeo.ecm.core.api.model.Property |
|---|
accept, add, add, add, get, get, getChildren, getDirtyChildren, getField, getName, getType, isContainer, isSameAs, set |
| Field Detail |
|---|
public static final int IS_READONLY
public static final int IS_VALIDATING
public static final int KEYED_DATA
protected final Property parent
protected int flags
protected Object data
| Constructor Detail |
|---|
protected AbstractProperty(Property parent)
protected AbstractProperty(Property parent,
int flags)
| Method Detail |
|---|
public abstract void internalSetValue(Serializable value)
throws PropertyException
This applies only for nodes that physicaly store a value (that means non container nodes). Container nodes does nothing.
value -
PropertyException
public abstract Serializable internalGetValue()
throws PropertyException
PropertyException
public void init(Serializable value)
throws PropertyException
PropertyThe given value must be normalized - note that no check is done on that.
The phantom flag is unset by tthis operation.
This method should be used to initializate properties.
init in interface Propertyvalue - the normalized value to set
PropertyExceptionpublic void removePhantomFlag()
public Property set(int index,
Object value)
throws PropertyException,
UnsupportedOperationException
Property
If this method is not supported, an UnsupportedOperationException must be thrown.
This method will mark the child value as dirty for existing values and in the case of map properties it will mark phantom properties as new properties.
set in interface Propertyvalue - the new value
PropertyException
UnsupportedOperationExceptionpublic int size()
PropertyComplexType.getFieldsCount()
size in interface Propertypublic Iterator<Property> iterator()
iterator in interface Iterable<Property>
public Serializable remove()
throws PropertyException
Property
remove in interface PropertyPropertyExceptionpublic Property getParent()
Property
getParent in interface Propertypublic String getPath()
PropertyThe path for top level properties is the same to the property name.
getPath in interface Propertyprotected Path collectPath(Path path)
public Schema getSchema()
Property
getSchema in interface Propertypublic boolean isList()
Property
isList in interface Propertypublic boolean isComplex()
Property
isComplex in interface Propertypublic boolean isScalar()
Property
isScalar in interface Propertypublic boolean isNew()
PropertyA property is new when added to a collection. This is trhe typical state for a new property added to a list
isNew in interface Propertypublic boolean isRemoved()
Property
isRemoved in interface Propertypublic boolean isMoved()
Property
isMoved in interface Propertypublic boolean isModified()
Property
isModified in interface Propertypublic boolean isPhantom()
Property
isPhantom in interface Propertypublic final boolean isDirty()
PropertyThis tests whether or not a dirty flag is set on the property
isDirty in interface Propertyprotected final void setDirtyFlags(int dirtyFlags)
protected final void appendDirtyFlags(int dirtyFlags)
public boolean isValidating()
Property
isValidating in interface Propertypublic boolean isReadOnly()
Property
isReadOnly in interface Propertypublic void setReadOnly(boolean value)
Property
setReadOnly in interface Propertyvalue - true to set this property read only false otherwisepublic void setValidating(boolean value)
Property
setValidating in interface Propertyvalue - true to put validating on false otherwisepublic final boolean areFlagsSet(long flags)
public final void setFlags(long flags)
public final void clearFlags(long flags)
public int getDirtyFlags()
Property
getDirtyFlags in interface Propertypublic void clearDirtyFlags()
PropertyDirty flags are removed accordlying to the type of the modifications. This way if the property was REMOVED it becomes a PHANTOM otherwise all dirty flags are cleared.
This method should be used by storage implementors to notify the property it should reset its dirty flags. Note that clearing dirty flags is not probagated to the parent property or to children. You need to clear dirty flags explicitely for each property.
clearDirtyFlags in interface Propertypublic void setIsModified()
protected void setIsNew()
protected void setIsRemoved()
protected void setIsMoved()
public <T> T getValue(Class<T> type)
throws PropertyException
PropertyThe value is converted using the registered converter to the given type.
If conversion is not supported a runtime exception will be triggered.
getValue in interface PropertyProperty#isNull() return
true
PropertyException
public void setValue(Object value)
throws PropertyException
PropertyFor complex or list properties the value will be set recursively (as a map or list value).
setValue in interface Propertyvalue - the value to set
PropertyException
public void setValue(String path,
Object value)
throws PropertyException
Property
This method is a shortcut for: resolvePath(path).setValue(value).
setValue in interface Propertypath - the property pathvalue - the value
PropertyNotFoundException - if the named peroperty doesn't exists
InvalidPropertyValueException - if the given value cannot be normalized
PropertyException
public <T> T getValue(Class<T> type,
String path)
throws PropertyException
PropertyThe value will be converted to the given type if possible, otherwise an exception will be thrown.
This method is a shortcut for: resolvePath(path).getValue(type).
getValue in interface PropertyT - The type of the value to returntype - the class of the valuepath - the java path of the property value
PropertyNotFoundException
PropertyException
public Serializable getValue(String path)
throws PropertyException
Property
This method is a shortcut for: resolvePath(path).getValue().
getValue in interface Propertypath - the path to the property
PropertyNotFoundException
PropertyException
public Serializable getValue()
throws PropertyException
PropertyNormalized values are of the java type that correspond to the field type
getValue in interface PropertyProperty#isNull() return
true
PropertyException
public void moveTo(int index)
throws UnsupportedOperationException
PropertyThis method applies only for list item properties. The given index includes removed properties.
moveTo in interface PropertyUnsupportedOperationException - if the operation is not supported by the target propertypublic DocumentPart getRoot()
Property
getRoot in interface Property
public Property resolvePath(String path)
throws PropertyNotFoundException
PropertyProperty.resolvePath(Path) but with a string path as argument.
This is the same as calling resolvePath(new Path(path))
resolvePath in interface Propertypath - the string path to resolve.
PropertyNotFoundException - if the path cannot be resolved
public Property resolvePath(Path path)
throws PropertyNotFoundException
PropertyThe path format is a subset of XPath. Thus, / is used as path element separator, [n] for list element indexes. Attribute separator '@' are not supported since all properties are assumed to be elements. Also you .. and . can be used as element names.
Example of paths:
dc:title
attachments/item[2]/mimeType
../dc:title
resolvePath in interface Propertypath - the path to resolve.
PropertyNotFoundException - if the path cannot be resolved
public Serializable normalize(Object value)
throws PropertyConversionException
PropertyNormalized values are the ones that are used for transportation over the net and that are givenm to the storage implementation to be stored in the repository
Normalized values must be Serializable
If the given value is already normalized it will be returned back.
normalize in interface Propertyvalue - the value to normalize acordying to the property type
PropertyConversionExceptionpublic boolean isNormalized(Object value)
PropertyNull values are considered as normalized.
isNormalized in interface Propertyvalue - the value to check
public <T> T convertTo(Serializable value,
Class<T> toType)
throws PropertyConversionException
PropertyIf the value has already the given type it will be returned back.
convertTo in interface Propertyvalue - the normalized value to converttoType - the conversion type
PropertyConversionException - If the conversion cannot be made
because of type incompatibilitiespublic boolean validateType(Class<?> type)
PropertyTests if the given value type can be converted to a normalized type and thus a value of this type can be set to tthat property.
validateType in interface Propertytype - the type to validate
public boolean validate(Serializable value)
PropertyOnly normalized values can be validated.
If the value is not validated, returns false.
validate in interface Propertyvalue - the value to validate
Property.validateType(Class)
public Object newInstance()
throws InstantiationException,
IllegalAccessException
Property
Empty is used in the sense of a vbalue that has not been initialized
or can be considered as an emtpy value. For example for the String type the empty value
will be the empty string ""
newInstance in interface PropertyInstantiationException
IllegalAccessExceptionpublic String toString()
toString in class Objectpublic Object getData()
getData in interface Propertypublic Object getData(String key)
Property
You are free to set any data you want on properties but be aware to
use Serializable objects if you want to serialize them along
with the property
getData in interface Propertypublic void setData(Object value)
Property
The property data is reserved for the implementation and you must not directly set it.
Data attached with properties must be Serializable objects if
you want to serialize them along with the property
setData in interface Property
public void setData(String key,
Object value)
Property
The property data is reserved for the implementation and you must not directly set it.
Data attached with properties must be Serializable objects if
you want to serialize them along with the property
setData in interface Property
|
Nuxeo Enterprise Platform 5.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||