mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. Confirmation screens for Undo All and Undo Selected items for a sandbox
- refactoring of revert functionality into Undo All and Undo Selected dialogs . Performance enhancement to Node class - to cache Path value from NodeService and changed appropriate class to use this . Fix to horribly broken values in AVMConstants git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4690 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -988,6 +988,12 @@ create_webapp=Create Webapp Folder
|
||||
create_webapp_title=Create Webapp Folder
|
||||
create_webapp_desc=Create a new root Webapp folder for this web project
|
||||
submit_workflow_config_error=Workflow parameters have not been fully configured, cannot submit items.
|
||||
revert_selected_title=Undo Selected Items
|
||||
revert_selected_desc=To undo the changes to the selected files in the sandbox, click OK.
|
||||
revert_selected_confirm=Are you sure you want to undo the changes to the selected files in from the sandbox?
|
||||
revert_all_title=Undo All Items
|
||||
revert_all_desc=To undo the changes to all the files in the sandbox, click OK.
|
||||
revert_all_confirm=Are you sure you want to undo the changes to all files in the sandbox?
|
||||
|
||||
# New User Wizard messages
|
||||
new_user_title=New User Wizard
|
||||
|
@@ -189,6 +189,14 @@
|
||||
<dialog name="createWebappFolder" page="/jsp/wcm/create-webapp.jsp" managed-bean="CreateWebappDialog"
|
||||
icon="/images/icons/create_webapp_large.gif" title-id="create_webapp_title"
|
||||
description-id="create_webapp_desc" />
|
||||
|
||||
<dialog name="revertSelectedItems" page="/jsp/wcm/revert.jsp" managed-bean="RevertSelectedDialog"
|
||||
icon="/images/icons/revert_all_large.gif" title-id="revert_selected_title"
|
||||
description-id="revert_selected_desc" />
|
||||
|
||||
<dialog name="revertAllItems" page="/jsp/wcm/revert.jsp" managed-bean="RevertAllDialog"
|
||||
icon="/images/icons/revert_all_large.gif" title-id="revert_all_title"
|
||||
description-id="revert_all_desc" />
|
||||
</dialogs>
|
||||
</config>
|
||||
|
||||
|
@@ -20,7 +20,6 @@ import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.web.action.ActionEvaluator;
|
||||
import org.alfresco.web.app.Application;
|
||||
@@ -44,10 +43,12 @@ public class CreateFormEvaluator implements ActionEvaluator
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final ServiceRegistry services = Repository.getServiceRegistry(fc);
|
||||
final NavigationBean navigator = (NavigationBean)FacesHelper.getManagedBean(fc, NavigationBean.BEAN_NAME);
|
||||
|
||||
// get the path to the current name - compare last element with the Website folder assoc name
|
||||
final Path path = services.getNodeService().getPath(navigator.getCurrentNode().getNodeRef());
|
||||
final Path path = navigator.getCurrentNode().getNodePath();
|
||||
final Path.Element element = path.get(path.size() - 1);
|
||||
final String endPath = element.getPrefixedString(services.getNamespaceService());
|
||||
|
||||
// check we have the permission to create nodes in that Website folder
|
||||
return (Application.getContentFormsFolderName(fc).equals(endPath) &&
|
||||
navigator.getCurrentNode().hasPermission(PermissionService.ADD_CHILDREN));
|
||||
|
@@ -990,14 +990,14 @@ public class BrowseBean implements IContextListener
|
||||
|
||||
public NodePropertyResolver resolverPath = new NodePropertyResolver() {
|
||||
public Object get(Node node) {
|
||||
return nodeService.getPath(node.getNodeRef());
|
||||
return node.getNodePath();
|
||||
}
|
||||
};
|
||||
|
||||
public NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() {
|
||||
public Object get(Node node) {
|
||||
// TODO: replace this with a method that shows the full display name - not QNames?
|
||||
return Repository.getDisplayPath( (Path)node.getProperties().get("path") );
|
||||
return Repository.getDisplayPath(node.getNodePath());
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -523,7 +523,7 @@ public class NavigationBean
|
||||
}
|
||||
String icon = (String)props.get("app:icon");
|
||||
props.put("icon", icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME);
|
||||
Path path = this.nodeService.getPath(nodeRef);
|
||||
Path path = node.getNodePath();
|
||||
|
||||
// resolve CIFS network folder location for this node
|
||||
DiskSharedDevice diskShare = cifsServer.getConfiguration().getPrimaryFilesystem();
|
||||
|
@@ -31,6 +31,7 @@ import org.alfresco.service.cmr.lock.LockStatus;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -49,7 +50,7 @@ public class Node implements Serializable
|
||||
protected NodeRef nodeRef;
|
||||
protected String name;
|
||||
protected QName type;
|
||||
protected String path;
|
||||
protected Path path;
|
||||
protected String id;
|
||||
protected Set<QName> aspects = null;
|
||||
protected Map<String, Boolean> permissions;
|
||||
@@ -367,15 +368,22 @@ public class Node implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The path for the node
|
||||
* @return The simple display path for the node
|
||||
*/
|
||||
public String getPath()
|
||||
{
|
||||
if (this.path == null)
|
||||
{
|
||||
this.path = getServiceRegistry().getNodeService().getPath(this.nodeRef).toString();
|
||||
return getNodePath().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the repo Path to the node
|
||||
*/
|
||||
public Path getNodePath()
|
||||
{
|
||||
if (this.path == null)
|
||||
{
|
||||
this.path = getServiceRegistry().getNodeService().getPath(this.nodeRef);
|
||||
}
|
||||
return this.path;
|
||||
}
|
||||
|
||||
|
@@ -261,7 +261,7 @@ public class TransientNode extends Node
|
||||
}
|
||||
|
||||
// setup remaining variables
|
||||
this.path = "";
|
||||
this.path = null;
|
||||
this.locked = Boolean.FALSE;
|
||||
this.workingCopyOwner = Boolean.FALSE;
|
||||
}
|
||||
|
@@ -41,18 +41,12 @@ import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.NameMatcher;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.app.context.IContextListener;
|
||||
@@ -88,8 +82,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
private static Log logger = LogFactory.getLog(AVMBrowseBean.class);
|
||||
|
||||
private static final String MSG_REVERT_SUCCESS = "revert_success";
|
||||
private static final String MSG_REVERTALL_SUCCESS = "revertall_success";
|
||||
private static final String MSG_REVERTSELECTED_SUCCESS = "revertselected_success";
|
||||
private static final String MSG_REVERT_SANDBOX = "revert_sandbox_success";
|
||||
private static final String MSG_SANDBOXTITLE = "sandbox_title";
|
||||
private static final String MSG_SANDBOXSTAGING = "sandbox_staging";
|
||||
@@ -101,10 +93,10 @@ public class AVMBrowseBean implements IContextListener
|
||||
private static final String MSG_SUBMITSELECTED_SUCCESS = "submitselected_success";
|
||||
|
||||
/** Component id the status messages are tied too */
|
||||
private static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel";
|
||||
static final String COMPONENT_SANDBOXESPANEL = "sandboxes-panel";
|
||||
|
||||
/** Top-level JSF form ID */
|
||||
private static final String FORM_ID = "browse-website";
|
||||
static final String FORM_ID = "browse-website";
|
||||
|
||||
/** Content Manager role name */
|
||||
private static final String ROLE_CONTENT_MANAGER = "ContentManager";
|
||||
@@ -128,7 +120,8 @@ public class AVMBrowseBean implements IContextListener
|
||||
private String currentPath = null;
|
||||
private AVMNode currentPathNode = null;
|
||||
|
||||
private boolean submitAll = false;
|
||||
/** flag to indicate that all items in the sandbox are involved in the current action */
|
||||
private boolean allItemsAction = false;
|
||||
|
||||
/* component references */
|
||||
private UIRichList foldersRichList;
|
||||
@@ -151,36 +144,18 @@ public class AVMBrowseBean implements IContextListener
|
||||
/** The NodeService to be used by the bean */
|
||||
protected NodeService nodeService;
|
||||
|
||||
/** The DictionaryService bean reference */
|
||||
protected DictionaryService dictionaryService;
|
||||
|
||||
/** The SearchService bean reference. */
|
||||
protected SearchService searchService;
|
||||
|
||||
/** The NamespaceService bean reference. */
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
/** The WorkflowService bean reference. */
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
/** The browse bean */
|
||||
protected BrowseBean browseBean;
|
||||
|
||||
/** The NavigationBean bean reference */
|
||||
protected NavigationBean navigator;
|
||||
|
||||
/** AVM service bean reference */
|
||||
protected AVMService avmService;
|
||||
|
||||
/** AVM Sync service bean reference */
|
||||
protected AVMSyncService avmSyncService;
|
||||
|
||||
/** Action service bean reference */
|
||||
protected ActionService actionService;
|
||||
|
||||
/** Global exclude name matcher */
|
||||
protected NameMatcher nameMatcher;
|
||||
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
@@ -202,14 +177,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSyncService The AVMSyncService to set.
|
||||
*/
|
||||
public void setAvmSyncService(AVMSyncService avmSyncService)
|
||||
{
|
||||
this.avmSyncService = avmSyncService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService The NodeService to set.
|
||||
*/
|
||||
@@ -237,40 +204,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
return this.nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dictionaryService The DictionaryService to set.
|
||||
*/
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param searchService The SearchService to set.
|
||||
*/
|
||||
public void setSearchService(SearchService searchService)
|
||||
{
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param namespaceService The NamespaceService to set.
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the BrowseBean instance to use to retrieve the current document
|
||||
*
|
||||
* @param browseBean BrowseBean instance
|
||||
*/
|
||||
public void setBrowseBean(BrowseBean browseBean)
|
||||
{
|
||||
this.browseBean = browseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param navigator The NavigationBean to set.
|
||||
*/
|
||||
@@ -287,14 +220,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nameMatcher The nameMatcher to set.
|
||||
*/
|
||||
public void setNameMatcher(NameMatcher nameMatcher)
|
||||
{
|
||||
this.nameMatcher = nameMatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary text for the staging store:
|
||||
* Created On: xx/yy/zz
|
||||
@@ -758,11 +683,11 @@ public class AVMBrowseBean implements IContextListener
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the special Submit All action has been initialised
|
||||
* @return true if a special All Items action has been initialised
|
||||
*/
|
||||
public boolean getSubmitAll()
|
||||
public boolean getAllItemsAction()
|
||||
{
|
||||
return this.submitAll;
|
||||
return this.allItemsAction;
|
||||
}
|
||||
|
||||
|
||||
@@ -833,7 +758,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
this.location = null;
|
||||
setCurrentPath(null);
|
||||
setAvmActionNode(null);
|
||||
this.submitAll = false;
|
||||
this.allItemsAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -862,7 +787,7 @@ public class AVMBrowseBean implements IContextListener
|
||||
// calculate username and store name from specified path
|
||||
String[] parts = path.split("[-:]");
|
||||
String storename = parts[0];
|
||||
String username = parts[1];
|
||||
String username = parts[2];
|
||||
if (username.equals(AVMConstants.STORE_STAGING.substring(1)))
|
||||
{
|
||||
setupSandboxActionImpl(null, null, false);
|
||||
@@ -889,12 +814,12 @@ public class AVMBrowseBean implements IContextListener
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit all nodes from user sandbox into the staging area sandbox via workflow
|
||||
* Action handler for all nodes from user sandbox
|
||||
*/
|
||||
public void setupSubmitAllAction(ActionEvent event)
|
||||
public void setupAllItemsAction(ActionEvent event)
|
||||
{
|
||||
setupSandboxAction(event);
|
||||
this.submitAll = true;
|
||||
this.allItemsAction = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -939,102 +864,6 @@ public class AVMBrowseBean implements IContextListener
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo changes to the entire sandbox
|
||||
*/
|
||||
public void revertAll(ActionEvent event)
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
String store = params.get("store");
|
||||
String username = params.get("username");
|
||||
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
tx = Repository.getUserTransaction(context, true);
|
||||
tx.begin();
|
||||
|
||||
// calcluate the list of differences between the user store and the staging area
|
||||
List<AVMDifference> diffs = this.avmSyncService.compare(
|
||||
-1, store + ":/", -1, getStagingStore() + ":/", this.nameMatcher);
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, diff.getSourcePath()));
|
||||
}
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
||||
this.actionService.executeAction(action, null); // dummy action ref
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
|
||||
// if we get here, all was well - output friendly status message to the user
|
||||
String msg = MessageFormat.format(Application.getMessage(
|
||||
context, MSG_REVERTALL_SUCCESS), username);
|
||||
displayStatusMessage(context, msg);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo changes to items selected using multi-select
|
||||
*/
|
||||
public void revertSelected(ActionEvent event)
|
||||
{
|
||||
UIActionLink link = (UIActionLink)event.getComponent();
|
||||
Map<String, String> params = link.getParameterMap();
|
||||
String username = params.get("username");
|
||||
|
||||
List<AVMNodeDescriptor> selected = this.userSandboxes.getSelectedNodes(username);
|
||||
if (selected != null)
|
||||
{
|
||||
UserTransaction tx = null;
|
||||
try
|
||||
{
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
tx = Repository.getUserTransaction(context, false);
|
||||
tx.begin();
|
||||
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, node.getPath()));
|
||||
}
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
||||
this.actionService.executeAction(action, AVMNodeConverter.ToNodeRef(-1, node.getPath()));
|
||||
}
|
||||
|
||||
// commit the transaction
|
||||
tx.commit();
|
||||
|
||||
// if we get here, all was well - output friendly status message to the user
|
||||
String msg = MessageFormat.format(Application.getMessage(
|
||||
context, MSG_REVERTSELECTED_SUCCESS), username);
|
||||
displayStatusMessage(context, msg);
|
||||
}
|
||||
catch (Throwable err)
|
||||
{
|
||||
err.printStackTrace(System.err);
|
||||
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
|
||||
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
|
||||
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert a sandbox to a specific snapshot version ID
|
||||
*/
|
||||
|
@@ -404,8 +404,8 @@ public final class AVMConstants
|
||||
private static final String STORE_SEPARATOR = "--";
|
||||
|
||||
// names of the stores representing the layers for an AVM website
|
||||
public final static String STORE_STAGING = "";
|
||||
public final static String STORE_MAIN = "";
|
||||
public final static String STORE_STAGING = STORE_SEPARATOR + "staging";
|
||||
public final static String STORE_MAIN = STORE_SEPARATOR + "main";
|
||||
public final static String STORE_PREVIEW = STORE_SEPARATOR + "preview";
|
||||
|
||||
// system directories at the top level of an AVM website
|
||||
@@ -416,11 +416,8 @@ public final class AVMConstants
|
||||
public final static String DIR_APPBASE = "appBase";
|
||||
public final static String DIR_WEBAPPS = "avm_webapps";
|
||||
|
||||
|
||||
|
||||
// servlet default webapp
|
||||
// Note: this webapp is mapped to the URL path ""
|
||||
//
|
||||
public final static String DIR_ROOT = "ROOT";
|
||||
|
||||
// system property keys for sandbox identification and DNS virtualisation mapping
|
||||
|
136
source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java
Normal file
136
source/java/org/alfresco/web/bean/wcm/RevertAllDialog.java
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.util.NameMatcher;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
|
||||
/**
|
||||
* Revert (undo) all files in the current user sandbox.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class RevertAllDialog extends BaseDialogBean
|
||||
{
|
||||
private static final String MSG_REVERTALL_SUCCESS = "revertall_success";
|
||||
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected AVMSyncService avmSyncService;
|
||||
protected ActionService actionService;
|
||||
protected NameMatcher nameMatcher;
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVM BrowseBean to set
|
||||
*/
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param avmSyncService The AVMSyncService to set.
|
||||
*/
|
||||
public void setAvmSyncService(AVMSyncService avmSyncService)
|
||||
{
|
||||
this.avmSyncService = avmSyncService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionService The actionService to set.
|
||||
*/
|
||||
public void setActionService(ActionService actionService)
|
||||
{
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nameMatcher The nameMatcher to set.
|
||||
*/
|
||||
public void setNameMatcher(NameMatcher nameMatcher)
|
||||
{
|
||||
this.nameMatcher = nameMatcher;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
String webapp = this.avmBrowseBean.getWebapp();
|
||||
String userStore = AVMConstants.buildAVMStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp);
|
||||
String stagingStore = AVMConstants.buildAVMStoreWebappPath(this.avmBrowseBean.getStagingStore(), webapp);
|
||||
|
||||
// calcluate the list of differences between the user store and the staging area
|
||||
List<AVMDifference> diffs = this.avmSyncService.compare(
|
||||
-1, userStore, -1, stagingStore, this.nameMatcher);
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMDifference diff : diffs)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, diff.getSourcePath()));
|
||||
}
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
||||
this.actionService.executeAction(action, null); // dummy action ref
|
||||
|
||||
String msg = MessageFormat.format(Application.getMessage(
|
||||
context, MSG_REVERTALL_SUCCESS), this.avmBrowseBean.getUsername());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the confirmation to display to the user
|
||||
*/
|
||||
public String getConfirmMessage()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "revert_all_confirm");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
112
source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java
Normal file
112
source/java/org/alfresco/web/bean/wcm/RevertSelectedDialog.java
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Alfresco, Inc.
|
||||
*
|
||||
* Licensed under the Mozilla Public License version 1.1
|
||||
* with a permitted attribution clause. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.alfresco.org/legal/license.txt
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the
|
||||
* License.
|
||||
*/
|
||||
package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.util.Pair;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
|
||||
/**
|
||||
* Revert (undo) the selected files in the current user sandbox.
|
||||
*
|
||||
* @author Kevin Roast
|
||||
*/
|
||||
public class RevertSelectedDialog extends BaseDialogBean
|
||||
{
|
||||
private static final String MSG_REVERTSELECTED_SUCCESS = "revertselected_success";
|
||||
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
protected ActionService actionService;
|
||||
|
||||
/**
|
||||
* @param avmBrowseBean The AVM BrowseBean to set
|
||||
*/
|
||||
public void setAvmBrowseBean(AVMBrowseBean avmBrowseBean)
|
||||
{
|
||||
this.avmBrowseBean = avmBrowseBean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actionService The actionService to set.
|
||||
*/
|
||||
public void setActionService(ActionService actionService)
|
||||
{
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected String finishImpl(FacesContext context, String outcome) throws Exception
|
||||
{
|
||||
List<AVMNodeDescriptor> selected = this.avmBrowseBean.getSelectedSandboxItems();
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>();
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
versionPaths.add(new Pair<Integer, String>(-1, node.getPath()));
|
||||
}
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(1, 1.0f);
|
||||
args.put(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
Action action = this.actionService.createAction(AVMUndoSandboxListAction.NAME, args);
|
||||
this.actionService.executeAction(action, AVMNodeConverter.ToNodeRef(-1, node.getPath()));
|
||||
}
|
||||
|
||||
String msg = MessageFormat.format(Application.getMessage(
|
||||
context, MSG_REVERTSELECTED_SUCCESS), this.avmBrowseBean.getUsername());
|
||||
FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg);
|
||||
context.addMessage(AVMBrowseBean.FORM_ID + ':' + AVMBrowseBean.COMPONENT_SANDBOXESPANEL, facesMsg);
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the confirmation to display to the user
|
||||
*/
|
||||
public String getConfirmMessage()
|
||||
{
|
||||
return Application.getMessage(FacesContext.getCurrentInstance(), "revert_selected_confirm");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -454,7 +454,7 @@ public class SubmitDialog extends BaseDialogBean
|
||||
{
|
||||
// TODO: start txn here?
|
||||
List<AVMNodeDescriptor> selected;
|
||||
if (this.avmBrowseBean.getSubmitAll())
|
||||
if (this.avmBrowseBean.getAllItemsAction())
|
||||
{
|
||||
String webapp = this.avmBrowseBean.getWebapp();
|
||||
String userStore = AVMConstants.buildAVMStoreWebappPath(this.avmBrowseBean.getSandbox(), webapp);
|
||||
|
@@ -633,8 +633,7 @@ public final class Utils
|
||||
NodeRef rootNode = contentCtx.getRootNode();
|
||||
try
|
||||
{
|
||||
Path path = nodeService.getPath(node.getNodeRef());
|
||||
url = Repository.getNamePath(nodeService, path, rootNode, "\\",
|
||||
url = Repository.getNamePath(nodeService, node.getNodePath(), rootNode, "\\",
|
||||
"file:///" + navBean.getCIFSServerPath(diskShare));
|
||||
}
|
||||
catch (AccessDeniedException e)
|
||||
|
@@ -345,12 +345,12 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_SUBMITALL, "/images/icons/submit_all.gif",
|
||||
"#{AVMBrowseBean.setupSubmitAllAction}", "dialog:submitSandboxItems"));
|
||||
"#{AVMBrowseBean.setupAllItemsAction}", "dialog:submitSandboxItems"));
|
||||
out.write(" ");
|
||||
|
||||
Utils.encodeRecursive(context, aquireAction(
|
||||
context, mainStore, username, ACT_SANDBOX_REVERTALL, "/images/icons/revert_all.gif",
|
||||
"#{AVMBrowseBean.revertAll}", null));
|
||||
"#{AVMBrowseBean.setupAllItemsAction}", "dialog:revertAllItems"));
|
||||
out.write(" ");
|
||||
|
||||
if (isManager)
|
||||
@@ -678,7 +678,7 @@ public class UIUserSandboxes extends SelfRenderingComponent
|
||||
out.write(" ");
|
||||
Utils.encodeRecursive(fc, aquireAction(
|
||||
fc, userStore, username, ACT_SANDBOX_REVERTSELECTED, "/images/icons/revert_all.gif",
|
||||
"#{AVMBrowseBean.revertSelected}", null));
|
||||
"#{AVMBrowseBean.setupSandboxAction}", "dialog:revertSelectedItems"));
|
||||
out.write("</td></tr>");
|
||||
|
||||
// end table
|
||||
|
@@ -1790,7 +1790,6 @@
|
||||
<property-name>avmSyncService</property-name>
|
||||
<value>#{AVMSyncService}</value>
|
||||
</managed-property>
|
||||
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
@@ -2363,10 +2362,6 @@
|
||||
<property-name>avmService</property-name>
|
||||
<value>#{AVMService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmSyncService</property-name>
|
||||
<value>#{AVMSyncService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>navigationBean</property-name>
|
||||
<value>#{NavigationBean}</value>
|
||||
@@ -2383,10 +2378,6 @@
|
||||
<property-name>workflowService</property-name>
|
||||
<value>#{WorkflowService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nameMatcher</property-name>
|
||||
<value>#{globalPathExcluder}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
@@ -2888,6 +2879,48 @@
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Revert selected items Dialog
|
||||
</description>
|
||||
<managed-bean-name>RevertSelectedDialog</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.RevertSelectedDialog</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>actionService</property-name>
|
||||
<value>#{ActionService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
<description>
|
||||
The bean that backs up the Revert all items Dialog
|
||||
</description>
|
||||
<managed-bean-name>RevertAllDialog</managed-bean-name>
|
||||
<managed-bean-class>org.alfresco.web.bean.wcm.RevertAllDialog</managed-bean-class>
|
||||
<managed-bean-scope>session</managed-bean-scope>
|
||||
<managed-property>
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>actionService</property-name>
|
||||
<value>#{ActionService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>avmSyncService</property-name>
|
||||
<value>#{AVMSyncService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nameMatcher</property-name>
|
||||
<value>#{globalPathExcluder}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<!-- ==================== COMPONENT GENERATOR BEANS ==================== -->
|
||||
<managed-bean>
|
||||
<description>
|
||||
|
26
source/web/jsp/wcm/revert.jsp
Normal file
26
source/web/jsp/wcm/revert.jsp
Normal file
@@ -0,0 +1,26 @@
|
||||
<%--
|
||||
Copyright (C) 2005 Alfresco, Inc.
|
||||
|
||||
Licensed under the Mozilla Public License version 1.1
|
||||
with a permitted attribution clause. You may obtain a
|
||||
copy of the License at
|
||||
|
||||
http://www.alfresco.org/legal/license.txt
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
either express or implied. See the License for the specific
|
||||
language governing permissions and limitations under the
|
||||
License.
|
||||
--%>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
|
||||
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
|
||||
|
||||
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
|
||||
<%@ page isELIgnored="false" %>
|
||||
|
||||
<h:outputText value="#{DialogManager.bean.confirmMessage}" styleClass="mainSubTitle" />
|
Reference in New Issue
Block a user