mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
WCM Content Launch:
- submit process now allows for delayed submissions (launch date may be entered during submit) - in case of delayed submission, initiator is sent "submission pending" task with actions for cancelling submission and submitting now. On launch date, submission is made, removing "pending" task from initiator. - approved task is now submitted task Fixes to jBPM Timers: - fix to ensure task is ended when associated timer is fired - fix to ensure Alfresco transaction is active when triggered node action is executed git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5687 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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.workflow.jbpm;
|
||||
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.jbpm.job.executor.JobExecutor;
|
||||
import org.springframework.beans.factory.access.BeanFactoryLocator;
|
||||
import org.springframework.beans.factory.access.BeanFactoryReference;
|
||||
import org.springmodules.workflow.jbpm31.JbpmFactoryLocator;
|
||||
|
||||
|
||||
/**
|
||||
* jBPM Job Executor
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class AlfrescoJobExecutor extends JobExecutor
|
||||
{
|
||||
private static final long serialVersionUID = -4576396495395482111L;
|
||||
|
||||
private static Log log = LogFactory.getLog(JobExecutor.class);
|
||||
private TransactionService transactionService;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public AlfrescoJobExecutor()
|
||||
{
|
||||
BeanFactoryLocator factoryLocator = new JbpmFactoryLocator();
|
||||
BeanFactoryReference factory = factoryLocator.useBeanFactory(null);
|
||||
transactionService = (TransactionService)factory.getFactory().getBean(ServiceRegistry.TRANSACTION_SERVICE.getLocalName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Transaction Service
|
||||
*
|
||||
* @return transaction service
|
||||
*/
|
||||
public TransactionService getTransactionService()
|
||||
{
|
||||
return transactionService;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jbpm.job.executor.JobExecutor#startThread()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected synchronized void startThread()
|
||||
{
|
||||
String threadName = getNextThreadName();
|
||||
Thread thread = new AlfrescoJobExecutorThread(threadName, this, getJbpmConfiguration(), getIdleInterval(), getMaxIdleInterval(), getMaxLockTime(), getHistoryMaxSize());
|
||||
getThreads().put(threadName, thread);
|
||||
log.debug("starting new job executor thread '" + threadName + "'");
|
||||
thread.start();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.workflow.jbpm;
|
||||
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.jbpm.JbpmConfiguration;
|
||||
import org.jbpm.job.Job;
|
||||
import org.jbpm.job.executor.JobExecutorThread;
|
||||
|
||||
|
||||
/**
|
||||
* Alfresco Job Executor Thread
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class AlfrescoJobExecutorThread extends JobExecutorThread
|
||||
{
|
||||
private AlfrescoJobExecutor alfrescoJobExecutor;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param name
|
||||
* @param jobExecutor
|
||||
* @param jbpmConfiguration
|
||||
* @param idleInterval
|
||||
* @param maxIdleInterval
|
||||
* @param maxLockTime
|
||||
* @param maxHistory
|
||||
*/
|
||||
public AlfrescoJobExecutorThread(String name, AlfrescoJobExecutor jobExecutor, JbpmConfiguration jbpmConfiguration, int idleInterval, int maxIdleInterval, long maxLockTime, int maxHistory)
|
||||
{
|
||||
super(name, jobExecutor, jbpmConfiguration, idleInterval, maxIdleInterval, maxLockTime, maxHistory);
|
||||
this.alfrescoJobExecutor = jobExecutor;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jbpm.job.executor.JobExecutorThread#executeJob(org.jbpm.job.Job)
|
||||
*/
|
||||
@Override
|
||||
protected void executeJob(Job job)
|
||||
{
|
||||
TransactionUtil.executeInUserTransaction(alfrescoJobExecutor.getTransactionService(), new TransactionJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class for holding Job reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
private class TransactionJob implements TransactionUtil.TransactionWork<Object>
|
||||
{
|
||||
private Job job;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param job
|
||||
*/
|
||||
public TransactionJob(Job job)
|
||||
{
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.repo.transaction.TransactionUtil.TransactionWork#doWork()
|
||||
*/
|
||||
public Object doWork() throws Throwable
|
||||
{
|
||||
AlfrescoJobExecutorThread.super.executeJob(job);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -25,7 +25,7 @@
|
||||
<bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
|
||||
<bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" />
|
||||
|
||||
<bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
|
||||
<bean name="jbpm.job.executor" class="org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutor">
|
||||
<field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
|
||||
<field name="name"><string value="AlfrescoJbpmJobExector" /></field>
|
||||
<field name="nbrOfThreads"><int value="1" /></field>
|
||||
|
@@ -35,9 +35,21 @@
|
||||
</timer>
|
||||
</task>
|
||||
<transition name="cancel" to="end" /> <!-- signalling this transition will cancel timer -->
|
||||
<transition name="launched" to="end" /> <!-- signalling this transition will cancel timer -->
|
||||
<transition name="launched" to="doit" /> <!-- signalling this transition will cancel timer -->
|
||||
</task-node>
|
||||
|
||||
<node name="doit">
|
||||
<event type="node-enter">
|
||||
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
|
||||
<script>
|
||||
companyhome.name = companyhome.name + "b";
|
||||
logger.log("Company Home: " + companyhome.name);
|
||||
</script>
|
||||
</action>
|
||||
</event>
|
||||
<transition name="" to="end" />
|
||||
</node>
|
||||
|
||||
<end-state name="end" />
|
||||
|
||||
</process-definition>
|
Reference in New Issue
Block a user