mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ACE-2171 - EOL: WCM and related JBPM workflow definition removal
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@87752 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -182,6 +182,8 @@ patch.imap.clear.old.messages.description.cleared=Old IMAP message templates hav
|
||||
patch.groupMembersAsIdentifiers.description=Reindex usr:authorityContainer members as identifiers
|
||||
|
||||
patch.genericWorkflow.result.deployed=Re-deployed {0} workflows.
|
||||
patch.genericWorkflow.result.undeployed=Undeployed {0} workflows.
|
||||
patch.genericWorkflow.property_required=At least one of the properties ''{0}'' or ''{1}'' must be set on this patch: {2}
|
||||
|
||||
patch.ReadmeTemplate.description=Deployed ReadMe Template
|
||||
patch.webScriptsReadme.description=Applied ReadMe template to Web Scripts folders
|
||||
@@ -463,3 +465,4 @@ patch.db-V5.0-upgrade-to-activiti-5.16.2.result=Activiti tables updated
|
||||
|
||||
patch.solrFacets.root.description=Creates the solr facets root folder in the Data Dictionary
|
||||
|
||||
patch.eol-wcmwf.description=Undeploys deprecated WCMWF Workflows
|
||||
|
@@ -3386,4 +3386,20 @@
|
||||
<value>classpath:alfresco/dbscripts/create/${db.script.dialect}/AlfrescoCreate-ContentUrlEncryptionTables.sql</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="patch.eol-wcmwf" class="org.alfresco.repo.admin.patch.impl.GenericWorkflowPatch" parent="baseWorkflowPatch" >
|
||||
<property name="id"><value>patch.eol-wcmwf</value></property>
|
||||
<property name="description"><value>patch.eol-wcmwf.description</value></property>
|
||||
<property name="fixesFromSchema"><value>0</value></property>
|
||||
<property name="fixesToSchema"><value>8007</value></property>
|
||||
<property name="targetSchema"><value>8008</value></property>
|
||||
<property name="undeployWorkflowNames">
|
||||
<list>
|
||||
<value>jbpm$wcmwf:submit</value>
|
||||
<value>jbpm$wcmwf:submitdirect</value>
|
||||
<value>jbpm$wcmwf:changerequest</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
@@ -146,9 +146,6 @@
|
||||
</fieldset>
|
||||
<!--
|
||||
JBPM ids for debug....
|
||||
id=jbpm$4,name=jbpm$wcmwf:changerequest,version=1,title=Change Request
|
||||
id=jbpm$3,name=jbpm$wcmwf:submit,version=1,title=Web Site Submission
|
||||
id=jbpm$5,name=jbpm$wcmwf:submitdirect,version=1,title=Web Site Submission (Direct)
|
||||
id=jbpm$2,name=jbpm$wf:adhoc,version=1,title=Adhoc Task
|
||||
id=jbpm$6,name=jbpm$wf:invite,version=1,title=Site Invite
|
||||
id=jbpm$1,name=jbpm$wf:review,version=1,title=Review & Approve
|
||||
|
@@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
version.schema=8007
|
||||
version.schema=8008
|
||||
|
@@ -24,6 +24,7 @@ import java.util.Properties;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.workflow.WorkflowDeployer;
|
||||
import org.alfresco.service.cmr.admin.PatchException;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
@@ -36,9 +37,12 @@ import org.springframework.context.ApplicationContextAware;
|
||||
public class GenericWorkflowPatch extends AbstractPatch implements ApplicationContextAware
|
||||
{
|
||||
private static final String MSG_DEPLOYED = "patch.genericWorkflow.result.deployed";
|
||||
private static final String MSG_UNDEPLOYED = "patch.genericWorkflow.result.undeployed";
|
||||
private static final String ERR_PROPERTY_REQUIRED = "patch.genericWorkflow.property_required";
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
private List<Properties> workflowDefinitions;
|
||||
private List<String> undeployWorkflowNames;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -59,11 +63,24 @@ public class GenericWorkflowPatch extends AbstractPatch implements ApplicationCo
|
||||
{
|
||||
this.workflowDefinitions = workflowDefinitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Workflow Names to be undeployed
|
||||
*
|
||||
* @param workflowDefinitions
|
||||
*/
|
||||
public void setUndeployWorkflowNames(List<String> undeployWorkflowNames)
|
||||
{
|
||||
this.undeployWorkflowNames = undeployWorkflowNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkProperties()
|
||||
{
|
||||
checkPropertyNotNull(workflowDefinitions, "workflowDefinitions");
|
||||
if ( (workflowDefinitions == null) && (undeployWorkflowNames == null) )
|
||||
{
|
||||
throw new PatchException(ERR_PROPERTY_REQUIRED, "workflowDefinitions", "undeployWorkflowNames", this);
|
||||
}
|
||||
super.checkProperties();
|
||||
}
|
||||
|
||||
@@ -72,15 +89,37 @@ public class GenericWorkflowPatch extends AbstractPatch implements ApplicationCo
|
||||
{
|
||||
WorkflowDeployer deployer = (WorkflowDeployer)applicationContext.getBean("workflowPatchDeployer");
|
||||
|
||||
for (Properties props : workflowDefinitions)
|
||||
if(workflowDefinitions != null)
|
||||
{
|
||||
props.put(WorkflowDeployer.REDEPLOY, "true");
|
||||
for (Properties props : workflowDefinitions)
|
||||
{
|
||||
props.put(WorkflowDeployer.REDEPLOY, "true");
|
||||
}
|
||||
deployer.setWorkflowDefinitions(workflowDefinitions);
|
||||
deployer.init();
|
||||
}
|
||||
|
||||
int undeployed = 0;
|
||||
if(undeployWorkflowNames != null)
|
||||
{
|
||||
undeployed = deployer.undeploy(undeployWorkflowNames);
|
||||
}
|
||||
deployer.setWorkflowDefinitions(workflowDefinitions);
|
||||
deployer.init();
|
||||
|
||||
// done
|
||||
return I18NUtil.getMessage(MSG_DEPLOYED, workflowDefinitions.size());
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if(workflowDefinitions != null)
|
||||
{
|
||||
msg.append(I18NUtil.getMessage(MSG_DEPLOYED, workflowDefinitions.size()));
|
||||
}
|
||||
if(undeployWorkflowNames != null)
|
||||
{
|
||||
if(msg.length() > 0)
|
||||
{
|
||||
msg.append(' ');
|
||||
}
|
||||
msg.append(I18NUtil.getMessage(MSG_UNDEPLOYED, undeployed));
|
||||
}
|
||||
return msg.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -452,6 +452,35 @@ public class WorkflowDeployer extends AbstractLifecycleBean
|
||||
}
|
||||
}
|
||||
|
||||
public int undeploy(List<String> workflowNames)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
return undeployed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBootstrap(ApplicationEvent event)
|
||||
{
|
||||
|
Reference in New Issue
Block a user