Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.model
Interface PropertyContainer

All Known Subinterfaces:
Document, DocumentProxy, SQLDocument
All Known Implementing Classes:
AbstractDocument, MockDocument, SQLComplexListProperty, SQLComplexProperty, SQLContentProperty, SQLDocumentLive, SQLDocumentProxy, SQLDocumentVersion

public interface PropertyContainer

Author:
Bogdan Stefanescu

Method Summary
 Map<String,Object> exportFlatMap(String[] schemas)
          Exports a flat view of properties in this document.
 Map<String,Object> exportMap(String schemaName)
           
 Map<String,Map<String,Object>> exportMap(String[] schemas)
          Exports the properties belonging to the given schemas as a java Map.
 boolean getBoolean(String name)
          Gets the value of a scalar property as a boolean.
 Blob getContent(String name)
          Gets the value of the named content property.
 Calendar getDate(String name)
          Gets the value of a scalar property as a date.
 List<String> getDirtyFields()
          Returns fields that were modified.
 double getDouble(String name)
          Gets the value of a scalar property as a double.
 long getLong(String name)
          Gets the value of a scalar property as a long.
 Collection<Property> getProperties()
          Gets the collection of the sub properties in this container.
 Property getProperty(String name)
          Gets a property given its name.
 Iterator<Property> getPropertyIterator()
          Gets an iterator over all existing properties in this container.
 Object getPropertyValue(String name)
          Generic method to retrieve a property value.
 String getString(String name)
          Gets the value of a scalar property as a string.
 void importFlatMap(Map<String,Object> map)
          Imports a flat map of properties into this document.
 void importMap(Map<String,Map<String,Object>> map)
          Imports the tree properties from the given Java Map.
 boolean isPropertySet(String path)
          Tests whether the property at the given path exists (the property may be either a scalar or a composite one).
 void removeProperty(String name)
          Removes the property with the given name.
 void setBoolean(String name, boolean value)
          Sets the scalar property value to the given boolean value.
 void setContent(String name, Blob value)
          Sets the content property to the given value.
 void setDate(String name, Calendar value)
          Sets the scalar property value to the given date value.
 void setDouble(String name, double value)
          Set the scalar property value to the given double value.
 void setLong(String name, long value)
          Sets the scalar property value to the given long value.
 void setPropertyValue(String name, Object value)
          Generic method to set a property value.
 void setString(String name, String value)
          Sets the scalar property value to the given string value.
 

Method Detail

isPropertySet

boolean isPropertySet(String path)
                      throws DocumentException
Tests whether the property at the given path exists (the property may be either a scalar or a composite one).

Parameters:
path - the path to test
Returns:
true if the property at the given path exists, false otherwise
Throws:
DocumentException - if any error occurs

getProperty

Property getProperty(String name)
                     throws DocumentException
Gets a property given its name.

If the named property is specified by schema of the container object this method will always return a property object even if the property was not yet set (doesn't exists).

In this case the method Property.isNull() of the returned property will return true. If the property is not specified by any container schema the NoSuchPropertyException will be thrown returns non null even if the property corresponding to that name was not previously set. The returned object is a scalar, composite or list property.

Parameters:
name - the property name to retrieve
Returns:
the property object
Throws:
DocumentException - if any error occurs

removeProperty

void removeProperty(String name)
                    throws DocumentException
Removes the property with the given name.

Parameters:
name - the property to remove
Throws:
DocumentException - if any error occurs

setPropertyValue

void setPropertyValue(String name,
                      Object value)
                      throws DocumentException
Generic method to set a property value.

This is a shortcut for getProperty(String).setValue(Object)

The following type of objects can be used as values depending on the property type:

Parameters:
name - the name of the property to set
value - the value to set
Throws:
DocumentException - if any error occurs

getPropertyValue

Object getPropertyValue(String name)
                        throws DocumentException
Generic method to retrieve a property value.

This is a shortcut for getProperty(String).getValue()

Parameters:
name - the name of the property to set
Returns:
the property value or null if the property is not set.
Throws:
DocumentException - if any error occurs
See Also:
for the list of supported value objects

getString

String getString(String name)
                 throws DocumentException
Gets the value of a scalar property as a string.

This is a shortcut for getScalar(name).getString()

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getString()};

getBoolean

boolean getBoolean(String name)
                   throws DocumentException
Gets the value of a scalar property as a boolean.

This is a shortcut for getScalar(name).getBoolean()

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getBoolean()};

getDouble

double getDouble(String name)
                 throws DocumentException
Gets the value of a scalar property as a double.

This is a shortcut for getScalar(name).getDouble()

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getDouble()};

getLong

long getLong(String name)
             throws DocumentException
Gets the value of a scalar property as a long.

This is a shortcut for getScalar(name).getLong()

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getLong()};

getDate

Calendar getDate(String name)
                 throws DocumentException
Gets the value of a scalar property as a date.

This is a shortcut for getScalar(name).getDate()

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getDate()};

getContent

Blob getContent(String name)
                throws DocumentException
Gets the value of the named content property.

Throws:
DocumentException - if any error occurs

setString

void setString(String name,
               String value)
               throws DocumentException
Sets the scalar property value to the given string value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set string properties.

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setString(String)}

setBoolean

void setBoolean(String name,
                boolean value)
                throws DocumentException
Sets the scalar property value to the given boolean value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set boolean properties.

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setBoolean(boolean)}

setLong

void setLong(String name,
             long value)
             throws DocumentException
Sets the scalar property value to the given long value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set long properties.

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setLong(long)}

setDouble

void setDouble(String name,
               double value)
               throws DocumentException
Set the scalar property value to the given double value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set double properties

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setDouble(double)}

setDate

void setDate(String name,
             Calendar value)
             throws DocumentException
Sets the scalar property value to the given date value.

If the property with that name doesn't exists, it will be created

This is a shortcut to create or set date properties.

Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setDate(Calendar)}

setContent

void setContent(String name,
                Blob value)
                throws DocumentException
Sets the content property to the given value.

If the property with that name doesn't exists, it will be created

Throws:
DocumentException - if any error occurs

exportMap

Map<String,Map<String,Object>> exportMap(String[] schemas)
                                         throws DocumentException
Exports the properties belonging to the given schemas as a java Map.

If the given schemas array is null then all schemas will be exported

The properties are grouped by schemas

The property tree is recursively traversed and all property in that schema exported as entry of the Map

Parameters:
schemas -
Returns:
the exported properties as a java Map
Throws:
DocumentException - if any error occurs

exportMap

Map<String,Object> exportMap(String schemaName)
                             throws DocumentException
Throws:
DocumentException

importMap

void importMap(Map<String,Map<String,Object>> map)
               throws DocumentException
Imports the tree properties from the given Java Map.

The property tree is recursively traversed and all property exported as entry of the Map.

Throws:
DocumentException - if any error occurs

exportFlatMap

Map<String,Object> exportFlatMap(String[] schemas)
                                 throws DocumentException
Exports a flat view of properties in this document.

If the given schemas array is null then all schemas will be exported.

Parameters:
schemas -
Returns:
Throws:
DocumentException - if any error occurs

importFlatMap

void importFlatMap(Map<String,Object> map)
                   throws DocumentException
Imports a flat map of properties into this document.

Parameters:
map -
Throws:
DocumentException - if any error occurs

getProperties

Collection<Property> getProperties()
                                   throws DocumentException
Gets the collection of the sub properties in this container.

The returned properties are existing.

Returns:
the existing properties in this container
Throws:
DocumentException - if any error occurs

getPropertyIterator

Iterator<Property> getPropertyIterator()
                                       throws DocumentException
Gets an iterator over all existing properties in this container.

The returned properties are existing.

Returns:
the existing properties in this container
Throws:
DocumentException - if any error occurs

getDirtyFields

List<String> getDirtyFields()
Returns fields that were modified.

XXX AT: compatibility method for NXP-666


Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.