05-03-2017 04:21 AM
i'm tryin to implement my own java logic using SPRING + JSF with activiti , this my BPMN file :
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"targetNamespace="http://www.bpmnwithactiviti.org"
xmlns:activiti="http://activiti.org/bpmn">
<process id="my-process" name="my-process">
<startEvent id="startEvent" name="Start" activiti:formKey="taskForm_newOrder.jsf" />
<sequenceFlow id="toValidateTask" sourceRef="startEvent" targetRef="validateTask"/><serviceTask id="validateTask" activiti:expression="#{operationController.sayHello()}" >
<extensionElements>
<activiti:field name="input" expression="${adminModele.operationLabel}" />
</extensionElements>
</serviceTask><sequenceFlow id="toCompletedOrderTask" sourceRef="validateTask" targetRef="completeOrderTask"/>
<userTask id="completeOrderTask" name="Complete order" activiti:assignee="${adminModele.operationLabel}" activiti:formKey="taskForm_completeOrder.jsf">
<documentation>Completing order for book with isbn : ${adminModele.operationLabel} </documentation>
</userTask>
<sequenceFlow id="toApproveTask" sourceRef="completeOrderTask" targetRef="approveTask"/>
<serviceTask id="approveTask" activiti:expression="#{bookOrder.validates()}" />
<sequenceFlow id="toEndEvent" sourceRef="approveTask" targetRef="endEvent"/>
<endEvent id="endEvent" name="End"/>
</process>
</definitions>
the sayHello() :
public void sayHello(){
System.out.println("SayHello ................."+bookOrder.getIsbn());
}
when i do a simple call to sayHello () it displays what i want but when the ServiceTask calls sayHello i get JavaNullPointerException , means my bookOrder object is null .
Any ideas how to deal with this problem
05-05-2017 04:54 AM
Nope, these are simple spring beans and need to be declared in the spring context.
05-05-2017 06:01 AM
For example @Service("bookOrder") won't work ?
05-05-2017 07:50 AM
If you're using spring annotation based configuration then this is what you would do.
If you are using xml based configuration (which is what it appears you are doing) then you would use the activiti.cfg.xml
05-05-2017 08:48 AM
Thank you Geg ,
Let's say you have a ServiceTask where you pass expression , activiti:expression="${operationController.sayHello()}" .
and your method implements something like this :
public void sayHello(){
System.out.println("the isbn :"+bookOrder.getIsbn());
}
the value of ISBN comes from a JSF Form , How would you implement this ?
Explore our Alfresco products with the links below. Use labels to filter content by product module.