View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation.
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.select.document;
17  
18  import org.apache.commons.lang.StringEscapeUtils;
19  import org.kuali.ole.docstore.discovery.service.QueryService;
20  import org.kuali.ole.docstore.discovery.service.QueryServiceImpl;
21  import org.kuali.ole.docstore.model.bo.WorkBibDocument;
22  import org.kuali.ole.docstore.model.bo.WorkInstanceDocument;
23  import org.kuali.ole.docstore.model.bo.WorkItemDocument;
24  import org.kuali.ole.docstore.model.enums.DocType;
25  import org.kuali.ole.module.purap.document.CorrectionReceivingDocument;
26  import org.kuali.ole.module.purap.document.LineItemReceivingDocument;
27  import org.kuali.ole.select.OleSelectConstant;
28  import org.kuali.ole.select.businessobject.*;
29  import org.kuali.ole.select.document.service.OleLineItemReceivingService;
30  import org.kuali.ole.select.document.service.impl.OleLineItemReceivingServiceImpl;
31  import org.kuali.ole.select.document.service.impl.OleReceivingServiceImpl;
32  import org.kuali.ole.select.service.BibInfoWrapperService;
33  import org.kuali.ole.select.service.FileProcessingService;
34  import org.kuali.ole.select.service.impl.BibInfoWrapperServiceImpl;
35  import org.kuali.ole.sys.OLEConstants;
36  import org.kuali.ole.sys.context.SpringContext;
37  import org.kuali.ole.sys.service.impl.OleParameterConstants;
38  import org.kuali.rice.core.api.config.property.ConfigurationService;
39  import org.kuali.rice.core.api.util.type.KualiDecimal;
40  import org.kuali.rice.core.api.util.type.KualiInteger;
41  import org.kuali.rice.coreservice.framework.parameter.ParameterConstants.COMPONENT;
42  import org.kuali.rice.coreservice.framework.parameter.ParameterConstants.NAMESPACE;
43  import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
44  import org.kuali.rice.krad.service.BusinessObjectService;
45  
46  import java.util.*;
47  
48  @NAMESPACE(namespace = OleParameterConstants.PURCHASING_NAMESPACE)
49  @COMPONENT(component = "CorrectionReceivingDocument")
50  public class OleCorrectionReceivingDocument extends CorrectionReceivingDocument {
51  
52      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OleCorrectionReceivingDocument.class);
53      private static transient BusinessObjectService businessObjectService;
54      private static transient OleLineItemReceivingService oleCorrectionItemReceivingService;
55  
56      public static OleLineItemReceivingService getOleCorrectionItemReceivingService() {
57          if (oleCorrectionItemReceivingService == null) {
58              oleCorrectionItemReceivingService = SpringContext.getBean(OleLineItemReceivingService.class);
59          }
60          return oleCorrectionItemReceivingService;
61      }
62  
63      public static void setOleCorrectionItemReceivingService(OleLineItemReceivingService oleLineItemReceivingService) {
64          OleCorrectionReceivingDocument.oleCorrectionItemReceivingService = oleLineItemReceivingService;
65      }
66  
67      @Override
68      public BusinessObjectService getBusinessObjectService() {
69          if (businessObjectService == null) {
70              businessObjectService = SpringContext.getBean(BusinessObjectService.class);
71          }
72          return businessObjectService;
73      }
74  
75      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
76          this.businessObjectService = businessObjectService;
77      }
78  
79      /**
80       * This method is overridden to populate Ole Correction Receiving Item from Receiving Line Item
81       *
82       * @see org.kuali.ole.module.purap.document.CorrectionReceivingDocument#populateCorrectionReceivingFromReceivingLine(org.kuali.ole.module.purap.document.LineItemReceivingDocument)
83       */
84      @Override
85      public void populateCorrectionReceivingFromReceivingLine(LineItemReceivingDocument rlDoc) {
86          LOG.debug("Inside populateCorrectionReceivingFromReceivingLine of OleCorrectionReceivingDocument");
87          //populate receiving line document from purchase order
88          this.setPurchaseOrderIdentifier(rlDoc.getPurchaseOrderIdentifier());
89          this.getDocumentHeader().setDocumentDescription(rlDoc.getDocumentHeader().getDocumentDescription());
90          this.getDocumentHeader().setOrganizationDocumentNumber(rlDoc.getDocumentHeader().getOrganizationDocumentNumber());
91          this.setAccountsPayablePurchasingDocumentLinkIdentifier(rlDoc.getAccountsPayablePurchasingDocumentLinkIdentifier());
92          this.setLineItemReceivingDocumentNumber(rlDoc.getDocumentNumber());
93  
94          //copy receiving line items
95          for (OleLineItemReceivingItem rli : (List<OleLineItemReceivingItem>) rlDoc.getItems()) {
96              OleLineItemReceivingService oleLineItemReceivingService = SpringContext.getBean(OleLineItemReceivingServiceImpl.class);
97              OleLineItemReceivingDoc oleLineItemReceivingDoc = oleLineItemReceivingService.getOleLineItemReceivingDoc(rli.getReceivingItemIdentifier());
98              rli.setItemTitleId(oleLineItemReceivingDoc.getItemTitleId());
99              this.getItems().add(new OleCorrectionReceivingItem(rli, this));
100         }
101         LOG.debug("Leaving populateCorrectionReceivingFromReceivingLine of OleCorrectionReceivingDocument");
102     }
103 
104     /**
105      * This method is overridden to set special processing notes and other types of receipt notes
106      * in two different lists to be displayed under Special Processing Notes Tab and Receipt Notes tab respectively.
107      */
108     @Override
109     public void processAfterRetrieve() {
110         try {
111             LOG.debug("Inside processAfterRetrieve of OleCorrectionReceivingDocument");
112             super.processAfterRetrieve();
113             BibInfoWrapperService docStore = SpringContext.getBean(BibInfoWrapperServiceImpl.class);
114             FileProcessingService fileProcessingService = SpringContext.getBean(FileProcessingService.class);
115             String itemDescription = "";
116             List<OleCorrectionReceivingItem> items = new ArrayList<OleCorrectionReceivingItem>();
117             items = this.getItems();
118             Iterator<OleCorrectionReceivingItem> iterator = items.iterator();
119             String titleId = null;
120             int itemCount = 0;
121             boolean isBibFileExist = false;
122             boolean isBibEdit = false;
123             List<OleCorrectionReceivingItemReceiptNotes> receiptNoteList;
124             List<OleCorrectionReceivingItemReceiptNotes> specialHandlingNoteList;
125             for (OleCorrectionReceivingItem item : items) {
126                 receiptNoteList = new ArrayList<OleCorrectionReceivingItemReceiptNotes>();
127                 specialHandlingNoteList = new ArrayList<OleCorrectionReceivingItemReceiptNotes>();
128                 List<OleCorrectionReceivingItemReceiptNotes> notes = new ArrayList<OleCorrectionReceivingItemReceiptNotes>();
129                 notes = item.getCorrectionNoteList();
130                 for (OleCorrectionReceivingItemReceiptNotes note : notes) {
131                     String noteType = note.getNoteType().getNoteType();
132                     if (noteType.equalsIgnoreCase(OLEConstants.SPECIAL_PROCESSING_INSTRUCTION_NOTE)) {
133                         specialHandlingNoteList.add(note);
134                     } else {
135                         receiptNoteList.add(note);
136                     }
137                     item.setCorrectionSpecialHandlingNoteList(specialHandlingNoteList);
138                     item.setCorrectionReceiptNoteList(receiptNoteList);
139                     item.setCorrectionReceiptNoteListSize(receiptNoteList.size());
140                 }
141                 while (iterator.hasNext()) {
142                     LOG.debug("###########inside processAfterRetrieve item loop###########");
143                     Object object = iterator.next();
144                     if (object instanceof OleCorrectionReceivingItem) {
145                         LOG.debug("###########inside processAfterRetrieve ole requisition item###########");
146                         OleCorrectionReceivingItem singleItem = (OleCorrectionReceivingItem) object;
147                         if (LOG.isDebugEnabled()) {
148                             LOG.debug("Title id while retriving ------>" + singleItem.getItemTitleId());
149                         }
150                         BibInfoBean xmlBibInfoBean = new BibInfoBean();
151                         HashMap<String, String> dataMap = new HashMap<String, String>();
152                         /***
153                          * This will check for if there is any bibmarc xml file, if it is avalailable it process the file either
154                          * create a new record or update record in docstore
155                          ***/
156                         if (singleItem.getItemTypeCode().equals(OleSelectConstant.ITEM_TYPE_CODE_ITEM)) {
157                             String fileName = this.getDocumentNumber() + "_" + itemCount;
158                             dataMap.put(OleSelectConstant.FILEPATH, getMarcXMLFileDirLocation());
159                             dataMap.put(OleSelectConstant.FILENAME, fileName);
160                             if (fileProcessingService.isCreateFileExist(dataMap)) {
161                                 isBibFileExist = false;
162                             }
163                             if (isBibFileExist) {
164                                 if (xmlBibInfoBean.getDocStoreOperation() == null) {
165                                     xmlBibInfoBean.setDocStoreOperation(OleSelectConstant.DOCSTORE_OPERATION_STAFF);
166                                 }
167                                 titleId = docStore.getTitleIdByMarcXMLFileProcessing(xmlBibInfoBean, dataMap);
168                                 if (titleId != null) {
169                                     singleItem.setItemTitleId(titleId);
170                                 }
171                             }
172                             itemCount++;
173                         }
174                         if (singleItem.getItemTitleId() == null) {
175                             singleItem.setItemTitleId(getOleCorrectionItemReceivingService().getCorrectionItemDocItemTitleId(singleItem));
176                         }
177 
178                         if (singleItem.getItemTitleId() != null) {
179                             HashMap<String, String> queryMap = new HashMap<String, String>();
180                             queryMap.put(OleSelectConstant.DocStoreDetails.ITEMLINKS_KEY, singleItem.getItemTitleId());
181                             List<DocInfoBean> docStoreResult = docStore.searchBibInfo(queryMap);
182                             Iterator<DocInfoBean> bibIdIterator = docStoreResult.iterator();
183                             if (bibIdIterator.hasNext()) {
184                                 DocInfoBean docInfoBean = bibIdIterator.next();
185                                 //singleItem.setBibUUID(docInfoBean.getUniqueId());
186                                 if (docInfoBean.getBibIdentifier() == null) {
187                                     singleItem.setBibUUID(docInfoBean.getUniqueId());
188                                 } else {
189                                     singleItem.setBibUUID(docInfoBean.getBibIdentifier());
190                                 }
191                             }
192                             dataMap.put(OleSelectConstant.DOC_CATEGORY_TYPE_INSTANCE, singleItem.getItemTitleId());
193                             dataMap.put(OleSelectConstant.DOC_CATEGORY_TYPE, OleSelectConstant.DOC_CATEGORY_TYPE_ITEMLINKS);
194                             xmlBibInfoBean = docStore.getBibInfo(dataMap);
195 
196                             singleItem.setBibInfoBean(xmlBibInfoBean);
197                             itemDescription = (singleItem.getBibInfoBean().getTitle() != null ? singleItem.getBibInfoBean().getTitle() : "") + (singleItem.getBibInfoBean().getAuthor() != null ? "," + singleItem.getBibInfoBean().getAuthor() : "") + (singleItem.getBibInfoBean().getPublisher() != null ? "," + singleItem.getBibInfoBean().getPublisher() : "") + (singleItem.getBibInfoBean().getIsbn() != null ? "," + singleItem.getBibInfoBean().getIsbn() : "");
198                             StringEscapeUtils stringEscapeUtils = new StringEscapeUtils();
199                             itemDescription = stringEscapeUtils.unescapeXml(itemDescription);
200                             singleItem.setItemDescription(itemDescription);
201                         }
202                         OleLineItemReceivingService oleLineItemReceivingService = SpringContext.getBean(OleLineItemReceivingServiceImpl.class);
203                         ;
204                         OlePurchaseOrderItem olePurchaseOrderItem = null;
205                         if (singleItem.getPurchaseOrderIdentifier() != null) {
206                             olePurchaseOrderItem = oleLineItemReceivingService.getOlePurchaseOrderItem(singleItem.getPurchaseOrderIdentifier());
207                         } else {
208                             olePurchaseOrderItem = oleLineItemReceivingService.getOlePurchaseOrderItem(getPurchaseOrderIdentifier());
209                         }
210                         if (olePurchaseOrderItem != null && olePurchaseOrderItem.getItemTitleId() != null) {
211                             singleItem.setItemTitleId(olePurchaseOrderItem.getItemTitleId());
212                         } else {
213                             singleItem.setItemTitleId(getOleCorrectionItemReceivingService()
214                                     .getCorrectionItemDocItemTitleId(singleItem));
215                         }
216 
217                         Integer rcvnitemIdentifier = item.getReceivingItemIdentifier();
218                         Map<String, Integer> recItemIdentifer = new HashMap<String, Integer>();
219                         recItemIdentifer.put(OLEConstants.RCV_LN_ITM_IDN, rcvnitemIdentifier);
220                         OleCorrectionReceivingItem oleCorrectionReceivingItems = new OleCorrectionReceivingItem();
221                         List<OleLineItemCorrectionReceivingDoc> oleLineItemCorrectionReceivingDocs = (List<OleLineItemCorrectionReceivingDoc>) getBusinessObjectService().findMatching(OleLineItemCorrectionReceivingDoc.class, recItemIdentifer);
222                         if (oleLineItemCorrectionReceivingDocs != null && oleLineItemCorrectionReceivingDocs.size() > 0) {
223                             for (int i = 0; i < oleLineItemCorrectionReceivingDocs.size(); i++) {
224                                 Integer rcvnItemIdentifier = oleLineItemCorrectionReceivingDocs.get(i).getReceivingLineItemIdentifier();
225                                 if (!rcvnItemIdentifier.equals(item.getReceivingItemIdentifier())) {
226                                     OleLineItemCorrectionReceivingDoc corr = new OleLineItemCorrectionReceivingDoc();
227                                     corr.setReceivingLineItemIdentifier(item.getReceivingItemIdentifier());
228                                     corr.setItemTitleId(item.getItemTitleId());
229                                     oleLineItemReceivingService.saveOleLineItemReceivingCorrection(corr);
230                                 }
231                             }
232                         } else {
233                             OleLineItemCorrectionReceivingDoc corr = new OleLineItemCorrectionReceivingDoc();
234                             corr.setReceivingLineItemIdentifier(item.getReceivingItemIdentifier());
235                             corr.setItemTitleId(item.getItemTitleId());
236                             oleLineItemReceivingService.saveOleLineItemReceivingCorrection(corr);
237                         }
238                         Map cpySection = new HashMap();
239                         cpySection.put("itemIdentifier", singleItem.getPurchaseOrderIdentifier());
240 
241                         List<OlePurchaseOrderItem> olePurchaseOrderItems = (List<OlePurchaseOrderItem>) getBusinessObjectService().findMatching(OlePurchaseOrderItem.class, cpySection);
242                         if (olePurchaseOrderItems.size() > 0) {
243                             for (OlePurchaseOrderItem purItem : olePurchaseOrderItems) {
244                                 singleItem.setCopyList(purItem.getCopyList());
245                             }
246                         }
247                      /*   List<OleCorrectionReceivingItem> correctionReceivingItems = this.getItems();
248                         OleLineItemReceivingDocument oleLineItemReceivingDocument =(OleLineItemReceivingDocument) this.getLineItemReceivingDocument();
249                         List<OleLineItemReceivingItem> itemReceivingItems = oleLineItemReceivingDocument.getItems();
250                         if(correctionReceivingItems.size()==itemReceivingItems.size()){
251                             for(int i=0;i<itemReceivingItems.size();i++){
252                                 correctionReceivingItems.get(i).setCopyList(itemReceivingItems.get(i).getCopyList());
253                             }
254                         }*/
255                         // Added for Jira OLE-1900 Starts
256 /*
257                         List<String> itemTitleIdsList = new ArrayList<String>();
258                         List<WorkBibDocument> workBibDocuments = new ArrayList<WorkBibDocument>();
259                         if (null != singleItem.getItemTitleId()) {
260                             itemTitleIdsList.add(singleItem.getItemTitleId());
261                             workBibDocuments = getWorkBibDocuments(itemTitleIdsList);
262                         }
263                         if (null != singleItem.getItemTitleId() && workBibDocuments.size() > 0) {
264                             *//*
265                              * if (singleItem.getItemReceivedTotalQuantity().isGreaterThan(new KualiDecimal(1)) ||
266                              * singleItem.getItemReceivedTotalParts().isGreaterThan(new KualiDecimal(1))) {
267                              *//*
268                                 for (WorkBibDocument workBibDocument : workBibDocuments) {
269                                     List<OleCopies> copies = setCopiesToLineItem(singleItem, workBibDocument);
270                                     singleItem.setCopies(copies);
271                                 }
272                             // }
273                         }*/
274 
275                         // Added for Jira OLE-1900 Ends
276                     }
277                 }
278                 LOG.debug("Leaving processAfterRetrieve of OleCorrectionReceivingDocument");
279             }
280         } catch (Exception e) {
281             LOG.error(e);
282             throw new RuntimeException(e);
283         }
284     }
285 
286     /**
287      * This method is used to get the bibedtior creat url from propertie file
288      *
289      * @return Bibeditor creat url string
290      */
291     public String getBibeditorCreateURL() {
292         String bibeditorCreateURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.BIBEDITOR_CREATE_URL_KEY);
293         return bibeditorCreateURL;
294     }
295 
296     public String getBibSearchURL() {
297         String bibSearchURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.BIBEDITOR_SEARCH_URL_KEY);
298         return bibSearchURL;
299     }
300 
301     /**
302      * This method is used to get the bibedtior edit url from propertie file
303      *
304      * @return Bibeditor edit url string
305      */
306     public String getBibeditorEditURL() {
307         String bibeditorEditURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.BIBEDITOR_URL_KEY);
308         return bibeditorEditURL;
309     }
310 
311     /**
312      * This method is used to get the bibedtior view url from propertie file
313      *
314      * @return Bibeditor view url string
315      */
316     public String getBibeditorViewURL() {
317         String bibeditorViewURL = SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.DOCSTORE_APP_URL_KEY);
318         return bibeditorViewURL;
319     }
320 
321     /**
322      * This method is used to get the directory path where the marc xml files need to be created
323      *
324      * @return Directory path string
325      */
326     public String getMarcXMLFileDirLocation() throws Exception {
327         FileProcessingService fileProcessingService = SpringContext.getBean(FileProcessingService.class);
328         String externaleDirectory = fileProcessingService.getMarcXMLFileDirLocation();
329         return externaleDirectory;
330     }
331 
332     /**
333      * This method is used to check the status of the document for displaying view and edit buttons in line item
334      *
335      * @return boolean
336      */
337     public boolean getIsSaved() {
338         if (this.getDocumentHeader().getWorkflowDocument().isSaved() || this.getDocumentHeader().getWorkflowDocument().isInitiated()) {
339             return true;
340         }
341         return false;
342     }
343 
344     @Override
345     public void doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) {
346 
347         if (this.getFinancialSystemDocumentHeader().getWorkflowDocument().isProcessed()) {
348             OleReceivingServiceImpl service = new OleReceivingServiceImpl();
349             service.completeCorrectionReceivingDocument(this);
350         }
351     }
352 
353     /**
354      * This method takes List of UUids as parameter and creates a LinkedHashMap with instance as key and id as value. and calls
355      * Docstore's QueryServiceImpl class getWorkBibRecords method and return workBibDocument for passed instance Id.
356      *
357      * @param instanceIdsList
358      * @return List<WorkBibDocument>
359      */
360     private List<WorkBibDocument> getWorkBibDocuments(List<String> instanceIdsList) {
361         List<LinkedHashMap<String, String>> instanceIdMapList = new ArrayList<LinkedHashMap<String, String>>();
362         for (String instanceId : instanceIdsList) {
363             LinkedHashMap<String, String> instanceIdMap = new LinkedHashMap<String, String>();
364             instanceIdMap.put(DocType.INSTANCE.getDescription(), instanceId);
365             instanceIdMapList.add(instanceIdMap);
366         }
367 
368         QueryService queryService = QueryServiceImpl.getInstance();
369         List<WorkBibDocument> workBibDocuments = new ArrayList<WorkBibDocument>();
370         try {
371             workBibDocuments = queryService.getWorkBibRecords(instanceIdMapList);
372         } catch (Exception ex) {
373             // TODO Auto-generated catch block
374             ex.printStackTrace();
375         }
376         return workBibDocuments;
377     }
378 
379     // Added for Jira OLE-1900 Ends
380 
381     // Added for Jira OLE-1900 Starts
382 
383     /**
384      * This method will set copies into list of copies for LineItem.
385      *
386      * @param singleItem
387      * @param workBibDocument
388      * @return
389      */
390     public List<OleCopies> setCopiesToLineItem(OleCorrectionReceivingItem singleItem, WorkBibDocument workBibDocument) {
391         List<WorkInstanceDocument> instanceDocuments = workBibDocument.getWorkInstanceDocumentList();
392         List<OleCopies> copies = new ArrayList<OleCopies>();
393         for (WorkInstanceDocument workInstanceDocument : instanceDocuments) {
394             List<WorkItemDocument> itemDocuments = workInstanceDocument.getItemDocumentList();
395             StringBuffer enumeration = new StringBuffer();
396             for (int itemDocs = 0; itemDocs < itemDocuments.size(); itemDocs++) {
397                 if (itemDocs + 1 == itemDocuments.size()) {
398                     enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration());
399                 } else {
400                     enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration() + ",");
401                 }
402 
403             }
404             int startingCopy = 0;
405             if (singleItem.getItemReceivedTotalParts().intValue() != 0 && null != enumeration) {
406                 String enumerationSplit = enumeration.substring(1, 2);
407                 boolean isint = checkIsEnumerationSplitIsIntegerOrNot(enumerationSplit);
408                 if (isint) {
409                     startingCopy = Integer.parseInt(enumerationSplit);
410                 }
411             }
412             int parts = 1;
413             if (null != singleItem.getPurchaseOrderIdentifier()) {
414                 parts = getPONoOfPartsOrdered(singleItem.getPurchaseOrderIdentifier());
415             } else {
416                 parts = singleItem.getItemReceivedTotalParts().intValue();
417             }
418             /*
419              * if (singleItem.getItemReceivedTotalQuantity().isGreaterThan(new KualiDecimal(1)) ||
420              * singleItem.getItemReceivedTotalParts().isGreaterThan(new KualiDecimal(1))) {
421              */
422             int noOfCopies = workInstanceDocument.getItemDocumentList().size()
423                     / parts;
424             OleRequisitionCopies copy = new OleRequisitionCopies();
425             copy.setParts(new KualiInteger(parts));
426             copy.setLocationCopies(workInstanceDocument.getHoldingsDocument().getLocationName());
427             copy.setItemCopies(new KualiDecimal(noOfCopies));
428             copy.setPartEnumeration(enumeration.toString());
429             copy.setStartingCopyNumber(new KualiInteger(startingCopy));
430             copies.add(copy);
431             // }
432         }
433         return copies;
434     }
435 
436     public int getPONoOfPartsOrdered(int poId) {
437         OleLineItemReceivingService oleLineItemReceivingService = SpringContext
438                 .getBean(OleLineItemReceivingServiceImpl.class);
439         OlePurchaseOrderItem olePurchaseOrderItem = oleLineItemReceivingService.getOlePurchaseOrderItem(poId);
440         return olePurchaseOrderItem.getItemNoOfParts().intValue();
441     }
442 
443     public boolean checkIsEnumerationSplitIsIntegerOrNot(String enumerationSplit) {
444         try {
445             int startingCopy = Integer.parseInt(enumerationSplit);
446         } catch (NumberFormatException e) {
447             return false;
448         }
449         return true;
450     }
451 
452     @Override
453     public void prepareForSave() {
454         items = this.getItems();
455         Iterator iterator = items.iterator();
456         HashMap dataMap = new HashMap();
457         while (iterator.hasNext()) {
458             LOG.debug("###########inside prepareForSave ole requisition item###########");
459             OleCorrectionReceivingItem singleItem = (OleCorrectionReceivingItem) iterator.next();
460             // Added for Jira OLE-1900 Starts
461             /*
462              * List<String> itemTitleIdsList = new ArrayList<String>(); List<WorkBibDocument> workBibDocuments = new
463              * ArrayList<WorkBibDocument>(); if (null != singleItem.getItemTitleId()) { if
464              * (singleItem.getItemReceivedTotalQuantity().isGreaterThan(new KualiDecimal(1)) ||
465              * singleItem.getItemReceivedTotalParts().isGreaterThan(new KualiDecimal(1))) {
466              * itemTitleIdsList.add(singleItem.getItemTitleId()); workBibDocuments = getWorkBibDocuments(itemTitleIdsList); } } try
467              * { if (null != singleItem.getItemTitleId() && workBibDocuments.size() > 0) { if
468              * (singleItem.getItemReceivedTotalQuantity().isGreaterThan(new KualiDecimal(1)) ||
469              * singleItem.getItemReceivedTotalParts().isGreaterThan(new KualiDecimal(1))) { for (WorkBibDocument workBibDocument :
470              * workBibDocuments) { OleDocstoreHelperService oleDocstoreHelperService = SpringContext
471              * .getBean(OleDocstoreHelperService.class);
472              * oleDocstoreHelperService.performDocstoreUpdationForCorrectionItem(singleItem, workBibDocument); } } } } catch
473              * (Exception e) { LOG.error("Error while persisting the copies to Docstore" + e.getMessage()); }
474              */
475 
476             // Added for Jira OLE-1900 Ends
477 
478         }
479     }
480 
481     public boolean getIsATypeOfRCVGDoc() {
482         return false;
483     }
484 
485     public boolean getIsATypeOfCORRDoc() {
486         return true;
487     }
488 
489     public boolean getIsFinalReqs() {
490         if (this.getDocumentHeader().getWorkflowDocument().isFinal()) {
491             return true;
492         }
493         return false;
494     }
495 
496 }