1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.businessobject.inquiry;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.ole.gl.businessobject.Encumbrance;
20 import org.kuali.ole.gl.businessobject.Transaction;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.kuali.rice.core.api.config.property.ConfigurationService;
24
25
26
27
28
29 public class InquirableFinancialDocument {
30
31 private ConfigurationService kualiConfigurationService = SpringContext.getBean(ConfigurationService.class);
32
33
34
35
36
37
38
39
40 public String getInquirableDocumentUrl(Transaction transaction) {
41 if (transaction == null) {
42 return OLEConstants.EMPTY_STRING;
43 }
44
45 String docNumber = transaction.getDocumentNumber();
46 String originationCode = transaction.getFinancialSystemOriginationCode();
47
48 return getUrl(originationCode, docNumber);
49 }
50
51
52
53
54
55
56
57
58 private String getUrl(String originCode, String docNumber) {
59 if (OLEConstants.ORIGIN_CODE_KUALI.equals(originCode) && !StringUtils.isBlank(docNumber)) {
60 return kualiConfigurationService.getPropertyValueAsString(OLEConstants.WORKFLOW_URL_KEY) + "/DocHandler.do?docId=" + docNumber + "&command=displayDocSearchView";
61 }
62 return OLEConstants.EMPTY_STRING;
63 }
64
65
66
67
68
69
70
71
72 public String getInquirableDocumentUrl(Encumbrance encumbrance) {
73 if (encumbrance == null) {
74 return OLEConstants.EMPTY_STRING;
75 }
76
77 String docNumber = encumbrance.getDocumentNumber();
78 String originationCode = encumbrance.getOriginCode();
79
80 return getUrl(originationCode, docNumber);
81 }
82 }