Class DocumentModelUtils

java.lang.Object
org.nuxeo.ecm.core.utils.DocumentModelUtils

public final class DocumentModelUtils extends Object
Utility methods to deal with property names retrieval.
Author:
Anahide Tchertchian
  • Method Details

    • encodePropertyName

      public static String encodePropertyName(String propertyName)
      Encodes a property name to use it in a url.
      Parameters:
      propertyName - like dc:title, file:content.3.filename (?)
    • decodePropertyName

      public static String decodePropertyName(String propertyPath)
      Decodes a property path given in a url.
      Parameters:
      propertyPath - like dc:title file/content/3/filename (?)
    • getPropertyValue

      public static Object getPropertyValue(DocumentModel doc, String propertyName)
      The given propertyName should have 'schema_name:property_name' format.
      Returns:
      null if any error occurs.
    • getComplexPropertyValue

      public static Object getComplexPropertyValue(DocumentModel doc, String propertyPath)
      Obtains a property value given its path.
      Parameters:
      doc - the document
      propertyPath - the property path
      Returns:
      the property value or null if an error occured.
    • getSchemaName

      public static String getSchemaName(String propertyName)
      Obtains the schema name from the full propertyName.
      Throws:
      IllegalArgumentException - if the propertyName does not have a schema:field pattern
    • getFieldName

      public static String getFieldName(String propertyName)
      Obtains the field name from the full propertyName.
      Throws:
      IllegalArgumentException - if the propertyName does not have a schema:field pattern
    • getProperties

      public static Map<String,Object> getProperties(DocumentModel docModel)
      Gets all properties defined in declared schemas of a DocumentModel.
      Returns:
      map with property names as keys