Package org.nuxeo.ecm.core.utils
Class DocumentModelUtils
java.lang.Object
org.nuxeo.ecm.core.utils.DocumentModelUtils
Utility methods to deal with property names retrieval.
- Author:
- Anahide Tchertchian
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodePropertyName(String propertyPath) Decodes a property path given in a url.static StringencodePropertyName(String propertyName) Encodes a property name to use it in a url.static ObjectgetComplexPropertyValue(DocumentModel doc, String propertyPath) Obtains a property value given its path.static StringgetFieldName(String propertyName) Obtains the field name from the full propertyName.getProperties(DocumentModel docModel) Gets all properties defined in declared schemas of a DocumentModel.static ObjectgetPropertyValue(DocumentModel doc, String propertyName) The given propertyName should have 'schema_name:property_name' format.static StringgetSchemaName(String propertyName) Obtains the schema name from the full propertyName.
-
Method Details
-
encodePropertyName
Encodes a property name to use it in a url.- Parameters:
propertyName- like dc:title, file:content.3.filename (?)
-
decodePropertyName
Decodes a property path given in a url.- Parameters:
propertyPath- like dc:title file/content/3/filename (?)
-
getPropertyValue
The given propertyName should have 'schema_name:property_name' format.- Returns:
nullif any error occurs.
-
getComplexPropertyValue
Obtains a property value given its path.- Parameters:
doc- the documentpropertyPath- the property path- Returns:
- the property value or
nullif an error occured.
-
getSchemaName
Obtains the schema name from the full propertyName.- Throws:
IllegalArgumentException- if the propertyName does not have a schema:field pattern
-
getFieldName
Obtains the field name from the full propertyName.- Throws:
IllegalArgumentException- if the propertyName does not have a schema:field pattern
-
getProperties
Gets all properties defined in declared schemas of a DocumentModel.- Returns:
- map with property names as keys
-