Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.ui.web.tag.fn
Class DocumentModelFunctions

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.tag.fn.DocumentModelFunctions
All Implemented Interfaces:
LiveEditConstants

public final class DocumentModelFunctions
extends java.lang.Object
implements LiveEditConstants

Document model functions.

Author:
Anahide Tchertchian, Olivier Grisel

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.platform.ui.web.tag.fn.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
 
Method Summary
static java.lang.String bigFileUrl(DocumentModel doc, java.lang.String blobPropertyName, java.lang.String filename)
           
static java.lang.String bigIconExpandedPath(DocumentModel document)
           
static java.lang.String bigIconPath(DocumentModel document)
           
static boolean canModify(DocumentModel document)
          Returns true if document can be modified.
static java.lang.String complexFileUrl(java.lang.String patternName, DocumentModel doc, int index, java.lang.String filename)
          Convenient method to get the REST URL of a blob inside the Files schema.
static java.lang.String complexFileUrl(java.lang.String patternName, DocumentModel doc, java.lang.String listElement, int index, java.lang.String blobPropertyName, java.lang.String filename)
          Get the REST URL for a blob inside a list of complex type.
static java.lang.String complexLiveEditUrl(DocumentModel doc, java.lang.String listPropertyName, int index, java.lang.String blobPropertyName, java.lang.String filenamePropertyName)
          Build the nxedit URL for the "edit existing document" use case
static java.lang.Object defaultValue(java.lang.String propertyName)
          Returns the default value for given property name.
static java.lang.Object defaultValue(java.lang.String schemaName, java.lang.String fieldName)
          Deprecated. use defaultValue(propertyName) instead
static java.lang.String documentUrl(DocumentModel doc)
           
static java.lang.String documentUrl(DocumentModel doc, javax.servlet.http.HttpServletRequest req)
           
static java.lang.String documentUrl(java.lang.String patternName, DocumentModel doc, java.lang.String viewId, java.util.Map<java.lang.String,java.lang.String> parameters, boolean newConversation)
           
static java.lang.String documentUrl(java.lang.String patternName, DocumentModel doc, java.lang.String viewId, java.util.Map<java.lang.String,java.lang.String> parameters, boolean newConversation, javax.servlet.http.HttpServletRequest req)
           
static java.lang.String fileDescription(DocumentModel document, java.lang.String blobPropertyName, java.lang.String filePropertyName, java.lang.String filename)
           
static java.lang.String fileIconPath(Blob blob)
           
static java.lang.String fileUrl(java.lang.String patternName, DocumentModel doc, java.lang.String blobPropertyName, java.lang.String filename)
           
static java.lang.String getLabelFromId(java.lang.String directoryName, java.lang.String id)
          Deprecated. use DirectoryFunctions.getDirectoryEntry(String, String)
static java.lang.String getPropertyPath(java.lang.String listPropertyName, int index, java.lang.String subPropertyName)
           
static boolean hasPermission(DocumentModel document, java.lang.String permission)
           
static java.lang.String iconExpandedPath(DocumentModel document)
           
static java.lang.String iconPath(DocumentModel document)
           
static java.lang.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 java.lang.String liveCreateFromTemplateUrl(DocumentModel template, java.lang.String templateSchemaName, java.lang.String templateBlobFieldName, java.lang.String docType, java.lang.String schemaName, java.lang.String blobFieldName, java.lang.String filenameFieldName)
          Build the nxedit URL for the "create new document from template" use case
static java.lang.String liveCreateUrl(java.lang.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 java.lang.String liveCreateUrl(java.lang.String mimetype, java.lang.String docType, java.lang.String schemaName, java.lang.String blobFieldName, java.lang.String filenameFieldName)
          Build the nxedit URL for the "create new document" use case
static java.lang.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 java.lang.String liveEditUrl(DocumentModel doc, java.lang.String schemaName, java.lang.String blobFieldName, java.lang.String filenameFieldName)
          Build the nxedit URL for the "edit existing document" use case
static java.lang.String titleOrId(DocumentModel document)
           
static TypeInfo typeInfo(DocumentModel document)
           
static java.lang.String typeLabel(DocumentModel document)
           
static java.lang.String typeView(DocumentModel document, java.lang.String viewId)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

typeInfo

public static TypeInfo typeInfo(DocumentModel document)

typeLabel

public static java.lang.String typeLabel(DocumentModel document)

typeView

public static java.lang.String typeView(DocumentModel document,
                                        java.lang.String viewId)

iconPath

public static java.lang.String iconPath(DocumentModel document)

iconExpandedPath

public static java.lang.String iconExpandedPath(DocumentModel document)

bigIconPath

public static java.lang.String bigIconPath(DocumentModel document)

bigIconExpandedPath

public static java.lang.String bigIconExpandedPath(DocumentModel document)

fileIconPath

public static java.lang.String fileIconPath(Blob blob)

titleOrId

public static java.lang.String titleOrId(DocumentModel document)

hasPermission

public static boolean hasPermission(DocumentModel document,
                                    java.lang.String permission)
                             throws ClientException
Throws:
ClientException

canModify

public static boolean canModify(DocumentModel document)
                         throws ClientException
Returns true if document can be modified.

A document can be modified if current user has 'Write' permission on it and document is mutable (no archived version).

Parameters:
document -
Returns:
true if document can be modified.
Throws:
ClientException

defaultValue

@Deprecated
public static java.lang.Object defaultValue(java.lang.String schemaName,
                                                       java.lang.String fieldName)
                                     throws java.lang.Exception
Deprecated. use defaultValue(propertyName) instead

Returns the default value for given schema field.

Parameters:
schemaName - the schema name
fieldName - the field name
Returns:
the default value.
Throws:
java.lang.Exception

defaultValue

public static java.lang.Object defaultValue(java.lang.String propertyName)
                                     throws java.lang.Exception
Returns the default value for given property name.

Parameters:
propertyName - as xpath
Returns:
the default value.
Throws:
java.lang.Exception

fileUrl

public static java.lang.String fileUrl(java.lang.String patternName,
                                       DocumentModel doc,
                                       java.lang.String blobPropertyName,
                                       java.lang.String filename)

bigFileUrl

public static java.lang.String bigFileUrl(DocumentModel doc,
                                          java.lang.String blobPropertyName,
                                          java.lang.String filename)

fileDescription

public static java.lang.String fileDescription(DocumentModel document,
                                               java.lang.String blobPropertyName,
                                               java.lang.String filePropertyName,
                                               java.lang.String filename)

complexFileUrl

public static java.lang.String complexFileUrl(java.lang.String patternName,
                                              DocumentModel doc,
                                              int index,
                                              java.lang.String filename)
Convenient method to get the REST URL of a blob inside the Files schema.

Parameters:
patternName -
doc - The document model.
index - index of the element containing the blob. index starts at 0.
filename - The filename of the blob.
Returns:
the REST URL for the blob, or null if an error occurred.

complexFileUrl

public static java.lang.String complexFileUrl(java.lang.String patternName,
                                              DocumentModel doc,
                                              java.lang.String listElement,
                                              int index,
                                              java.lang.String blobPropertyName,
                                              java.lang.String filename)
Get the REST URL for a blob inside a list of complex type. For instance, 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.

Parameters:
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.
Returns:
the REST URL for the blob, or null if an error occurred.

documentUrl

public static java.lang.String documentUrl(DocumentModel doc,
                                           javax.servlet.http.HttpServletRequest req)

documentUrl

public static java.lang.String documentUrl(DocumentModel doc)

documentUrl

public static java.lang.String documentUrl(java.lang.String patternName,
                                           DocumentModel doc,
                                           java.lang.String viewId,
                                           java.util.Map<java.lang.String,java.lang.String> parameters,
                                           boolean newConversation)

documentUrl

public static java.lang.String documentUrl(java.lang.String patternName,
                                           DocumentModel doc,
                                           java.lang.String viewId,
                                           java.util.Map<java.lang.String,java.lang.String> parameters,
                                           boolean newConversation,
                                           javax.servlet.http.HttpServletRequest req)

liveEditUrl

public static java.lang.String liveEditUrl(DocumentModel doc)
                                    throws ClientException
Build the nxedit URL for the "edit existing document" use case for a document using the file:content field as Blob holder

Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

liveEditUrl

public static java.lang.String liveEditUrl(DocumentModel doc,
                                           java.lang.String schemaName,
                                           java.lang.String blobFieldName,
                                           java.lang.String filenameFieldName)
                                    throws ClientException
Build the nxedit URL for the "edit existing document" use case

Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

complexLiveEditUrl

public static java.lang.String complexLiveEditUrl(DocumentModel doc,
                                                  java.lang.String listPropertyName,
                                                  int index,
                                                  java.lang.String blobPropertyName,
                                                  java.lang.String filenamePropertyName)
                                           throws ClientException
Build the nxedit URL for the "edit existing document" use case

Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

liveCreateUrl

public static java.lang.String liveCreateUrl(java.lang.String mimetype)
                                      throws ClientException
Build the nxedit URL for the "create new document" use case with a document using the file:content field as Blob holder

Parameters:
mimetype - the mime type of the newly created document
Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

liveCreateUrl

public static java.lang.String liveCreateUrl(java.lang.String mimetype,
                                             java.lang.String docType,
                                             java.lang.String schemaName,
                                             java.lang.String blobFieldName,
                                             java.lang.String filenameFieldName)
                                      throws ClientException
Build the nxedit URL for the "create new document" use case

Parameters:
mimetype - the mime type of the newly created document
docType - the document type of the document to create
schemaName - the schema of the blob to hold the new attachment
blobFieldName - the field name of the blob to hold the new attachment
filenameFieldName - the field name of the filename of the new attachment
Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

liveCreateFromTemplateUrl

public static java.lang.String liveCreateFromTemplateUrl(DocumentModel template)
                                                  throws ClientException
Build the nxedit URL for the "create new document from template" use case with "File" doc type and "file" schema

Parameters:
template - the document holding the blob to be used as template
Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

liveCreateFromTemplateUrl

public static java.lang.String liveCreateFromTemplateUrl(DocumentModel template,
                                                         java.lang.String templateSchemaName,
                                                         java.lang.String templateBlobFieldName,
                                                         java.lang.String docType,
                                                         java.lang.String schemaName,
                                                         java.lang.String blobFieldName,
                                                         java.lang.String filenameFieldName)
                                                  throws ClientException
Build the nxedit URL for the "create new document from template" use case

Parameters:
template - the document holding the blob to be used as template
templateSchemaName - the schema of the blob holding the template
templateBlobFieldName - the field name of the blob holding the template
docType - the document type of the new document to create
schemaName - the schema of the new blob to be saved as attachment
blobFieldName - the field name of the new blob to be saved as attachment
filenameFieldName - the field name of the filename of the attachment
Returns:
the encoded URL string
Throws:
ClientException - if the URL encoding fails

getLabelFromId

@Deprecated
public static java.lang.String getLabelFromId(java.lang.String directoryName,
                                                         java.lang.String id)
                                       throws DirectoryException
Deprecated. use DirectoryFunctions.getDirectoryEntry(String, String)

Returns the label for given directory and id.

Parameters:
directoryName - the directory name
id - the label id
Returns:
the label.
Throws:
DirectoryException

getPropertyPath

public static java.lang.String getPropertyPath(java.lang.String listPropertyName,
                                               int index,
                                               java.lang.String subPropertyName)

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.