Dear Camunda Users
I have the following, very simple process diagram:
Within the task “Do Something 1” I defined two input/output parameters
The Service Task uses the following Java Class:
package ch.hslu.ba.responsibilityWithVariables;
public class responsibilityWithVariables implements JavaDelegate {
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
BpmnModelInstance modelInstance = delegateExecution.getBpmnModelInstance();
// Database configuration
String user = "sa";
String password = "sa";
String url = "jdbc:h2:./camunda-db";
String jdbcDriver = "org.h2.Driver";
String sqlStatement = "SELECT * FROM ACT_RU_TASK";
String sqlStatement1 = "SELECT * FROM ACT_RU_VARIABLE";
try {
Class.forName(jdbcDriver);
Connection connection = DriverManager.getConnection(url, user, password);
Statement statement1 = connection.createStatement();
Statement statement2 = connection.createStatement();
ResultSet resultSet1 = statement1.executeQuery(sqlStatement);
ResultSet resultSet2 = statement2.executeQuery(sqlStatement1);
while (resultSet1.next()){
String name = resultSet1.getString("NAME_");
String prozessInstanzId = resultSet1.getString("PROC_INST_ID_");
String taskId = resultSet1.getString("EXECUTION_ID_");
System.out.println("Aufgabenname: " + name);
System.out.println("Prozessinstanz ID: " + prozessInstanzId);
System.out.println("Aufgaben ID: " + taskId);
System.out.println();
}
while (resultSet2.next()){
String name = resultSet2.getString("NAME_");
String id = resultSet2.getString("PROC_INST_ID_");
String type = resultSet2.getString("TYPE_");
String text = resultSet2.getString("TEXT_");
System.out.println("Variablenname: " + name);
System.out.println("Prozessinstanz ID:" + id);
System.out.println("Datentyp: " + type);
System.out.println("Wert: " + text);
System.out.println();
}
statement1.close();
statement2.close();
connection.close();
} catch (Exception e){
e.printStackTrace();
}
}
}
As a Result I Receive all active tasks and the variables.
I woud like to merge the variables to the tasks but as soon as I try to retreive the TASK_ID from the table act_ru_variables, there are only NULL values available. Is there a Solution to this problem?
Thanks a lot!