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.PurchaseOrderPaymentHoldDocument;
19 import org.kuali.ole.module.purap.document.RequisitionDocument;
20 import org.kuali.ole.module.purap.document.service.OlePurapService;
21 import org.kuali.ole.select.businessobject.OlePurchaseOrderItem;
22 import org.kuali.ole.select.document.service.OlePurchaseOrderDocumentHelperService;
23 import org.kuali.ole.sys.OLEConstants;
24 import org.kuali.ole.sys.context.SpringContext;
25 import org.kuali.ole.vnd.businessobject.VendorAlias;
26 import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
27
28 import java.util.HashMap;
29 import java.util.Iterator;
30 import java.util.List;
31 import java.util.Map;
32
33
34
35
36 public class OlePurchaseOrderPaymentHoldDocument extends PurchaseOrderPaymentHoldDocument {
37 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderPaymentHoldDocument.class);
38 private String vendorPoNumber;
39 private static transient OlePurapService olePurapService;
40
41 public String getVendorPoNumber() {
42 return vendorPoNumber;
43 }
44
45 public void setVendorPoNumber(String vendorPoNumber) {
46 this.vendorPoNumber = vendorPoNumber;
47 }
48
49
50
51
52 public OlePurchaseOrderPaymentHoldDocument() {
53 super();
54 }
55
56
57
58
59
60
61 @Override
62 public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
63 LOG.debug("Inside populatePurchaseOrderFromRequisition of OlePurchaseOrderPaymentHoldDocument");
64 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).populatePurchaseOrderFromRequisition(this, requisitionDocument);
65 LOG.debug("Leaving populatePurchaseOrderFromRequisition of OlePurchaseOrderPaymentHoldDocument");
66 }
67
68
69
70
71
72
73 @Override
74 public void prepareForSave(KualiDocumentEvent event) {
75 LOG.debug("Inside prepareForSave of OlePurchaseOrderPaymentHoldDocument");
76 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).prepareForSave(this, event);
77 super.prepareForSave(event);
78 }
79
80
81
82
83
84
85 @Override
86 public void processAfterRetrieve() {
87 LOG.debug("Inside processAfterRetrieve of OlePurchaseOrderPaymentHoldDocument");
88 if (this.getVendorAliasName() == null) {
89 populateVendorAliasName();
90 }
91 try {
92 List<OlePurchaseOrderItem> items = this.getItems();
93 Iterator iterator = items.iterator();
94 while (iterator.hasNext()) {
95 Object object = iterator.next();
96 if (object instanceof OlePurchaseOrderItem) {
97 OlePurchaseOrderItem singleItem = (OlePurchaseOrderItem) object;
98 if(singleItem.getCopyList().size() > 0) {
99
100 getOlePurapService().setInvoiceDocumentsForPO(this,singleItem);
101 }
102 }
103 }
104 } catch (Exception e) {
105 LOG.error("Exception in OlePurchaseOrderCloseDocument:processAfterRetrieve" + e.getMessage());
106 throw new RuntimeException(e);
107 }
108 SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).processAfterRetrieve(this);
109 LOG.debug("Leaving processAfterRetrieve of OlePurchaseOrderPaymentHoldDocument");
110 }
111
112 @Override
113 public List getItemsActiveOnly() {
114 LOG.debug("Inside getItemsActiveOnly of OlePurchaseOrderPaymentHoldDocument");
115 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnly(this);
116 }
117
118
119
120
121
122
123 @Override
124 public List getItemsActiveOnlySetupAlternateAmount() {
125 LOG.debug("Inside getItemsActiveOnlySetupAlternateAmount of OlePurchaseOrderPaymentHoldDocument");
126 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getItemsActiveOnlySetupAlternateAmount(this);
127 }
128
129 @Override
130 public boolean getAdditionalChargesExist() {
131 LOG.debug("Inside getAdditionalChargesExist of OlePurchaseOrderPaymentHoldDocument");
132 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getAdditionalChargesExist(this);
133 }
134
135
136
137
138
139
140 public boolean getIsFinalReqs() {
141 LOG.debug("Inside getIsFinalReqs of OlePurchaseOrderPaymentHoldDocument");
142
143 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsFinalReqs(this);
144 }
145
146 public boolean getIsSplitPO() {
147 LOG.debug("Inside getIsSplitPO of OlePurchaseOrderPaymentHoldDocument");
148 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsSplitPO(this);
149 }
150
151 public boolean getIsReOpenPO() {
152 LOG.debug("Inside getIsReOpenPO of OlePurchaseOrderPaymentHoldDocument");
153 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getIsReOpenPO(this);
154 }
155
156
157
158
159
160
161 public String getBibeditorCreateURL() {
162 LOG.debug("Inside getBibeditorCreateURL of OlePurchaseOrderPaymentHoldDocument");
163 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorCreateURL();
164 }
165
166 public String getBibSearchURL() {
167 LOG.debug("Inside getBibSearchURL of OlePurchaseOrderPaymentHoldDocument");
168 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibSearchURL();
169 }
170
171
172
173
174
175
176 public String getBibeditorEditURL() {
177 LOG.debug("Inside getBibeditorEditURL of OlePurchaseOrderPaymentHoldDocument");
178 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorEditURL();
179 }
180
181
182
183
184
185
186 public String getDublinEditorEditURL() {
187 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorEditURL();
188 }
189
190
191
192
193
194 public String getInstanceEditorURL() {
195 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getInstanceEditorURL();
196 }
197
198
199
200
201
202
203 public String getBibeditorViewURL() {
204 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorViewURL();
205 }
206
207
208
209
210
211
212 public String getDublinEditorViewURL() {
213 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorViewURL();
214 }
215
216
217
218
219
220 public String getMarcXMLFileDirLocation() throws Exception {
221 LOG.debug("Inside getMarcXMLFileDirLocation of OlePurchaseOrderPaymentHoldDocument");
222 return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getMarcXMLFileDirLocation();
223 }
224
225
226
227
228
229
230 public boolean getIsSaved() {
231 if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
232 return true;
233 }
234 return false;
235 }
236
237 public boolean getIsATypeOfRCVGDoc() {
238 return false;
239 }
240
241 public boolean getIsATypeOfCORRDoc() {
242 return false;
243 }
244
245 private void populateVendorAliasName() {
246 Map vendorDetailMap = new HashMap();
247 vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorHeaderGeneratedIdentifier());
248 vendorDetailMap.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER, this.getVendorDetailAssignedIdentifier());
249 List<VendorAlias> vendorDetailList = (List) getBusinessObjectService().findMatching(VendorAlias.class, vendorDetailMap);
250 if (vendorDetailList != null && vendorDetailList.size() > 0) {
251 this.setVendorAliasName(vendorDetailList.get(0).getVendorAliasName());
252 }
253 }
254
255 public static OlePurapService getOlePurapService() {
256 if (olePurapService == null) {
257 olePurapService = SpringContext.getBean(OlePurapService.class);
258 }
259 return olePurapService;
260 }
261 }