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.PurchaseOrderSplitDocument;
19  import org.kuali.ole.module.purap.document.RequisitionDocument;
20  import org.kuali.ole.select.businessobject.OlePurchaseOrderItem;
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  
35  public class OlePurchaseOrderSplitDocument extends PurchaseOrderSplitDocument {
36  
37      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OlePurchaseOrderSplitDocument.class);
38  
39      private String vendorPoNumber;
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  
53  
54      @Override
55      public void populatePurchaseOrderFromRequisition(RequisitionDocument requisitionDocument) {
56  
57          if (LOG.isDebugEnabled()) {
58              LOG.debug("Inside populatePurchaseOrderFromRequisition of OlePurchaseOrderSplitDocument");
59          }
60          SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).populatePurchaseOrderFromRequisition(this, requisitionDocument);
61      }
62  
63      
64  
65  
66  
67  
68      @Override
69      public void prepareForSave(KualiDocumentEvent event) {
70  
71          if (LOG.isDebugEnabled()) {
72              LOG.debug("Inside prepareForSave of OlePurchaseOrderSplitDocument");
73          }
74          SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).prepareForSave(this, event);
75          super.prepareForSave(event);
76  
77      }
78  
79      
80  
81  
82  
83  
84      @Override
85      public void processAfterRetrieve() {
86          if (LOG.isDebugEnabled()) {
87              LOG.debug("Inside processAfterRetrieve of OlePurchaseOrderSplitDocument");
88          }
89          if (this.getVendorAliasName() == null) {
90              populateVendorAliasName();
91          }
92          SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).processAfterRetrieve(this);
93      }
94  
95      @Override
96      public List getItemsActiveOnly() {
97          if (LOG.isDebugEnabled()) {
98              LOG.debug("Inside getItemsActiveOnly of OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
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 OlePurchaseOrderSplitDocument");
159         }
160         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorCreateURL();
161     }
162 
163     public String getBibSearchURL() {
164         LOG.debug("Inside getBibSearchURL of OlePurchaseOrderSplitDocument");
165         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibSearchURL();
166     }
167 
168     
169 
170 
171 
172 
173     public String getBibeditorEditURL() {
174         if (LOG.isDebugEnabled()) {
175             LOG.debug("Inside getBibeditorEditURL of OlePurchaseOrderSplitDocument");
176         }
177         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorEditURL();
178     }
179 
180     
181 
182 
183 
184 
185     public String getInstanceEditorURL() {
186         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getInstanceEditorURL();
187     }
188 
189     
190 
191 
192 
193 
194     public String getBibeditorViewURL() {
195         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getBibeditorViewURL();
196     }
197 
198     
199 
200 
201 
202 
203     public String getDublinEditorEditURL() {
204         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getDublinEditorEditURL();
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 
221     public String getMarcXMLFileDirLocation() throws Exception {
222         if (LOG.isDebugEnabled()) {
223             LOG.debug("Inside getMarcXMLFileDirLocation of OlePurchaseOrderSplitDocument");
224         }
225         return SpringContext.getBean(OlePurchaseOrderDocumentHelperService.class).getMarcXMLFileDirLocation();
226     }
227 
228     @Override
229     public Class getItemClass() {
230         return OlePurchaseOrderItem.class;
231     }
232 
233     
234 
235 
236 
237 
238     public boolean getIsSaved() {
239         if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
240             return true;
241         }
242         return false;
243     }
244 
245     public boolean getIsATypeOfRCVGDoc() {
246         return false;
247     }
248 
249     public boolean getIsATypeOfCORRDoc() {
250         return false;
251     }
252 
253     private void populateVendorAliasName() {
254         Map vendorDetailMap = new HashMap();
255         vendorDetailMap.put(OLEConstants.VENDOR_HEADER_IDENTIFIER, this.getVendorHeaderGeneratedIdentifier());
256         vendorDetailMap.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER, this.getVendorDetailAssignedIdentifier());
257         List<VendorAlias> vendorDetailList = (List) getBusinessObjectService().findMatching(VendorAlias.class, vendorDetailMap);
258         if (vendorDetailList != null && vendorDetailList.size() > 0) {
259             this.setVendorAliasName(vendorDetailList.get(0).getVendorAliasName());
260         }
261     }
262 }