Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.api.ejb
Class DocumentManagerBean

java.lang.Object
  extended by org.nuxeo.ecm.core.api.AbstractSession
      extended by org.nuxeo.ecm.core.api.ejb.DocumentManagerBean
All Implemented Interfaces:
java.io.Serializable, javax.ejb.SessionSynchronization, CoreSession, DocumentManagerLocal, OperationHandler, SecurityConstants

public class DocumentManagerBean
extends AbstractSession
implements DocumentManagerLocal, javax.ejb.SessionSynchronization

The implementation for CoreSession interface. This class and its parents mostly delegate the calls to the AbstractSession and its children.

This class and its children are also the points where security is attached/checked.

Author:
Razvan Caraghin
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.nuxeo.ecm.core.api.AbstractSession
ADMINISTRATOR, ANONYMOUS
 
Fields inherited from interface org.nuxeo.ecm.core.api.CoreSession
IMPORT_BASE_VERSION_ID, IMPORT_CHECKED_IN, IMPORT_IS_VERSION, IMPORT_LIFECYCLE_POLICY, IMPORT_LIFECYCLE_STATE, IMPORT_LOCK, IMPORT_PROXY_TARGET_ID, IMPORT_PROXY_TYPE, IMPORT_PROXY_VERSIONABLE_ID, IMPORT_VERSION_CREATED, IMPORT_VERSION_DESCRIPTION, IMPORT_VERSION_IS_LATEST, IMPORT_VERSION_IS_LATEST_MAJOR, IMPORT_VERSION_LABEL, IMPORT_VERSION_MAJOR, IMPORT_VERSION_MINOR, IMPORT_VERSION_VERSIONABLE_ID
 
Fields inherited from interface org.nuxeo.ecm.core.api.security.SecurityConstants
ADD_CHILDREN, ADMINISTRATORS, BROWSE, EVERYONE, EVERYTHING, MANAGE_WORKFLOWS, MEMBERS, READ, READ_CHILDREN, READ_LIFE_CYCLE, READ_PROPERTIES, READ_SECURITY, READ_VERSION, READ_WRITE, REMOVE, REMOVE_CHILDREN, RESTRICTED_READ, SYSTEM_USERNAME, UNLOCK, VERSION, VIEW_WORKLFOW, WRITE, WRITE_LIFE_CYCLE, WRITE_PROPERTIES, WRITE_SECURITY, WRITE_VERSION
 
Constructor Summary
DocumentManagerBean()
           
 
Method Summary
 DocumentRef checkIn(DocumentRef docRef, VersioningOption option, java.lang.String checkinComment)
          Checks in a modified document, creating a new version.
 DocumentModel checkIn(DocumentRef docRef, VersionModel version)
          Deprecated. 
 void checkOut(DocumentRef docRef)
          Checks out a versioned document.
 java.lang.String connect(java.lang.String repositoryName, java.util.Map<java.lang.String,java.io.Serializable> sessionContext)
          Connects to the repository given its URI.
 DocumentModel copy(DocumentRef src, DocumentRef dst, java.lang.String name)
          Copies the source document to the destination folder under the given name.
 java.util.List<DocumentModel> copy(java.util.List<DocumentRef> src, DocumentRef dst)
          Bulk copy.
 DocumentModel copyProxyAsDocument(DocumentRef src, DocumentRef dst, java.lang.String name)
          Work like copy but in the case of a source proxy the destination will be a new document instead of a proxy.
 java.util.List<DocumentModel> copyProxyAsDocument(java.util.List<DocumentRef> src, DocumentRef dst)
          Bulk copyProxyAsDocument.
 DocumentModel createDocument(DocumentModel docModel)
          Creates a document using given document model for initialization.
 DocumentModel[] createDocument(DocumentModel[] docModels)
          Bulk creation of documents.
 DocumentModel createProxy(DocumentRef docRef, DocumentRef folderRef)
          Creates a generic proxy to the given document inside the given folder.
 DocumentModel createProxy(DocumentRef parentRef, DocumentRef docRef, VersionModel version, boolean overwriteExistingProxy)
          Creates a proxy for the given version of the given document.
 void destroy()
          Destroys any system resources held by this instance.
 boolean followTransition(DocumentRef docRef, java.lang.String transition)
          Follows a given life cycle transition.
 DocumentModel getLastDocumentVersion(DocumentRef docRef)
          Gets the document corresponding to the last version for the given document.
 DocumentRef getLastDocumentVersionRef(DocumentRef docRef)
          Gets the document reference corresponding to the last version for the given document.
 java.security.Principal getPrincipal()
          Gets the principal that created the client session.
 java.util.List<SecuritySummaryEntry> getSecuritySummary(DocumentModel docModel, java.lang.Boolean includeParents)
          Returns security descriptors of doc and all it's children that hold explicit security.
 Session getSession()
          Internal method: Gets the current session based on the client session id.
 DocumentModel getSourceDocument(DocumentRef docRef)
          Gets the head (live) document for this document.
 java.util.List<DocumentModel> getVersions(DocumentRef docRef)
          Retrieves all the versions for a specified document.
 java.util.List<VersionModel> getVersionsForDocument(DocumentRef docRef)
          Retrieves all the versions for a specified document.
 void importDocuments(java.util.List<DocumentModel> docModels)
          Low-level import of documents, reserved for the administrator.
 boolean isSessionAlive()
           
 boolean isStateSharedByAllThreadSessions()
          Returns true if all sessions in the current thread share the same state.
 DocumentModel move(DocumentRef src, DocumentRef dst, java.lang.String name)
          Moves the source document to the destination folder under the given name.
 void move(java.util.List<DocumentRef> src, DocumentRef dst)
          Bulk move.
 void preDestroy()
           
 void prePassivate()
           
 DocumentModel publishDocument(DocumentModel docToPublish, DocumentModel section)
          Publishes the document in a section overwriting any existing proxy to the same document.
 DocumentModel publishDocument(DocumentModel docToPublish, DocumentModel section, boolean overwriteExistingProxy)
          Publishes the document in a section.
 void readState()
           
 void removeChildren(DocumentRef docRef)
          Removes all children from the given document.
 void removeDocuments(DocumentRef[] docRefs)
          Implementation uses the fact that the lexicographic ordering of paths is a refinement of the "contains" partial ordering.
 DocumentModel restoreToVersion(DocumentRef docRef, VersionModel version)
          Restores the given document to the specified version.
 void save()
          Saves any pending changes done until now through this session.
 DocumentModel saveDocument(DocumentModel docModel)
          Saves changes done on the given document model.
 void saveDocuments(DocumentModel[] docModels)
          Bulk document saving.
 void setACP(DocumentRef docRef, ACP newAcp, boolean overwrite)
          Sets the ACP for this document.
 void setLock(DocumentRef docRef, java.lang.String key)
          Sets a lock on the given document using the given key.
 boolean supportsTags()
          Indicates if the current repository implementation supports tags.
 boolean supportsTags(java.lang.String repositoryName)
          Indicates if implementation of the given repositoryName supports Tags feature
 java.lang.String unlock(DocumentRef docRef)
          Removes the lock if one exists.
 
Methods inherited from class org.nuxeo.ecm.core.api.AbstractSession
afterBegin, afterCompletion, applyDefaultPermissions, beforeCompletion, cancel, canRemoveDocument, createDocumentModel, createDocumentModel, createDocumentModel, disconnect, endOperation, exists, fireEvent, generateDocumentName, generateVersionLabelFor, getACP, getAllowedStateTransitions, getAvailableSecurityPermissions, getBaseVersion, getChild, getChildren, getChildren, getChildren, getChildren, getChildren, getChildrenIterator, getChildrenIterator, getChildrenIterator, getChildrenRefs, getContentData, getCurrentLifeCycleState, getDataModel, getDataModelField, getDataModelFields, getDataModelsField, getDataModelsFieldUp, getDocsResultChunk, getDocument, getDocument, getDocuments, getDocumentSystemProp, getDocumentType, getDocumentWithVersion, getEventService, getFiles, getFiles, getFilesIterator, getFolders, getFolders, getFoldersIterator, getLastVersion, getLifeCyclePolicy, getLock, getParentDocument, getParentDocumentRefs, getParentDocuments, getPermissionsToCheck, getProxies, getProxyVersions, getRepositoryName, getRootDocument, getSessionId, getStreamURI, getSuperParentType, getSuperSpace, getVersion, getVersionLabel, getVersionSeriesId, getVersionsRefs, getWorkingCopy, hasChildren, hasPermission, hasPermission, internalCheckOut, isCheckedOut, isDirty, newEventContext, orderBefore, query, query, query, query, query, queryAndFetch, queryIt, querySimpleFts, querySimpleFts, querySimpleFtsIt, querySimpleFtsIt, refreshDocument, removeDocument, restoreToVersion, restoreToVersion, restoreToVersion, run, run, setDocumentSystemProp, startOperation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuxeo.ecm.core.api.CoreSession
afterBegin, afterCompletion, applyDefaultPermissions, beforeCompletion, cancel, canRemoveDocument, createDocumentModel, createDocumentModel, createDocumentModel, disconnect, exists, generateVersionLabelFor, getACP, getAllowedStateTransitions, getAvailableSecurityPermissions, getBaseVersion, getChild, getChildren, getChildren, getChildren, getChildren, getChildren, getChildrenIterator, getChildrenIterator, getChildrenIterator, getChildrenRefs, getContentData, getCurrentLifeCycleState, getDataModel, getDataModelField, getDataModelFields, getDataModelsField, getDataModelsFieldUp, getDocsResultChunk, getDocument, getDocument, getDocuments, getDocumentSystemProp, getDocumentType, getDocumentWithVersion, getFiles, getFiles, getFilesIterator, getFolders, getFolders, getFoldersIterator, getLastVersion, getLifeCyclePolicy, getLock, getParentDocument, getParentDocumentRefs, getParentDocuments, getPermissionsToCheck, getProxies, getProxyVersions, getRepositoryName, getRootDocument, getSessionId, getStreamURI, getSuperParentType, getSuperSpace, getVersion, getVersionLabel, getVersionSeriesId, getVersionsRefs, getWorkingCopy, hasChildren, hasPermission, hasPermission, isCheckedOut, isDirty, orderBefore, query, query, query, query, query, queryAndFetch, queryIt, querySimpleFts, querySimpleFts, querySimpleFtsIt, querySimpleFtsIt, refreshDocument, removeDocument, restoreToVersion, restoreToVersion, restoreToVersion, run, run, setDocumentSystemProp
 
Methods inherited from interface javax.ejb.SessionSynchronization
afterBegin, afterCompletion, beforeCompletion
 

Constructor Detail

DocumentManagerBean

public DocumentManagerBean()
Method Detail

destroy

public void destroy()
Description copied from interface: CoreSession
Destroys any system resources held by this instance.

Called when the instance is no more needed.

Specified by:
destroy in interface CoreSession
Overrides:
destroy in class AbstractSession

preDestroy

@PreDestroy
public void preDestroy()

readState

public void readState()

prePassivate

public void prePassivate()

getPrincipal

public java.security.Principal getPrincipal()
Description copied from interface: CoreSession
Gets the principal that created the client session.

Specified by:
getPrincipal in interface CoreSession
Overrides:
getPrincipal in class AbstractSession
Returns:
the principal

connect

public java.lang.String connect(java.lang.String repositoryName,
                                java.util.Map<java.lang.String,java.io.Serializable> sessionContext)
                         throws ClientException
Description copied from interface: CoreSession
Connects to the repository given its URI. This opens a new session on the specified repository.

This method must never be called by users. Is is indirectly called from CoreInstance.open(String, Map) when creating the client.

Specified by:
connect in interface CoreSession
Overrides:
connect in class AbstractSession
Parameters:
repositoryName - the repository URI (unique in the platform)
sessionContext - a map of properties used to initialize the session. Can be null if no context properties are specified.
Returns:
the session ID if the connection succeed, null otherwise
Throws:
ClientException

getSession

public Session getSession()
                   throws ClientException
Description copied from class: AbstractSession
Internal method: Gets the current session based on the client session id.

Specified by:
getSession in class AbstractSession
Returns:
the repository session
Throws:
ClientException

supportsTags

public boolean supportsTags(java.lang.String repositoryName)
                     throws ClientException
Description copied from interface: CoreSession
Indicates if implementation of the given repositoryName supports Tags feature

Specified by:
supportsTags in interface CoreSession
Parameters:
repositoryName - the name of the repository to test
Returns:
Throws:
ClientException

supportsTags

public boolean supportsTags()
                     throws ClientException
Description copied from interface: CoreSession
Indicates if the current repository implementation supports tags.

Specified by:
supportsTags in interface CoreSession
Returns:
true if tags are supported
Throws:
ClientException

isStateSharedByAllThreadSessions

public boolean isStateSharedByAllThreadSessions()
Description copied from interface: CoreSession
Returns true if all sessions in the current thread share the same state.

Specified by:
isStateSharedByAllThreadSessions in interface CoreSession

isSessionAlive

public boolean isSessionAlive()
Specified by:
isSessionAlive in class AbstractSession

getSecuritySummary

public java.util.List<SecuritySummaryEntry> getSecuritySummary(DocumentModel docModel,
                                                               java.lang.Boolean includeParents)
                                                        throws ClientException
Description copied from interface: CoreSession
Returns security descriptors of doc and all it's children that hold explicit security.

Specified by:
getSecuritySummary in interface CoreSession
Overrides:
getSecuritySummary in class AbstractSession
Parameters:
docModel - the document node from where the security export is done
includeParents - flag is the parent nodes holding security information should be added at the top of the returned list
Returns:
a list of SecuritySummaryEntry
Throws:
ClientException

createDocument

public DocumentModel createDocument(DocumentModel docModel)
                             throws ClientException
Description copied from interface: CoreSession
Creates a document using given document model for initialization.

The model contains path of the new document, its type and optionally the initial data models of the document.

Specified by:
createDocument in interface CoreSession
Overrides:
createDocument in class AbstractSession
Parameters:
docModel - the document model to use for initialization
Returns:
the created document
Throws:
ClientException

createDocument

public DocumentModel[] createDocument(DocumentModel[] docModels)
                               throws ClientException
Description copied from interface: CoreSession
Bulk creation of documents.

Specified by:
createDocument in interface CoreSession
Overrides:
createDocument in class AbstractSession
Parameters:
docModels - the document models to use for intialization
Returns:
the created documents
Throws:
ClientException

save

public void save()
          throws ClientException
Description copied from interface: CoreSession
Saves any pending changes done until now through this session.

Specified by:
save in interface CoreSession
Overrides:
save in class AbstractSession
Throws:
ClientException

saveDocument

public DocumentModel saveDocument(DocumentModel docModel)
                           throws ClientException
Description copied from interface: CoreSession
Saves changes done on the given document model.

Specified by:
saveDocument in interface CoreSession
Overrides:
saveDocument in class AbstractSession
Parameters:
docModel - the document model that needs modified
Throws:
ClientException

saveDocuments

public void saveDocuments(DocumentModel[] docModels)
                   throws ClientException
Description copied from interface: CoreSession
Bulk document saving.

Specified by:
saveDocuments in interface CoreSession
Overrides:
saveDocuments in class AbstractSession
Parameters:
docModels - the document models that needs to be saved
Throws:
ClientException

removeDocuments

public void removeDocuments(DocumentRef[] docRefs)
                     throws ClientException
Description copied from class: AbstractSession
Implementation uses the fact that the lexicographic ordering of paths is a refinement of the "contains" partial ordering.

Specified by:
removeDocuments in interface CoreSession
Overrides:
removeDocuments in class AbstractSession
Parameters:
docRefs - the refs to the document to remove
Throws:
ClientException

removeChildren

public void removeChildren(DocumentRef docRef)
                    throws ClientException
Description copied from interface: CoreSession
Removes all children from the given document.

Specified by:
removeChildren in interface CoreSession
Overrides:
removeChildren in class AbstractSession
Parameters:
docRef - the reference to the document to remove
Throws:
ClientException

copy

public DocumentModel copy(DocumentRef src,
                          DocumentRef dst,
                          java.lang.String name)
                   throws ClientException
Description copied from interface: CoreSession
Copies the source document to the destination folder under the given name. If the name is null the original name is preserved.

If the destination document is not a folder or it doesn't exists then throws an exception.

If the source is a proxy the destination will be a copy of the proxy.

Specified by:
copy in interface CoreSession
Overrides:
copy in class AbstractSession
Parameters:
src - the source document reference
dst - the destination folder reference
name - the new name of the file or null if the original name must be preserved
Throws:
ClientException

copy

public java.util.List<DocumentModel> copy(java.util.List<DocumentRef> src,
                                          DocumentRef dst)
                                   throws ClientException
Description copied from interface: CoreSession
Bulk copy. Destination must be a folder document.

Specified by:
copy in interface CoreSession
Overrides:
copy in class AbstractSession
Parameters:
src - the documents to copy
dst - the destination folder
Throws:
ClientException

copyProxyAsDocument

public DocumentModel copyProxyAsDocument(DocumentRef src,
                                         DocumentRef dst,
                                         java.lang.String name)
                                  throws ClientException
Description copied from interface: CoreSession
Work like copy but in the case of a source proxy the destination will be a new document instead of a proxy.

Specified by:
copyProxyAsDocument in interface CoreSession
Overrides:
copyProxyAsDocument in class AbstractSession
Parameters:
src - the source document reference
dst - the destination folder reference
name - the new name of the file or null if the original name must be preserved
Throws:
ClientException
See Also:
CoreSession.copy(DocumentRef, DocumentRef, String)

copyProxyAsDocument

public java.util.List<DocumentModel> copyProxyAsDocument(java.util.List<DocumentRef> src,
                                                         DocumentRef dst)
                                                  throws ClientException
Description copied from interface: CoreSession
Bulk copyProxyAsDocument. Destination must be a folder document.

Specified by:
copyProxyAsDocument in interface CoreSession
Overrides:
copyProxyAsDocument in class AbstractSession
Parameters:
src - the documents to copy
dst - the destination folder
Throws:
ClientException

move

public DocumentModel move(DocumentRef src,
                          DocumentRef dst,
                          java.lang.String name)
                   throws ClientException
Description copied from interface: CoreSession
Moves the source document to the destination folder under the given name. If the name is null or if there is a collision, a suitable new name is found.

If the destination document is not a folder or it doesn't exists then throws an exception.

Specified by:
move in interface CoreSession
Overrides:
move in class AbstractSession
Parameters:
src - the source document reference
dst - the destination folder reference
name - the new name of the file, or null
Throws:
ClientException

move

public void move(java.util.List<DocumentRef> src,
                 DocumentRef dst)
          throws ClientException
Description copied from interface: CoreSession
Bulk move. Destination must be a folder document.

Specified by:
move in interface CoreSession
Overrides:
move in class AbstractSession
Parameters:
src - the documents to move
dst - the destination folder
Throws:
ClientException

setACP

public void setACP(DocumentRef docRef,
                   ACP newAcp,
                   boolean overwrite)
            throws ClientException
Description copied from interface: CoreSession
Sets the ACP for this document.

If the ACP contains an INHERITED ACL it will be discarded. Only ACLs relative to the current document may be changed.

If the overwrite argument is false, the ACP is merged with the existing one if any. The merge is done as follow:

If the overwrite argument is true, the old ACP will be replaced by the new one.

This way if you can remove the existing ACP by specifying a null ACP and overwrite argument set to true.

Setting a null ACP when overwrite is false will do nothing.

Specified by:
setACP in interface CoreSession
Overrides:
setACP in class AbstractSession
Throws:
ClientException

restoreToVersion

public DocumentModel restoreToVersion(DocumentRef docRef,
                                      VersionModel version)
                               throws ClientException
Description copied from interface: CoreSession
Restores the given document to the specified version.

Specified by:
restoreToVersion in interface CoreSession
Overrides:
restoreToVersion in class AbstractSession
Parameters:
docRef - the reference to the document
version - the version to which the document should be restored to - only the label is used for the moment
Throws:
ClientException

checkOut

public void checkOut(DocumentRef docRef)
              throws ClientException
Description copied from interface: CoreSession
Checks out a versioned document.

Specified by:
checkOut in interface CoreSession
Overrides:
checkOut in class AbstractSession
Parameters:
docRef - the reference to the document
Throws:
ClientException

checkIn

public DocumentRef checkIn(DocumentRef docRef,
                           VersioningOption option,
                           java.lang.String checkinComment)
                    throws ClientException
Description copied from interface: CoreSession
Checks in a modified document, creating a new version.

Specified by:
checkIn in interface CoreSession
Overrides:
checkIn in class AbstractSession
Parameters:
docRef - the reference to the document
option - whether to do create a new VersioningOption.MINOR or VersioningOption.MAJOR version during check in
checkinComment - the checkin comment
Returns:
the version just created
Throws:
ClientException

checkIn

@Deprecated
public DocumentModel checkIn(DocumentRef docRef,
                                        VersionModel version)
                      throws ClientException
Deprecated. 

Description copied from interface: CoreSession
Checks in a modified document, creating a new version.

Specified by:
checkIn in interface CoreSession
Overrides:
checkIn in class AbstractSession
Parameters:
docRef - the reference to the document
version - the version descriptor
Returns:
the version document just created
Throws:
ClientException

createProxy

public DocumentModel createProxy(DocumentRef docRef,
                                 DocumentRef folderRef)
                          throws ClientException
Description copied from interface: CoreSession
Creates a generic proxy to the given document inside the given folder.

The document may be a version, or a working copy (live document) in which case the proxy will be a "shortcut".

Specified by:
createProxy in interface CoreSession
Overrides:
createProxy in class AbstractSession
Throws:
ClientException

createProxy

public DocumentModel createProxy(DocumentRef parentRef,
                                 DocumentRef docRef,
                                 VersionModel version,
                                 boolean overwriteExistingProxy)
                          throws ClientException
Description copied from interface: CoreSession
Creates a proxy for the given version of the given document.

Specified by:
createProxy in interface CoreSession
Overrides:
createProxy in class AbstractSession
docRef - the reference to the document
version - the version
Returns:
the proxy
Throws:
ClientException - if any error occurs

followTransition

public boolean followTransition(DocumentRef docRef,
                                java.lang.String transition)
                         throws ClientException
Description copied from interface: CoreSession
Follows a given life cycle transition.

This will update the current life cycle of the document.

Specified by:
followTransition in interface CoreSession
Overrides:
followTransition in class AbstractSession
Parameters:
docRef - the document reference
transition - the name of the transition to follow
Returns:
a boolean representing the status if the operation
Throws:
ClientException

setLock

public void setLock(DocumentRef docRef,
                    java.lang.String key)
             throws ClientException
Description copied from interface: CoreSession
Sets a lock on the given document using the given key.

Specified by:
setLock in interface CoreSession
Overrides:
setLock in class AbstractSession
Parameters:
docRef - the document reference
key - the lock key
Throws:
ClientException - if a lock is already set or other exception occurred

unlock

public java.lang.String unlock(DocumentRef docRef)
                        throws ClientException
Description copied from interface: CoreSession
Removes the lock if one exists.

The caller principal should be the same as the one who set the lock or to belongs to the administrator group, otherwise an exception will be throw.

If the document was not locked do nothing

Specified by:
unlock in interface CoreSession
Overrides:
unlock in class AbstractSession
Parameters:
docRef - the document to unlock
Returns:
the lock key that was removed
Throws:
ClientException

publishDocument

public DocumentModel publishDocument(DocumentModel docToPublish,
                                     DocumentModel section)
                              throws ClientException
Description copied from interface: CoreSession
Publishes the document in a section overwriting any existing proxy to the same document. This is simmilar to publishDocument(docToPublish, section, true);

Specified by:
publishDocument in interface CoreSession
Overrides:
publishDocument in class AbstractSession
Returns:
The proxy document that was created
Throws:
ClientException

publishDocument

public DocumentModel publishDocument(DocumentModel docToPublish,
                                     DocumentModel section,
                                     boolean overwriteExistingProxy)
                              throws ClientException
Description copied from interface: CoreSession
Publishes the document in a section.

Specified by:
publishDocument in interface CoreSession
Overrides:
publishDocument in class AbstractSession
Returns:
The proxy document that was created
Throws:
ClientException

importDocuments

public void importDocuments(java.util.List<DocumentModel> docModels)
                     throws ClientException
Description copied from interface: CoreSession
Low-level import of documents, reserved for the administrator.

This method is used to import documents with given ids, or directly import versions and proxies.

The id, parent, name and typeName must be present in each docModel.

The context data needs to be filled with values depending on the type of the document:

For a proxy (type = "ecm:proxyType"): CoreSession.IMPORT_PROXY_TARGET_ID and CoreSession.IMPORT_PROXY_VERSIONABLE_ID.

For a version (no parent): CoreSession.IMPORT_VERSION_VERSIONABLE_ID, CoreSession.IMPORT_VERSION_CREATED, CoreSession.IMPORT_VERSION_LABEL and CoreSession.IMPORT_VERSION_DESCRIPTION.

For a live document: CoreSession.IMPORT_BASE_VERSION_ID and CoreSession.IMPORT_CHECKED_IN (Boolean).

For a live document or a version: CoreSession.IMPORT_LIFECYCLE_POLICY , CoreSession.IMPORT_LIFECYCLE_STATE, CoreSession.IMPORT_VERSION_MAJOR (Long) and CoreSession.IMPORT_VERSION_MINOR (Long).

Specified by:
importDocuments in interface CoreSession
Overrides:
importDocuments in class AbstractSession
Parameters:
docModels - the documents to create
Throws:
ClientException

getSourceDocument

public DocumentModel getSourceDocument(DocumentRef docRef)
                                throws ClientException
Description copied from interface: CoreSession
Gets the head (live) document for this document.

Specified by:
getSourceDocument in interface CoreSession
Overrides:
getSourceDocument in class AbstractSession
Parameters:
docRef - the reference to the document
Returns:
the version
Throws:
ClientException - if any error occurs

getVersionsForDocument

public java.util.List<VersionModel> getVersionsForDocument(DocumentRef docRef)
                                                    throws ClientException
Description copied from interface: CoreSession
Retrieves all the versions for a specified document.

Specified by:
getVersionsForDocument in interface CoreSession
Overrides:
getVersionsForDocument in class AbstractSession
Parameters:
docRef - the reference to the document
Returns:
the list of VersionModel representing versions, empty list if none is found.
Throws:
ClientException

getLastDocumentVersion

public DocumentModel getLastDocumentVersion(DocumentRef docRef)
                                     throws ClientException
Description copied from interface: CoreSession
Gets the document corresponding to the last version for the given document.

Specified by:
getLastDocumentVersion in interface CoreSession
Overrides:
getLastDocumentVersion in class AbstractSession
Parameters:
docRef - the reference to the document
Returns:
the document model corresponding to the version
Throws:
ClientException

getLastDocumentVersionRef

public DocumentRef getLastDocumentVersionRef(DocumentRef docRef)
                                      throws ClientException
Description copied from interface: CoreSession
Gets the document reference corresponding to the last version for the given document.

Specified by:
getLastDocumentVersionRef in interface CoreSession
Overrides:
getLastDocumentVersionRef in class AbstractSession
Parameters:
docRef - the reference to the document
Returns:
the document reference corresponding to the last version
Throws:
ClientException

getVersions

public java.util.List<DocumentModel> getVersions(DocumentRef docRef)
                                          throws ClientException
Description copied from interface: CoreSession
Retrieves all the versions for a specified document.

Specified by:
getVersions in interface CoreSession
Overrides:
getVersions in class AbstractSession
Parameters:
docRef - the reference to the document
Returns:
the list of DocumentModel representing versions, empty list if none is found.
Throws:
ClientException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.