1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.service.impl;
17
18 import java.util.Map;
19 import java.util.Properties;
20
21 import org.apache.struts.action.ActionForward;
22 import org.apache.struts.action.ActionMapping;
23 import org.kuali.ole.sys.businessobject.ElectronicPaymentClaim;
24 import org.kuali.ole.sys.service.ElectronicFundTransferActionHelper;
25 import org.kuali.ole.sys.service.ElectronicPaymentClaimingService;
26 import org.kuali.ole.sys.web.struts.ElectronicFundTransferForm;
27 import org.kuali.rice.krad.util.KRADConstants;
28 import org.kuali.rice.krad.util.UrlFactory;
29
30
31
32
33 public class ElectronicFundTransferStartActionHelper implements ElectronicFundTransferActionHelper {
34 private ElectronicPaymentClaimingService electronicPaymentClaimingService;
35
36
37
38
39 public ActionForward performAction(ElectronicFundTransferForm form, ActionMapping mapping, Map parameterMap, String basePath) {
40 return new ActionForward((form.hasAvailableClaimingDocumentStrategies() ? getClaimingLookupUrl(form, basePath) : getNonClaimingLookupUrl(form, basePath) ), true);
41 }
42
43
44
45
46 protected String getNonClaimingLookupUrl(ElectronicFundTransferForm form, String basePath) {
47 Properties props = getCommonLookupProperties(form);
48 props.put(KRADConstants.HIDE_LOOKUP_RETURN_LINK, Boolean.toString(true));
49 props.put(KRADConstants.RETURN_LOCATION_PARAMETER, basePath + "/" + getNonClaimingReturnLocation());
50 props.put(KRADConstants.BACK_LOCATION, basePath + "/" + getNonClaimingReturnLocation());
51 return UrlFactory.parameterizeUrl(basePath + "/kr/" + KRADConstants.LOOKUP_ACTION, props);
52 }
53
54
55
56
57 protected String getClaimingLookupUrl(ElectronicFundTransferForm form, String basePath) {
58 Properties props = getCommonLookupProperties(form);
59 props.put(KRADConstants.MULTIPLE_VALUE, Boolean.toString(true));
60 props.put(KRADConstants.LOOKUP_ANCHOR, KRADConstants.ANCHOR_TOP_OF_FORM);
61 props.put(KRADConstants.LOOKED_UP_COLLECTION_NAME, "claims");
62 props.put(KRADConstants.RETURN_LOCATION_PARAMETER, basePath + "/" + getClaimingReturnLocation());
63 props.put(KRADConstants.BACK_LOCATION, basePath + "/" + getClaimingReturnLocation());
64 return UrlFactory.parameterizeUrl(basePath + "/kr/" + KRADConstants.MULTIPLE_VALUE_LOOKUP_ACTION, props);
65 }
66
67
68
69
70 protected Properties getCommonLookupProperties(ElectronicFundTransferForm form) {
71 Properties props = new Properties();
72 props.put(KRADConstants.SUPPRESS_ACTIONS, Boolean.toString(true));
73 props.put(KRADConstants.DOC_FORM_KEY, "88888888");
74 props.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, ElectronicPaymentClaim.class.getName());
75 props.put(KRADConstants.METHOD_TO_CALL_ATTRIBUTE, "start");
76 return props;
77 }
78
79
80
81
82 protected String getClaimingReturnLocation() {
83 return "electronicFundTransfer.do";
84 }
85
86
87
88
89 protected String getNonClaimingReturnLocation() {
90 return "portal.do";
91 }
92
93
94
95
96
97 public void setElectronicPaymentClaimingService(ElectronicPaymentClaimingService electronicPaymentClaimingService) {
98 this.electronicPaymentClaimingService = electronicPaymentClaimingService;
99 }
100
101 }
102