public final class DocumentModelFunctions extends Object implements LiveEditConstants
ACTION, ACTION_CREATE_DOCUMENT, ACTION_CREATE_DOCUMENT_FROM_TEMPLATE, ACTION_EDIT_DOCUMENT, actionSelectorTag, BLOB_FIELD, BLOB_PROPERTY_NAME, DEFAULT_BLOB_FIELD, DEFAULT_DOCTYPE, DEFAULT_FILENAME_FIELD, DEFAULT_SCHEMA, DEFAULT_SUB_BLOB_FIELD, DOC_REF, DOC_TYPE, docBlobFieldNameTag, docBlobFieldPathTag, docFieldNameTag, docfieldPathTag, docFileAuthorizedExtensionsTag, docFileAuthorizedExtensionTag, docFileExtensionTag, docFilenameFieldNameTag, docFilenameFieldPathTag, docfileNameTag, docIsLockedTag, docIsVersionTag, docMimetypeTag, docPathTag, docRefTag, docRepositoryTag, docSchemaNameTag, docTitleTag, docTypeTag, documentTag, editIdTag, FILENAME_FIELD, FILENAME_PROPERTY_NAME, liveEditTag, MIMETYPE, REPO_ID, requestBaseURLTag, requestCookiesTag, requestCookieTag, requestHeadersTag, requestHeaderTag, requestInfoTag, SCHEMA, serverInfoTag, serverVersionTag, TEMPLATE_BLOB_FIELD, TEMPLATE_DOC_REF, TEMPLATE_REPO_ID, TEMPLATE_SCHEMA, templateDocumentTag, URL_ENCODE_CHARSET, userInfoTag, userLocaleTag, userNameTag, userPasswordTag, userTokenTag, wsdlAccessWebServiceTag, wsdlLEWebServiceTag, wsdlLocationsTag, XML_LE_NAMESPACE
Modifier and Type | Method and Description |
---|---|
protected static void |
addQueryParameter(StringBuilder sb,
String name,
String value,
boolean isFirst) |
static String |
bigFileUrl(DocumentModel doc,
String blobPropertyName,
String filename) |
static String |
bigIconExpandedPath(DocumentModel document) |
static String |
bigIconPath(DocumentModel document) |
static boolean |
canModify(DocumentModel document)
Returns true if document can be modified.
|
static String |
complexFileUrl(String patternName,
DocumentModel doc,
int index,
String filename)
Convenient method to get the REST URL of a blob inside the
Files schema. |
static String |
complexFileUrl(String patternName,
DocumentModel doc,
String listElement,
int index,
String blobPropertyName,
String filename)
Get the REST URL for a blob inside a list of complex type.
|
static String |
complexLiveEditUrl(DocumentModel doc,
String listPropertyName,
int index,
String blobPropertyName,
String filenamePropertyName)
Build the nxedit URL for the "edit existing document" use case
|
static Object |
defaultValue(String propertyName)
Returns the default value for given property name.
|
static Object |
defaultValue(String schemaName,
String fieldName)
Deprecated.
use defaultValue(propertyName) instead
|
static String |
documentUrl(DocumentModel doc) |
static String |
documentUrl(DocumentModel doc,
javax.servlet.http.HttpServletRequest req) |
static String |
documentUrl(String patternName,
DocumentLocation docLoc,
String viewId,
Map<String,String> parameters,
boolean newConversation,
javax.servlet.http.HttpServletRequest req) |
static String |
documentUrl(String patternName,
DocumentLocation docLoc,
String viewId,
Map<String,String> parameters,
boolean newConversation,
String baseURL)
Computes a document URL.
|
static String |
documentUrl(String patternName,
DocumentModel doc,
String viewId,
Map<String,String> parameters,
boolean newConversation)
Deprecated.
since 7.3, use
documentUrl(String, DocumentLocation, String, Map, boolean, String) instead. |
static String |
documentUrl(String patternName,
DocumentModel doc,
String viewId,
Map<String,String> parameters,
boolean newConversation,
javax.servlet.http.HttpServletRequest req)
Deprecated.
since 7.3, use
documentUrl(String, DocumentLocation, String, Map, boolean, String) instead. |
static String |
documentUrl(String patternName,
DocumentModel doc,
String viewId,
Map<String,String> parameters,
boolean newConversation,
String baseURL)
Computes a document URL.
|
static String |
extractJSessionId(javax.servlet.http.HttpServletRequest request)
Extract the current JSESSIONID value from the request context
|
static String |
fileDescription(DocumentModel document,
String blobPropertyName,
String filePropertyName,
String filename) |
static String |
fileIconPath(Blob blob) |
static String |
fileUrl(String patternName,
DocumentModel doc,
String blobPropertyName,
String filename) |
static String |
fileUrl(String baseURL,
String patternName,
DocumentModel doc,
String blobPropertyName,
String filename) |
static Collection<String> |
getAvailableLifeCycleTransitions(String lifeCycleName,
String currentState)
Returns all the available transitions given the current state.
|
static String |
getLabelFromId(String directoryName,
String id)
Deprecated.
|
static String |
getPropertyPath(String listPropertyName,
int index,
String subPropertyName) |
static boolean |
hasPermission(DocumentModel document,
String permission) |
static String |
iconExpandedPath(DocumentModel document) |
static String |
iconPath(DocumentModel document) |
static boolean |
isDirty(DocumentModel doc) |
static boolean |
isDocumentModel(Object value) |
protected static boolean |
isPropertyValueDirty(Object value) |
static String |
liveCreateFromTemplateUrl(DocumentModel template)
Build the nxedit URL for the "create new document from template" use case with "File" doc type and "file" schema
|
static String |
liveCreateFromTemplateUrl(DocumentModel template,
String templateSchemaName,
String templateBlobFieldName,
String docType,
String schemaName,
String blobFieldName,
String filenameFieldName)
Build the nxedit URL for the "create new document from template" use case
|
static String |
liveCreateUrl(String mimetype)
Build the nxedit URL for the "create new document" use case with a document using the file:content field as Blob
holder
|
static String |
liveCreateUrl(String mimetype,
String docType,
String schemaName,
String blobFieldName,
String filenameFieldName)
Build the nxedit URL for the "create new document" use case
|
static String |
liveEditUrl(DocumentModel doc)
Build the nxedit URL for the "edit existing document" use case for a document using the file:content field as
Blob holder
|
static String |
liveEditUrl(DocumentModel doc,
String schemaName,
String blobFieldName,
String filenameFieldName)
Build the nxedit URL for the "edit existing document" use case
|
static String |
repositoryUrl(String patternName,
String repositoryName,
String viewId,
Map<String,String> parameters,
boolean newConversation)
Deprecated.
since 7.3, use
repositoryUrl(String, String, String, Map, boolean, String) instead. |
static String |
repositoryUrl(String patternName,
String repositoryName,
String viewId,
Map<String,String> parameters,
boolean newConversation,
javax.servlet.http.HttpServletRequest req)
Deprecated.
since 7.3, use
repositoryUrl(String, String, String, Map, boolean, String) instead. |
static String |
repositoryUrl(String patternName,
String repositoryName,
String viewId,
Map<String,String> parameters,
boolean newConversation,
String baseURL)
Computes an URL for a
repositoryName only. |
static void |
resetDefaultViewCache()
Reset default view cache.
|
static String |
titleFromId(String documentId) |
static String |
titleOrId(DocumentModel document) |
static TypeInfo |
typeInfo(DocumentModel document) |
static String |
typeLabel(DocumentModel document) |
static String |
typeView(DocumentModel document,
String viewId) |
public static TypeInfo typeInfo(DocumentModel document)
public static String typeLabel(DocumentModel document)
public static String typeView(DocumentModel document, String viewId)
public static String iconPath(DocumentModel document)
public static String iconExpandedPath(DocumentModel document)
public static String bigIconPath(DocumentModel document)
public static String bigIconExpandedPath(DocumentModel document)
public static String fileIconPath(Blob blob)
public static String titleOrId(DocumentModel document)
public static String titleFromId(String documentId)
public static boolean isDocumentModel(Object value)
public static boolean isDirty(DocumentModel doc)
protected static boolean isPropertyValueDirty(Object value)
public static boolean hasPermission(DocumentModel document, String permission)
public static boolean canModify(DocumentModel document)
A document can be modified if current user has 'Write' permission on it and document is mutable (no archived version).
document
- @Deprecated public static Object defaultValue(String schemaName, String fieldName)
schemaName
- the schema namefieldName
- the field namepublic static Object defaultValue(String propertyName)
propertyName
- as xpathpublic static String fileUrl(String baseURL, String patternName, DocumentModel doc, String blobPropertyName, String filename)
public static String fileUrl(String patternName, DocumentModel doc, String blobPropertyName, String filename)
public static String bigFileUrl(DocumentModel doc, String blobPropertyName, String filename)
public static String fileDescription(DocumentModel document, String blobPropertyName, String filePropertyName, String filename)
public static String complexFileUrl(String patternName, DocumentModel doc, int index, String filename)
Files
schema.patternName
- doc
- The document model.index
- index of the element containing the blob. index
starts at 0.filename
- The filename of the blob.null
if an error occurred.public static String complexFileUrl(String patternName, DocumentModel doc, String listElement, int index, String blobPropertyName, String filename)
http://localhost/nuxeo/nxfile/server/docId/files:files%5B0%5D/file/image.png
for the blob property
'file' of the first element inside the 'files:files' list.patternName
- doc
- The document model.listElement
- Element containing a list of complex type.index
- Index of the element containing the blob inside the list. index
starts at 0.blobPropertyName
- The property containing the blob.filename
- Filename of the blob.null
if an error occurred.public static String documentUrl(DocumentModel doc, javax.servlet.http.HttpServletRequest req)
public static String documentUrl(DocumentModel doc)
public static String documentUrl(String patternName, DocumentModel doc, String viewId, Map<String,String> parameters, boolean newConversation)
documentUrl(String, DocumentLocation, String, Map, boolean, String)
instead.public static String documentUrl(String patternName, DocumentModel doc, String viewId, Map<String,String> parameters, boolean newConversation, javax.servlet.http.HttpServletRequest req)
documentUrl(String, DocumentLocation, String, Map, boolean, String)
instead.public static String documentUrl(String patternName, DocumentModel doc, String viewId, Map<String,String> parameters, boolean newConversation, String baseURL)
public static String documentUrl(String patternName, DocumentLocation docLoc, String viewId, Map<String,String> parameters, boolean newConversation, javax.servlet.http.HttpServletRequest req)
public static String documentUrl(String patternName, DocumentLocation docLoc, String viewId, Map<String,String> parameters, boolean newConversation, String baseURL)
public static String repositoryUrl(String patternName, String repositoryName, String viewId, Map<String,String> parameters, boolean newConversation)
repositoryUrl(String, String, String, Map, boolean, String)
instead.repositoryName
only.public static String repositoryUrl(String patternName, String repositoryName, String viewId, Map<String,String> parameters, boolean newConversation, javax.servlet.http.HttpServletRequest req)
repositoryUrl(String, String, String, Map, boolean, String)
instead.repositoryName
only.public static String repositoryUrl(String patternName, String repositoryName, String viewId, Map<String,String> parameters, boolean newConversation, String baseURL)
repositoryName
only.protected static void addQueryParameter(StringBuilder sb, String name, String value, boolean isFirst)
public static String liveEditUrl(DocumentModel doc)
public static String liveEditUrl(DocumentModel doc, String schemaName, String blobFieldName, String filenameFieldName)
public static String complexLiveEditUrl(DocumentModel doc, String listPropertyName, int index, String blobPropertyName, String filenamePropertyName)
public static String liveCreateUrl(String mimetype)
mimetype
- the mime type of the newly created documentpublic static String liveCreateUrl(String mimetype, String docType, String schemaName, String blobFieldName, String filenameFieldName)
mimetype
- the mime type of the newly created documentdocType
- the document type of the document to createschemaName
- the schema of the blob to hold the new attachmentblobFieldName
- the field name of the blob to hold the new attachmentfilenameFieldName
- the field name of the filename of the new attachmentpublic static String liveCreateFromTemplateUrl(DocumentModel template)
template
- the document holding the blob to be used as templatepublic static String liveCreateFromTemplateUrl(DocumentModel template, String templateSchemaName, String templateBlobFieldName, String docType, String schemaName, String blobFieldName, String filenameFieldName)
template
- the document holding the blob to be used as templatetemplateSchemaName
- the schema of the blob holding the templatetemplateBlobFieldName
- the field name of the blob holding the templatedocType
- the document type of the new document to createschemaName
- the schema of the new blob to be saved as attachmentblobFieldName
- the field name of the new blob to be saved as attachmentfilenameFieldName
- the field name of the filename of the attachmentpublic static String extractJSessionId(javax.servlet.http.HttpServletRequest request)
request
- the current HttpServletRequest request@Deprecated public static String getLabelFromId(String directoryName, String id) throws DirectoryException
DirectoryFunctions.getDirectoryEntry(String, String)
directoryName
- the directory nameid
- the label idDirectoryException
public static String getPropertyPath(String listPropertyName, int index, String subPropertyName)
public static Collection<String> getAvailableLifeCycleTransitions(String lifeCycleName, String currentState) throws LifeCycleException
lifeCycleName
- the Life Cycle namecurrentState
- the state from which the transitions should startLifeCycleException
public static void resetDefaultViewCache()
Copyright © 2016 Nuxeo SA. All rights reserved.