public class DocumentHelper extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addBlob(Property p,
Blob blob)
Given a document property, updates its value with the given blob.
|
static HashMap<String,Serializable> |
createBlobHolderMap(Blob blob) |
static String[] |
readStringList(String value)
Read an encoded string list as a comma separated list.
|
static Object |
readStringList(String value,
SimpleType type)
Read an encoded string list as a comma separated list.
|
static void |
removeProperty(DocumentModel doc,
String xpath)
Removes a property from a document given the xpath.
|
static DocumentModel |
saveDocument(CoreSession session,
DocumentModel doc)
Saves the document and clear context data to avoid incrementing version in next operations if not needed.
|
static void |
setJSONProperties(CoreSession session,
DocumentModel doc,
Properties properties)
Sets the properties of a document based on their JSON representation (especially for scalar lists).
|
static void |
setProperties(CoreSession session,
DocumentModel doc,
Map<String,String> values)
Sets the properties given as a map of xpath:value to the given document.
|
static void |
setProperties(CoreSession session,
DocumentModel doc,
Properties properties) |
static void |
setProperty(CoreSession session,
DocumentModel doc,
String key,
String value) |
static void |
setProperty(CoreSession session,
DocumentModel doc,
String key,
String value,
boolean decodeStringListAsJSON) |
public static DocumentModel saveDocument(CoreSession session, DocumentModel doc) throws ClientException
ClientException
public static void removeProperty(DocumentModel doc, String xpath) throws ClientException
ClientException
public static void addBlob(Property p, Blob blob) throws PropertyException
PropertyException
public static HashMap<String,Serializable> createBlobHolderMap(Blob blob)
public static void setProperties(CoreSession session, DocumentModel doc, Properties properties) throws ClientException, IOException
ClientException
IOException
public static void setProperties(CoreSession session, DocumentModel doc, Map<String,String> values) throws ClientException, IOException
ClientException
IOException
public static void setProperty(CoreSession session, DocumentModel doc, String key, String value) throws ClientException, IOException
ClientException
IOException
public static Object readStringList(String value, SimpleType type)
StringType.ID
then array elements will be converted
to the actual type.value
- type
- public static String[] readStringList(String value)
value
- public static void setJSONProperties(CoreSession session, DocumentModel doc, Properties properties) throws ClientException, IOException
session
- doc
- properties
- ClientException
IOException
public static void setProperty(CoreSession session, DocumentModel doc, String key, String value, boolean decodeStringListAsJSON) throws ClientException, IOException
session
- doc
- key
- value
- decodeStringListAsJSON
- ClientException
IOException
Copyright © 2015 Nuxeo SA. All rights reserved.