|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nuxeo.ecm.core.api.AbstractSession org.nuxeo.ecm.core.api.ejb.DocumentManagerBean
public class DocumentManagerBean
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.
Field Summary |
---|
Fields inherited from class org.nuxeo.ecm.core.api.AbstractSession |
---|
ADMINISTRATOR, ANONYMOUS |
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 java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.ejb.SessionSynchronization |
---|
afterBegin, afterCompletion, beforeCompletion |
Constructor Detail |
---|
public DocumentManagerBean()
Method Detail |
---|
public void destroy()
CoreSession
Called when the instance is no more needed.
destroy
in interface CoreSession
destroy
in class AbstractSession
@PreDestroy public void preDestroy()
public void readState()
public void prePassivate()
public java.security.Principal getPrincipal()
CoreSession
getPrincipal
in interface CoreSession
getPrincipal
in class AbstractSession
public java.lang.String connect(java.lang.String repositoryName, java.util.Map<java.lang.String,java.io.Serializable> sessionContext) throws ClientException
CoreSession
This method must never be called by users. Is is indirectly
called from CoreInstance.open(String, Map)
when creating the
client.
connect
in interface CoreSession
connect
in class AbstractSession
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.
ClientException
public Session getSession() throws ClientException
AbstractSession
getSession
in class AbstractSession
ClientException
public boolean supportsTags(java.lang.String repositoryName) throws ClientException
CoreSession
supportsTags
in interface CoreSession
repositoryName
- the name of the repository to test
ClientException
public boolean supportsTags() throws ClientException
CoreSession
supportsTags
in interface CoreSession
ClientException
public boolean isStateSharedByAllThreadSessions()
CoreSession
true
if all sessions in the current thread share the same
state.
isStateSharedByAllThreadSessions
in interface CoreSession
public boolean isSessionAlive()
isSessionAlive
in class AbstractSession
public java.util.List<SecuritySummaryEntry> getSecuritySummary(DocumentModel docModel, java.lang.Boolean includeParents) throws ClientException
CoreSession
getSecuritySummary
in interface CoreSession
getSecuritySummary
in class AbstractSession
docModel
- the document node from where the security export is doneincludeParents
- flag is the parent nodes holding security
information should be added at the top of the returned list
ClientException
public DocumentModel createDocument(DocumentModel docModel) throws ClientException
CoreSession
The model contains path of the new document, its type and optionally the initial data models of the document.
createDocument
in interface CoreSession
createDocument
in class AbstractSession
docModel
- the document model to use for initialization
ClientException
public DocumentModel[] createDocument(DocumentModel[] docModels) throws ClientException
CoreSession
createDocument
in interface CoreSession
createDocument
in class AbstractSession
docModels
- the document models to use for intialization
ClientException
public void save() throws ClientException
CoreSession
save
in interface CoreSession
save
in class AbstractSession
ClientException
public DocumentModel saveDocument(DocumentModel docModel) throws ClientException
CoreSession
saveDocument
in interface CoreSession
saveDocument
in class AbstractSession
docModel
- the document model that needs modified
ClientException
public void saveDocuments(DocumentModel[] docModels) throws ClientException
CoreSession
saveDocuments
in interface CoreSession
saveDocuments
in class AbstractSession
docModels
- the document models that needs to be saved
ClientException
public void removeDocuments(DocumentRef[] docRefs) throws ClientException
AbstractSession
removeDocuments
in interface CoreSession
removeDocuments
in class AbstractSession
docRefs
- the refs to the document to remove
ClientException
public void removeChildren(DocumentRef docRef) throws ClientException
CoreSession
removeChildren
in interface CoreSession
removeChildren
in class AbstractSession
docRef
- the reference to the document to remove
ClientException
public DocumentModel copy(DocumentRef src, DocumentRef dst, java.lang.String name) throws ClientException
CoreSession
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.
copy
in interface CoreSession
copy
in class AbstractSession
src
- the source document referencedst
- the destination folder referencename
- the new name of the file or null if the original name must be
preserved
ClientException
public java.util.List<DocumentModel> copy(java.util.List<DocumentRef> src, DocumentRef dst) throws ClientException
CoreSession
copy
in interface CoreSession
copy
in class AbstractSession
src
- the documents to copydst
- the destination folder
ClientException
public DocumentModel copyProxyAsDocument(DocumentRef src, DocumentRef dst, java.lang.String name) throws ClientException
CoreSession
copyProxyAsDocument
in interface CoreSession
copyProxyAsDocument
in class AbstractSession
src
- the source document referencedst
- the destination folder referencename
- the new name of the file or null if the original name must be
preserved
ClientException
CoreSession.copy(DocumentRef, DocumentRef, String)
public java.util.List<DocumentModel> copyProxyAsDocument(java.util.List<DocumentRef> src, DocumentRef dst) throws ClientException
CoreSession
copyProxyAsDocument
in interface CoreSession
copyProxyAsDocument
in class AbstractSession
src
- the documents to copydst
- the destination folder
ClientException
public DocumentModel move(DocumentRef src, DocumentRef dst, java.lang.String name) throws ClientException
CoreSession
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.
move
in interface CoreSession
move
in class AbstractSession
src
- the source document referencedst
- the destination folder referencename
- the new name of the file, or null
ClientException
public void move(java.util.List<DocumentRef> src, DocumentRef dst) throws ClientException
CoreSession
move
in interface CoreSession
move
in class AbstractSession
src
- the documents to movedst
- the destination folder
ClientException
public void setACP(DocumentRef docRef, ACP newAcp, boolean overwrite) throws ClientException
CoreSession
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:
owners
are specified then they will replace
the existing ones if any. Otherwise the old owners are preserved if any.
As for the ACL if you want to remove existing owners you need to specify
an empty owner array (and not a null one)
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.
setACP
in interface CoreSession
setACP
in class AbstractSession
ClientException
public DocumentModel restoreToVersion(DocumentRef docRef, VersionModel version) throws ClientException
CoreSession
restoreToVersion
in interface CoreSession
restoreToVersion
in class AbstractSession
docRef
- the reference to the documentversion
- the version to which the document should be restored to -
only the label is used for the moment
ClientException
public void checkOut(DocumentRef docRef) throws ClientException
CoreSession
checkOut
in interface CoreSession
checkOut
in class AbstractSession
docRef
- the reference to the document
ClientException
public DocumentRef checkIn(DocumentRef docRef, VersioningOption option, java.lang.String checkinComment) throws ClientException
CoreSession
checkIn
in interface CoreSession
checkIn
in class AbstractSession
docRef
- the reference to the documentoption
- whether to do create a new VersioningOption.MINOR
or VersioningOption.MAJOR
version during check incheckinComment
- the checkin comment
ClientException
@Deprecated public DocumentModel checkIn(DocumentRef docRef, VersionModel version) throws ClientException
CoreSession
checkIn
in interface CoreSession
checkIn
in class AbstractSession
docRef
- the reference to the documentversion
- the version descriptor
ClientException
public DocumentModel createProxy(DocumentRef docRef, DocumentRef folderRef) throws ClientException
CoreSession
The document may be a version, or a working copy (live document) in which case the proxy will be a "shortcut".
createProxy
in interface CoreSession
createProxy
in class AbstractSession
ClientException
public DocumentModel createProxy(DocumentRef parentRef, DocumentRef docRef, VersionModel version, boolean overwriteExistingProxy) throws ClientException
CoreSession
createProxy
in interface CoreSession
createProxy
in class AbstractSession
docRef
- the reference to the documentversion
- the version
ClientException
- if any error occurspublic boolean followTransition(DocumentRef docRef, java.lang.String transition) throws ClientException
CoreSession
This will update the current life cycle of the document.
followTransition
in interface CoreSession
followTransition
in class AbstractSession
docRef
- the document referencetransition
- the name of the transition to follow
ClientException
public void setLock(DocumentRef docRef, java.lang.String key) throws ClientException
CoreSession
setLock
in interface CoreSession
setLock
in class AbstractSession
docRef
- the document referencekey
- the lock key
ClientException
- if a lock is already set or other exception
occurredpublic java.lang.String unlock(DocumentRef docRef) throws ClientException
CoreSession
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
unlock
in interface CoreSession
unlock
in class AbstractSession
docRef
- the document to unlock
ClientException
public DocumentModel publishDocument(DocumentModel docToPublish, DocumentModel section) throws ClientException
CoreSession
publishDocument
in interface CoreSession
publishDocument
in class AbstractSession
ClientException
public DocumentModel publishDocument(DocumentModel docToPublish, DocumentModel section, boolean overwriteExistingProxy) throws ClientException
CoreSession
publishDocument
in interface CoreSession
publishDocument
in class AbstractSession
ClientException
public void importDocuments(java.util.List<DocumentModel> docModels) throws ClientException
CoreSession
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).
importDocuments
in interface CoreSession
importDocuments
in class AbstractSession
docModels
- the documents to create
ClientException
public DocumentModel getSourceDocument(DocumentRef docRef) throws ClientException
CoreSession
getSourceDocument
in interface CoreSession
getSourceDocument
in class AbstractSession
docRef
- the reference to the document
ClientException
- if any error occurspublic java.util.List<VersionModel> getVersionsForDocument(DocumentRef docRef) throws ClientException
CoreSession
getVersionsForDocument
in interface CoreSession
getVersionsForDocument
in class AbstractSession
docRef
- the reference to the document
VersionModel
representing versions, empty list
if none is found.
ClientException
public DocumentModel getLastDocumentVersion(DocumentRef docRef) throws ClientException
CoreSession
getLastDocumentVersion
in interface CoreSession
getLastDocumentVersion
in class AbstractSession
docRef
- the reference to the document
ClientException
public DocumentRef getLastDocumentVersionRef(DocumentRef docRef) throws ClientException
CoreSession
getLastDocumentVersionRef
in interface CoreSession
getLastDocumentVersionRef
in class AbstractSession
docRef
- the reference to the document
ClientException
public java.util.List<DocumentModel> getVersions(DocumentRef docRef) throws ClientException
CoreSession
getVersions
in interface CoreSession
getVersions
in class AbstractSession
docRef
- the reference to the document
DocumentModel
representing versions, empty
list if none is found.
ClientException
|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |