Package org.nuxeo.ecm.core.api.impl
Class DataModelImpl
java.lang.Object
org.nuxeo.ecm.core.api.impl.DataModelImpl
- All Implemented Interfaces:
Serializable
,DataModel
Data model implementation.
- Author:
- Bogdan Stefanescu
- See Also:
-
Constructor Summary
ConstructorDescriptionDataModelImpl
(String schema) Builds an empty data model.DataModelImpl
(String schemaName, Map<String, Object> data) Builds a data model using the given data.DataModelImpl
(DocumentPart part) -
Method Summary
Modifier and TypeMethodDescriptionGets the named field value.Gets the collection of the dirty fields in this data model.Gets the underlying document part.getMap()
Gets all the fields set in this data model.Gets the schema of this data model.Gets a value given its path.boolean
isDirty()
Tests whether or not this data model is dirty (i.e. it was changed by the client).boolean
Tests whether or not the specified field from this data model is dirty.void
Sets the name field.void
Marks the specified field from this data model as dirty.void
Sets several field at once.Sets a value to a property given its path.toString()
-
Constructor Details
-
DataModelImpl
Builds an empty data model.- Parameters:
schema
- a schema name.
-
DataModelImpl
Builds a data model using the given data.- Parameters:
schemaName
- a schema name.data
- the data (map String>Object) to put in the DataModel.
-
DataModelImpl
-
-
Method Details
-
getDocumentPart
Gets the underlying document part. -
getSchema
Description copied from interface:DataModel
Gets the schema of this data model. -
getData
Description copied from interface:DataModel
Gets the named field value.- Specified by:
getData
in interfaceDataModel
- Parameters:
key
- the field key- Returns:
- the value or null if no such field exists
- Throws:
PropertyException
-
setData
Description copied from interface:DataModel
Sets the name field.- Specified by:
setData
in interfaceDataModel
- Parameters:
key
- the field namevalue
- the value to set. Accept null values.- Throws:
PropertyException
-
getMap
Description copied from interface:DataModel
Gets all the fields set in this data model.It is not guaranteed that the returned map will contain all the fields defined by the schema. It may even be empty.
The returned map is null if the data model was not yet loaded.
- Specified by:
getMap
in interfaceDataModel
- Returns:
- a read only map containing actual data in this object
- Throws:
PropertyException
-
setMap
Description copied from interface:DataModel
Sets several field at once.- Specified by:
setMap
in interfaceDataModel
- Parameters:
data
- the fields to set as a map- Throws:
PropertyException
-
isDirty
public boolean isDirty()Description copied from interface:DataModel
Tests whether or not this data model is dirty (i.e. it was changed by the client). -
isDirty
Description copied from interface:DataModel
Tests whether or not the specified field from this data model is dirty.- Specified by:
isDirty
in interfaceDataModel
- Parameters:
name
- the field name to tests- Returns:
- true if the field is dirty, false otherwise
- Throws:
PropertyNotFoundException
-
getDirtyFields
Description copied from interface:DataModel
Gets the collection of the dirty fields in this data model.- Specified by:
getDirtyFields
in interfaceDataModel
- Returns:
- the dirty fields or null if there are no dirty fields
-
toString
-
setDirty
Description copied from interface:DataModel
Marks the specified field from this data model as dirty.- Specified by:
setDirty
in interfaceDataModel
- Parameters:
name
- the field name to be dirty- Throws:
PropertyNotFoundException
-
getValue
Description copied from interface:DataModel
Gets a value given its path.The path is a subset of XPath: / and [] are supported.
- Specified by:
getValue
in interfaceDataModel
- Parameters:
path
- the property path- Throws:
PropertyException
-
setValue
Description copied from interface:DataModel
Sets a value to a property given its path.- Specified by:
setValue
in interfaceDataModel
- Throws:
PropertyException
-