I am starting a process with via a REST request and I am passing the following in Request body
{
"variables": {
"id": {
"value": "201",
"type": "String"
},
"dob": {
"value": "2013-12-27T00: 00",
"type": "Date"
}
}
}
Now the first service task is a JAva Delegate class, and I assume that the execution.getVariables() should return the variables passed in the request body above. Am I right? At the moment the Map returned by execution.getVariables() is empty.
thanks
{
"variables":{
"id": {
"value": "201",
"type": "String"
},
"dob": {
"value": "2013-12-27T00:00:00",
"type": "Date"
}
}
}
Also the following is my process definition.
<bpmn2:process id="validationProcess" name="Validation process">
<bpmn2:extensionElements>
<camunda:executionListener delegateExpression="${validationListener}" event="end" />
</bpmn2:extensionElements>
<bpmn2:startEvent id="theStart" />
<bpmn2:sequenceFlow id="flow1" sourceRef="theStart" targetRef="validateDate" />
<bpmn2:serviceTask id="validateDate" name="validate Date is between two months"
camunda:class="com.cif.poc.activiti.process.validation.ValidateDate">
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="flow2" sourceRef="validateDate" targetRef="updateUser"/>
<bpmn2:serviceTask id="updateUser" name="updateUser"
camunda:expression="#{userService.updateUser()}">
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="flow3" sourceRef="updateUser" targetRef="theEnd" />
<bpmn2:endEvent id="theEnd" />
</bpmn2:process>
</bpmn2:definitions>
And the first service task java Delegate is as follows which has the execution.getVariables() empty
public class ValidateDate implements JavaDelegate {
private final static Logger LOGGER = Logger.getLogger(ValidateDate.class.getName());
@Override
public void execute(DelegateExecution execution) throws Exception {
LOGGER.warning("THIS IS A TEST FROM VALIDATION PROCESS" + execution.getId());
Iterator<Map.Entry<String, Object>> it =execution.getVariables().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next();
System.out.println(pairs.getKey() + " = " + pairs.getValue());
}
execution.setVariable("validationPassed", true);
}
}
Also I noticed that when I try to get the process definitions with /process-definition . I get a list of empty JSON objects as follows
[{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
thanks
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.cdi.CdiStandaloneProcessEngineConfiguration">
<property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/camunda" />
<property name="jdbcDriver" value="org.postgresql.Driver" />
<property name="jdbcUsername" value="camunda" />
<property name="jdbcPassword" value="camunda" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
<property name="mailServerHost" value="mail.my-corp.com" />
<property name="mailServerPort" value="5025" />
<property name="customPostBPMNParseListeners">
<list>
<bean class="org.camunda.bpm.engine.cdi.impl.event.CdiEventSupportBpmnParseListener" />
</list>
</property>
</bean>
</beans>
Also I added the Camunda Rest dependencies to my web application and exposed the services as follows
@ApplicationPath("/engine-rest")
public class MyApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(org.camunda.bpm.engine.rest.impl.ProcessEngineRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.ProcessDefinitionRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.ProcessInstanceRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.IdentityRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.MessageRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.JobRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.ExecutionRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.VariableInstanceRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.UserRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.GroupRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.AuthorizationRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.impl.history.HistoryRestServiceImpl.class);
classes.add(org.camunda.bpm.engine.rest.mapper.JacksonConfigurator.class);
classes.add(org.camunda.bpm.engine.rest.exception.RestExceptionHandler.class);
classes.add(org.camunda.bpm.engine.rest.exception.ProcessEngineExceptionHandler.class);
return classes;
}
}
classes.add(ProcessEngineRestServiceImpl.class); classes.add(ProcessDefinitionRestServiceImpl.class); classes.add(ProcessInstanceRestServiceImpl.class); classes.add(TaskRestServiceImpl.class); classes.add(IdentityRestServiceImpl.class); classes.add(MessageRestServiceImpl.class); classes.add(JobRestServiceImpl.class); classes.add(ExecutionRestServiceImpl.class); classes.add(VariableInstanceRestServiceImpl.class); classes.add(UserRestServiceImpl.class); classes.add(GroupRestServiceImpl.class); classes.add(AuthorizationRestServiceImpl.class); classes.add(HistoryRestServiceImpl.class);
classes.add(JacksonConfigurator.class);
classes.add(JacksonJsonProvider.class); classes.add(JsonMappingExceptionMapper.class); classes.add(JsonParseExceptionMapper.class);
classes.add(ProcessEngineExceptionHandler.class); classes.add(RestExceptionHandler.class);
--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/BnUxqnxwo5k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-users+unsubscribe@googlegroups.com.
To post to this group, send email to camunda-bpm-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/53329F8B.9050105%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
classes.add(JacksonFeature.class);
{"variables":
{"user" : {"value" : "myGlassfishUser", "type": "String"},
"anotherVariable" : {"value" : true, "type": "Boolean"}},
"businessKey" : "myBusinessKey"
}
Caused by: java.lang.NullPointerException at com.cif.poc.activiti.servicetasks.UserService.updateUser(UserService.java:33)