[JBoss JIRA] Created: (JBPM-2907) Candidate-Groups
by Sandro Röder (JIRA)
Candidate-Groups
----------------
Key: JBPM-2907
URL: https://jira.jboss.org/browse/JBPM-2907
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.3
Reporter: Sandro Röder
@see: https://jira.jboss.org/browse/JBPM-2648
Hi everybody,
if you solve the problem like this "hql.append ( "select distinct task");" in the version 4.4 the code will not work anymore with Oracle because of the clob description field.
I test the source code from the cvs:
this is the resulting sql:
select distinct (task.id) from org.jbpm.pvm.internal.task.TaskImpl as task , org.jbpm.pvm.internal.task.ParticipationImpl as participant where participant.task = task and participant.type = 'candidate' and ((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds))) and task.assignee is null
and in the result set is the following:
[1260352, 1260356]
just the task ids.
here is my working change 8on version (4.3) with a subselect to get the tasks directly:
/**
*
*/
package com.ctlmb.vip.jbpm.impl;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.jbpm.api.identity.Group;
import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.TaskQueryImpl;
import org.jbpm.pvm.internal.task.ParticipationImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
/**
* TODO comment me
* @author roeder
*
*/
public class TaskQueryWorkaround extends TaskQueryImpl{
private static final Logger log = Logger.getLogger(TaskQueryWorkaround.class);
/* (non-Javadoc)
* @see org.jbpm.pvm.internal.query.TaskQueryImpl#hql()
*/
@Override
public String hql() {
StringBuilder hql = new StringBuilder();
hql.append("select ");
if (count) {
hql.append("count(task) ");
} else {
hql.append("task ");
}
hql.append("from ");
hql.append(TaskImpl.class.getName());
hql.append(" as task ");
// participations
if (candidate!=null) {
//################# orginal
// hql.append(", ");
// hql.append(ParticipationImpl.class.getName());
// hql.append(" as participant ");
//
// appendWhereClause("participant.task = task ", hql);
// appendWhereClause("participant.type = 'candidate' ", hql);
//
// IdentitySession identitySession = EnvironmentImpl.getFromCurrent(IdentitySession.class);
// List<Group> groups = identitySession.findGroupsByUser(candidate);
// if (groups.isEmpty()) {
// groupIds = null;
// appendWhereClause("participant.userId = :candidateUserId ", hql);
//
// } else {
// groupIds = new ArrayList<String>();
// for (Group group: groups) {
// groupIds.add(group.getId());
// }
// appendWhereClause("((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds)))", hql);
// }
//################# end orginal
//################# my change
appendWhereClause("task in ( ", hql);
StringBuilder innerSelect = new StringBuilder();
innerSelect.append("select participant.task ");
innerSelect.append("from ");
innerSelect.append(ParticipationImpl.class.getName());
innerSelect.append(" as participant ");
innerSelect.append("where ");
innerSelect.append("participant.type = 'candidate' ");
IdentitySession identitySession = EnvironmentImpl.getFromCurrent(IdentitySession.class);
List<Group> groups = identitySession.findGroupsByUser(candidate);
innerSelect.append("and ");
if (groups.isEmpty()) {
groupIds = null;
innerSelect.append("participant.userId = :candidateUserId ");
} else {
groupIds = new ArrayList<String>();
for (Group group: groups) {
groupIds.add(group.getId());
}
innerSelect.append("((participant.userId = :candidateUserId) or (participant.groupId in (:candidateGroupIds)))");
}
hql.append(innerSelect);
hql.append(") ");
}
//################# end my change
if (suspended!=null) {
if (suspended) {
appendWhereClause("task.state = '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
} else {
appendWhereClause("task.state != '"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
}
}
if (processInstanceId!=null) {
appendWhereClause("task.processInstance.id = '"+processInstanceId+"' ", hql);
}
if (activityName!=null) {
appendWhereClause("task.execution.activityName = '"+activityName+"' ", hql);
}
if (processDefinitionId!=null) {
appendWhereClause("task.processInstance.processDefinitionId = '"+processDefinitionId+"' ", hql);
}
if (assignee!=null) {
appendWhereClause("task.assignee = :assignee ", hql);
} else if (unassigned) {
appendWhereClause("task.assignee is null ", hql);
}
appendOrderByClause(hql);
String hqlQuery = hql.toString();
log.debug(hqlQuery);
return hqlQuery;
}
/* (non-Javadoc)
* @see org.jbpm.pvm.internal.query.AbstractQuery#count()
*/
@Override
public long count() {
count = true;
return -9999;
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[JBoss JIRA] Created: (JBPM-2929) ClassCastException after reading serialized variable
by Marcus Klimstra (JIRA)
ClassCastException after reading serialized variable
----------------------------------------------------
Key: JBPM-2929
URL: https://jira.jboss.org/browse/JBPM-2929
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.4
Environment: Windows XP, Java 6
Reporter: Marcus Klimstra
Related to JBPM-2703.
I have a process definition with two custom nodes, refering to ActivityBehaviour classes Custom1 and Custom2. Class Custom1 sets a process variable named "bean" of class Bean, and Custom2 reads and uses this variable:
{code}
public class Bean implements Serializable {
private int value;
public int getValue() { return value; }
public void setValue(int value) { this.value = value; }
}
public class Custom1 implements ActivityBehaviour {
public void execute(ActivityExecution execution) throws Exception {
Bean bean = new Bean();
bean.setValue(42);
execution.setVariable("bean", bean);
}
}
public class Custom2 implements ActivityBehaviour {
public void execute(ActivityExecution execution) throws Exception {
Bean bean = (Bean)execution.getVariable("bean");
if (bean.getValue() != 42) {
throw new Exception("Value must be 42!");
}
}
}
{code}
All these classes were added to the deployment using addResourcesFromZipInputStream/addResourceFromInputStream. So far this works fine.
However, when I put a task node between custom1 and custom2 (apparently causing the variable to be serialized?), things go awry:
{code}
java.lang.ClassCastException: [...].Bean cannot be cast to [...].Bean
at [...].Custom2.execute(Custom2.java:6)
at org.jbpm.pvm.internal.wire.usercode.UserCodeActivityBehaviour.execute(UserCodeActivityBehaviour.java:42)
at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
at ...etc...
{code}
So it seems that there are two Bean-classes, loaded by different classloaders. I've traced this problem to the DeploymentObjectInputStream, which creates a new DeploymentClassLoader each time it enters the catch-clause. Since the second Bean-class is loaded by a different classloader, it is incompatible with the first.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months
[JBoss JIRA] Created: (JBPM-2932) NullPointerException is thrown when forcing a process to end having attached end event listener
by Nándor Előd Fekete (JIRA)
NullPointerException is thrown when forcing a process to end having attached end event listener
-----------------------------------------------------------------------------------------------
Key: JBPM-2932
URL: https://jira.jboss.org/browse/JBPM-2932
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.4
Reporter: Nándor Előd Fekete
NullPointerException is thrown when forcing a process to end using ExecutionService.endProcessInstance(...) having attached end event listener
DefaultCommandService - exception while executing command org.jbpm.pvm.internal.cmd.EndProcessInstance@6649
java.lang.NullPointerException
at org.jbpm.pvm.internal.util.ReflectUtil.installDeploymentClassLoader(ReflectUtil.java:385)
at org.jbpm.pvm.internal.util.ReflectUtil.instantiateUserCode(ReflectUtil.java:412)
at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:63)
at org.jbpm.pvm.internal.wire.usercode.UserCodeReference.getObject(UserCodeReference.java:47)
at org.jbpm.pvm.internal.wire.usercode.UserCodeEventListener.notify(UserCodeEventListener.java:38)
at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:672)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:632)
at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:579)
at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:568)
at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:386)
at org.jbpm.pvm.internal.cmd.EndProcessInstance.execute(EndProcessInstance.java:48)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:40)
at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.endProcessInstance(ExecutionServiceImpl.java:117)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 2 months