Class ListProperty
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Property>
,Collection<Property>
,List<Property>
,Property
- See Also:
-
Field Summary
Fields inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
flags, forceDirty, IS_DEPRECATED, IS_READONLY, IS_SECURED, NON_CANON_INDEX, 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
ConstructorDescriptionListProperty
(Property parent, Field field) ListProperty
(Property parent, Field field, int flags) -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(PropertyVisitor visitor, Object arg) Method that implement the visitor pattern.void
Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
addAll
(int index, Collection<? extends Property> c) Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
addAll
(Collection<? extends Property> c) Throws UnsupportedOperationException, added to implement List<Property> interface.addEmpty()
Creates an empty child property and adds it as a property to the list container.Inserts at the given position a new value to the list.Appends a new value to the list.void
Supports ListDiff for compatibility.static ArrayList<?>
arrayToList
(Object obj) void
clear()
void
Notify the property that its changes was stored so it can safely remove dirty flags.clone()
boolean
Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
containsAll
(Collection<?> c) Throws UnsupportedOperationException, added to implement List<Property> interface.<T> T
convertTo
(Serializable value, Class<T> toType) Converts the given normalized value to the given type.get
(int index) Get the child property given it's index.Gets the child property having the given name.Get a collection over the children properties.protected Serializable
Gets an iterator over the dirty children properties.getField()
Gets the field corresponding to this property.getName()
Gets the property name.getType()
Get the type of the field corresponding to this property.Gets the property normalized value for write.int
Throws UnsupportedOperationException, added to implement List<Property> interface.int
void
init
(Serializable value) Initializes the property with the given normalized value.void
internalSetValue
(Serializable value) Sets the given normalized value.boolean
TODO FIXME XXX uncommentedreturn true;
see NXP-1653.boolean
isEmpty()
boolean
isNormalized
(Object value) Checks if the given value is a normalized one.boolean
Compare the two properties by content.int
Throws UnsupportedOperationException, added to implement List<Property> interface.Throws UnsupportedOperationException, added to implement List<Property> interface.listIterator
(int index) Throws UnsupportedOperationException, added to implement List<Property> interface.Normalizes the given value as dictated by the property type.remove
(int index) boolean
Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
boolean
removeAll
(Collection<?> c) Throws UnsupportedOperationException, added to implement List<Property> interface.boolean
retainAll
(Collection<?> c) Throws UnsupportedOperationException, added to implement List<Property> interface.Throws UnsupportedOperationException, added to implement List<Property> interface.void
Sets the child property having the given name.void
Sets this property value.subList
(int fromIndex, int toIndex) Throws UnsupportedOperationException, added to implement List<Property> interface.Object[]
toArray()
<T> T[]
toArray
(T[] a) Methods inherited from class org.nuxeo.ecm.core.api.model.impl.AbstractProperty
appendDirtyFlags, areFlagsSet, clearFlags, collectPath, computeRemovedProperty, getDeprecatedFallback, getDeprecatedParent, getDirtyFlags, getObjectResolver, getParent, getRoot, getSchema, getValue, getValue, getValue, getValue, getValueDeprecation, getXPath, getXPath, hasDefaultValue, isComplex, isDeprecated, isDirty, isForceDirty, isList, isModified, isMoved, isNew, isPhantom, isReadOnly, isRemoved, isSameValue, isScalar, isSecured, isSecuredForContext, iterator, moveTo, newDeprecatedMessage, newInstance, remove, removePhantomFlag, resolvePath, resolvePath, setDirtyFlags, setFlags, setForceDirty, setIsModified, setIsMoved, setIsNew, setIsRemoved, setReadOnly, setValue, setValue, setValueDeprecation, size, toString, validateType
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
equals, hashCode, iterator, replaceAll, size, sort, spliterator
-
Field Details
-
field
The corresponding field. -
children
-
-
Constructor Details
-
ListProperty
-
ListProperty
-
-
Method Details
-
internalSetValue
Description copied from class:AbstractProperty
Sets the given normalized value.This applies only for nodes that physically store a value (that means non container nodes). Container nodes does nothing.
- Specified by:
internalSetValue
in classAbstractProperty
- Throws:
PropertyException
-
isContainer
public boolean isContainer()TODO FIXME XXX uncommentedreturn true;
see NXP-1653.- Specified by:
isContainer
in interfaceProperty
- Returns:
- true if scalar false otherwise
- See Also:
-
addValue
Description copied from interface:Property
Inserts at the given position a new value to the list. A new property will be created to store the given value and appended to the children list.The created property will be marked as
Property.isNew()
.- Specified by:
addValue
in interfaceProperty
- Parameters:
index
- the position to insert the value- Returns:
- the added property
- Throws:
PropertyException
-
addValue
Description copied from interface:Property
Appends a new value to the list. A new property will be created to store the given value and appended to the children list.The created property will be marked as
Property.isNew()
.- Specified by:
addValue
in interfaceProperty
- Returns:
- the added property
- Throws:
PropertyException
-
addEmpty
Description copied from interface:Property
Creates an empty child property and adds it as a property to the list container.This method is useful to construct lists.
-
getChildren
Description copied from interface:Property
Get a collection over the children properties. This includes all children including phantom ones (those who are not yet set by the user).The returned collection is ordered for list properties, and unordered for complex properties
Be aware that this method is creating phantom child properties for all schema fields that are not yet set.
- Specified by:
getChildren
in interfaceProperty
- Returns:
- the children properties
-
getName
Description copied from interface:Property
Gets the property name. -
getType
Description copied from interface:Property
Get the type of the field corresponding to this property. -
get
Description copied from interface:Property
Gets the child property having the given name.If the property is a scalar, this will return always null.
The given name should be the full name (i.e. prefixed name if any prefix exists).
If a non prefixed name is given, the first child property having the given local name will be returned.
Relative paths are not resolved. THis method is intended to lookup direct children. For path lookups use
Property.resolvePath(String)
instead. -
get
Description copied from interface:Property
Get the child property given it's index. This operation is mandatory for List properties.If this method is not supported an
UnsupportedOperationException
must be thrownRelative paths are not resolved. THis method is intended to lookup direct chilren. For path lookups, use
Property.resolvePath(String)
instead. -
set
Description copied from interface:Property
Sets the child property having the given name.The given name should be the full name (i.e. prefixed name if any prefix exists).
If a non prefixed name is given, the first child property having the given local name will be returned.
Relative paths are not resolved. This method is intended to lookup direct children. For path lookups use
Property.resolvePath(String)
instead.- Specified by:
set
in interfaceProperty
- Parameters:
name
- the child property name (the full name including the prefix if any)property
- the child property to set- Throws:
PropertyNotFoundException
- if the child property is not found in the type definitionPropertyException
-
getDefaultValue
- Overrides:
getDefaultValue
in classAbstractProperty
-
internalGetValue
- Specified by:
internalGetValue
in classAbstractProperty
- Throws:
PropertyException
-
getValueForWrite
Description copied from interface:Property
Gets the property normalized value for write.Can be different fropm
Property.getValue()
in cases where the property adapts the value it is given to store.- Specified by:
getValueForWrite
in interfaceProperty
- Overrides:
getValueForWrite
in classAbstractProperty
- Returns:
- the property value to use for write, which may be null
- Throws:
PropertyException
-
init
Description copied from interface:Property
Initializes the property with the given normalized value.The given value must be normalized - note that no check is done on that.
The phantom flag is unset by this operation.
This method should be used to initialize properties.
- Specified by:
init
in interfaceProperty
- Overrides:
init
in classAbstractProperty
- Parameters:
value
- the normalized value to set- Throws:
PropertyException
-
setValue
Description copied from interface:Property
Sets this property value. The value will be first normalized and then set.For complex or list properties the value will be set recursively (as a map or list value).
- Specified by:
setValue
in interfaceProperty
- Overrides:
setValue
in classAbstractProperty
- Parameters:
value
- the value to set- Throws:
InvalidPropertyValueException
- if the given value type is not compatible with the expected value typePropertyException
-
clear
public void clear() -
getField
Description copied from interface:Property
Gets the field corresponding to this property.The field is the object defining the property. You can see the field as a java class and the property as a class instance
-
remove
-
remove
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
accept
Description copied from interface:Property
Method that implement the visitor pattern.The visitor must return null to stop visiting children otherwise a context object that will be passed as the arg argument to children
- Specified by:
accept
in interfaceProperty
- Parameters:
visitor
- the visitor to acceptarg
- an argument passed to the visitor. This should be used by the visitor to carry on the visiting context.- Throws:
PropertyException
-
isNormalized
Description copied from interface:Property
Checks if the given value is a normalized one. This means the value has a type that is normalized.Null values are considered as normalized.
- Specified by:
isNormalized
in interfaceProperty
- Overrides:
isNormalized
in classAbstractProperty
- Parameters:
value
- the value to check- Returns:
- true if the value is normalized false otherwise
-
normalize
Description copied from interface:Property
Normalizes the given value as dictated by the property type.Normalized values are the ones that are used for transportation over the net and that are given 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.
- Specified by:
normalize
in interfaceProperty
- Overrides:
normalize
in classAbstractProperty
- Parameters:
value
- the value to normalize according to the property type- Returns:
- the normalized value
- Throws:
PropertyConversionException
-
convertTo
Description copied from interface:Property
Converts the given normalized value to the given type.If the value has already the given type it will be returned back.
- Specified by:
convertTo
in interfaceProperty
- Overrides:
convertTo
in classAbstractProperty
- Parameters:
value
- the normalized value to converttoType
- the conversion type- Returns:
- the converted value, which may be null
- Throws:
PropertyConversionException
- if the conversion cannot be made because of type incompatibilities
-
arrayToList
-
applyListDiff
Supports ListDiff for compatibility.- Throws:
PropertyException
-
isSameAs
Description copied from interface:Property
Compare the two properties by content.- Specified by:
isSameAs
in interfaceProperty
- Returns:
- true If the properties have a similar content, otherwise false
- Throws:
PropertyException
-
getDirtyChildren
Description copied from interface:Property
Gets an iterator over the dirty children properties.- Specified by:
getDirtyChildren
in interfaceProperty
- Returns:
- the iterator
-
indexOf
-
add
Throws UnsupportedOperationException, added to implement List<Property> interface. -
add
Throws UnsupportedOperationException, added to implement List<Property> interface. -
addAll
Throws UnsupportedOperationException, added to implement List<Property> interface. -
addAll
Throws UnsupportedOperationException, added to implement List<Property> interface. -
contains
Throws UnsupportedOperationException, added to implement List<Property> interface. -
containsAll
Throws UnsupportedOperationException, added to implement List<Property> interface.- Specified by:
containsAll
in interfaceCollection<Property>
- Specified by:
containsAll
in interfaceList<Property>
-
indexOf
Throws UnsupportedOperationException, added to implement List<Property> interface. -
isEmpty
public boolean isEmpty() -
lastIndexOf
Throws UnsupportedOperationException, added to implement List<Property> interface.- Specified by:
lastIndexOf
in interfaceList<Property>
-
listIterator
Throws UnsupportedOperationException, added to implement List<Property> interface.- Specified by:
listIterator
in interfaceList<Property>
-
listIterator
Throws UnsupportedOperationException, added to implement List<Property> interface.- Specified by:
listIterator
in interfaceList<Property>
-
remove
Throws UnsupportedOperationException, added to implement List<Property> interface. -
removeAll
Throws UnsupportedOperationException, added to implement List<Property> interface. -
retainAll
Throws UnsupportedOperationException, added to implement List<Property> interface. -
set
Throws UnsupportedOperationException, added to implement List<Property> interface. -
subList
Throws UnsupportedOperationException, added to implement List<Property> interface. -
toArray
-
toArray
public <T> T[] toArray(T[] a) -
clearDirtyFlags
public void clearDirtyFlags()Description copied from interface:Property
Notify the property that its changes was stored so it can safely remove dirty flags.Dirty flags are removed according 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 propagated to the parent property or to children. You need to clear dirty flags explicitly for each property.
- Specified by:
clearDirtyFlags
in interfaceProperty
- Overrides:
clearDirtyFlags
in classAbstractProperty
-