001/* 002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Razvan Caraghin 018 * Florent Guillaume 019 * Antoine Taillefer 020 */ 021 022package org.nuxeo.ecm.webapp.versioning; 023 024import org.jboss.seam.annotations.Create; 025import org.nuxeo.ecm.core.api.DocumentModel; 026import org.nuxeo.ecm.core.api.VersionModel; 027import org.nuxeo.ecm.platform.query.api.PageSelections; 028 029/** 030 * Exposes the actions that can be taken related to versioning and documents. 031 * 032 * @author Razvan Caraghin 033 * @author Florent Guillaume 034 */ 035public interface VersionedActions { 036 037 /** 038 * Factory accessor for currentDocument versionList. 039 * 040 * @return the selected version list as a {@link PageSelections<VersionModel>} 041 */ 042 PageSelections<VersionModel> getVersionList(); 043 044 /** 045 * Retrieves the versions for the current document. 046 */ 047 void retrieveVersions(); 048 049 /** 050 * Restored the document to the selected version. If there is no selected version it does nothing. 051 * 052 * @return the page that needs to be displayed next 053 */ 054 String restoreToVersion(VersionModel selectedVersion); 055 056 /** 057 * Restores the version which id is returned by {@link #getSelectedVersionId()}. 058 * 059 * @return the view id 060 * @since 5.6 061 */ 062 String restoreToVersion(); 063 064 /** 065 * Security check to enable or disable the restore button. 066 * 067 * @return permission check result 068 */ 069 boolean getCanRestore(); 070 071 /** 072 * Tells if the current selected document is checked out or not. 073 */ 074 String getCheckedOut(); 075 076 /** 077 * Changes the checked-out string. 078 * 079 * @param checkedOut 080 */ 081 void setCheckedOut(String checkedOut); 082 083 /** 084 * Checks the document out. 085 * 086 * @return the next page 087 */ 088 @SuppressWarnings({ "NonBooleanMethodNameMayNotStartWithQuestion" }) 089 String checkOut(); 090 091 /** 092 * Checks the selected document in, with the selected version. 093 */ 094 String checkIn(); 095 096 @Create 097 void initialize(); 098 099 /** 100 * When the user selects/changes other documents then we nullify the list of versions associated with the document 101 * so that the factory method gets called when the list is used. 102 * <p> 103 * This way we achieve lazy loading of data from backend - only when its needed and not loading it when the event is 104 * fired. 105 */ 106 void resetVersions(); 107 108 /** 109 * View an older version of the document. 110 */ 111 String viewArchivedVersion(VersionModel selectedVersion); 112 113 /** 114 * Navigates to the version which id is returned by {@link #getSelectedVersionId()}. 115 * 116 * @return the view id 117 * @since 5.6 118 */ 119 String viewArchivedVersion(); 120 121 DocumentModel getSourceDocument(); 122 123 DocumentModel getSourceDocument(DocumentModel document); 124 125 /** 126 * Check if a version can be removed. It won't be possible if a proxy is pointing to it. 127 */ 128 boolean canRemoveArchivedVersion(VersionModel selectedVersion); 129 130 /** 131 * Check if the currently selected versions can be removed. It won't be possible if a proxy is pointing to one of 132 * them. 133 * 134 * @return true if can remove selected archived versions 135 * @since 5.6 136 */ 137 boolean getCanRemoveSelectedArchivedVersions(); 138 139 /** 140 * Remove an archived version. 141 * 142 * @param selectedVersion the version model to remove 143 */ 144 String removeArchivedVersion(VersionModel selectedVersion); 145 146 /** 147 * Remove currently selected archived versions. 148 * 149 * @since 5.6 150 */ 151 String removeSelectedArchivedVersions(); 152 153 /** 154 * Gets currently selected version id. 155 * 156 * @since 5.6 157 */ 158 String getSelectedVersionId(); 159 160 /** 161 * Sets currently selected version id. 162 * 163 * @since 5.6 164 */ 165 void setSelectedVersionId(String selectedVersionId); 166}