mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-23 18:05:32 +00:00
Merged V2.1 to HEAD
6408: removing the avmsubmittedaspect 6409: reintroducing the avmclearsubmittedhandler as a stub in order to keep inflight workflows operating properly. 6412: Fix to a subtle navigation issue when browsing WCM projects. 6415: WCM-678 - Page size WCM browse screens 6417: Fixes WCM-556, WCM-557, WCM-618 & WCM-620 Line endings change -- manual merge Manual 'root\projects\web-client\config\alfresco\messages\webclient.properties' git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6731 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
858faa9f7b
commit
10b7df662f
@ -238,11 +238,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="AVMSubmittedAspect" class="org.alfresco.repo.avm.wf.AVMSubmittedAspect">
|
|
||||||
<property name="avmService">
|
|
||||||
<ref bean="AVMService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Used to notify virtualization server occur after commit/rollback -->
|
<!-- Used to notify virtualization server occur after commit/rollback -->
|
||||||
<bean id="AVMSubmitTransactionListener"
|
<bean id="AVMSubmitTransactionListener"
|
||||||
|
@ -210,9 +210,6 @@
|
|||||||
</task-node>
|
</task-node>
|
||||||
|
|
||||||
<task-node name="submitcancelled">
|
<task-node name="submitcancelled">
|
||||||
<event type="node-enter">
|
|
||||||
<action class="org.alfresco.repo.avm.wf.AVMClearSubmittedHandler"/>
|
|
||||||
</event>
|
|
||||||
<task name="wcmwf:submitcancelledTask" swimlane="initiator" />
|
<task name="wcmwf:submitcancelledTask" swimlane="initiator" />
|
||||||
<transition name="" to="end" />
|
<transition name="" to="end" />
|
||||||
</task-node>
|
</task-node>
|
||||||
@ -225,7 +222,6 @@
|
|||||||
<transition name="" to="end" />
|
<transition name="" to="end" />
|
||||||
</task-node>
|
</task-node>
|
||||||
|
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- End the Process -->
|
<!-- End the Process -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
@ -233,7 +229,6 @@
|
|||||||
<end-state name="end"/>
|
<end-state name="end"/>
|
||||||
|
|
||||||
<event type="process-end">
|
<event type="process-end">
|
||||||
<action class="org.alfresco.repo.avm.wf.AVMClearSubmittedHandler"/>
|
|
||||||
<action class="org.alfresco.repo.avm.wf.AVMRemoveAllWebappsHandler"/>
|
<action class="org.alfresco.repo.avm.wf.AVMRemoveAllWebappsHandler"/>
|
||||||
<action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
|
<action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
|
||||||
</event>
|
</event>
|
||||||
|
@ -158,47 +158,21 @@ public class LinkValidationAction extends ActionExecuterAbstractBase
|
|||||||
// get the broken files created due to deletions and new/modified files
|
// get the broken files created due to deletions and new/modified files
|
||||||
HrefManifest manifest = this.linkValidationService.getBrokenHrefManifest(hdiff);
|
HrefManifest manifest = this.linkValidationService.getBrokenHrefManifest(hdiff);
|
||||||
|
|
||||||
// TODO: use the counts retrieved from the manifest object and pass them
|
|
||||||
// into the constructor, the report object can then store these for
|
|
||||||
// later retrieval.
|
|
||||||
|
|
||||||
// int baseVersion = manifest.getBaseSnapshotVersion();
|
|
||||||
// int latestVersion = manifest.getLatestSnapshotVersion();
|
|
||||||
// int fileCount = manifest.getBaseFileCount();
|
|
||||||
// int linkCount = manifest.getBaseLinkCount();
|
|
||||||
|
|
||||||
HrefManifest bogus = new HrefManifest();
|
|
||||||
|
|
||||||
// TODO: change the constructor to just take one manifest object
|
|
||||||
|
|
||||||
// create the report object using the 2 sets of results
|
// create the report object using the 2 sets of results
|
||||||
report = new LinkValidationReport(storeName, webappName, monitor, manifest, bogus);
|
report = new LinkValidationReport(storeName, webappName, manifest,
|
||||||
|
monitor.getFileUpdateCount(), monitor.getUrlUpdateCount());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// retrieve the manifest of all the broken links and files for the webapp
|
// retrieve the manifest of all the broken links and files for the webapp
|
||||||
HrefManifest manifest = this.linkValidationService.getBrokenHrefManifest(webappPath);
|
HrefManifest manifest = this.linkValidationService.getBrokenHrefManifest(webappPath);
|
||||||
|
|
||||||
List<HrefManifestEntry> manifests =
|
|
||||||
manifest.getManifestEntries();
|
|
||||||
|
|
||||||
// TODO: use the counts retrieved from the manifest object and pass them
|
|
||||||
// into the constructor, the report object can then store these for
|
|
||||||
// later retrieval to show how far 'bejind' the report is.
|
|
||||||
// NOTE: that latestVersion >= baseVersion
|
|
||||||
// Whenever latestVersion > baseVersion,
|
|
||||||
// link validation is "behind".
|
|
||||||
|
|
||||||
// int baseVersion = manifest.getBaseSnapshotVersion();
|
|
||||||
// int latestVersion = manifest.getLatestSnapshotVersion();
|
|
||||||
// int fileCount = manifest.getBaseFileCount();
|
|
||||||
// int linkCount = manifest.getBaseLinkCount();
|
|
||||||
|
|
||||||
// Create the report object using the link check results
|
// Create the report object using the link check results
|
||||||
report = new LinkValidationReport(storeName, webappName, monitor, manifests);
|
report = new LinkValidationReport(storeName, webappName, manifest,
|
||||||
|
manifest.getBaseFileCount(), manifest.getBaseLinkCount());
|
||||||
|
|
||||||
// the monitor object is not used anymore so manually set
|
// the monitor object is not used here so manually set
|
||||||
// the done status so the client ca retrieve the report.
|
// the done status so the client can retrieve the report.
|
||||||
monitor.setDone( true );
|
monitor.setDone( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,8 @@ public class LinkValidationReport implements Serializable
|
|||||||
private int numberFilesChecked = -1;
|
private int numberFilesChecked = -1;
|
||||||
private int numberLinksChecked = -1;
|
private int numberLinksChecked = -1;
|
||||||
private int numberBrokenLinks = -1;
|
private int numberBrokenLinks = -1;
|
||||||
|
private int baseSnapshotVersion = -1;
|
||||||
|
private int latestSnapshotVersion = -1;
|
||||||
private boolean successful = true;
|
private boolean successful = true;
|
||||||
private Date completedAt;
|
private Date completedAt;
|
||||||
|
|
||||||
@ -67,21 +69,24 @@ public class LinkValidationReport implements Serializable
|
|||||||
*
|
*
|
||||||
* @param store The store the link check was run against
|
* @param store The store the link check was run against
|
||||||
* @param webapp The webapp within the store the check was run against
|
* @param webapp The webapp within the store the check was run against
|
||||||
* @param status The object containing status i.e. file, link counts and the list
|
* @param manifest The manifest of broken links and snapshot info
|
||||||
* of files containing broken links
|
* @param noFilesChecked The number of files checked
|
||||||
* @param manifests The manifest of broken links and files
|
* @param noLinksChecked The number of links checked
|
||||||
*/
|
*/
|
||||||
public LinkValidationReport(String store, String webapp, HrefValidationProgress status,
|
public LinkValidationReport(String store, String webapp, HrefManifest manifest,
|
||||||
List<HrefManifestEntry> manifests)
|
int noFilesChecked, int noLinksChecked)
|
||||||
{
|
{
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.webapp = webapp;
|
this.webapp = webapp;
|
||||||
this.completedAt = new Date();
|
this.completedAt = new Date();
|
||||||
this.numberFilesChecked = status.getFileUpdateCount();
|
|
||||||
this.numberLinksChecked = status.getUrlUpdateCount();
|
|
||||||
this.numberBrokenLinks = 0;
|
this.numberBrokenLinks = 0;
|
||||||
|
this.numberFilesChecked = noFilesChecked;
|
||||||
|
this.numberLinksChecked = noLinksChecked;
|
||||||
|
this.baseSnapshotVersion = manifest.getBaseSnapshotVersion();
|
||||||
|
this.latestSnapshotVersion = manifest.getLatestSnapshotVersion();
|
||||||
|
|
||||||
// create list and map
|
// create list and map
|
||||||
|
List<HrefManifestEntry> manifests = manifest.getManifestEntries();
|
||||||
this.brokenFiles = new ArrayList<String>(manifests.size());
|
this.brokenFiles = new ArrayList<String>(manifests.size());
|
||||||
this.brokenLinksByFile = new HashMap<String, HrefManifestEntry>(manifests.size());
|
this.brokenLinksByFile = new HashMap<String, HrefManifestEntry>(manifests.size());
|
||||||
|
|
||||||
@ -89,43 +94,6 @@ public class LinkValidationReport implements Serializable
|
|||||||
storeBrokenFiles(manifests);
|
storeBrokenFiles(manifests);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a link validation report from the results of a comparison check
|
|
||||||
* between the staging area and another sandbox i.e. an authors sandbox or a
|
|
||||||
* workflow sandbox.
|
|
||||||
*
|
|
||||||
* @param store The store the link check was run against
|
|
||||||
* @param webapp The webapp within the store the check was run against
|
|
||||||
* @param status The object containing status i.e. file, link counts and the list
|
|
||||||
* of files containing broken links
|
|
||||||
* @param brokenByDelete Object representing the broken links caused by deleted assets
|
|
||||||
* @param brokenByNewOrMod Object representing the broken links caused by new or
|
|
||||||
* modified assets
|
|
||||||
*/
|
|
||||||
public LinkValidationReport(String store, String webapp, HrefValidationProgress status,
|
|
||||||
HrefManifest brokenByDelete, HrefManifest brokenByNewOrMod)
|
|
||||||
{
|
|
||||||
this.store = store;
|
|
||||||
this.webapp = webapp;
|
|
||||||
this.completedAt = new Date();
|
|
||||||
this.numberFilesChecked = status.getFileUpdateCount();
|
|
||||||
this.numberLinksChecked = status.getUrlUpdateCount();
|
|
||||||
this.numberBrokenLinks = 0;
|
|
||||||
|
|
||||||
// get the lists of broken files
|
|
||||||
List<HrefManifestEntry> byDelete = brokenByDelete.getManifestEntries();
|
|
||||||
List<HrefManifestEntry> byNewOrMod = brokenByNewOrMod.getManifestEntries();
|
|
||||||
|
|
||||||
// create list and map
|
|
||||||
this.brokenFiles = new ArrayList<String>(byDelete.size() + byNewOrMod.size());
|
|
||||||
this.brokenLinksByFile = new HashMap<String, HrefManifestEntry>(
|
|
||||||
byDelete.size() + byNewOrMod.size());
|
|
||||||
|
|
||||||
// build the required list and map
|
|
||||||
storeBrokenFiles(byDelete);
|
|
||||||
storeBrokenFiles(byNewOrMod);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a link validation report from an error that occurred
|
* Constructs a link validation report from an error that occurred
|
||||||
*
|
*
|
||||||
@ -197,6 +165,16 @@ public class LinkValidationReport implements Serializable
|
|||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBaseSnapshotVersion()
|
||||||
|
{
|
||||||
|
return this.baseSnapshotVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLatestSnapshotVersion()
|
||||||
|
{
|
||||||
|
return this.latestSnapshotVersion;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean wasSuccessful()
|
public boolean wasSuccessful()
|
||||||
{
|
{
|
||||||
return this.successful;
|
return this.successful;
|
||||||
@ -219,6 +197,8 @@ public class LinkValidationReport implements Serializable
|
|||||||
StringBuilder buffer = new StringBuilder(super.toString());
|
StringBuilder buffer = new StringBuilder(super.toString());
|
||||||
buffer.append(" (store=").append(this.store);
|
buffer.append(" (store=").append(this.store);
|
||||||
buffer.append(" webapp=").append(this.webapp);
|
buffer.append(" webapp=").append(this.webapp);
|
||||||
|
buffer.append(" baseSnapshot=").append(this.baseSnapshotVersion);
|
||||||
|
buffer.append(" latestSnapshot=").append(this.latestSnapshotVersion);
|
||||||
buffer.append(" error=").append(this.error).append(")");
|
buffer.append(" error=").append(this.error).append(")");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
@ -236,16 +216,12 @@ public class LinkValidationReport implements Serializable
|
|||||||
{
|
{
|
||||||
String fileName = manifest.getFileName();
|
String fileName = manifest.getFileName();
|
||||||
|
|
||||||
// make sure the same file only gets added once
|
|
||||||
if (this.brokenFiles.contains(fileName) == false)
|
|
||||||
{
|
|
||||||
this.brokenFiles.add(fileName);
|
this.brokenFiles.add(fileName);
|
||||||
this.brokenLinksByFile.put(fileName, manifest);
|
this.brokenLinksByFile.put(fileName, manifest);
|
||||||
this.numberBrokenLinks = this.numberBrokenLinks + manifest.getHrefs().size();
|
this.numberBrokenLinks = this.numberBrokenLinks + manifest.getHrefs().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,50 +20,22 @@
|
|||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
* FLOSS exception. You should have recieved a copy of the text describing
|
||||||
* the FLOSS exception, and it is also available here:
|
* the FLOSS exception, and it is also available here:
|
||||||
* http://www.alfresco.com/legal/licensing"
|
* http://www.alfresco.com/legal/licensing
|
||||||
*/
|
*/
|
||||||
package org.alfresco.repo.avm.wf;
|
package org.alfresco.repo.avm.wf;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
|
||||||
import org.alfresco.repo.workflow.jbpm.JBPMNode;
|
|
||||||
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
import org.alfresco.repo.workflow.jbpm.JBPMSpringActionHandler;
|
||||||
import org.alfresco.service.ServiceRegistry;
|
|
||||||
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.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.util.Pair;
|
|
||||||
import org.jbpm.graph.exe.ExecutionContext;
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear "submitted" mark from (source of) items within the WCM Workflow Package
|
* No-op stub for the no longer used AVMSubmittedApsect.
|
||||||
*
|
|
||||||
* @author davidc
|
|
||||||
*/
|
*/
|
||||||
public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
|
public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 4113360751217684995L;
|
private static final long serialVersionUID = 4113360751217684995L;
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVMService instance.
|
|
||||||
*/
|
|
||||||
private AVMService avmService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVMSyncService instance.
|
|
||||||
*/
|
|
||||||
private AVMSyncService avmSyncService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVMSubmittedAspect instance.
|
|
||||||
*/
|
|
||||||
private AVMSubmittedAspect avmSubmittedAspect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize service references.
|
* Initialize service references.
|
||||||
* @param factory The BeanFactory to get references from.
|
* @param factory The BeanFactory to get references from.
|
||||||
@ -71,58 +43,13 @@ public class AVMClearSubmittedHandler extends JBPMSpringActionHandler
|
|||||||
@Override
|
@Override
|
||||||
protected void initialiseHandler(BeanFactory factory)
|
protected void initialiseHandler(BeanFactory factory)
|
||||||
{
|
{
|
||||||
this.avmService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
|
||||||
this.avmSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
|
||||||
this.avmSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do the actual work.
|
* Do the actual work.
|
||||||
* @param executionContext The context to get stuff from.
|
* @param executionContext The context to get stuff from.
|
||||||
*/
|
*/
|
||||||
public void execute(final ExecutionContext executionContext)
|
public void execute(ExecutionContext executionContext) throws Exception
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
// TODO: Allow submit parameters to be passed into this action handler
|
|
||||||
// rather than pulling directly from execution context
|
|
||||||
|
|
||||||
// NOTE: Submitted items can only be marked as "submitted" if we know where they came from
|
|
||||||
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
|
||||||
if (from == null || from.length() == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// retrieve list of changes in submitted package
|
|
||||||
NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
|
||||||
Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
|
||||||
AVMNodeDescriptor pkgDesc = this.avmService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
|
||||||
String targetPath = pkgDesc.getIndirection();
|
|
||||||
final List<AVMDifference> diffs = this.avmSyncService.compare(pkgPath.getFirst(),
|
|
||||||
pkgPath.getSecond(),
|
|
||||||
-1,
|
|
||||||
targetPath,
|
|
||||||
null);
|
|
||||||
|
|
||||||
// for each change, mark original as submitted
|
|
||||||
for (final AVMDifference diff : diffs)
|
|
||||||
{
|
|
||||||
final String submittedPath = from + diff.getSourcePath().substring(pkgPath.getSecond().length());
|
|
||||||
this.clearSubmitted(this.avmService.lookup(-1, submittedPath, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively clear the submitted aspect.
|
|
||||||
*/
|
|
||||||
private void clearSubmitted(final AVMNodeDescriptor d)
|
|
||||||
{
|
|
||||||
this.avmSubmittedAspect.clearSubmitted(d.getVersionID(), d.getPath());
|
|
||||||
if (d.isDirectory())
|
|
||||||
{
|
|
||||||
for (final AVMNodeDescriptor c : this.avmService.getDirectoryListingArray(d, true))
|
|
||||||
{
|
|
||||||
this.clearSubmitted(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ import org.alfresco.service.cmr.avmsync.AVMSyncService;
|
|||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.Pair;
|
import org.alfresco.util.Pair;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.jbpm.graph.exe.ExecutionContext;
|
import org.jbpm.graph.exe.ExecutionContext;
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
|
|
||||||
@ -51,24 +53,15 @@ public class AVMSubmitPackageHandler
|
|||||||
{
|
{
|
||||||
private static final long serialVersionUID = 4113360751217684995L;
|
private static final long serialVersionUID = 4113360751217684995L;
|
||||||
|
|
||||||
/**
|
private static final Log LOGGER = LogFactory.getLog(AVMSubmitPackageHandler.class);
|
||||||
* The AVMService instance.
|
|
||||||
*/
|
/** The AVMService instance. */
|
||||||
private AVMService fAVMService;
|
private AVMService fAVMService;
|
||||||
|
|
||||||
/**
|
/** The AVMSyncService instance. */
|
||||||
* The AVMSyncService instance.
|
|
||||||
*/
|
|
||||||
private AVMSyncService fAVMSyncService;
|
private AVMSyncService fAVMSyncService;
|
||||||
|
|
||||||
/**
|
/** The AVMLockingService instance. */
|
||||||
* The AVMSubmittedAspect instance.
|
|
||||||
*/
|
|
||||||
private AVMSubmittedAspect fAVMSubmittedAspect;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The AVMLockingService instance.
|
|
||||||
*/
|
|
||||||
private AVMLockingService fAVMLockingService;
|
private AVMLockingService fAVMLockingService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,18 +70,16 @@ public class AVMSubmitPackageHandler
|
|||||||
*/
|
*/
|
||||||
private AVMSubmitTransactionListener fAVMSubmitTransactionListener;
|
private AVMSubmitTransactionListener fAVMSubmitTransactionListener;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize service references.
|
* Initialize service references.
|
||||||
* @param factory The BeanFactory to get references from.
|
* @param factory The BeanFactory to get references from.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void initialiseHandler(BeanFactory factory)
|
protected void initialiseHandler(final BeanFactory factory)
|
||||||
{
|
{
|
||||||
fAVMService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
fAVMService = (AVMService)factory.getBean(ServiceRegistry.AVM_SERVICE.getLocalName());
|
||||||
fAVMSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
fAVMSyncService = (AVMSyncService)factory.getBean(ServiceRegistry.AVM_SYNC_SERVICE.getLocalName());
|
||||||
fAVMLockingService = (AVMLockingService)factory.getBean(ServiceRegistry.AVM_LOCKING_SERVICE.getLocalName());
|
fAVMLockingService = (AVMLockingService)factory.getBean(ServiceRegistry.AVM_LOCKING_SERVICE.getLocalName());
|
||||||
fAVMSubmittedAspect = (AVMSubmittedAspect)factory.getBean("AVMSubmittedAspect");
|
|
||||||
fAVMSubmitTransactionListener = (AVMSubmitTransactionListener) factory.getBean("AVMSubmitTransactionListener");
|
fAVMSubmitTransactionListener = (AVMSubmitTransactionListener) factory.getBean("AVMSubmitTransactionListener");
|
||||||
|
|
||||||
AlfrescoTransactionSupport.bindListener(fAVMSubmitTransactionListener);
|
AlfrescoTransactionSupport.bindListener(fAVMSubmitTransactionListener);
|
||||||
@ -103,24 +94,30 @@ public class AVMSubmitPackageHandler
|
|||||||
{
|
{
|
||||||
// TODO: Allow submit parameters to be passed into this action handler
|
// TODO: Allow submit parameters to be passed into this action handler
|
||||||
// rather than pulling directly from execution context
|
// rather than pulling directly from execution context
|
||||||
|
|
||||||
final NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
final NodeRef pkg = ((JBPMNode)executionContext.getContextInstance().getVariable("bpm_package")).getNodeRef();
|
||||||
final Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
final Pair<Integer, String> pkgPath = AVMNodeConverter.ToAVMVersionPath(pkg);
|
||||||
|
final AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
||||||
|
final String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
||||||
|
final String targetPath = pkgDesc.getIndirection();
|
||||||
|
LOGGER.debug("handling submit of " + pkgPath.getSecond() + " from " + from + " to " + targetPath);
|
||||||
|
|
||||||
// submit the package changes
|
// submit the package changes
|
||||||
final String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
final String description = (String)executionContext.getContextInstance().getVariable("bpm_workflowDescription");
|
||||||
final String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
final String tag = (String)executionContext.getContextInstance().getVariable("wcmwf_label");
|
||||||
final AVMNodeDescriptor pkgDesc = fAVMService.lookup(pkgPath.getFirst(), pkgPath.getSecond());
|
|
||||||
final String targetPath = pkgDesc.getIndirection();
|
|
||||||
final Map<QName, PropertyValue> dnsProperties = this.fAVMService.queryStorePropertyKey(targetPath.split(":")[0], QName.createQName(null, ".dns%"));
|
final Map<QName, PropertyValue> dnsProperties = this.fAVMService.queryStorePropertyKey(targetPath.split(":")[0], QName.createQName(null, ".dns%"));
|
||||||
String webProject = dnsProperties.keySet().iterator().next().getLocalName();
|
String webProject = dnsProperties.keySet().iterator().next().getLocalName();
|
||||||
webProject = webProject.substring(webProject.lastIndexOf('.') + 1, webProject.length());
|
webProject = webProject.substring(webProject.lastIndexOf('.') + 1, webProject.length());
|
||||||
final List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
final List<AVMDifference> stagingDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, targetPath, null);
|
||||||
for (final AVMDifference diff : stagingDiffs)
|
for (final AVMDifference diff : stagingDiffs)
|
||||||
{
|
{
|
||||||
this.recursivelyRemoveLocksAndSubmittedAspect(webProject,
|
String p = diff.getSourcePath();
|
||||||
diff.getSourceVersion(),
|
if (from != null && from.length() != 0)
|
||||||
diff.getSourcePath());
|
{
|
||||||
|
p = from + p.substring(pkgPath.getSecond().length());
|
||||||
|
}
|
||||||
|
this.recursivelyRemoveLocks(webProject, -1, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
// Allow AVMSubmitTransactionListener to inspect the staging diffs
|
||||||
@ -133,16 +130,17 @@ public class AVMSubmitPackageHandler
|
|||||||
AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs);
|
AlfrescoTransactionSupport.bindResource("staging_diffs", stagingDiffs);
|
||||||
|
|
||||||
fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description);
|
fAVMSyncService.update(stagingDiffs, null, false, false, true, true, tag, description);
|
||||||
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
|
fAVMSyncService.flatten(pkgPath.getSecond(), targetPath);
|
||||||
|
|
||||||
// flatten source folder where changes were submitted from
|
// flatten source folder where changes were submitted from
|
||||||
String from = (String)executionContext.getContextInstance().getVariable("wcmwf_fromPath");
|
|
||||||
if (from != null && from.length() > 0)
|
if (from != null && from.length() > 0)
|
||||||
{
|
{
|
||||||
// first, submit changes back to sandbox forcing addition of edits in workflow (and submission
|
// first, submit changes back to sandbox forcing addition of edits in workflow (and submission
|
||||||
// flag removal). second, flatten sandbox, removing modified items that have been submitted
|
// flag removal). second, flatten sandbox, removing modified items that have been submitted
|
||||||
// TODO: Without locking on the sandbox, it's possible that a change to a "submitted" item
|
// TODO: Without locking on the sandbox, it's possible that a change to a "submitted" item
|
||||||
// may get lost when the item is finally approved
|
// may get lost when the item is finally approved
|
||||||
List<AVMDifference> sandboxDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, from, null);
|
final List<AVMDifference> sandboxDiffs = fAVMSyncService.compare(pkgPath.getFirst(), pkgPath.getSecond(), -1, from, null);
|
||||||
fAVMSyncService.update(sandboxDiffs, null, true, true, false, false, tag, description);
|
fAVMSyncService.update(sandboxDiffs, null, true, true, false, false, tag, description);
|
||||||
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
AVMDAOs.Instance().fAVMNodeDAO.flush();
|
||||||
fAVMSyncService.flatten(from, targetPath);
|
fAVMSyncService.flatten(from, targetPath);
|
||||||
@ -153,10 +151,10 @@ public class AVMSubmitPackageHandler
|
|||||||
* Recursively remove locks from a path. Walking child folders looking for files
|
* Recursively remove locks from a path. Walking child folders looking for files
|
||||||
* to remove locks from.
|
* to remove locks from.
|
||||||
*/
|
*/
|
||||||
private void recursivelyRemoveLocksAndSubmittedAspect(final String webProject, final int version, final String path)
|
private void recursivelyRemoveLocks(final String webProject, final int version, final String path)
|
||||||
{
|
{
|
||||||
fAVMSubmittedAspect.clearSubmitted(version, path);
|
LOGGER.debug("removing lock on " + path);
|
||||||
AVMNodeDescriptor desc = fAVMService.lookup(version, path, true);
|
final AVMNodeDescriptor desc = fAVMService.lookup(version, path, true);
|
||||||
if (desc.isFile() || desc.isDeletedFile())
|
if (desc.isFile() || desc.isDeletedFile())
|
||||||
{
|
{
|
||||||
fAVMLockingService.removeLock(webProject, path.substring(path.indexOf(":") + 1));
|
fAVMLockingService.removeLock(webProject, path.substring(path.indexOf(":") + 1));
|
||||||
@ -165,7 +163,7 @@ public class AVMSubmitPackageHandler
|
|||||||
{
|
{
|
||||||
for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(version, path, true))
|
for (final AVMNodeDescriptor child : fAVMService.getDirectoryListingArray(version, path, true))
|
||||||
{
|
{
|
||||||
this.recursivelyRemoveLocksAndSubmittedAspect(webProject, version, child.getPath());
|
this.recursivelyRemoveLocks(webProject, version, child.getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005-2007 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
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
|
|
||||||
* As a special exception to the terms and conditions of version 2.0 of
|
|
||||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
|
||||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
|
||||||
* FLOSS exception. You should have recieved a copy of the text describing
|
|
||||||
* the FLOSS exception, and it is also available here:
|
|
||||||
* http://www.alfresco.com/legal/licensing"
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.wf;
|
|
||||||
|
|
||||||
import org.alfresco.repo.domain.PropertyValue;
|
|
||||||
import org.alfresco.service.cmr.avm.AVMService;
|
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
|
||||||
import org.alfresco.service.cmr.workflow.WorkflowException;
|
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.alfresco.util.ParameterCheck;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aspect to represent a node is currently taking part in a workflow.
|
|
||||||
*
|
|
||||||
* @author davidc
|
|
||||||
*/
|
|
||||||
public class AVMSubmittedAspect
|
|
||||||
{
|
|
||||||
|
|
||||||
private final static String NAMESPACE_URI = "http://www.alfresco.org/model/wcmworkflow/1.0";
|
|
||||||
|
|
||||||
public final static QName ASPECT = QName.createQName(NAMESPACE_URI, "submitted");
|
|
||||||
public final static QName PROP_WORKFLOW_INSTANCE_ID = QName.createQName(NAMESPACE_URI, "workflowInstanceId");
|
|
||||||
|
|
||||||
|
|
||||||
// Dependencies
|
|
||||||
private AVMService avmService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the AVM Service
|
|
||||||
*
|
|
||||||
* @param avmService
|
|
||||||
*/
|
|
||||||
public void setAvmService(AVMService avmService)
|
|
||||||
{
|
|
||||||
this.avmService = avmService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mark an item as submitted via a workflow
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param path
|
|
||||||
* @param workflowInstanceId
|
|
||||||
*/
|
|
||||||
public void markSubmitted(int version, String path, String workflowInstanceId)
|
|
||||||
{
|
|
||||||
String existingWorkflowInstanceId = getWorkflowInstance(version, path);
|
|
||||||
if (existingWorkflowInstanceId != null)
|
|
||||||
{
|
|
||||||
throw new WorkflowException("Node " + path + "[" + version + "] already submitted in workflow " + existingWorkflowInstanceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
ParameterCheck.mandatoryString("workflowInstanceId", workflowInstanceId);
|
|
||||||
avmService.addAspect(path, ASPECT);
|
|
||||||
avmService.setNodeProperty(path, PROP_WORKFLOW_INSTANCE_ID, new PropertyValue(DataTypeDefinition.TEXT, workflowInstanceId));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unmark an submitted item
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param path
|
|
||||||
*/
|
|
||||||
public void clearSubmitted(int version, String path)
|
|
||||||
{
|
|
||||||
if (avmService.hasAspect(version, path, ASPECT))
|
|
||||||
{
|
|
||||||
avmService.removeAspect(path, ASPECT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the submitted workflow instances for the specified item
|
|
||||||
*
|
|
||||||
* @param version
|
|
||||||
* @param path
|
|
||||||
* @return workflow instance (or null, if not submitted)
|
|
||||||
*/
|
|
||||||
public String getWorkflowInstance(int version, String path)
|
|
||||||
{
|
|
||||||
String workflowInstanceId = null;
|
|
||||||
PropertyValue value = avmService.getNodeProperty(version, path, PROP_WORKFLOW_INSTANCE_ID);
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
workflowInstanceId = value.getStringValue();
|
|
||||||
}
|
|
||||||
return workflowInstanceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user