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