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).
|
protected static void |
setLocalAcl(CoreSession session,
DocumentModel doc,
String value) |
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)
public static void removeProperty(DocumentModel doc, String xpath)
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 IOException, PropertyException
IOException
PropertyException
public static void setProperties(CoreSession session, DocumentModel doc, Map<String,String> values) throws IOException
IOException
public static void setProperty(CoreSession session, DocumentModel doc, String key, String value) throws IOException
IOException
protected static void setLocalAcl(CoreSession session, DocumentModel doc, String value)
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 IOException
session
- doc
- properties
- IOException
public static void setProperty(CoreSession session, DocumentModel doc, String key, String value, boolean decodeStringListAsJSON) throws IOException
session
- doc
- key
- value
- decodeStringListAsJSON
- IOException
Copyright © 2016 Nuxeo SA. All rights reserved.