@Name(value="versionedActions") @Scope(value=CONVERSATION) @Install(precedence=10) public class VersionedActionsBean extends Object implements VersionedActions, Serializable
Modifier and Type | Field and Description |
---|---|
protected String |
checkedOut |
protected CoreSession |
documentManager |
protected DocumentsListsManager |
documentsListsManager |
protected DocumentVersioning |
documentVersioning |
protected org.jboss.seam.faces.FacesMessages |
facesMessages |
protected NavigationContext |
navigationContext |
protected ResourcesAccessor |
resourcesAccessor |
protected String |
selectedVersionId |
protected org.jboss.seam.contexts.Context |
sessionContext |
protected PageSelections<VersionModel> |
versionModelList |
Constructor and Description |
---|
VersionedActionsBean() |
Modifier and Type | Method and Description |
---|---|
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 |
getCanRemoveSelectedArchivedVersions()
Check if the currently selected versions can be removed.
|
boolean |
getCanRestore()
Security check to enable or disable the restore button.
|
String |
getCheckedOut()
Tells if the current selected document is checked out or not.
|
String |
getSelectedVersionId()
Gets currently selected version id.
|
DocumentModel |
getSourceDocument() |
DocumentModel |
getSourceDocument(DocumentModel document) |
PageSelections<VersionModel> |
getVersionList()
Factory accessor for currentDocument versionList.
|
void |
initialize() |
protected boolean |
isVersionSelected(VersionModel versionModel)
Checks if the
versionModel is selected. |
String |
removeArchivedVersion(VersionModel selectedVersion)
Remove an archived version.
|
String |
removeSelectedArchivedVersions()
Remove currently selected archived versions.
|
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()
Restores the version which id is returned by
VersionedActions.getSelectedVersionId() . |
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.
|
void |
setSelectedVersionId(String selectedVersionId)
Sets currently selected version id.
|
String |
viewArchivedVersion()
Navigates to the version which id is returned by
VersionedActions.getSelectedVersionId() . |
String |
viewArchivedVersion(VersionModel selectedVersion)
View an older version of the document.
|
@In(create=true) protected transient NavigationContext navigationContext
@In(create=true, required=false) protected transient DocumentsListsManager documentsListsManager
@In(create=true, required=false) protected transient CoreSession documentManager
@In(create=true, required=false) protected transient org.jboss.seam.faces.FacesMessages facesMessages
@In(create=true, required=false) protected transient ResourcesAccessor resourcesAccessor
@In protected transient org.jboss.seam.contexts.Context sessionContext
@In(create=true) protected transient DocumentVersioning documentVersioning
protected transient PageSelections<VersionModel> versionModelList
protected String selectedVersionId
protected String checkedOut
public VersionedActionsBean()
@Create public void initialize()
initialize
in interface VersionedActions
@Observer(value={"documentSelectionChanged","documentChanged","documentSubmitedForPublication","documentPublished"}, create=false) @BypassInterceptors public void resetVersions()
VersionedActions
This way we achieve lazy loading of data from backend - only when its needed and not loading it when the event is fired.
resetVersions
in interface VersionedActions
@Factory(value="versionList", scope=EVENT) public PageSelections<VersionModel> getVersionList()
VersionedActions
getVersionList
in interface VersionedActions
PageSelections
public void retrieveVersions()
VersionedActions
retrieveVersions
in interface VersionedActions
protected boolean isVersionSelected(VersionModel versionModel)
versionModel
is selected.versionModel
- the version modelpublic String restoreToVersion(VersionModel selectedVersion)
restoreToVersion
in interface VersionedActions
public String restoreToVersion()
VersionedActions
VersionedActions.getSelectedVersionId()
.restoreToVersion
in interface VersionedActions
public String viewArchivedVersion(VersionModel selectedVersion)
VersionedActions
viewArchivedVersion
in interface VersionedActions
public String viewArchivedVersion()
VersionedActions
VersionedActions.getSelectedVersionId()
.viewArchivedVersion
in interface VersionedActions
public boolean getCanRestore()
VersionedActions
getCanRestore
in interface VersionedActions
public String getCheckedOut()
getCheckedOut
in interface VersionedActions
public void setCheckedOut(String checkedOut)
VersionedActions
setCheckedOut
in interface VersionedActions
public String checkOut()
checkOut
in interface VersionedActions
public String checkIn()
checkIn
in interface VersionedActions
public DocumentModel getSourceDocument()
getSourceDocument
in interface VersionedActions
public DocumentModel getSourceDocument(DocumentModel document)
getSourceDocument
in interface VersionedActions
public boolean canRemoveArchivedVersion(VersionModel selectedVersion)
VersionedActions
canRemoveArchivedVersion
in interface VersionedActions
public boolean getCanRemoveSelectedArchivedVersions()
VersionedActions
getCanRemoveSelectedArchivedVersions
in interface VersionedActions
public String removeArchivedVersion(VersionModel selectedVersion)
VersionedActions
removeArchivedVersion
in interface VersionedActions
selectedVersion
- the version model to removepublic String removeSelectedArchivedVersions()
VersionedActions
removeSelectedArchivedVersions
in interface VersionedActions
public String getSelectedVersionId()
VersionedActions
getSelectedVersionId
in interface VersionedActions
public void setSelectedVersionId(String selectedVersionId)
VersionedActions
setSelectedVersionId
in interface VersionedActions
Copyright © 2018 Nuxeo. All rights reserved.