Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.webapp.versioning
Class VersionedActionsBean

java.lang.Object
  extended by org.nuxeo.ecm.webapp.versioning.VersionedActionsBean
All Implemented Interfaces:
Serializable, VersionedActions

@Name(value="versionedActions")
@Scope(value=CONVERSATION)
@Install(precedence=10)
public class VersionedActionsBean
extends Object
implements VersionedActions, Serializable

Deals with versioning actions.

Author:
Razvan Caraghin, Florent Guillaume, Thierry Martins
See Also:
Serialized Form

Constructor Summary
VersionedActionsBean()
           
 
Method Summary
 boolean canRemoveArchivedVersion(VersionModel selectedVersion)
          Check if a version can be removed.
 String checkIn()
          Checks the selected document in, with the selected version.
 String checkOut()
          Checks the document out.
 boolean getCanRestore()
          Security check to enable or disable the restore button.
 String getCheckedOut()
          Tells if the current selected document is checked out or not.
 DocumentModel getSourceDocument()
           
 DocumentModel getSourceDocument(DocumentModel document)
           
 List<VersionModel> getVersionList()
          Factory accessor for currentDocument versionList.
 void initialize()
           
 String removeArchivedVersion(VersionModel selectedVersion)
          Remove an archived version.
 void resetVersions()
          When the user selects/changes other documents then we nullify the list of versions associated with the document so that the factory method gets called when the list is used.
 String restoreToVersion(VersionModel selectedVersion)
          Restores the document to the selected version.
 void retrieveVersions()
          Retrieves the versions for the current document.
 void setCheckedOut(String checkedOut)
          Changes the checked-out string.
 String viewArchivedVersion(VersionModel selectedVersion)
          View an older version of the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionedActionsBean

public VersionedActionsBean()
Method Detail

initialize

@Create
public void initialize()
Specified by:
initialize in interface VersionedActions

resetVersions

@Observer(value={"documentSelectionChanged","documentChanged","documentSubmitedForPublication","documentPublished"},
          create=false)
@BypassInterceptors
public void resetVersions()
Description copied from interface: VersionedActions
When the user selects/changes other documents then we nullify the list of versions associated with the document so that the factory method gets called when the list is used.

This way we achieve lazy loading of data from backend - only when its needed and not loading it when the event is fired.

Specified by:
resetVersions in interface VersionedActions

getVersionList

@Factory(value="versionList",
         scope=EVENT)
public List<VersionModel> getVersionList()
                                  throws ClientException
Description copied from interface: VersionedActions
Factory accessor for currentDocument versionList.

Specified by:
getVersionList in interface VersionedActions
Returns:
list of VersionModel
Throws:
ClientException

retrieveVersions

public void retrieveVersions()
                      throws ClientException
Description copied from interface: VersionedActions
Retrieves the versions for the current document.

Specified by:
retrieveVersions in interface VersionedActions
Throws:
ClientException

restoreToVersion

public String restoreToVersion(VersionModel selectedVersion)
                        throws ClientException
Restores the document to the selected version. If there is no selected version it does nothing.

Specified by:
restoreToVersion in interface VersionedActions
Returns:
the page that needs to be displayed next
Throws:
ClientException

viewArchivedVersion

public String viewArchivedVersion(VersionModel selectedVersion)
                           throws ClientException
Description copied from interface: VersionedActions
View an older version of the document.

Specified by:
viewArchivedVersion in interface VersionedActions
Throws:
ClientException

getCanRestore

public boolean getCanRestore()
                      throws ClientException
Description copied from interface: VersionedActions
Security check to enable or disable the restore button.

Specified by:
getCanRestore in interface VersionedActions
Returns:
permission check result
Throws:
ClientException

getCheckedOut

public String getCheckedOut()
                     throws ClientException
Tells if the current selected document is checked out or not.

Specified by:
getCheckedOut in interface VersionedActions
Throws:
ClientException

setCheckedOut

public void setCheckedOut(String checkedOut)
Description copied from interface: VersionedActions
Changes the checked-out string.

Specified by:
setCheckedOut in interface VersionedActions

checkOut

public String checkOut()
                throws ClientException
Checks the document out.

Specified by:
checkOut in interface VersionedActions
Returns:
the next page
Throws:
ClientException

checkIn

public String checkIn()
               throws ClientException
Checks the selected document in, with the selected version.

Specified by:
checkIn in interface VersionedActions
Throws:
ClientException

getSourceDocument

public DocumentModel getSourceDocument()
                                throws ClientException
Specified by:
getSourceDocument in interface VersionedActions
Throws:
ClientException

getSourceDocument

public DocumentModel getSourceDocument(DocumentModel document)
                                throws ClientException
Specified by:
getSourceDocument in interface VersionedActions
Throws:
ClientException
Since:
5.4

canRemoveArchivedVersion

public boolean canRemoveArchivedVersion(VersionModel selectedVersion)
Description copied from interface: VersionedActions
Check if a version can be removed. It won't be possible if a proxy is pointing to it.

Specified by:
canRemoveArchivedVersion in interface VersionedActions

removeArchivedVersion

public String removeArchivedVersion(VersionModel selectedVersion)
                             throws ClientException
Description copied from interface: VersionedActions
Remove an archived version.

Specified by:
removeArchivedVersion in interface VersionedActions
Parameters:
selectedVersion - the version model to remove
Throws:
ClientException

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.