提交 854ef3e6 编写于 作者: J jbarrez

UI: Expanding on expense process example

上级 613d88c1
......@@ -190,7 +190,6 @@ public class DemoDataGenerator {
.createDeployment()
.name("Expense process")
.addClasspathResource("org/activiti/explorer/demo/process/expense_process.bpmn20.xml")
.addClasspathResource("org/activiti/explorer/demo/process/expense_process.png")
.deploy();
}
......
......@@ -13,11 +13,16 @@
package org.activiti.explorer.ui.flow.listener;
import java.util.List;
import org.activiti.engine.FormService;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.form.StartFormData;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.explorer.ExplorerApp;
import org.activiti.explorer.Messages;
import org.activiti.explorer.NotificationManager;
......@@ -29,12 +34,14 @@ import com.vaadin.ui.Button.ClickListener;
/**
* @author Frederik Heremans
* @author Joram Barrez
*/
public class StartFlowClickListener implements ClickListener {
private static final long serialVersionUID = -1811557526259754226L;
private static final long serialVersionUID = 1L;
protected RuntimeService runtimeService;
protected TaskService taskService;
protected FormService formService;
protected NotificationManager notificationManager;
......@@ -44,6 +51,7 @@ public class StartFlowClickListener implements ClickListener {
public StartFlowClickListener(ProcessDefinition processDefinition, FlowPage flowPage) {
this.runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
this.taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
this.formService = ProcessEngines.getDefaultProcessEngine().getFormService();
this.notificationManager = ExplorerApp.get().getNotificationManager();
......@@ -60,10 +68,19 @@ public class StartFlowClickListener implements ClickListener {
} else {
// Just start the process-instance since it has no form.
// TODO: Error handling
runtimeService.startProcessInstanceById(processDefinition.getId());
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
// Show notification of success
notificationManager.showInformationNotification(Messages.FLOW_STARTED_NOTIFICATION, processDefinition.getName());
// Switch to inbox page in case a task of this process was created
List<Task> loggedInUsersTasks = taskService.createTaskQuery()
.taskAssignee(ExplorerApp.get().getLoggedInUser().getId())
.processInstanceId(processInstance.getId())
.list();
if (loggedInUsersTasks.size() > 0) {
ExplorerApp.get().getViewManager().showInboxPage(loggedInUsersTasks.get(0).getId());
}
}
......
......@@ -33,10 +33,10 @@
<omgdc:Bounds height="55" width="111" x="330" y="195"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35" width="35" x="80" y="200"></omgdc:Bounds>
<omgdc:Bounds height="35" width="35" x="80" y="195"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55" width="105" x="170" y="190"></omgdc:Bounds>
<omgdc:Bounds height="55" width="105" x="170" y="195"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
<omgdc:Bounds height="55" width="105" x="490" y="195"></omgdc:Bounds>
......@@ -52,7 +52,7 @@
<omgdi:waypoint x="170" y="217"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
<omgdi:waypoint x="275" y="217"></omgdi:waypoint>
<omgdi:waypoint x="275" y="222"></omgdi:waypoint>
<omgdi:waypoint x="330" y="222"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
......@@ -64,14 +64,14 @@
<omgdi:waypoint x="640" y="222"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="660" y="242"></omgdi:waypoint>
<omgdi:waypoint x="680" y="222"></omgdi:waypoint>
<omgdi:waypoint x="750" y="222"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
<omgdi:waypoint x="660" y="202"></omgdi:waypoint>
<omgdi:waypoint x="660" y="101"></omgdi:waypoint>
<omgdi:waypoint x="222" y="101"></omgdi:waypoint>
<omgdi:waypoint x="222" y="135"></omgdi:waypoint>
<omgdi:waypoint x="222" y="195"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册