putting jon's change from last night back in and fixing mostly everything (i know of) that it broke

- added utility methods to AVMConstants to extract information about stores from their names.  this has to be reimplemented to look at store properties rather than inferring things from their names - but it works for now.  this also centralizes all the usage of the store name to infer data about it so it'll make it easier later.
- made the problematic constants jon changed private to avoid having this problem happen again
- checked pretty much every usage of buildAVM<bla> to ensure that nothing else was broken.  in the process removed the AVM part from the buildAVM<bla> part of the method to shorten it and since it's redundant with the classname AVMConstants in which their contained.

creating workflow sandboxes in a manner consistent with user sandboxes
- added a method to SandboxFactory to create workflow sandboxes. they're created with the name <storeId>--workflow-<guid>
- centralized workflow package creation code in AVMWorkflowUtil.
- refactored sandbox creation code to use new utility methods in AVMConstants and so that at some point it can be further refactored.
 
getting avm actions to show up in manage task screen for avm workflows
- modified the model to use different packageItemActionGroups for wcm workflows
- modified the AVMWorkflowEvaluator to allow all actions for items in a workflow package
- added some debug output to various classes
- made wcm navigation ids exposed throughout the app since they are now called from workflow jsps.

things that now work that didn't before:
- virtualization now works again with jon's new naming scheme
- some actions from the manage task screen.

known bugs introduced or remaining as a consequence of this change (i'll filed jira issues for these as soon as i commit this):
- i'm inaccurately counting the number of users in a sandbox since it's harder now to differentiate between user main sandboxes and all the other ones that are being created
- preview does not work on assets within the workflow sandboxes
- review and approve workflow does not appear to actually submit once approved.  not sure if it did before
- lots of actions still do not work from manage tasks, though edit does appear to.
- i commented out the location column in the manage task screen since the path link was causing me troubles - need to put that back in.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4692 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-12-23 01:44:19 +00:00
parent 86f31616ba
commit 15733b9771
32 changed files with 811 additions and 494 deletions

View File

@@ -185,9 +185,9 @@ public class CreateWebContentWizard extends BaseContentWizard
}
// reset the preview layer
String path = this.avmBrowseBean.getCurrentPath();
path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW);
path = path.split(":")[0] + ":/" + AVMConstants.DIR_APPBASE;
String storeName = AVMConstants.getStoreName(this.avmBrowseBean.getCurrentPath());
storeName = AVMConstants.getCorrespondingPreviewStoreName(storeName);
final String path = AVMConstants.buildStoreRootPath(storeName);
if (LOGGER.isDebugEnabled())
LOGGER.debug("reseting layer " + path);
this.avmSyncService.resetLayer(path);
@@ -273,15 +273,13 @@ public class CreateWebContentWizard extends BaseContentWizard
final List<AVMDifference> diffList =
new ArrayList<AVMDifference>(1 + this.renditions.size() + uploadedFiles.length);
diffList.add(new AVMDifference(-1, this.createdPath,
-1, this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN),
-1, AVMConstants.getCorrespondingPathInMainStore(this.createdPath),
AVMDifference.NEWER));
for (Rendition rendition : this.renditions)
{
final String path = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
diffList.add(new AVMDifference(-1, path,
-1, path.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN),
-1, AVMConstants.getCorrespondingPathInMainStore(path),
AVMDifference.NEWER));
}
@@ -289,8 +287,7 @@ public class CreateWebContentWizard extends BaseContentWizard
{
final String path = AVMNodeConverter.ToAVMVersionPath(uploadedFile).getSecond();
diffList.add(new AVMDifference(-1, path,
-1, path.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN),
-1, AVMConstants.getCorrespondingPathInMainStore(path),
AVMDifference.NEWER));
}
@@ -298,14 +295,13 @@ public class CreateWebContentWizard extends BaseContentWizard
{
for (AVMDifference diff : diffList)
{
LOGGER.debug("updating " + AVMConstants.STORE_MAIN + " with " + diff.getSourcePath());
LOGGER.debug("updating main store with " + diff.getSourcePath());
}
}
this.avmSyncService.update(diffList, null, true, true, true, true, null, null);
// reset all paths and structures to the main store
this.createdPath = this.createdPath.replaceFirst(AVMConstants.STORE_PREVIEW,
AVMConstants.STORE_MAIN);
this.createdPath = AVMConstants.getCorrespondingPathInMainStore(this.createdPath);
LOGGER.debug("reset path " + this.createdPath + " to main store");
@@ -379,65 +375,42 @@ public class CreateWebContentWizard extends BaseContentWizard
{
if (LOGGER.isDebugEnabled())
LOGGER.debug("creating workflow package");
// create package paths (layered to user sandbox area as target)
String stagingPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getStagingStore());
String packagesPath = AVMWorkflowUtil.createAVMLayeredPackage(this.avmService, stagingPath);
LOGGER.debug("created layered package " + packagesPath +
" above " + stagingPath);
List<AVMDifference> diffs = new ArrayList<AVMDifference>(8);
final String storeId = this.avmBrowseBean.getStagingStore();
final List<String> srcPaths = new ArrayList<String>();
// construct diffs for selected items for submission
String webapp = this.avmBrowseBean.getWebapp();
String sandboxPath = AVMConstants.buildAVMStoreRootPath(this.avmBrowseBean.getSandbox());
final String sandboxName = this.avmBrowseBean.getSandbox();
if (form)
{
// collect diffs for form data instance and all renditions
for (Rendition rendition : this.getRenditions())
{
String renditionPath = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
int webappIndex = renditionPath.indexOf('/' + webapp);
renditionPath = renditionPath.substring(webappIndex);
String srcPath = sandboxPath + renditionPath;
String destPath = packagesPath + renditionPath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
final String renditionPath = AVMNodeConverter.ToAVMVersionPath(rendition.getNodeRef()).getSecond();
srcPaths.add(AVMConstants.getCorrespondingPath(renditionPath, sandboxName));
}
String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
int webappIndex = instancePath.indexOf('/' + webapp);
instancePath = instancePath.substring(webappIndex);
String srcPath = sandboxPath + instancePath;
String destPath = packagesPath + instancePath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
final String instancePath = AVMNodeConverter.ToAVMVersionPath(this.formInstanceData.getNodeRef()).getSecond();
srcPaths.add(AVMConstants.getCorrespondingPath(instancePath, sandboxName));
}
else
{
// diff for txt or html content
int webappIndex = this.createdPath.indexOf('/' + webapp);
String itemPath = this.createdPath.substring(webappIndex);
String srcPath = sandboxPath + itemPath;
String destPath = packagesPath + itemPath;
AVMDifference diff = new AVMDifference(-1, srcPath, -1, destPath, AVMDifference.NEWER);
diffs.add(diff);
avmSubmittedAspect.markSubmitted(-1, srcPath, path.instance.id);
srcPaths.add(AVMConstants.getCorrespondingPath(this.createdPath, sandboxName));
}
// write changes to layer so files are marked as modified
this.avmSyncService.update(diffs, null, true, true, false, false, null, null);
// convert package to workflow package
AVMNodeDescriptor packageDesc = this.avmService.lookup(-1, packagesPath);
NodeRef packageNodeRef = this.workflowService.createPackage(
AVMNodeConverter.ToNodeRef(-1, packageDesc.getPath()));
this.nodeService.setProperty(packageNodeRef, WorkflowModel.PROP_IS_SYSTEM_PACKAGE, true);
final NodeRef packageNodeRef =
AVMWorkflowUtil.createWorkflowPackage(srcPaths,
storeId,
path,
avmSubmittedAspect,
this.avmSyncService,
this.avmService,
this.workflowService,
this.nodeService);
parameters.put(WorkflowModel.ASSOC_PACKAGE, packageNodeRef);
// TODO: capture label and comment?
parameters.put(AVMWorkflowUtil.PROP_LABEL, form ? this.formInstanceData.getName() : this.fileName);
parameters.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildAVMStoreRootPath(
this.avmBrowseBean.getSandbox()));
parameters.put(AVMWorkflowUtil.PROP_FROM_PATH, AVMConstants.buildStoreRootPath(sandboxName));
// update start task with submit parameters
this.workflowService.updateTask(startTask.id, parameters, null, null);
@@ -488,7 +461,7 @@ public class CreateWebContentWizard extends BaseContentWizard
LOGGER.debug("saving file content to " + fileName);
String path = this.avmBrowseBean.getCurrentPath();
path = path.replaceFirst(AVMConstants.STORE_MAIN, AVMConstants.STORE_PREVIEW);
path = AVMConstants.getCorrespondingPathInPreviewStore(path);
if (MimetypeMap.MIMETYPE_XML.equals(this.mimeType) && this.formName != null)
{
path = this.getForm().getOutputPathForFormInstanceData(this.instanceDataDocument,