mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
17307: Merged DEV/BELARUS/V3.2-2009_10_19 to V3.2 17121: ETHREEOH-2999: Accessing Recent snapshots fails in a web project that is created from an already existing project 17223: ETHREEEOH-2999: (post-review changes) 17346: ETHREEOH-2824 - further perf improvement for multiple single submits (to active workflow sandboxes) from large modified list 17375: Fix ETHREEOH-1643 - WCM revert file & version history, including a few unreported WCM / UI revert file issues 17380: ETHREEOH-1643 - fix build/test fallout git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18110 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,19 +24,13 @@
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.wcm.AVMBrowseBean;
|
||||
import org.alfresco.web.bean.wcm.AVMNode;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.alfresco.web.bean.wcm.AVMWorkflowUtil;
|
||||
import org.alfresco.web.bean.wcm.WebProject;
|
||||
|
||||
/**
|
||||
@@ -49,8 +43,6 @@ public class WCMWorkflowDeletedEvaluator extends WCMLockEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = -4341942166433855200L;
|
||||
|
||||
private static final String TASK_CACHE = "_alf_sandbox_task_cache";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
@@ -61,28 +53,16 @@ public class WCMWorkflowDeletedEvaluator extends WCMLockEvaluator
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
|
||||
|
||||
WebProject webProject = avmBrowseBean.getWebProject();
|
||||
if (webProject == null || webProject.hasWorkflow())
|
||||
{
|
||||
Map<String, List<WorkflowTask>> cachedSandboxTasks = (Map<String, List<WorkflowTask>>)fc.getExternalContext().getRequestMap().get(TASK_CACHE);
|
||||
if (cachedSandboxTasks == null)
|
||||
{
|
||||
cachedSandboxTasks = new HashMap<String, List<WorkflowTask>>(64, 1.0f);
|
||||
fc.getExternalContext().getRequestMap().put(TASK_CACHE, cachedSandboxTasks);
|
||||
}
|
||||
|
||||
String sandbox = AVMUtil.getStoreName(node.getPath());
|
||||
List<WorkflowTask> cachedTasks = cachedSandboxTasks.get(sandbox);
|
||||
if (cachedTasks == null)
|
||||
{
|
||||
cachedTasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(sandbox);
|
||||
cachedSandboxTasks.put(sandbox, cachedTasks);
|
||||
}
|
||||
|
||||
// evaluate to true if we are within a workflow store (i.e. list of resources in the task
|
||||
// dialog) or not part of an already in-progress workflow
|
||||
proceed = (AVMUtil.isWorkflowStore(sandbox) ||
|
||||
!((AVMNode)node).isWorkflowInFlight(cachedTasks));
|
||||
!((AVMNode)node).isInActiveWorkflow(sandbox));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -24,19 +24,13 @@
|
||||
*/
|
||||
package org.alfresco.web.action.evaluator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.web.app.servlet.FacesHelper;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.wcm.AVMBrowseBean;
|
||||
import org.alfresco.web.bean.wcm.AVMNode;
|
||||
import org.alfresco.web.bean.wcm.AVMUtil;
|
||||
import org.alfresco.web.bean.wcm.AVMWorkflowUtil;
|
||||
import org.alfresco.web.bean.wcm.WebProject;
|
||||
|
||||
/**
|
||||
@@ -48,8 +42,6 @@ public class WCMWorkflowEvaluator extends WCMLockEvaluator
|
||||
{
|
||||
private static final long serialVersionUID = -5847066921917855781L;
|
||||
|
||||
private static final String TASK_CACHE = "_alf_sandbox_task_cache";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
|
||||
*/
|
||||
@@ -60,26 +52,14 @@ public class WCMWorkflowEvaluator extends WCMLockEvaluator
|
||||
{
|
||||
final FacesContext fc = FacesContext.getCurrentInstance();
|
||||
final AVMBrowseBean avmBrowseBean = (AVMBrowseBean)FacesHelper.getManagedBean(fc, AVMBrowseBean.BEAN_NAME);
|
||||
|
||||
WebProject webProject = avmBrowseBean.getWebProject();
|
||||
if (webProject == null || webProject.hasWorkflow())
|
||||
{
|
||||
Map<String, List<WorkflowTask>> cachedSandboxTasks = (Map<String, List<WorkflowTask>>)fc.getExternalContext().getRequestMap().get(TASK_CACHE);
|
||||
if (cachedSandboxTasks == null)
|
||||
{
|
||||
cachedSandboxTasks = new HashMap<String, List<WorkflowTask>>(64, 1.0f);
|
||||
fc.getExternalContext().getRequestMap().put(TASK_CACHE, cachedSandboxTasks);
|
||||
}
|
||||
|
||||
String sandbox = AVMUtil.getStoreName(node.getPath());
|
||||
List<WorkflowTask> cachedTasks = cachedSandboxTasks.get(sandbox);
|
||||
if (cachedTasks == null)
|
||||
{
|
||||
cachedTasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(sandbox);
|
||||
cachedSandboxTasks.put(sandbox, cachedTasks);
|
||||
}
|
||||
|
||||
proceed = ((AVMUtil.isWorkflowStore(sandbox) ||
|
||||
!((AVMNode)node).isWorkflowInFlight(cachedTasks)) &&
|
||||
!((AVMNode)node).isInActiveWorkflow(sandbox)) &&
|
||||
!((AVMNode)node).isDeleted());
|
||||
}
|
||||
else
|
||||
|
@@ -71,7 +71,6 @@ import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.wcm.asset.AssetInfo;
|
||||
import org.alfresco.wcm.asset.AssetInfoImpl;
|
||||
import org.alfresco.wcm.sandbox.SandboxInfo;
|
||||
@@ -2254,18 +2253,11 @@ public class AVMBrowseBean implements IContextListener
|
||||
String sbStoreId = storePath[0];
|
||||
|
||||
List<String> paths = new ArrayList<String>();
|
||||
List<WorkflowTask> tasks = null;
|
||||
for (AssetInfo asset : assets)
|
||||
{
|
||||
if (asset.getDiffCode() == AVMDifference.CONFLICT)
|
||||
{
|
||||
// TODO refactor getAssociatedTasksForNode to use AssetInfo instead of AVMNodeDescriptor
|
||||
AVMNodeDescriptor node = ((AssetInfoImpl)asset).getAVMNodeDescriptor();
|
||||
if (tasks == null)
|
||||
{
|
||||
tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(sbStoreId);
|
||||
}
|
||||
if (AVMWorkflowUtil.getAssociatedTasksForNode(node, tasks).size() == 0)
|
||||
if (! AVMWorkflowUtil.isInActiveWorkflow(sbStoreId, asset.getPath()))
|
||||
{
|
||||
paths.add(asset.getPath());
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.wcm.asset.AssetInfo;
|
||||
import org.alfresco.wcm.asset.AssetInfoImpl;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.web.bean.BrowseBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.NodePropertyResolver;
|
||||
@@ -256,7 +257,7 @@ public class AVMNode extends Node implements Map<String, Object>
|
||||
return !this.layeringDesc.isBackground();
|
||||
}
|
||||
|
||||
public final boolean isWorkflowInFlight(List<WorkflowTask> tasks)
|
||||
public final boolean isInActiveWorkflow(String sandbox)
|
||||
{
|
||||
if (this.workflowInFlight == null)
|
||||
{
|
||||
@@ -266,7 +267,7 @@ public class AVMNode extends Node implements Map<String, Object>
|
||||
}
|
||||
else
|
||||
{
|
||||
this.workflowInFlight = AVMWorkflowUtil.getAssociatedTasksForNode(this.avmRef, tasks).size() != 0;
|
||||
this.workflowInFlight = AVMWorkflowUtil.isInActiveWorkflow(sandbox, this.getDescriptor());
|
||||
}
|
||||
}
|
||||
return this.workflowInFlight;
|
||||
|
@@ -32,7 +32,9 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -43,6 +45,7 @@ import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
@@ -50,6 +53,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.wcm.util.WCMWorkflowUtil;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -67,6 +71,8 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
{
|
||||
private static final Log logger = LogFactory.getLog(AVMWorkflowUtil.class);
|
||||
|
||||
private static final String PATH_CACHE = "_alf_sandbox_path_cache";
|
||||
|
||||
// cached configured lists
|
||||
private static List<WorkflowDefinition> configuredWorkflowDefs = null;
|
||||
|
||||
@@ -177,6 +183,9 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
return configuredWorkflowDefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 3.2
|
||||
*/
|
||||
public static List<WorkflowTask> getAssociatedTasksForSandbox(final String storeName)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
@@ -184,10 +193,47 @@ public class AVMWorkflowUtil extends WorkflowUtil
|
||||
return WCMWorkflowUtil.getAssociatedTasksForSandbox(workflowService, storeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 3.2
|
||||
*/
|
||||
public static List<WorkflowTask> getAssociatedTasksForNode(AVMNodeDescriptor node, List<WorkflowTask> tasks)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
AVMService avmService = Repository.getServiceRegistry(fc).getAVMService();
|
||||
return WCMWorkflowUtil.getAssociatedTasksForNode(avmService, node, tasks);
|
||||
}
|
||||
|
||||
public static boolean isInActiveWorkflow(String sandbox, AVMNodeDescriptor node)
|
||||
{
|
||||
return isInActiveWorkflow(sandbox, WCMUtil.getStoreRelativePath(node.getPath()));
|
||||
}
|
||||
|
||||
public static boolean isInActiveWorkflow(String sandbox, String relativePath)
|
||||
{
|
||||
List<String> cachedPaths = AVMWorkflowUtil.getAssociatedPathsForSandbox(sandbox);
|
||||
return (cachedPaths.contains(relativePath));
|
||||
}
|
||||
|
||||
private static List<String> getAssociatedPathsForSandbox(String sandbox)
|
||||
{
|
||||
FacesContext fc = FacesContext.getCurrentInstance();
|
||||
AVMSyncService avmSyncService = Repository.getServiceRegistry(fc).getAVMSyncService();
|
||||
WorkflowService workflowService = Repository.getServiceRegistry(fc).getWorkflowService();
|
||||
|
||||
Map<String, List<String>> cachedSandboxPaths = (Map<String, List<String>>)fc.getExternalContext().getRequestMap().get(PATH_CACHE);
|
||||
if (cachedSandboxPaths == null)
|
||||
{
|
||||
cachedSandboxPaths = new HashMap<String, List<String>>(64, 1.0f);
|
||||
fc.getExternalContext().getRequestMap().put(PATH_CACHE, cachedSandboxPaths);
|
||||
}
|
||||
|
||||
List<String> cachedPaths = cachedSandboxPaths.get(sandbox);
|
||||
if (cachedPaths == null)
|
||||
{
|
||||
cachedPaths = WCMWorkflowUtil.getAssociatedPathsForSandbox(avmSyncService, workflowService, sandbox);
|
||||
cachedSandboxPaths.put(sandbox, cachedPaths);
|
||||
}
|
||||
|
||||
return cachedPaths;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -33,6 +33,7 @@ import javax.faces.context.FacesContext;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.wcm.sandbox.SandboxService;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
@@ -43,7 +44,6 @@ import org.apache.commons.logging.LogFactory;
|
||||
* Base class for AVMCompare dialogs
|
||||
*
|
||||
* @author Dmitry Lazurkin
|
||||
*
|
||||
*/
|
||||
public abstract class CompareSnapshotDialog extends BaseDialogBean
|
||||
{
|
||||
@@ -53,6 +53,7 @@ public abstract class CompareSnapshotDialog extends BaseDialogBean
|
||||
|
||||
private final static String MSG_CLOSE = "close";
|
||||
protected AVMBrowseBean avmBrowseBean;
|
||||
transient private SandboxService sandboxService;
|
||||
transient private AVMService avmService;
|
||||
transient private AVMSyncService avmSyncService;
|
||||
protected NodeRef websiteRef;
|
||||
@@ -108,7 +109,7 @@ public abstract class CompareSnapshotDialog extends BaseDialogBean
|
||||
@Override
|
||||
public String getContainerDescription()
|
||||
{
|
||||
int prev = AVMCompareUtils.getPrevVersionID(getAvmService(), sandbox, version);
|
||||
int prev = WCMCompareUtils.getPrevVersionID(getSandboxService(), sandbox, version);
|
||||
return MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), getDescription()), version, prev);
|
||||
}
|
||||
|
||||
@@ -159,6 +160,20 @@ public abstract class CompareSnapshotDialog extends BaseDialogBean
|
||||
return avmService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for sandboxService service
|
||||
*
|
||||
* @return sandboxService
|
||||
*/
|
||||
public SandboxService getSandboxService()
|
||||
{
|
||||
if (sandboxService == null)
|
||||
{
|
||||
sandboxService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getSandboxService();
|
||||
}
|
||||
return sandboxService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for avmSyncService service
|
||||
*
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -65,10 +65,11 @@ public class CompareToAnySnapshotDialog extends CompareSnapshotDialog
|
||||
/**
|
||||
* Builds list of available version numbers
|
||||
*/
|
||||
private void buildAvailibleVersionNumbers()
|
||||
private void buildAvailableVersionNumbers()
|
||||
{
|
||||
this.curAvailableVersionNumber = -1;
|
||||
this.availableVersionNumbers = AVMCompareUtils.getAllVersionID(getAvmService(), userSpecifiedStore);
|
||||
this.availableVersionNumbers = WCMCompareUtils.getAllVersionID(getSandboxService(), userSpecifiedStore);
|
||||
Collections.sort(availableVersionNumbers);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +79,7 @@ public class CompareToAnySnapshotDialog extends CompareSnapshotDialog
|
||||
userSpecifiedStore = sandbox;
|
||||
userSpecifiedRoot = storeRoot;
|
||||
userSpecifiedVersion = -1;
|
||||
buildAvailibleVersionNumbers();
|
||||
buildAvailableVersionNumbers();
|
||||
this.compare = true;
|
||||
this.storeChanged = false;
|
||||
}
|
||||
@@ -102,7 +103,7 @@ public class CompareToAnySnapshotDialog extends CompareSnapshotDialog
|
||||
|
||||
if (isCorrectVersion(userSpecifiedVersion))
|
||||
{
|
||||
nodes = AVMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, userSpecifiedVersion, userSpecifiedRoot, null);
|
||||
nodes = WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, userSpecifiedVersion, userSpecifiedRoot, null);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
@@ -118,7 +119,7 @@ public class CompareToAnySnapshotDialog extends CompareSnapshotDialog
|
||||
*/
|
||||
public List<SelectItem> getStoresList()
|
||||
{
|
||||
List<String> stores = AVMCompareUtils.receiveStoresList(getAvmService());
|
||||
List<String> stores = WCMCompareUtils.receiveStoresList(getAvmService());
|
||||
|
||||
List<SelectItem> result = new ArrayList<SelectItem>();
|
||||
|
||||
@@ -211,7 +212,7 @@ public class CompareToAnySnapshotDialog extends CompareSnapshotDialog
|
||||
this.userSpecifiedStore = userSpecifiedSnapshot;
|
||||
this.userSpecifiedRoot = AVMUtil.buildSandboxRootPath(this.userSpecifiedStore);
|
||||
this.userSpecifiedVersion = -1;
|
||||
buildAvailibleVersionNumbers();
|
||||
buildAvailableVersionNumbers();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -32,8 +32,8 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Class for compareToCurrentSnapshot dialog
|
||||
* @author ValerySh
|
||||
*
|
||||
* @author ValerySh
|
||||
*/
|
||||
public class CompareToCurrentSnapshotDialog extends CompareSnapshotDialog
|
||||
{
|
||||
@@ -58,7 +58,7 @@ public class CompareToCurrentSnapshotDialog extends CompareSnapshotDialog
|
||||
return null;
|
||||
}
|
||||
finished = true;
|
||||
return AVMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, -1, storeRoot, null);
|
||||
return WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, -1, storeRoot, null);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -31,7 +31,6 @@ import java.util.Map;
|
||||
* Class for compareToPreviousSnapshot dialog
|
||||
*
|
||||
* @author ValerySh
|
||||
*
|
||||
*/
|
||||
public class CompareToPreviousSnapshotDialog extends CompareSnapshotDialog
|
||||
{
|
||||
@@ -42,8 +41,8 @@ public class CompareToPreviousSnapshotDialog extends CompareSnapshotDialog
|
||||
|
||||
public List<Map<String, String>> getComparedNodes()
|
||||
{
|
||||
int prevVersion = AVMCompareUtils.getPrevVersionID(getAvmService(), sandbox, version);
|
||||
return AVMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, prevVersion, storeRoot, null);
|
||||
int prevVersion = WCMCompareUtils.getPrevVersionID(getSandboxService(), sandbox, version);
|
||||
return WCMCompareUtils.getComparedNodes(getAvmSyncService(), version, storeRoot, prevVersion, storeRoot, null);
|
||||
}
|
||||
|
||||
protected String getDescription()
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -461,6 +461,8 @@ public class CreateWebContentWizard extends CreateContentWizard
|
||||
" and " + this.renditions.size() + " rendition(s) to main store");
|
||||
}
|
||||
|
||||
this.avmBrowseBean.setAvmActionNode(new AVMNode(this.getAvmService().lookup(-1, this.createdPath)));
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,6 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowTask;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.springframework.extensions.surf.util.ISO8601DateFormat;
|
||||
@@ -730,18 +729,15 @@ public class SubmitDialog extends BaseDialogBean
|
||||
Set<String> submittedPaths = new HashSet<String>(selected.size());
|
||||
this.submitItems = new ArrayList<ItemWrapper>(selected.size());
|
||||
this.warningItems = new ArrayList<ItemWrapper>(selected.size() >> 1);
|
||||
List<WorkflowTask> tasks = null;
|
||||
|
||||
for (AVMNodeDescriptor node : selected)
|
||||
{
|
||||
if (tasks == null)
|
||||
{
|
||||
tasks = AVMWorkflowUtil.getAssociatedTasksForSandbox(AVMUtil.getStoreName(node.getPath()));
|
||||
}
|
||||
if (AVMWorkflowUtil.getAssociatedTasksForNode(node, tasks).size() != 0)
|
||||
if (AVMWorkflowUtil.isInActiveWorkflow(this.avmBrowseBean.getStagingStore(), node))
|
||||
{
|
||||
this.warningItems.add(new ItemWrapper(node));
|
||||
continue;
|
||||
}
|
||||
|
||||
NodeRef ref = AVMNodeConverter.ToNodeRef(-1, node.getPath());
|
||||
if (submittedPaths.contains(node.getPath()))
|
||||
{
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -26,30 +26,34 @@ package org.alfresco.web.bean.wcm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
import org.alfresco.service.cmr.avm.VersionDescriptor;
|
||||
import org.alfresco.service.cmr.avmsync.AVMDifference;
|
||||
import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
||||
import org.alfresco.util.NameMatcher;
|
||||
import org.alfresco.wcm.sandbox.SandboxService;
|
||||
import org.alfresco.wcm.sandbox.SandboxVersion;
|
||||
import org.alfresco.web.app.Application;
|
||||
|
||||
/**
|
||||
* AVMCompare Utils
|
||||
* @author ValerySh
|
||||
*
|
||||
* @author ValerySh
|
||||
*/
|
||||
public class AVMCompareUtils
|
||||
public class WCMCompareUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* Get a difference map between two corresponding node trees.
|
||||
*
|
||||
* @param avmSyncService AVMSyncService
|
||||
* @param srcVersion The version id for the source tree.
|
||||
* @param srcPath The avm path to the source tree.
|
||||
@@ -101,76 +105,74 @@ public class AVMCompareUtils
|
||||
|
||||
/**
|
||||
* checks the version of the first is accessible for Store
|
||||
* @param avmService AVMService
|
||||
* @param name The name of the AVMStore
|
||||
* @param version Version
|
||||
*
|
||||
* @param versions versions of specified store.
|
||||
* @param item Version
|
||||
* @return true if version is first
|
||||
*/
|
||||
public static boolean isFirstVersion(AVMService avmService, String name, int version)
|
||||
public static boolean isFirstVersion(List<SandboxVersion> versions, SandboxVersion item)
|
||||
{
|
||||
boolean result = false;
|
||||
List<Integer> allVersions = getAllVersionID(avmService, name);
|
||||
|
||||
if (version == Collections.min(allVersions))
|
||||
if (versions.size() > 0)
|
||||
{
|
||||
if (item.getVersion() == Collections.min(versions, new SandboxVersionComparator()).getVersion())
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks the version of the last is accessible for Store
|
||||
* @param avmService AVMService
|
||||
* @param name The name of the AVMStore
|
||||
* @param version Version
|
||||
*
|
||||
* @param versions versions of specified store.
|
||||
* @param item Version
|
||||
* @return true if version is latest
|
||||
*/
|
||||
public static boolean isLatestVersion(AVMService avmService, String name, int version)
|
||||
public static boolean isLatestVersion(List<SandboxVersion> versions, SandboxVersion item)
|
||||
{
|
||||
boolean result = false;
|
||||
List<Integer> allVersions = getAllVersionID(avmService, name);
|
||||
if (version == Collections.max(allVersions))
|
||||
if (versions.size() > 0)
|
||||
{
|
||||
if (item.getVersion() == Collections.max(versions, new SandboxVersionComparator()).getVersion())
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the versions id in an AVMStore
|
||||
* @param avmService AVMService
|
||||
* @param name The name of the AVMStore
|
||||
* @return List versions id
|
||||
*/
|
||||
public static List<Integer> getAllVersionID(AVMService avmService, String name)
|
||||
{
|
||||
List<Integer> allVersions = new ArrayList<Integer>();
|
||||
List<VersionDescriptor> listVersion = avmService.getStoreVersions(name);
|
||||
for (VersionDescriptor vd : listVersion)
|
||||
{
|
||||
if ((vd.getTag() != null || AVMUtil.isUserStore(name)) && vd.getVersionID() > 2)
|
||||
{
|
||||
allVersions.add(vd.getVersionID());
|
||||
}
|
||||
}
|
||||
|
||||
return allVersions;
|
||||
}
|
||||
|
||||
/** Get Previous Version Id
|
||||
* @param avmService AVMService
|
||||
* Get Previous Version Id
|
||||
*
|
||||
* @param sandboxService SandboxService
|
||||
* @param name The name of the AVMStore
|
||||
* @param version Current version Id
|
||||
* @return Previous Version Id
|
||||
*/
|
||||
public static int getPrevVersionID(AVMService avmService, String name, int version)
|
||||
public static int getPrevVersionID(SandboxService sandboxService, String name, int version)
|
||||
{
|
||||
List<Integer> allVersions = getAllVersionID(avmService, name);
|
||||
List<Integer> allVersions = getAllVersionID(sandboxService, name);
|
||||
Collections.sort(allVersions);
|
||||
int index = allVersions.indexOf(version);
|
||||
if (index == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return allVersions.get(index - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive Stores List
|
||||
*
|
||||
* @param avmService AVMService
|
||||
* @return List Stores name
|
||||
*/
|
||||
@@ -180,9 +182,42 @@ public class AVMCompareUtils
|
||||
List<AVMStoreDescriptor> storeDescs = avmService.getStores();
|
||||
for (AVMStoreDescriptor storeDesc : storeDescs)
|
||||
{
|
||||
if (!storeDesc.getCreator().equalsIgnoreCase("system") && !AVMUtil.isPreviewStore(storeDesc.getName()))
|
||||
if (!storeDesc.getCreator().equalsIgnoreCase(AuthenticationUtil.SYSTEM_USER_NAME) && !AVMUtil.isPreviewStore(storeDesc.getName()))
|
||||
{
|
||||
result.add(storeDesc.getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the versions id in an AVMStore
|
||||
*
|
||||
* @param sandboxService SandboxService
|
||||
* @param store The name of the AVMStore
|
||||
* @return List versions id
|
||||
*/
|
||||
public static List<Integer> getAllVersionID(SandboxService sandboxService, String store)
|
||||
{
|
||||
List<SandboxVersion> allVersions = sandboxService.listSnapshots(store, false);
|
||||
List<Integer> result = new ArrayList<Integer>();
|
||||
for (SandboxVersion sandboxVersion : allVersions)
|
||||
{
|
||||
result.add(sandboxVersion.getVersion());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparator for SandboxVersion class
|
||||
*/
|
||||
private static class SandboxVersionComparator implements Comparator<SandboxVersion>
|
||||
{
|
||||
|
||||
public int compare(SandboxVersion o1, SandboxVersion o2)
|
||||
{
|
||||
return ((Integer) o1.getVersion()).compareTo((Integer) o2.getVersion());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -53,7 +53,7 @@ import org.alfresco.wcm.sandbox.SandboxVersion;
|
||||
import org.alfresco.wcm.util.WCMUtil;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wcm.AVMCompareUtils;
|
||||
import org.alfresco.web.bean.wcm.WCMCompareUtils;
|
||||
import org.alfresco.web.bean.wcm.DeploymentUtil;
|
||||
import org.alfresco.web.ui.common.ComponentConstants;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
@@ -313,7 +313,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
* Utils.encodeRecursive(context, aquireAction( context, sandbox, ACT_SNAPSHOT_PREVIEW, null, null, null)); out.write(" ");
|
||||
*/
|
||||
|
||||
boolean isLatestVersion = AVMCompareUtils.isLatestVersion(avmService, sandbox, version);
|
||||
boolean isLatestVersion = WCMCompareUtils.isLatestVersion(versions, item);
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
if (!isLatestVersion)
|
||||
{
|
||||
@@ -335,7 +335,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
|
||||
Utils.encodeRecursive(context, action);
|
||||
}
|
||||
|
||||
boolean isFirstVersion = AVMCompareUtils.isFirstVersion(avmService, sandbox, version);
|
||||
boolean isFirstVersion = WCMCompareUtils.isFirstVersion(versions, item);
|
||||
if (!isFirstVersion)
|
||||
{
|
||||
out.write(" ");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<%--
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -119,9 +119,15 @@
|
||||
<h:outputText id="outT3" value="#{msg.actions}" />
|
||||
</f:facet>
|
||||
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" image="#{r.fileType16}" style="padding-right:8px" />
|
||||
|
||||
<r:permissionEvaluator id="eval2" value="#{DialogManager.bean.avmNode}" allow="Write">
|
||||
<r:actionInstanceEvaluator id="acEv1" value="#{DialogManager.bean.avmNode}" evaluatorClassName="org.alfresco.web.action.evaluator.WCMWorkflowEvaluator">
|
||||
<a:actionLink id="revert-link" value="#{msg.revert}" actionListener="#{DialogManager.bean.revertNode}" action="dialog:close" image="/images/icons/revert.gif">
|
||||
<f:param name="version" value="#{r.strVersion}" />
|
||||
</a:actionLink>
|
||||
</r:actionInstanceEvaluator>
|
||||
</r:permissionEvaluator>
|
||||
|
||||
</a:column>
|
||||
|
||||
<a:dataPager id="pager" styleClass="pager" />
|
||||
|
Reference in New Issue
Block a user