From 9ad1644441a1e7d7b71af2f2c2e384d033e90d43 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Wed, 11 Mar 2009 01:17:39 +0000 Subject: [PATCH] Merged V3.1 to HEAD 12982: Merged V3.0 to V3.1 12921: Merged V2.2 to V3.0 12524: Fix ETWOTWO-974: Submit Action Queue (...) 12687: Add missing workflow to bootstrap (follow on from 12524) ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V3.0:r12921 Merged /alfresco/BRANCHES/V2.2:r12524,12687 Merged /alfresco/BRANCHES/V3.1:r12982 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13545 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/bootstrap-context.xml | 25 +++-- .../messages/patch-service.properties | 1 + .../alfresco/patch/patch-services-context.xml | 38 ++++++++ config/alfresco/version.properties | 2 +- .../workflow/submit_processdefinition.xml | 35 +++++-- .../submitdirect_processdefinition.xml | 61 ++++++++++++ .../workflow/wcm-workflow-messages.properties | 7 ++ config/alfresco/workflow/wcmWorkflowModel.xml | 49 +++++++--- .../alfresco/wcm/sandbox/SandboxFactory.java | 92 ++++++++++++++++++- 9 files changed, 276 insertions(+), 34 deletions(-) create mode 100644 config/alfresco/workflow/submitdirect_processdefinition.xml diff --git a/config/alfresco/bootstrap-context.xml b/config/alfresco/bootstrap-context.xml index 9634135dfe..4ec4ac66e1 100644 --- a/config/alfresco/bootstrap-context.xml +++ b/config/alfresco/bootstrap-context.xml @@ -364,20 +364,27 @@ text/xml false - - + + jbpm alfresco/workflow/submit_processdefinition.xml text/xml false - - - jbpm - alfresco/workflow/changerequest_processdefinition.xml - text/xml - false - + + + jbpm + alfresco/workflow/changerequest_processdefinition.xml + text/xml + false + + + + jbpm + alfresco/workflow/submitdirect_processdefinition.xml + text/xml + false + diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index f8142b6af8..988869c051 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -166,6 +166,7 @@ patch.groupMembersAsIdentifiers.description=Reindex usr:authorityContainer membe patch.genericWorkflow.result.deployed=Re-deployed {0} workflows. patch.redeploySubmitProcess.description=Re-deploy WCM Submit Process Definition. +patch.deploySubmitDirectProcess.description=Deploy WCM Direct Submit Process Definition. patch.AVMLocking.description=Adds existing web projects to locking service. patch.AVMLocking.result=Necessary web projects added. diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index faad459f4d..2764dab19e 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -1559,5 +1559,43 @@ + + + + patch.redeploySubmitProcess5 + patch.redeploySubmitProcess.description + 0 + 2000 + 2001 + + + + + jbpm + alfresco/workflow/submit_processdefinition.xml + text/xml + + + + + + + patch.deploySubmitDirectProcess + patch.deploySubmitDirectProcess.description + 0 + 2000 + 2001 + + + + + jbpm + alfresco/workflow/submitdirect_processdefinition.xml + text/xml + + + + + diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index bfd23804e7..87fd99dcb6 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -19,4 +19,4 @@ version.build=@build-number@ # Schema number -version.schema=2000 \ No newline at end of file +version.schema=2001 diff --git a/config/alfresco/workflow/submit_processdefinition.xml b/config/alfresco/workflow/submit_processdefinition.xml index a670177b85..4101146143 100644 --- a/config/alfresco/workflow/submit_processdefinition.xml +++ b/config/alfresco/workflow/submit_processdefinition.xml @@ -214,15 +214,38 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/alfresco/workflow/submitdirect_processdefinition.xml b/config/alfresco/workflow/submitdirect_processdefinition.xml new file mode 100644 index 0000000000..ccb6b14e20 --- /dev/null +++ b/config/alfresco/workflow/submitdirect_processdefinition.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/alfresco/workflow/wcm-workflow-messages.properties b/config/alfresco/workflow/wcm-workflow-messages.properties index 03ebbbe4f0..75123525c8 100644 --- a/config/alfresco/workflow/wcm-workflow-messages.properties +++ b/config/alfresco/workflow/wcm-workflow-messages.properties @@ -27,11 +27,16 @@ wcmwf_submit.node.submitpending.transition.cancel.description=Abort Submission wcmwf_submit.node.submitpending.transition.launch.title=Submit Now wcmwf_submit.node.submitpending.transition.launch.description=Submit Now +wcmwf_submitdirect.workflow.title=Web Site Submission (Direct) +wcmwf_submitdirect.workflow.description=Submit changes direct to staging sandbox + # Submit Task Definitions wcmwf_workflowmodel.type.wcmwf_submitReviewTask.title=Web Site Submission wcmwf_workflowmodel.type.wcmwf_submitReviewTask.description=Submit changes for approval +wcmwf_workflowmodel.type.wcmwf_submitDirectTask.title=Web Site Submission (Direct) +wcmwf_workflowmodel.type.wcmwf_submitDirectTask.description=Submit changes direct to staging sandbox wcmwf_workflowmodel.type.wcmwf_verifyBrokenLinksTask.title=Verify Broken Links wcmwf_workflowmodel.type.wcmwf_verifyBrokenLinksTask.description=Verify links that do not point to a live resource wcmwf_workflowmodel.type.wcmwf_reviewTask.title=Review @@ -44,6 +49,8 @@ wcmwf_workflowmodel.type.wcmwf_approvedTask.title=Approved wcmwf_workflowmodel.type.wcmwf_approvedTask.description=Approved wcmwf_workflowmodel.type.wcmwf_submittedTask.title=Submitted wcmwf_workflowmodel.type.wcmwf_submittedTask.description=Submitted +wcmwf_workflowmodel.type.wcmwf_submittedDirectTask.title=Submitted +wcmwf_workflowmodel.type.wcmwf_submittedDirectTask.description=Submitted wcmwf_workflowmodel.type.wcmwf_submitpendingTask.title=Submission Pending wcmwf_workflowmodel.type.wcmwf_submitpendingTask.description=Submission Pending wcmwf_workflowmodel.type.wcmwf_submitcancelledTask.title=Submission Aborted diff --git a/config/alfresco/workflow/wcmWorkflowModel.xml b/config/alfresco/workflow/wcmWorkflowModel.xml index 402b293116..5a0c7611d6 100644 --- a/config/alfresco/workflow/wcmWorkflowModel.xml +++ b/config/alfresco/workflow/wcmWorkflowModel.xml @@ -66,21 +66,17 @@ - - - - false - false - - - wca:webfolder - true - false - - - bpm:assignees + wcmwf:webproject + wcmwf:submission + + + + + wcmwf:startTask + + wcmwf:webproject wcmwf:submission @@ -169,8 +165,15 @@ - - + + wcmwf:workflowTask + + wcmwf:submission + + + + + wcmwf:workflowTask bpm:assignees @@ -221,6 +224,22 @@ + + + + + false + false + + + wca:webfolder + true + false + + + + + diff --git a/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java b/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java index 127f460a36..baf3fc1982 100644 --- a/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java +++ b/source/java/org/alfresco/wcm/sandbox/SandboxFactory.java @@ -228,6 +228,11 @@ public final class SandboxFactory extends WCMUtil * @return SandboxInfo returns sandbox info or null if sandbox does not exist or is not visible */ /* package */ SandboxInfo getSandbox(String sandboxId) + { + return getSandbox(sandboxId, true); + } + + /* package */ SandboxInfo getSandbox(final String sandboxId, boolean withPreview) { AVMStoreDescriptor storeDesc = avmService.getStore(sandboxId); if (storeDesc == null) @@ -246,11 +251,17 @@ public final class SandboxFactory extends WCMUtil // derive name for now String name = null; + String previewSandboxId = null; + if (withPreview && (! WCMUtil.isPreviewStore(sandboxId))) + { + previewSandboxId = WCMUtil.getCorrespondingPreviewStoreName(sandboxId); + } + if (props.containsKey(SandboxConstants.PROP_SANDBOX_STAGING_MAIN)) { sandboxType = SandboxConstants.PROP_SANDBOX_STAGING_MAIN; name = sandboxId; - storeNames = new String[] {sandboxId, WCMUtil.getCorrespondingPreviewStoreName(sandboxId)}; + storeNames = new String[] {sandboxId, previewSandboxId}; } else if ( props.containsKey( SandboxConstants.PROP_SANDBOX_STAGING_PREVIEW)) { @@ -261,7 +272,7 @@ public final class SandboxFactory extends WCMUtil { sandboxType = SandboxConstants.PROP_SANDBOX_AUTHOR_MAIN; name = WCMUtil.getUserName(sandboxId); - storeNames = new String[] {sandboxId, WCMUtil.getCorrespondingPreviewStoreName(sandboxId)}; + storeNames = new String[] {sandboxId, previewSandboxId}; } else if (props.containsKey(SandboxConstants.PROP_SANDBOX_AUTHOR_PREVIEW)) { @@ -273,7 +284,7 @@ public final class SandboxFactory extends WCMUtil { sandboxType = SandboxConstants.PROP_SANDBOX_WORKFLOW_MAIN; name = WCMUtil.getWorkflowId(sandboxId); - storeNames = new String[] {sandboxId, WCMUtil.getCorrespondingPreviewStoreName(sandboxId)}; + storeNames = new String[] {sandboxId, previewSandboxId}; } else if (props.containsKey(SandboxConstants.PROP_SANDBOX_WORKFLOW_PREVIEW)) { @@ -632,6 +643,81 @@ public final class SandboxFactory extends WCMUtil return getSandbox(mainStoreName); } + /** + * Create a read-only workflow sandbox for the named store. + * + * Note: read-only means it's only safe to use in a workflow where the sandbox + * is not expected to be updated. The sandbox does not protected itself + * from writes. + * + * Note: this sandbox does not support the preview layer + * Note: a snapshot within this sandbox is NOT taken + * + * Various store meta-data properties are set including: + * Identifier for store-types: .sandbox.workflow.main and .sandbox.workflow.preview + * Store-id: .sandbox-id. (unique across all stores in the sandbox) + * DNS: .dns. = + * Website Name: .website.name = website name + * + * @param storeId The id of the store to create a sandbox for + * @return Information about the sandbox + */ + public SandboxInfo createReadOnlyWorkflowSandbox(final String storeId) + { + final String stagingStoreName = WCMUtil.buildStagingStoreName(storeId); + + // create the workflow 'main' store + final String packageName = WCMUtil.STORE_WORKFLOW + "-" + GUID.generate(); + final String mainStoreName = + WCMUtil.buildWorkflowMainStoreName(storeId, packageName); + + avmService.createStore(mainStoreName); + if (logger.isDebugEnabled()) + logger.debug("Created read-only workflow sandbox store: " + mainStoreName); + + // create a layered directory pointing to 'www' in the staging area + avmService.createLayeredDirectory(WCMUtil.buildStoreRootPath(stagingStoreName), + mainStoreName + ":/", + JNDIConstants.DIR_DEFAULT_WWW); + + // tag the store with the store type + avmService.setStoreProperty(mainStoreName, + SandboxConstants.PROP_SANDBOX_WORKFLOW_MAIN, + new PropertyValue(DataTypeDefinition.TEXT, null)); + + // tag the store with the base name of the website so that corresponding + // staging areas can be found. + avmService.setStoreProperty(mainStoreName, + SandboxConstants.PROP_WEBSITE_NAME, + new PropertyValue(DataTypeDefinition.TEXT, storeId)); + + // tag the store, oddly enough, with its own store name for querying. + avmService.setStoreProperty(mainStoreName, + QName.createQName(null, SandboxConstants.PROP_SANDBOX_STORE_PREFIX + mainStoreName), + new PropertyValue(DataTypeDefinition.TEXT, null)); + + // tag the store with the DNS name property + tagStoreDNSPath(avmService, mainStoreName, storeId, packageName); + + + // The main workflow store depends on the main staging store (dist=1) + tagStoreBackgroundLayer(avmService,mainStoreName, stagingStoreName ,1); + + // tag all related stores to indicate that they are part of a single sandbox + final QName sandboxIdProp = QName.createQName(SandboxConstants.PROP_SANDBOXID + GUID.generate()); + avmService.setStoreProperty(mainStoreName, + sandboxIdProp, + new PropertyValue(DataTypeDefinition.TEXT, null)); + + if (logger.isDebugEnabled()) + { + dumpStoreProperties(avmService, mainStoreName); + } + + return getSandbox(mainStoreName, false); // no preview store + } + + /** * Creates a workflow sandbox for the given user store. This will create a * workflow sandbox layered over the user's main store.