inputMap = createInputMap(context, services, variableAccesses);
ScriptService scriptService = services.getScriptService();
+ scriptService.buildCoreModel(inputMap);
Object result = scriptService.executeScriptString(expression, inputMap);
result = convertForJBPM(result, services);
return result;
diff --git a/source/java/org/alfresco/service/cmr/repository/CopyService.java b/source/java/org/alfresco/service/cmr/repository/CopyService.java
index e7a12693b7..c5d710cf41 100644
--- a/source/java/org/alfresco/service/cmr/repository/CopyService.java
+++ b/source/java/org/alfresco/service/cmr/repository/CopyService.java
@@ -25,7 +25,7 @@ import org.alfresco.service.PublicService;
import org.alfresco.service.namespace.QName;
/**
- * Node operations service interface.
+ * Copy operations service interface.
*
* This interface provides methods to copy nodes within and across workspaces and to
* update the state of a node, with that of another node, within and across workspaces.
diff --git a/source/java/org/alfresco/service/cmr/repository/ScriptService.java b/source/java/org/alfresco/service/cmr/repository/ScriptService.java
index 2638eb8ee5..1788e29699 100644
--- a/source/java/org/alfresco/service/cmr/repository/ScriptService.java
+++ b/source/java/org/alfresco/service/cmr/repository/ScriptService.java
@@ -184,6 +184,16 @@ public interface ScriptService
@Auditable
public void resetScriptProcessors();
+
+ /**
+ * Add core data-model to provided Map
+ *
+ * @param inputMap initial Map of global scope scriptable Node objects
+ * @return A Map of global scope scriptable Node objects
+ */
+ @Auditable(parameters = {"inputMap"})
+ public void buildCoreModel(Map inputMap);
+
/**
* Create the default data-model available to scripts as global scope level objects:
*
diff --git a/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java b/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java
index 547ff3c888..7d93bc3d96 100644
--- a/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java
+++ b/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java
@@ -146,6 +146,8 @@ public final class SandboxFactory extends WCMUtil
NodeRef webProjectNodeRef,
String branchStoreId)
{
+ long start = System.currentTimeMillis();
+
// create the 'staging' store for the website
String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
@@ -159,9 +161,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(stagingStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created staging sandbox: " + stagingStoreName);
+ logger.trace("Created staging sandbox: " + stagingStoreName);
}
// we can either branch from an existing staging store or create a new structure
@@ -204,9 +206,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(previewStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created staging preview sandbox store: " + previewStoreName +
+ logger.trace("Created staging preview sandbox store: " + previewStoreName +
" above " + stagingStoreName);
}
@@ -238,8 +240,15 @@ public final class SandboxFactory extends WCMUtil
dumpStoreProperties(avmService, stagingStoreName);
dumpStoreProperties(avmService, previewStoreName);
}
-
- return getSandbox(stagingStoreName);
+
+ SandboxInfo sbInfo = getSandbox(stagingStoreName);
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("createStagingSandbox: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return sbInfo;
}
/**
@@ -568,6 +577,8 @@ public final class SandboxFactory extends WCMUtil
String username,
String role)
{
+ long start = System.currentTimeMillis();
+
// create the user 'main' store
String userStoreName = WCMUtil.buildUserMainStoreName(storeId, username);
String previewStoreName = WCMUtil.buildUserPreviewStoreName(storeId, username);
@@ -575,9 +586,9 @@ public final class SandboxFactory extends WCMUtil
SandboxInfo userSandboxInfo = getSandbox(userStoreName);
if (userSandboxInfo != null)
{
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Not creating author sandbox as it already exists: " + userStoreName);
+ logger.trace("Not creating author sandbox as it already exists: " + userStoreName);
}
return userSandboxInfo;
}
@@ -604,9 +615,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(userStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created user sandbox: " + userStoreName + " above staging store " + stagingStoreName);
+ logger.trace("Created user sandbox: " + userStoreName + " above staging store " + stagingStoreName);
}
// create a layered directory pointing to 'www' in the staging area
@@ -623,7 +634,7 @@ public final class SandboxFactory extends WCMUtil
addToGroupIfRequired(stagingStoreName, currentUser, PermissionService.WCM_CONTENT_MANAGER);
String cms = authorityService.getName(AuthorityType.GROUP, stagingStoreName + "-" + PermissionService.WCM_CONTENT_MANAGER);
permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.WCM_CONTENT_MANAGER, true);
-
+
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// apply the manager role permission for each manager in the web project
@@ -654,9 +665,9 @@ public final class SandboxFactory extends WCMUtil
// create the user 'preview' store
avmService.createStore(previewStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created user preview sandbox store: " + previewStoreName +
+ logger.trace("Created user preview sandbox store: " + previewStoreName +
" above " + userStoreName);
}
@@ -687,7 +698,14 @@ public final class SandboxFactory extends WCMUtil
dumpStoreProperties(avmService, previewStoreName);
}
- return getSandbox(userStoreName);
+ SandboxInfo sbInfo = getSandbox(userStoreName);
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("createUserSandbox: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return sbInfo;
}
/**
@@ -704,6 +722,8 @@ public final class SandboxFactory extends WCMUtil
*/
public SandboxInfo createWorkflowSandbox(final String storeId)
{
+ long start = System.currentTimeMillis();
+
String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
// create the workflow 'main' store
@@ -730,9 +750,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(mainStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created workflow sandbox store: " + mainStoreName);
+ logger.trace("Created workflow sandbox store: " + mainStoreName);
}
// create a layered directory pointing to 'www' in the staging area
@@ -765,9 +785,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(previewStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created workflow sandbox preview store: " + previewStoreName);
+ logger.trace("Created workflow sandbox preview store: " + previewStoreName);
}
// create a layered directory pointing to 'www' in the workflow 'main' store
@@ -784,7 +804,14 @@ public final class SandboxFactory extends WCMUtil
dumpStoreProperties(avmService, previewStoreName);
}
- return getSandbox(mainStoreName);
+ SandboxInfo sbInfo = getSandbox(mainStoreName);
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("createWorkflowSandbox: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return sbInfo;
}
/**
@@ -808,6 +835,8 @@ public final class SandboxFactory extends WCMUtil
*/
public SandboxInfo createReadOnlyWorkflowSandbox(final String storeId)
{
+ long start = System.currentTimeMillis();
+
String wpStoreId = WCMUtil.getWebProjectStoreId(storeId);
String stagingStoreName = WCMUtil.buildStagingStoreName(storeId);
@@ -835,11 +864,11 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(mainStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created read-only workflow sandbox store: " + mainStoreName);
+ logger.trace("Created read-only workflow sandbox store: " + mainStoreName);
}
-
+
// create a layered directory pointing to 'www' in the staging area
avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(stagingStoreName),
mainStoreName + ":/",
@@ -850,7 +879,14 @@ public final class SandboxFactory extends WCMUtil
dumpStoreProperties(avmService, mainStoreName);
}
- return getSandbox(wpStoreId, mainStoreName, false); // no preview store
+ SandboxInfo sbInfo = getSandbox(wpStoreId, mainStoreName, false); // no preview store
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("createReadOnlyWorkflowSandbox: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return sbInfo;
}
@@ -865,6 +901,8 @@ public final class SandboxFactory extends WCMUtil
// TODO refactor AVMExpiredContentProcessor ...
public String createUserWorkflowSandbox(String stagingStore, String userStore)
{
+ long start = System.currentTimeMillis();
+
// create the workflow 'main' store
String packageName = "workflow-" + GUID.generate();
String workflowStoreName = userStore + STORE_SEPARATOR + packageName;
@@ -891,9 +929,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(workflowStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created user workflow sandbox store: " + workflowStoreName);
+ logger.trace("Created user workflow sandbox store: " + workflowStoreName);
}
// create a layered directory pointing to 'www' in the users store
@@ -927,9 +965,9 @@ public final class SandboxFactory extends WCMUtil
avmService.createStore(previewStoreName, props);
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Created user workflow sandbox preview store: " + previewStoreName);
+ logger.trace("Created user workflow sandbox preview store: " + previewStoreName);
}
// create a layered directory pointing to 'www' in the workflow 'main' store
@@ -940,6 +978,11 @@ public final class SandboxFactory extends WCMUtil
// snapshot the store
avmService.createSnapshot(previewStoreName, null, null);
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("createUserWorkflowSandbox: " + workflowStoreName + " in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
// return the main workflow store name
return workflowStoreName;
}
@@ -951,6 +994,8 @@ public final class SandboxFactory extends WCMUtil
public List listAllSandboxes(String wpStoreId, boolean includeWorkflowSandboxes, boolean includeLocalhostDeployed)
{
+ long start = System.currentTimeMillis();
+
List stores = avmService.getStores();
List sbInfos = new ArrayList();
@@ -969,22 +1014,29 @@ public final class SandboxFactory extends WCMUtil
}
}
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("listAllSandboxes: " + wpStoreId + "[" + sbInfos.size() + "] in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
return sbInfos;
}
public void deleteSandbox(String sbStoreId)
{
- deleteSandbox(WCMUtil.getWebProjectStoreId(sbStoreId), sbStoreId);
+ deleteSandbox(sbStoreId, false);
}
- public void deleteSandbox(String wpStoreId, String sbStoreId)
+ public void deleteSandbox(String sbStoreId, boolean isSubmitDirectWorkflowSandbox)
{
- deleteSandbox(getSandbox(wpStoreId, sbStoreId, true), true);
+ deleteSandbox(getSandbox(WCMUtil.getWebProjectStoreId(sbStoreId), sbStoreId, true), isSubmitDirectWorkflowSandbox, true);
}
- public void deleteSandbox(SandboxInfo sbInfo, boolean removeLocks)
+ public void deleteSandbox(SandboxInfo sbInfo, boolean isSubmitDirectWorkflowSandbox, boolean removeLocks)
{
if (sbInfo != null)
{
+ long start = System.currentTimeMillis();
+
String mainSandboxStore = sbInfo.getMainStoreName();
String wpStoreId = WCMUtil.getWebProjectStoreId(mainSandboxStore);
@@ -1008,7 +1060,11 @@ public final class SandboxFactory extends WCMUtil
// accessing a preview layer whose main layer has been torn
// out from under it.
- WCMUtil.removeAllVServerWebapps(virtServerRegistry, path, true);
+ // optimization: direct submits no longer virtualize the workflow sandbox
+ if (! isSubmitDirectWorkflowSandbox)
+ {
+ WCMUtil.removeAllVServerWebapps(virtServerRegistry, path, true);
+ }
// NOTE: Could use the .sandbox-id. GUID property to delete all sandboxes,
// rather than assume a sandbox always had a single preview
@@ -1033,9 +1089,9 @@ public final class SandboxFactory extends WCMUtil
}
}
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("Deleted sandbox: " + mainSandboxStore);
+ logger.trace("deleteSandbox: " + mainSandboxStore + " in "+(System.currentTimeMillis()-start)+" ms");
}
}
}
diff --git a/source/java/org/alfresco/wcm/sandbox/SandboxServiceImpl.java b/source/java/org/alfresco/wcm/sandbox/SandboxServiceImpl.java
index b5743f5b16..16ebe1d8d6 100644
--- a/source/java/org/alfresco/wcm/sandbox/SandboxServiceImpl.java
+++ b/source/java/org/alfresco/wcm/sandbox/SandboxServiceImpl.java
@@ -82,7 +82,7 @@ public class SandboxServiceImpl implements SandboxService
/** Logger */
private static Log logger = LogFactory.getLog(SandboxServiceImpl.class);
- private static final String WORKFLOW_SUBMITDIRECT = "jbpm$wcmwf:submitdirect";
+ private static final String WORKFLOW_SUBMITDIRECT = "jbpm$"+WCMUtil.WORKFLOW_SUBMITDIRECT_NAME;
private WebProjectService wpService;
private SandboxFactory sandboxFactory;
@@ -188,6 +188,8 @@ public class SandboxServiceImpl implements SandboxService
private SandboxInfo createAuthorSandboxImpl(String wpStoreId, String userName)
{
+ long start = System.currentTimeMillis();
+
WebProjectInfo wpInfo = wpService.getWebProject(wpStoreId);
final NodeRef wpNodeRef = wpInfo.getNodeRef();
@@ -223,9 +225,9 @@ public class SandboxServiceImpl implements SandboxService
CreateSandboxTransactionListener tl = new CreateSandboxTransactionListener(sandboxInfoList, wpService.listWebApps(wpNodeRef));
AlfrescoTransactionSupport.bindListener(tl);
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Created author sandbox: " + sbInfo.getSandboxId() + " (web project id: " + wpStoreId + ")");
+ logger.debug("createAuthorSandboxImpl: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
}
return sbInfo;
@@ -236,6 +238,8 @@ public class SandboxServiceImpl implements SandboxService
*/
public List listSandboxes(String wpStoreId)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("wpStoreId", wpStoreId);
List sbInfos = null;
@@ -264,6 +268,11 @@ public class SandboxServiceImpl implements SandboxService
}
}
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("listSandboxes: " + wpStoreId + " in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
+ }
+
return sbInfos;
}
@@ -313,6 +322,8 @@ public class SandboxServiceImpl implements SandboxService
*/
public SandboxInfo getSandbox(String sbStoreId)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
@@ -337,7 +348,21 @@ public class SandboxServiceImpl implements SandboxService
}
}
- return sandboxFactory.getSandbox(sbStoreId);
+ SandboxInfo sbInfo = sandboxFactory.getSandbox(sbStoreId);
+
+ if (logger.isTraceEnabled())
+ {
+ if (sbInfo != null)
+ {
+ logger.trace("getSandbox: " + sbInfo.getSandboxId() + " in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
+ }
+ else
+ {
+ logger.trace("getSandbox: " + sbStoreId +" (does not exist) in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
+ }
+ }
+
+ return sbInfo;
}
/* (non-Javadoc)
@@ -377,6 +402,8 @@ public class SandboxServiceImpl implements SandboxService
*/
public void deleteSandbox(String sbStoreId)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
@@ -411,9 +438,9 @@ public class SandboxServiceImpl implements SandboxService
}
}
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Deleted sandbox: " + sbStoreId + " (web project id: " + wpStoreId + ")");
+ logger.debug("deleteSandbox: " + sbStoreId + " in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
}
}
@@ -506,11 +533,11 @@ public class SandboxServiceImpl implements SandboxService
}
}
- if (logger.isTraceEnabled())
+ if (logger.isDebugEnabled())
{
- logger.trace("listChanged: "+assets.size()+" assets in "+(System.currentTimeMillis()-start)+" ms (between "+srcVersion+","+srcPath+" and "+dstVersion+","+dstPath);
+ logger.debug("listChanged: "+assets.size()+" assets in "+(System.currentTimeMillis()-start)+" ms (between "+srcVersion+","+srcPath+" and "+dstVersion+","+dstPath);
}
-
+
return assets;
}
@@ -623,6 +650,8 @@ public class SandboxServiceImpl implements SandboxService
final String submitLabel, final String submitComment,
final Map expirationDates, final Date launchDate, final boolean autoDeploy)
{
+ long start = System.currentTimeMillis();
+
// checks sandbox access (TODO review)
getSandbox(sbStoreId); // ignore result
@@ -632,10 +661,13 @@ public class SandboxServiceImpl implements SandboxService
final String finalWorkflowName;
final Map finalWorkflowParams;
+ boolean isSubmitDirectWorkflowSandbox = false;
+
if ((workflowName == null) || (workflowName.equals("")))
{
finalWorkflowName = WORKFLOW_SUBMITDIRECT;
finalWorkflowParams = new HashMap();
+ isSubmitDirectWorkflowSandbox = true;
}
else
{
@@ -673,7 +705,11 @@ public class SandboxServiceImpl implements SandboxService
// inform the virtualisation server if the workflow sandbox was created
if (virtUpdatePath != null)
{
- WCMUtil.updateVServerWebapp(virtServerRegistry, virtUpdatePath, true);
+ // optimization: direct submits no longer virtualize the workflow sandbox
+ if (! isSubmitDirectWorkflowSandbox)
+ {
+ WCMUtil.updateVServerWebapp(virtServerRegistry, virtUpdatePath, true);
+ }
}
try
@@ -697,6 +733,11 @@ public class SandboxServiceImpl implements SandboxService
throw new AlfrescoRuntimeException("Failed to submit to workflow", err);
}
}
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("submitViaWorkflow: " + sbStoreId + " ["+submitLabel+", "+finalWorkflowName+"] in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
+ }
}
/**
@@ -789,7 +830,7 @@ public class SandboxServiceImpl implements SandboxService
return new Pair(sandboxInfo, virtUpdatePath);
}
-
+
/**
* Starts the configured workflow to allow the submitted items to be link
* checked and reviewed.
@@ -854,7 +895,7 @@ public class SandboxServiceImpl implements SandboxService
public String execute() throws Throwable
{
// delete AVM stores in the workflow sandbox
- sandboxFactory.deleteSandbox(sandboxInfo, true);
+ sandboxFactory.deleteSandbox(sandboxInfo.getSandboxId());
return null;
}
};
@@ -934,6 +975,8 @@ public class SandboxServiceImpl implements SandboxService
*/
public void revertListAssets(String sbStoreId, List assets)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
// checks sandbox access (TODO review)
@@ -980,9 +1023,9 @@ public class SandboxServiceImpl implements SandboxService
if (parent.isLayeredDirectory())
{
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("reverting " + parentChild[1] + " in " + parentChild[0]);
+ logger.trace("reverting " + parentChild[1] + " in " + parentChild[0]);
}
avmService.makeTransparent(parentChild[0], parentChild[1]);
@@ -993,9 +1036,9 @@ public class SandboxServiceImpl implements SandboxService
// is file or deleted file
String relativePath = asset.getPath();
- if (logger.isDebugEnabled())
+ if (logger.isTraceEnabled())
{
- logger.debug("unlocking file " + relativePath + " in web project " + wpStoreId);
+ logger.trace("unlocking file " + relativePath + " in web project " + wpStoreId);
}
if (avmLockingService.getLockOwner(wpStoreId, relativePath) != null)
@@ -1011,6 +1054,11 @@ public class SandboxServiceImpl implements SandboxService
}
}
}
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("revertListAssets: " + sbStoreId + " ["+assets.size()+", "+assetsToRevert.size()+"] in "+(System.currentTimeMillis()-start)+" ms (web project id: " + wpStoreId + ")");
+ }
}
/* (non-Javadoc)
@@ -1026,8 +1074,7 @@ public class SandboxServiceImpl implements SandboxService
throw new AccessDeniedException("Only content managers may list snapshots '"+sbStoreId+"' (web project id: "+wpStoreId+")");
}
- List allVersions = avmService.getStoreVersions(sbStoreId);
- return listSnapshots(allVersions, includeSystemGenerated);
+ return listSnapshots(sbStoreId, null, null, includeSystemGenerated);
}
/* (non-Javadoc)
@@ -1043,18 +1090,30 @@ public class SandboxServiceImpl implements SandboxService
throw new AccessDeniedException("Only content managers may list snapshots '"+sbStoreId+"' (web project id: "+wpStoreId+")");
}
- List versionsToFilter = avmService.getStoreVersions(sbStoreId, from, to);
- return listSnapshots(versionsToFilter, includeSystemGenerated);
+ return listSnapshotsImpl(sbStoreId, from, to, includeSystemGenerated);
}
- private List listSnapshots(List versionsToFilter, boolean includeSystemGenerated)
+ private List listSnapshotsImpl(String sbStoreId, Date from, Date to, boolean includeSystemGenerated)
{
+ long start = System.currentTimeMillis();
+
+ List versionsToFilter = null;
+
+ if ((from != null) && (to != null))
+ {
+ versionsToFilter = avmService.getStoreVersions(sbStoreId, from, to);
+ }
+ else
+ {
+ versionsToFilter = avmService.getStoreVersions(sbStoreId);
+ }
+
List versions = new ArrayList(versionsToFilter.size());
for (int i = versionsToFilter.size() - 1; i >= 0; i--) // reverse order
{
VersionDescriptor item = versionsToFilter.get(i);
-
+
// only display snapshots with a valid tag - others are system generated snapshots
if ((includeSystemGenerated == true) || ((item.getTag() != null) && (item.getVersionID() != 0)))
{
@@ -1062,6 +1121,11 @@ public class SandboxServiceImpl implements SandboxService
}
}
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("listSnapshotsImpl: " + sbStoreId + " ["+from+", "+to+", "+versions.size()+"] in "+(System.currentTimeMillis()-start)+" ms (web project id: "+WCMUtil.getWebProjectStoreId(sbStoreId)+")");
+ }
+
return versions;
}
@@ -1070,6 +1134,8 @@ public class SandboxServiceImpl implements SandboxService
*/
public void revertSnapshot(final String sbStoreId, final int revertVersion)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
@@ -1104,6 +1170,11 @@ public class SandboxServiceImpl implements SandboxService
break;
}
}
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug("revertSnapshot: " + sbStoreId + " ["+revertVersion+"] in "+(System.currentTimeMillis()-start)+" ms (web project id: "+WCMUtil.getWebProjectStoreId(sbStoreId)+")");
+ }
}
/**
@@ -1126,14 +1197,14 @@ public class SandboxServiceImpl implements SandboxService
{
avmService.addAspect(srcPath, WCMAppModel.ASPECT_EXPIRES);
}
-
+
// set the expiration date
avmService.setNodeProperty(srcPath, WCMAppModel.PROP_EXPIRATIONDATE,
new PropertyValue(DataTypeDefinition.DATETIME, expirationDate));
-
- if (logger.isDebugEnabled())
+
+ if (logger.isTraceEnabled())
{
- logger.debug("Set expiration date of " + expirationDate + " for " + srcPath);
+ logger.trace("Set expiration date of " + expirationDate + " for " + srcPath);
}
}
diff --git a/source/java/org/alfresco/wcm/util/WCMUtil.java b/source/java/org/alfresco/wcm/util/WCMUtil.java
index 13708da530..79a6cdfa99 100644
--- a/source/java/org/alfresco/wcm/util/WCMUtil.java
+++ b/source/java/org/alfresco/wcm/util/WCMUtil.java
@@ -40,11 +40,11 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.FileNameValidator;
-import org.springframework.extensions.surf.util.ParameterCheck;
import org.alfresco.util.VirtServerUtils;
import org.alfresco.wcm.sandbox.SandboxConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.springframework.extensions.surf.util.ParameterCheck;
/**
* Helper methods and constants related to WCM directories, paths and store name manipulation.
@@ -698,7 +698,7 @@ public class WCMUtil extends AVMUtil
protected static Map listWebUsers(NodeService nodeService, NodeRef wpNodeRef)
{
- List userInfoRefs = nodeService.getChildAssocs(wpNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
+ List userInfoRefs = listWebUserRefs(nodeService, wpNodeRef, true);
Map webUsers = new HashMap(23);
@@ -710,10 +710,15 @@ public class WCMUtil extends AVMUtil
webUsers.put(userName, userRole);
}
-
+
return webUsers;
}
+ protected static List listWebUserRefs(NodeService nodeService, NodeRef wpNodeRef, boolean preLoad)
+ {
+ return nodeService.getChildAssocs(wpNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL, preLoad);
+ }
+
/**
* Creates all directories for a path if they do not already exist.
*/
@@ -885,4 +890,6 @@ public class WCMUtil extends AVMUtil
private final static Pattern SANDBOX_RELATIVE_PATH_PATTERN =
Pattern.compile("([^:]+:/" + JNDIConstants.DIR_DEFAULT_WWW +
AVM_PATH_SEPARATOR + JNDIConstants.DIR_DEFAULT_APPBASE + ")(.*)");
+
+ public static final String WORKFLOW_SUBMITDIRECT_NAME = "wcmwf:submitdirect";
}
diff --git a/source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java b/source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java
index 061b6c866e..ea5173ffa6 100644
--- a/source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java
+++ b/source/java/org/alfresco/wcm/webproject/WebProjectServiceImpl.java
@@ -185,6 +185,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
public WebProjectInfo createWebProject(WebProjectInfo wpInfo)
{
+ long start = System.currentTimeMillis();
+
String wpStoreId = wpInfo.getStoreId();
String name = wpInfo.getName();
String title = wpInfo.getTitle();
@@ -290,9 +292,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
CreateWebProjectTransactionListener tl = new CreateWebProjectTransactionListener(wpStoreId);
AlfrescoTransactionSupport.bindListener(tl);
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Created web project: " + wpNodeRef + " (store id: " + wpStoreId + ")");
+ logger.debug("Created web project: " + wpNodeRef + " in "+(System.currentTimeMillis()-start)+" ms (store id: " + wpStoreId + ")");
}
// Return created web project info
@@ -312,6 +314,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void createWebApp(NodeRef wpNodeRef, final String webAppName, final String webAppDescription)
{
+ long start = System.currentTimeMillis();
+
WebProjectInfo wpInfo = getWebProject(wpNodeRef);
if (isContentManager(wpNodeRef))
@@ -345,9 +349,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
}
}, AuthenticationUtil.getSystemUserName());
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Created web app: "+webAppName+" (store id: "+wpInfo.getStoreId()+")");
+ logger.debug("Created web app: "+webAppName+" in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpInfo.getStoreId()+")");
}
}
else
@@ -392,6 +396,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void deleteWebApp(NodeRef wpNodeRef, final String webAppName)
{
+ long start = System.currentTimeMillis();
+
ParameterCheck.mandatoryString("webAppName", webAppName);
WebProjectInfo wpInfo = getWebProject(wpNodeRef);
@@ -422,9 +428,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
}
}, AuthenticationUtil.getSystemUserName());
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Deleted web app: "+webAppName+" (store id: "+wpStoreId+")");
+ logger.debug("Deleted web app: "+webAppName+" in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpStoreId+")");
}
}
else
@@ -623,6 +629,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void updateWebProject(WebProjectInfo wpInfo)
{
+ long start = System.currentTimeMillis();
+
NodeRef wpNodeRef = getWebProjectNodeFromStore(wpInfo.getStoreId());
if (wpNodeRef == null)
{
@@ -667,7 +675,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
if (logger.isDebugEnabled())
{
- logger.debug("Updated web project: " + wpNodeRef + " (store id: " + wpInfo.getStoreId() + ")");
+ logger.debug("Updated web project: " + wpNodeRef + " in "+(System.currentTimeMillis()-start)+" ms (store id: " + wpInfo.getStoreId() + ")");
}
}
@@ -693,6 +701,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void deleteWebProject(final NodeRef wpNodeRef)
{
+ long start = System.currentTimeMillis();
+
if (! isContentManager(wpNodeRef))
{
// the current user is not a content manager since the web project does not exist (or is not visible)
@@ -701,7 +711,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
// delete all attached website sandboxes in reverse order to the layering
final String wpStoreId = (String)nodeService.getProperty(wpNodeRef, WCMAppModel.PROP_AVMSTORE);
-
+
if (wpStoreId != null)
{
// Notify virtualization server about removing this website
@@ -754,7 +764,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
}
// delete sandbox (and associated preview sandbox, if it exists)
- sandboxFactory.deleteSandbox(sbInfo, false);
+ sandboxFactory.deleteSandbox(sbInfo, false, false);
}
// delete all web project locks in one go (ie. all those currently held against staging store)
@@ -778,9 +788,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
transactionService.getRetryingTransactionHelper().doInTransaction(deleteWebProjectWork);
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Deleted web project: " + wpNodeRef + " (store id: " + wpStoreId + ")");
+ logger.debug("Deleted web project: " + wpNodeRef + " in "+(System.currentTimeMillis()-start)+" ms (store id: " + wpStoreId + ")");
}
}
catch (Throwable err)
@@ -867,7 +877,16 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public int getWebUserCount(NodeRef wpNodeRef)
{
- return WCMUtil.listWebUsers(nodeService, wpNodeRef).size();
+ long start = System.currentTimeMillis();
+
+ int cnt = WCMUtil.listWebUserRefs(nodeService, wpNodeRef, false).size();
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("Get web user cnt: " + wpNodeRef + "(" + cnt + ") in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return cnt;
}
/* (non-Javadoc)
@@ -883,19 +902,28 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public Map listWebUsers(NodeRef wpNodeRef)
{
+ long start = System.currentTimeMillis();
+
// special case: allow System - eg. to allow user to create their own sandbox on-demand (createAuthorSandbox)
if (isContentManager(wpNodeRef)
|| (AuthenticationUtil.getRunAsUser().equals(AuthenticationUtil.getSystemUserName())
|| (permissionService.hasPermission(wpNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED)))
{
- return WCMUtil.listWebUsers(nodeService, wpNodeRef);
+ Map users = WCMUtil.listWebUsers(nodeService, wpNodeRef);
+
+ if (logger.isTraceEnabled())
+ {
+ logger.trace("List web users: " + wpNodeRef + "(" + users.size() + ") in "+(System.currentTimeMillis()-start)+" ms");
+ }
+
+ return users;
}
else
{
throw new AccessDeniedException("Only content managers may list users in a web project");
}
}
-
+
/* (non-Javadoc)
* @see org.alfresco.wcm.webproject.WebProjectService#getWebUserRole(java.lang.String, java.lang.String)
*/
@@ -1039,6 +1067,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
public void inviteWebUsersGroups(NodeRef wpNodeRef, Map userGroupRoles, boolean autoCreateAuthorSandbox)
{
+ long start = System.currentTimeMillis();
+
if (! (isContentManager(wpNodeRef) ||
permissionService.hasPermission(wpNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED))
{
@@ -1191,7 +1221,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
}
}
}
-
+
// TODO - split out into separate 'change role'
// update user's roles
if (usersToUpdate.size() != 0)
@@ -1199,9 +1229,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
sandboxFactory.updateSandboxRoles(wpStoreId, usersToUpdate, perms);
}
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Invited "+invitedCount+" web users (store id: "+wpStoreId+")");
+ logger.debug("Invited "+invitedCount+" web users in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpStoreId+")");
}
}
@@ -1226,6 +1256,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void inviteWebUser(NodeRef wpNodeRef, String userAuth, String role, boolean autoCreateAuthorSandbox)
{
+ long start = System.currentTimeMillis();
+
if (! (isContentManager(wpNodeRef) ||
permissionService.hasPermission(wpNodeRef, PermissionService.ADD_CHILDREN) == AccessStatus.ALLOWED))
{
@@ -1234,7 +1266,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
WebProjectInfo wpInfo = getWebProject(wpNodeRef);
final String wpStoreId = wpInfo.getStoreId();
-
+
// build a list of managers who will have full permissions on ALL staging areas
List managers = new ArrayList(4);
@@ -1286,9 +1318,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
sandboxFactory.updateSandboxRoles(wpStoreId, usersToUpdate, perms);
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Web user "+userAuth +"'s role has been changed from '" + oldUserRole + "' to '" + role + "' (store id: "+wpStoreId+")");
+ logger.debug("Web user "+userAuth +"'s role has been changed from '" + oldUserRole + "' to '" + role + "' in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpStoreId+")");
}
}
}
@@ -1333,9 +1365,9 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
}
}
- if (logger.isInfoEnabled())
+ if (logger.isDebugEnabled())
{
- logger.info("Invited web user: "+userAuth+" (store id: "+wpStoreId+")");
+ logger.debug("Invited web user: "+userAuth+" in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpStoreId+")");
}
}
}
@@ -1374,6 +1406,8 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
*/
public void uninviteWebUser(NodeRef wpNodeRef, String userAuth, boolean autoDeleteAuthorSandbox)
{
+ long start = System.currentTimeMillis();
+
if (! isContentManager(wpNodeRef))
{
throw new AccessDeniedException("Only content managers may uninvite web user '"+userAuth+"' from web project: "+wpNodeRef);
@@ -1385,7 +1419,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
WebProjectInfo wpInfo = getWebProject(wpNodeRef);
String wpStoreId = wpInfo.getStoreId();
String userMainStore = WCMUtil.buildUserMainStoreName(wpStoreId, userAuth);
-
+
if (autoDeleteAuthorSandbox)
{
sandboxFactory.deleteSandbox(userMainStore);
@@ -1420,12 +1454,12 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
// remove permission for the user (also fixes ETWOONE-338)
permissionService.clearPermission(wpNodeRef, userAuth);
-
- if (logger.isInfoEnabled())
+
+ if (logger.isDebugEnabled())
{
- logger.info("Uninvited web user: "+userAuth+" (store id: "+wpStoreId+")");
+ logger.debug("Uninvited web user: "+userAuth+" in "+(System.currentTimeMillis()-start)+" ms (store id: "+wpStoreId+")");
}
-
+
break; // for loop
}
}