1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.select.document;
17
18 import org.kuali.ole.module.purap.document.PurchaseOrderCloseDocument;
19 import org.kuali.ole.module.purap.document.RequisitionDocument;
20 import org.kuali.ole.select.document.service.OlePurchaseOrderDocumentHelperService;
21 import org.kuali.ole.sys.OLEConstants;
22 import org.kuali.ole.sys.context.SpringContext;
23 import org.kuali.ole.vnd.businessobject.VendorAlias;
24 import org.kuali.rice.krad.rules.rule.event.DocumentEvent;
25 import org.kuali.rice.krad.rules.rule.event.DocumentEventBase;
26 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
27
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31
32
33
34
35 public class OlePurchaseOrderCloseDocument extends PurchaseOrderCloseDocument {
36 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderCloseDocument.class);
37 private String vendorPoNumber;
38
39
40
41
42 public OlePurchaseOrderCloseDocument() {
43 super();
44 }
45
46
47
48
49
50
51 @Override
52 public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
53 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).populatePurchaseOrderFromRequisition(this, requisitionDocument);
54 }
55
56
57
58
59
60
61 @Override
62 public void prepareForSave(DocumentEvent event) {
63 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).prepareForSave(this, event);
64 super.prepareForSave(event);
65 }
66
67
68
69
70
71
72 @Override
73 public void processAfterRetrieve() {
74 if (this.getVendorAliasName() == null) {
75 populateVendorAliasName();
76 }
77 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).processAfterRetrieve(this);
78 }
79
80 @Override
81 public List getItemsActiveOnly() {
82 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnly(this);
83 }
84
85
86
87
88
89
90 @Override
91 public List getItemsActiveOnlySetupAlternateAmount() {
92 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnlySetupAlternateAmount(this);
93 }
94
95 @Override
96 public boolean getAdditionalChargesExist() {
97 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getAdditionalChargesExist(this);
98 }
99
100
101
102
103
104
105 public boolean getIsFinalReqs() {
106 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsFinalReqs(this);
107 }
108
109 public boolean getIsSplitPO() {
110 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsSplitPO(this);
111 }
112
113 public boolean getIsReOpenPO() {
114 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsReOpenPO(this);
115 }
116
117
118
119
120
121
122 public String getBibeditorCreateURL() {
123 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorCreateURL();
124 }
125
126 public String getBibSearchURL() {
127 LOG.debug("Inside getBibSearchURL of OlePurchaseOrderCloseDocument");
128 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibSearchURL();
129 }
130
131
132
133
134
135
136 public String getBibeditorEditURL() {
137 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorEditURL();
138 }
139
140
141
142
143
144
145 public String getInstanceEditorURL() {
146 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getInstanceEditorURL();
147 }
148
149
150
151
152
153
154 public String getBibeditorViewURL() {
155 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorViewURL();
156 }
157
158
159
160
161
162
163 public String getMarcXMLFileDirLocation() throws Exception {
164 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getMarcXMLFileDirLocation();
165 }
166
167 public String getVendorPoNumber() {
168 return vendorPoNumber;
169 }
170
171 public void setVendorPoNumber(String vendorPoNumber) {
172 this.vendorPoNumber = vendorPoNumber;
173 }
174
175
176
177
178
179
180 public boolean getIsSaved() {
181 if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
182 return true;
183 }
184 return false;
185 }
186
187
188
189
190
191
192 public String getDublinEditorEditURL() {
193 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorEditURL();
194 }
195
196
197
198
199
200
201 public String getDublinEditorViewURL() {
202 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorViewURL();
203 }
204
205 public boolean getIsATypeOfRCVGDoc() {
206 return false;
207 }
208
209 public boolean getIsATypeOfCORRDoc() {
210 return false;
211 }
212
213 private void populateVendorAliasName() {
214 Map vendorDetailMap = new HashMap();
215 vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorHeaderGeneratedIdentifier());
216 vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorDetailAssignedIdentifier());
217 List<VendorAlias> vendorDetailList = (List) KRADServiceLocatorWeb.getLegacyDataAdapter().findMatching(VendorAlias.class, vendorDetailMap);
218 if (vendorDetailList != null && vendorDetailList.size() > 0) {
219 this.setVendorAliasName(vendorDetailList.get(0).getVendorAliasName());
220 }
221 }
222 }