Merged V2.2 to HEAD

10931: Merged V2.1 to V2.2
      9931: Fix for https://issues.alfresco.com/jira/browse/ETWOONE-295
      10094: Further fix for ETWOONE-241: SAXException - XML parser apparently is not thread safe
      10101: Resolve ACT 1282: wcm workflow falling over on Oracle while hitting in clause limit of 1000 expressions.
      10188: https://issues.alfresco.com/jira/browse/ETWOONE-74 (Part 1)
      10447: ETWOONE-328: performance improvement added to rule trigger code
      10455: Fix for ETWOONE-306.
      10292: Fix for ETWOONE-92: If two users update the same contents at the same time, you get InvalidNodeRefException
      10293: Fix for ETWOONE-116: Send email action does not handle invalid email address
      10294: Fix for ETWOONE-164: when a powerpoint 2007 pptx is stored in alfresco ...
      10341: Action Evaluator request level cache


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10934 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-09-19 12:51:08 +00:00
parent 3ca446e81e
commit 8fb3a02d1f
13 changed files with 556 additions and 103 deletions

View File

@@ -47,6 +47,7 @@ import org.springframework.beans.factory.BeanFactory;
public class ForEachFork extends JBPMSpringActionHandler
{
private static final long serialVersionUID = 4643103713602441652L;
private ServiceRegistry services;
private Element foreach;
@@ -190,7 +191,7 @@ public class ForEachFork extends JBPMSpringActionHandler
protected String getTokenName(Token parent, String transitionName, int loopIndex)
{
String tokenName = null;
if (transitionName != null)
if (transitionName != null && transitionName.length() > 0)
{
if (!parent.hasChild(transitionName))
{
@@ -210,12 +211,13 @@ public class ForEachFork extends JBPMSpringActionHandler
else
{
// no transition name
int size = ( parent.getChildren()!=null ? parent.getChildren().size()+1 : 1 );
tokenName = Integer.toString(size);
int size = (parent.getChildren() != null) ? parent.getChildren().size() + 1 : 1;
tokenName = "FOREACHFORK" + Integer.toString(size);
}
return tokenName + "." + loopIndex;
}
/**
* Fork Transition
*/

View File

@@ -84,6 +84,7 @@ import org.hibernate.Session;
import org.hibernate.criterion.Conjunction;
import org.hibernate.criterion.Disjunction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.hibernate.proxy.HibernateProxy;
@@ -1302,7 +1303,6 @@ public class JBPMEngine extends BPMEngine
*/
private Criteria createTaskQueryCriteria(Session session, WorkflowTaskQuery query)
{
Criteria process = null;
Criteria task = session.createCriteria(TaskInstance.class);
// task id
@@ -1358,35 +1358,9 @@ public class JBPMEngine extends BPMEngine
}
}
// process active?
if (query.isActive() != null)
{
process = (process == null) ? task.createCriteria("processInstance") : process;
if (query.isActive())
{
process.add(Restrictions.isNull("end"));
}
else
{
process.add(Restrictions.isNotNull("end"));
}
}
// process criteria
Criteria process = createProcessCriteria(task, query);
// process id
if (query.getProcessId() != null)
{
process = (process == null) ? task.createCriteria("processInstance") : process;
process.add(Restrictions.eq("id", getJbpmId(query.getProcessId())));
}
// process name
if (query.getProcessName() != null)
{
process = (process == null) ? task.createCriteria("processInstance") : process;
Criteria processDef = process.createCriteria("processDefinition");
processDef.add(Restrictions.eq("name", query.getProcessName().toPrefixString(namespaceService)));
}
// process custom properties
if (query.getProcessCustomProps() != null)
{
@@ -1398,7 +1372,7 @@ public class JBPMEngine extends BPMEngine
{
// create criteria for process variables
Criteria variables = session.createCriteria(VariableInstance.class);
variables.setProjection(Property.forName("processInstance"));
variables.setProjection(Projections.distinct(Property.forName("processInstance")));
Disjunction values = Restrictions.disjunction();
for (Map.Entry<QName, Object> prop : props.entrySet())
{
@@ -1409,6 +1383,9 @@ public class JBPMEngine extends BPMEngine
}
variables.add(values);
// note: constrain process variables to same criteria as tasks
createProcessCriteria(variables, query);
// retrieve list of processes matching specified variables
List<ProcessInstance> processList = variables.list();
Object[] processIds = null;
@@ -1491,6 +1468,49 @@ public class JBPMEngine extends BPMEngine
return task;
}
/**
* Create process-specific query criteria
*
* @param root
* @param query
* @return
*/
private Criteria createProcessCriteria(Criteria root, WorkflowTaskQuery query)
{
Criteria process = null;
// process active?
if (query.isActive() != null)
{
process = (process == null) ? root.createCriteria("processInstance") : process;
if (query.isActive())
{
process.add(Restrictions.isNull("end"));
}
else
{
process.add(Restrictions.isNotNull("end"));
}
}
// process id
if (query.getProcessId() != null)
{
process = (process == null) ? root.createCriteria("processInstance") : process;
process.add(Restrictions.eq("id", getJbpmId(query.getProcessId())));
}
// process name
if (query.getProcessName() != null)
{
process = (process == null) ? root.createCriteria("processInstance") : process;
Criteria processDef = process.createCriteria("processDefinition");
processDef.add(Restrictions.eq("name", query.getProcessName().toPrefixString(namespaceService)));
}
return process;
}
/**
* Gets a jBPM Task Instance
* @param taskSession jBPM task session