1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.leave.workflow;
17
18 import org.kuali.kpme.tklm.leave.payout.LeavePayout;
19 import org.kuali.rice.kew.api.exception.WorkflowException;
20 import org.kuali.rice.kew.engine.RouteContext;
21 import org.kuali.rice.kew.engine.RouteHelper;
22 import org.kuali.rice.kew.engine.node.SplitNode;
23 import org.kuali.rice.kew.engine.node.SplitResult;
24 import org.kuali.rice.kns.document.MaintenanceDocument;
25 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
26
27 import java.util.ArrayList;
28 import java.util.List;
29
30 public class LeavePayoutSplitNode implements SplitNode {
31
32 public SplitResult process(RouteContext context, RouteHelper helper) throws Exception {
33 List<String> resultList = new ArrayList<String>();
34
35
36 String documentNumber = context.getDocument().getDocumentId();
37 MaintenanceDocument document = null;
38 try {
39 document = (MaintenanceDocument) KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(documentNumber);
40 } catch (WorkflowException e) {
41 e.printStackTrace();
42 }
43
44 LeavePayout leavePayout= null;
45 if (document != null && document.getNewMaintainableObject() != null) {
46 leavePayout = (LeavePayout) document.getNewMaintainableObject().getDataObject();
47 }
48
49 if (leavePayout != null) {
50 if (leavePayout.getAccrualCategoryRule() == null) {
51 resultList.add("maintenance");
52 } else {
53 resultList.add("calendar");
54 }
55
56 }
57 return new SplitResult(resultList);
58 }
59 }