Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.webapp.contentbrowser
Class DocumentActionsBean

java.lang.Object
  extended by org.nuxeo.ecm.webapp.base.InputController
      extended by org.nuxeo.ecm.webapp.contentbrowser.DocumentActionsBean
All Implemented Interfaces:
Serializable, EventListener, SelectDataModelListener, DocumentActions

@Name(value="documentActions")
@Scope(value=CONVERSATION)
public class DocumentActionsBean
extends InputController
implements DocumentActions, Serializable

Handles creation and edition of a document.

Author:
Razvan Caraghin, M.-A. Darche
See Also:
Serialized Form

Field Summary
static String DEFAULT_SUMMARY_LAYOUT
           
static String LIFE_CYCLE_TRANSITION_KEY
           
 
Fields inherited from interface org.nuxeo.ecm.webapp.contentbrowser.DocumentActions
CHILDREN_DOCUMENT_LIST
 
Constructor Summary
DocumentActionsBean()
           
 
Method Summary
 String checkCurrentDocAndProcessSelectPage(String providerName, String listName, Boolean selection, String currentDocRef)
          Handle complete table selection event after having ensured that the navigation context stills points to currentDocumentRef to protect against browsers' back button errors
 String checkCurrentDocAndProcessSelectRow(String docRef, String providerName, String listName, Boolean selection, String currentDocRef)
          Handle complete row selection event after having ensured that the navigation context stills points to currentDocumentRef to protect against browsers' back button errors
 String createDocument()
          Creates a document with type given by TypesTool and stores it in the context as the current changeable document.
 String createDocument(String typeName)
          Creates a document with given type and stores it in the context as the current changeable document.
 String download()
           
 void download(DocumentView docView)
          Downloads file as described by given document view.
 String downloadFromList()
           
 String editDocument()
          Returns the edit view of a document.
 void followTransition(DocumentModel changedDocument)
           
 boolean getCanUnpublish()
          This method is used to test whether the logged user has enough rights for the unpublish support.
 Type getChangeableDocumentType()
           
 SelectDataModel getChildrenSelectModel()
           
 String getComment()
          Returns the comment to attach to the document
 String getCurrentDocumentSummaryLayout()
           
 Type getCurrentType()
           
 String getFileName(DocumentModel doc)
           
 SelectDataModel getSectionChildrenSelectModel()
           
 boolean getWriteRight()
          Checks the current document write permission.
 String processSelectPage(String providerName, String listName, Boolean selection)
           
 String processSelectRow(String docRef, String providerName, String listName, Boolean selection)
           
 void processSelectRowEvent(SelectDataModelRowEvent event)
           
 String saveDocument()
          Creates the document from the changeableDocument put in request.
 String saveDocument(DocumentModel newDocument)
          Creates the given document.
 void setComment(String comment)
          Sets the comment to attach to a document
 String updateCurrentDocument()
          Updates document considering that current document model holds edited values.
 String updateDocument()
          Saves changes held by the changeableDocument document model.
 String updateDocumentAsNewVersion()
          Saves changes held by the changeableDocument document model in current version and then create a new current one.
 
Methods inherited from class org.nuxeo.ecm.webapp.base.InputController
computeOutcome, getAdministrator, logDocumentWithName, logDocumentWithTitle, removeDocumentFromList
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SUMMARY_LAYOUT

public static String DEFAULT_SUMMARY_LAYOUT

LIFE_CYCLE_TRANSITION_KEY

public static String LIFE_CYCLE_TRANSITION_KEY
Constructor Detail

DocumentActionsBean

public DocumentActionsBean()
Method Detail

getCurrentDocumentSummaryLayout

@Factory(autoCreate=true,
         value="currentDocumentSummaryLayout",
         scope=EVENT)
public String getCurrentDocumentSummaryLayout()
Specified by:
getCurrentDocumentSummaryLayout in interface DocumentActions

getCurrentType

@Factory(autoCreate=true,
         value="currentDocumentType",
         scope=EVENT)
public Type getCurrentType()
Specified by:
getCurrentType in interface DocumentActions
Returns:
ecm type for current document, null if current doc is null.

getChangeableDocumentType

public Type getChangeableDocumentType()
Specified by:
getChangeableDocumentType in interface DocumentActions

editDocument

public String editDocument()
                    throws ClientException
Description copied from interface: DocumentActions
Returns the edit view of a document.

Specified by:
editDocument in interface DocumentActions
Throws:
ClientException

getFileName

public String getFileName(DocumentModel doc)
                   throws ClientException
Throws:
ClientException

download

public String download()
                throws ClientException
Specified by:
download in interface DocumentActions
Throws:
ClientException

download

public void download(DocumentView docView)
              throws ClientException
Description copied from interface: DocumentActions
Downloads file as described by given document view.

To be used by url pattern descriptors performing a download.

Specified by:
download in interface DocumentActions
Parameters:
docView - the document view as generated through the url service
Throws:
ClientException - when document is not found or file is not retrieved correctly.

downloadFromList

public String downloadFromList()
                        throws ClientException
Specified by:
downloadFromList in interface DocumentActions
Throws:
ClientException

updateCurrentDocument

public String updateCurrentDocument()
                             throws ClientException
Description copied from interface: DocumentActions
Updates document considering that current document model holds edited values.

Specified by:
updateCurrentDocument in interface DocumentActions
Throws:
ClientException

updateDocument

public String updateDocument()
                      throws ClientException
Description copied from interface: DocumentActions
Saves changes held by the changeableDocument document model.

Specified by:
updateDocument in interface DocumentActions
Throws:
ClientException

updateDocumentAsNewVersion

public String updateDocumentAsNewVersion()
                                  throws ClientException
Description copied from interface: DocumentActions
Saves changes held by the changeableDocument document model in current version and then create a new current one.

Specified by:
updateDocumentAsNewVersion in interface DocumentActions
Throws:
ClientException

createDocument

public String createDocument()
                      throws ClientException
Description copied from interface: DocumentActions
Creates a document with type given by TypesTool and stores it in the context as the current changeable document.

Returns the create view of given document type.

Specified by:
createDocument in interface DocumentActions
Throws:
ClientException

createDocument

public String createDocument(String typeName)
                      throws ClientException
Description copied from interface: DocumentActions
Creates a document with given type and stores it in the context as the current changeable document.

Returns the create view of given document type.

Specified by:
createDocument in interface DocumentActions
Throws:
ClientException

saveDocument

public String saveDocument()
                    throws ClientException
Description copied from interface: DocumentActions
Creates the document from the changeableDocument put in request.

Specified by:
saveDocument in interface DocumentActions
Throws:
ClientException

saveDocument

public String saveDocument(DocumentModel newDocument)
                    throws ClientException
Description copied from interface: DocumentActions
Creates the given document.

Specified by:
saveDocument in interface DocumentActions
Throws:
ClientException

getChildrenSelectModel

@Factory(value="currentChildrenSelectModel",
         scope=EVENT)
public SelectDataModel getChildrenSelectModel()
                                       throws ClientException
Specified by:
getChildrenSelectModel in interface DocumentActions
Throws:
ClientException

getSectionChildrenSelectModel

public SelectDataModel getSectionChildrenSelectModel()
                                              throws ClientException
Specified by:
getSectionChildrenSelectModel in interface DocumentActions
Throws:
ClientException

processSelectRowEvent

public void processSelectRowEvent(SelectDataModelRowEvent event)
Specified by:
processSelectRowEvent in interface SelectDataModelListener

checkCurrentDocAndProcessSelectRow

@WebRemote
public String checkCurrentDocAndProcessSelectRow(String docRef,
                                                           String providerName,
                                                           String listName,
                                                           Boolean selection,
                                                           String currentDocRef)
                                          throws ClientException
Description copied from interface: DocumentActions
Handle complete row selection event after having ensured that the navigation context stills points to currentDocumentRef to protect against browsers' back button errors

Specified by:
checkCurrentDocAndProcessSelectRow in interface DocumentActions
Throws:
ClientException - if currentDocRef is not a valid document

processSelectRow

@WebRemote
public String processSelectRow(String docRef,
                                         String providerName,
                                         String listName,
                                         Boolean selection)
Specified by:
processSelectRow in interface DocumentActions

checkCurrentDocAndProcessSelectPage

@WebRemote
public String checkCurrentDocAndProcessSelectPage(String providerName,
                                                            String listName,
                                                            Boolean selection,
                                                            String currentDocRef)
                                           throws ClientException
Description copied from interface: DocumentActions
Handle complete table selection event after having ensured that the navigation context stills points to currentDocumentRef to protect against browsers' back button errors

Specified by:
checkCurrentDocAndProcessSelectPage in interface DocumentActions
Throws:
ClientException - if currentDocRef is not a valid document

processSelectPage

@WebRemote
public String processSelectPage(String providerName,
                                          String listName,
                                          Boolean selection)
Specified by:
processSelectPage in interface DocumentActions

getWriteRight

public boolean getWriteRight()
                      throws ClientException
Description copied from interface: DocumentActions
Checks the current document write permission.

Specified by:
getWriteRight in interface DocumentActions
Returns:
true if the user has WRITE permission on current document
Throws:
ClientException

getComment

public String getComment()
Description copied from interface: DocumentActions
Returns the comment to attach to the document

Specified by:
getComment in interface DocumentActions

setComment

public void setComment(String comment)
Description copied from interface: DocumentActions
Sets the comment to attach to a document

Specified by:
setComment in interface DocumentActions

getCanUnpublish

public boolean getCanUnpublish()
Description copied from interface: DocumentActions
This method is used to test whether the logged user has enough rights for the unpublish support.

Specified by:
getCanUnpublish in interface DocumentActions
Returns:
true if the user can unpublish, false otherwise

followTransition

@Observer(value="beforeDocumentChanged")
public void followTransition(DocumentModel changedDocument)
                      throws ClientException
Specified by:
followTransition in interface DocumentActions
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.