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