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