public class DataModelImpl extends Object implements DataModel
| Constructor and Description | 
|---|
DataModelImpl(DocumentPart part)  | 
DataModelImpl(String schema)
Builds an empty data model. 
 | 
DataModelImpl(String schemaName,
             Map<String,Object> data)
Builds a data model using the given data. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Object | 
getData(String key)
Gets the named field value. 
 | 
Collection<String> | 
getDirtyFields()
Gets the collection of the dirty fields in this data model. 
 | 
DocumentPart | 
getDocumentPart()
Gets the underlying document part. 
 | 
Map<String,Object> | 
getMap()
Gets all the fields set in this data model. 
 | 
String | 
getSchema()
Gets the schema of this data model. 
 | 
Object | 
getValue(String path)
Gets a value given its path. 
 | 
boolean | 
isDirty()
Tests whether or not this data model is dirty (i.e. 
 | 
boolean | 
isDirty(String name)
Tests whether or not the specified field from this data model is dirty. 
 | 
void | 
setData(String key,
       Object value)
Sets the name field. 
 | 
void | 
setDirty(String name)
Marks the specified field from this data model as dirty. 
 | 
void | 
setMap(Map<String,Object> data)
Sets several field at once. 
 | 
Object | 
setValue(String path,
        Object value)
Sets a value to a property given its path. 
 | 
String | 
toString()  | 
public DataModelImpl(String schema)
schema - a schema name.public DataModelImpl(String schemaName, Map<String,Object> data)
schema - a schema name.data - the data (map String>Object) to put in the DataModel.public DataModelImpl(DocumentPart part)
public DocumentPart getDocumentPart()
public String getSchema()
DataModelpublic Object getData(String key) throws PropertyException
DataModelgetData in interface DataModelkey - the field keyPropertyExceptionpublic void setData(String key, Object value) throws PropertyException
DataModelsetData in interface DataModelkey - the field namevalue - the value to set. Accept null values.PropertyExceptionpublic Map<String,Object> getMap() throws PropertyException
DataModelIt 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.
getMap in interface DataModelPropertyExceptionpublic void setMap(Map<String,Object> data) throws PropertyException
DataModelsetMap in interface DataModeldata - the fields to set as a mapPropertyExceptionpublic boolean isDirty()
DataModelpublic boolean isDirty(String name) throws PropertyNotFoundException
DataModelisDirty in interface DataModelname - the field name to testsPropertyNotFoundExceptionpublic Collection<String> getDirtyFields()
DataModelgetDirtyFields in interface DataModelpublic void setDirty(String name) throws PropertyNotFoundException
DataModelsetDirty in interface DataModelname - the field name to be dirtyPropertyNotFoundExceptionpublic Object getValue(String path) throws PropertyException
DataModelThe path is a subset of XPath: / and [] are supported.
getValue in interface DataModelpath - the property pathPropertyExceptionpublic Object setValue(String path, Object value) throws PropertyException
DataModelsetValue in interface DataModelPropertyExceptionCopyright © 2019 Nuxeo. All rights reserved.