ACE-3095 - Patch patch.eol-wcmwf fails if wf engine is disabled.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@87857 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Stefan Kopf
2014-10-13 12:40:21 +00:00
parent c8a6a9847c
commit a98be4b880
3 changed files with 50 additions and 18 deletions

View File

@@ -457,25 +457,33 @@ public class WorkflowDeployer extends AbstractLifecycleBean
int undeployed = 0;
for(String workflowName : workflowNames)
{
// Undeploy the workflow definition - all versions in JBPM
List<WorkflowDefinition> defs = workflowService.getAllDefinitionsByName(workflowName);
if(defs.size() > 0)
String engineId = BPMEngineRegistry.getEngineId(workflowName);
if (workflowAdminService.isEngineEnabled(engineId))
{
undeployed++;
// Undeploy the workflow definition - all versions in JBPM
List<WorkflowDefinition> defs = workflowService.getAllDefinitionsByName(workflowName);
if(defs.size() > 0)
{
undeployed++;
}
for (WorkflowDefinition def: defs)
{
if (logger.isDebugEnabled())
{
logger.debug("Undeploying workflow '" + workflowName + "' ...");
}
workflowService.undeployDefinition(def.getId());
if (logger.isDebugEnabled())
{
logger.debug("... undeployed '" + def.getId() + "' v" + def.getVersion());
}
}
}
for (WorkflowDefinition def: defs)
else
{
if (logger.isDebugEnabled())
{
logger.debug("Undeploying workflow '" + workflowName + "' ...");
}
workflowService.undeployDefinition(def.getId());
if (logger.isDebugEnabled())
{
logger.debug("... undeployed '" + def.getId() + "' v" + def.getVersion());
}
logger.debug("Workflow deployer: Definition '" + workflowName + "' cannot be undeployed as the '" + engineId + "' engine is disabled");
}
}
return undeployed;