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.businessobject;
17  
18  import org.kuali.ole.describe.bo.SearchResultDisplayRow;
19  import org.kuali.ole.docstore.common.client.DocstoreClient;
20  import org.kuali.ole.docstore.common.client.DocstoreClientLocator;
21  import org.kuali.ole.docstore.common.document.BibTree;
22  import org.kuali.ole.docstore.common.document.HoldingsTree;
23  import org.kuali.ole.docstore.common.document.Item;
24  import  org.kuali.ole.docstore.common.document.Holdings;
25  import org.kuali.ole.docstore.common.document.content.instance.Items;
26  import org.kuali.ole.docstore.common.document.content.instance.OleHoldings;
27  import org.kuali.ole.docstore.common.document.content.instance.xstream.HoldingOlemlRecordProcessor;
28  import org.kuali.ole.DocumentUniqueIDPrefix;
29  import org.kuali.ole.docstore.model.bo.WorkBibDocument;
30  import org.kuali.ole.docstore.model.bo.WorkInstanceDocument;
31  import org.kuali.ole.docstore.model.bo.WorkItemDocument;
32  import org.kuali.ole.docstore.model.enums.DocType;
33  import org.kuali.ole.module.purap.businessobject.CorrectionReceivingItem;
34  import org.kuali.ole.module.purap.businessobject.LineItemReceivingItem;
35  import org.kuali.ole.module.purap.document.CorrectionReceivingDocument;
36  import org.kuali.ole.pojo.OleOrderRecord;
37  import org.kuali.ole.select.bo.OLELinkPurapDonor;
38  import org.kuali.ole.select.document.service.OleLineItemReceivingService;
39  import org.kuali.ole.select.document.service.impl.OleLineItemReceivingServiceImpl;
40  import org.kuali.ole.select.lookup.DocData;
41  import org.kuali.ole.sys.OLEConstants;
42  import org.kuali.ole.sys.context.SpringContext;
43  import org.kuali.rice.core.api.util.type.KualiDecimal;
44  import org.kuali.rice.core.api.util.type.KualiInteger;
45  import org.kuali.rice.krad.util.ObjectUtils;
46  
47  import java.util.ArrayList;
48  import java.util.Collections;
49  import java.util.LinkedHashMap;
50  import java.util.List;
51  
52  public class OleCorrectionReceivingItem extends CorrectionReceivingItem implements OleReceivingItem {
53  
54      private Integer itemFormatId;
55      private KualiDecimal itemOriginalReceivedTotalParts;
56      private KualiDecimal itemOriginalReturnedTotalParts;
57      private KualiDecimal itemOriginalDamagedTotalParts;
58      private KualiDecimal itemReceivedTotalParts;
59      private KualiDecimal itemReturnedTotalParts;
60      private KualiDecimal itemDamagedTotalParts;
61  
62      private List<OleCorrectionReceivingItemExceptionNotes> correctionExceptionNoteList;
63      private Integer exceptionTypeId;
64      private String exceptionNotes;
65      private List<OleCorrectionReceivingItemReceiptNotes> correctionReceiptNoteList;
66      private List<OleCorrectionReceivingItemReceiptNotes> correctionNoteList;
67      private List<OleCorrectionReceivingItemReceiptNotes> correctionSpecialHandlingNoteList;
68      private Integer noteTypeId;
69      private String receiptNotes;
70      private boolean notesAck = false;
71      private Integer correctionReceiptNoteListSize;
72      private String itemTitleId;
73      private BibInfoBean bibInfoBean;
74      private String bibUUID;
75      private DocData docData;
76      private OleLineItemCorrectionReceivingDoc oleLineItemReceivingCorrection;
77      private OleOrderRecord oleOrderRecord;
78      private List<OleLineItemCorrectionReceivingDoc> oleCorrectionReceivingItemDocList;
79      private String notes;
80      /**
81       * For List of copies
82       */
83      private String donorCode;
84      private List<OLELinkPurapDonor> oleDonors=new ArrayList<>();
85      protected String localTitleId;
86      private Integer itemCopiesId;
87      private KualiInteger parts;
88      private KualiDecimal itemCopies;
89      private String partEnumeration;
90      private String locationCopies;
91      private KualiInteger startingCopyNumber;
92      private List<OleCopies> copies = new ArrayList<OleCopies>();
93      private String itemLocation;
94  
95      /**
96       * For Quantity and Parts fields As Integer
97       */
98      private KualiInteger oleItemOriginalReceivedTotalQuantity;
99      private KualiInteger oleItemOriginalReturnedTotalQuantity;
100     private KualiInteger oleItemOriginalDamagedTotalQuantity;
101     private KualiInteger oleItemReceivedTotalQuantity;
102     private KualiInteger oleItemReturnedTotalQuantity;
103     private KualiInteger oleItemDamagedTotalQuantity;
104     private KualiInteger oleItemOriginalReceivedTotalParts;
105     private KualiInteger oleItemOriginalReturnedTotalParts;
106     private KualiInteger oleItemOriginalDamagedTotalParts;
107     private KualiInteger oleItemReceivedTotalParts;
108     private KualiInteger oleItemReturnedTotalParts;
109     private KualiInteger oleItemDamagedTotalParts;
110     private String docFormat;
111     private String enumeration;
112     private String location;
113     private String copyNumber;
114     private String receiptStatus;
115     private List<OleCopy> copyList = new ArrayList<>();
116 
117     private DocstoreClientLocator docstoreClientLocator;
118     public String getDocFormat() {
119         return docFormat;
120     }
121 
122     public DocstoreClientLocator getDocstoreClientLocator() {
123 
124         if (docstoreClientLocator == null) {
125             docstoreClientLocator = SpringContext.getBean(DocstoreClientLocator.class);
126         }
127         return docstoreClientLocator;
128     }
129     public void setDocFormat(String docFormat) {
130         this.docFormat = docFormat;
131     }
132 
133     public Class getOleLineItemCorrectionDocClass() {
134         return OleLineItemCorrectionReceivingDoc.class;
135     }
136 
137     /**
138      * Default constructor.
139      */
140     public OleCorrectionReceivingItem() {
141         correctionExceptionNoteList = new ArrayList();
142         correctionReceiptNoteList = new ArrayList();
143         correctionSpecialHandlingNoteList = new ArrayList();
144         correctionNoteList = new ArrayList();
145         oleCorrectionReceivingItemDocList = new ArrayList();
146     }
147 
148     public OleCorrectionReceivingItem(CorrectionReceivingDocument rld) {
149         oleCorrectionReceivingItemDocList = new ArrayList();
150     }
151 
152     public String getLocalTitleId() {
153         return localTitleId;
154     }
155 
156     public void setLocalTitleId(String localTitleId) {
157         this.localTitleId = localTitleId;
158     }
159 
160     /**
161      * Constructs a OleCorrectionReceivingItem with default values for parts attributes.
162      *
163      * @param rli
164      * @param rcd
165      */
166     public OleCorrectionReceivingItem(LineItemReceivingItem rli, CorrectionReceivingDocument rcd) {
167         super(rli, rcd);
168 
169         OleLineItemReceivingItem oleRli = (OleLineItemReceivingItem) rli;
170         this.setItemFormatId(oleRli.getOleFormatId());
171         this.setItemOriginalReceivedTotalParts(oleRli.getItemReceivedTotalParts());
172         this.setItemOriginalReturnedTotalParts(oleRli.getItemReturnedTotalParts());
173         this.setItemOriginalDamagedTotalParts(oleRli.getItemDamagedTotalParts());
174         this.setOleDonors(oleRli.getOleDonors());
175         this.setItemReceivedTotalParts(oleRli.getItemReceivedTotalParts());
176         this.setItemReturnedTotalParts(oleRli.getItemReturnedTotalParts());
177         this.setItemDamagedTotalParts(oleRli.getItemDamagedTotalParts());
178         this.setItemTitleId(oleRli.getItemTitleId());
179         if (oleRli.getItemTitleId() != null) {
180             this.setDocFormat(DocumentUniqueIDPrefix.getBibFormatType(oleRli.getItemTitleId()));
181         }
182         String titleId = oleRli.getItemTitleId();
183         OleLineItemReceivingService oleLineItemReceivingService = SpringContext.getBean(OleLineItemReceivingServiceImpl.class);
184         if (titleId == null) {
185             OlePurchaseOrderItem olePurchaseOrderItem = oleLineItemReceivingService.getOlePurchaseOrderItem(oleRli.getPurchaseOrderIdentifier());
186             this.setItemTitleId(olePurchaseOrderItem.getItemTitleId());
187         }
188         OleLineItemCorrectionReceivingDoc oleLineItemCorrectionReceivingDoc = new OleLineItemCorrectionReceivingDoc();
189         oleLineItemCorrectionReceivingDoc.setReceivingLineItemIdentifier(this.getReceivingItemIdentifier());
190         oleLineItemCorrectionReceivingDoc.setItemTitleId(oleRli.getItemTitleId());
191         oleCorrectionReceivingItemDocList = oleLineItemCorrectionReceivingDoc.getItemTitleId() != null ? Collections.singletonList(oleLineItemCorrectionReceivingDoc) : new ArrayList();
192 
193 
194         correctionExceptionNoteList = new ArrayList();
195         correctionReceiptNoteList = new ArrayList();
196         correctionSpecialHandlingNoteList = new ArrayList();
197         correctionNoteList = new ArrayList();
198 
199         if (oleRli.getNoteList() != null && oleRli.getNoteList().size() > 0) {
200             List receiptNoteList = new ArrayList();
201             List specialHandlingNoteList = new ArrayList();
202             List noteList = new ArrayList();
203             for (OleLineItemReceivingReceiptNotes receiveNotes : oleRli.getNoteList()) {
204                 OleCorrectionReceivingItemReceiptNotes receiptNote = new OleCorrectionReceivingItemReceiptNotes(receiveNotes);
205                 receiptNote.setCorrectionReceivingItem(this);
206                 receiptNote.setNoteType(receiveNotes.getNoteType());
207                 String note = receiptNote.getNoteType().getNoteType();
208                 if (note.equalsIgnoreCase(OLEConstants.SPECIAL_PROCESSING_INSTRUCTION_NOTE)) {
209                     specialHandlingNoteList.add(receiptNote);
210                 } else {
211                     receiptNoteList.add(receiptNote);
212                 }
213                 noteList.add(receiptNote);
214             }
215             this.setCorrectionSpecialHandlingNoteList(specialHandlingNoteList);
216             this.setCorrectionReceiptNoteList(receiptNoteList);
217             this.setCorrectionReceiptNoteListSize(receiptNoteList.size());
218             this.setCorrectionNoteList(noteList);
219         }
220 
221         if (oleRli.getExceptionNoteList() != null && oleRli.getExceptionNoteList().size() > 0) {
222             List exceptionNoteList = new ArrayList();
223             for (OleReceivingLineExceptionNotes receiveExceptionNotes : oleRli.getExceptionNoteList()) {
224                 OleCorrectionReceivingItemExceptionNotes exceptionNotes = new OleCorrectionReceivingItemExceptionNotes(receiveExceptionNotes);
225                 exceptionNotes.setReceivingLineItem(oleRli);
226                 exceptionNotes.setExceptionType(receiveExceptionNotes.getExceptionType());
227                 exceptionNoteList.add(exceptionNotes);
228             }
229             this.setCorrectionExceptionNoteList(exceptionNoteList);
230         }
231         this.setPurchaseOrderIdentifier(rli.getPurchaseOrderIdentifier());
232         BibTree bibTree=new BibTree();
233         if (null != this.itemTitleId) {
234             //List<String> itemTitleIdsList = new ArrayList<String>();
235 
236             //itemTitleIdsList.add(this.itemTitleId);
237             try{
238             bibTree = getDocstoreClientLocator().getDocstoreClient().retrieveBibTree(this.itemTitleId);
239             }
240             catch (Exception e) {
241                 e.printStackTrace();
242             }
243 
244         }
245         if (null != this.itemTitleId ) {
246             if (this.getItemReceivedTotalQuantity().isGreaterThan(new KualiDecimal(1))
247                     || this.getItemReceivedTotalParts().isGreaterThan(new KualiDecimal(1))) {
248                     List<OleCopies> copies = setCopiesToLineItem(bibTree);
249                     this.setCopies(copies);
250                     this.setItemReceivedTotalQuantity(oleRli.getItemReceivedTotalQuantity());
251                     this.setItemReceivedTotalParts(oleRli.getItemReceivedTotalParts());
252 
253             }
254         }
255         this.setCopyList(oleRli.getCopyList());
256         // this.setCopies(oleRli.getCopies());
257     }
258 
259     /**
260      * Overridden method to check if atleast one parts or quantity related item is entered.
261      *
262      * @see org.kuali.ole.module.purap.businessobject.ReceivingItemBase#isConsideredEntered()
263      */
264     @Override
265     public boolean isConsideredEntered() {
266         boolean isConsideredEntered = super.isConsideredEntered();
267         isConsideredEntered |= !((ObjectUtils.isNull(this.getItemReceivedTotalParts()) || this.getItemReceivedTotalParts().isZero()) &&
268                 (ObjectUtils.isNull(this.getItemDamagedTotalParts()) || this.getItemDamagedTotalParts().isZero()) &&
269                 (ObjectUtils.isNull(this.getItemReturnedTotalParts()) || this.getItemReturnedTotalParts().isZero()));
270         return isConsideredEntered;
271     }
272 
273     public Integer getItemFormatId() {
274         return itemFormatId;
275     }
276 
277     public void setItemFormatId(Integer itemFormatId) {
278         this.itemFormatId = itemFormatId;
279     }
280 
281 
282     public List<OleLineItemCorrectionReceivingDoc> getOleCorrectionReceivingItemDocList() {
283         return oleCorrectionReceivingItemDocList;
284     }
285 
286     public void setOleCorrectionReceivingItemDocList(List<OleLineItemCorrectionReceivingDoc> oleCorrectionReceivingItemDocList) {
287         this.oleCorrectionReceivingItemDocList = oleCorrectionReceivingItemDocList;
288     }
289 
290     public String getDonorCode() {
291         return donorCode;
292     }
293 
294     public void setDonorCode(String donorCode) {
295         this.donorCode = donorCode;
296     }
297 
298     public List<OLELinkPurapDonor> getOleDonors() {
299         return oleDonors;
300     }
301 
302     public void setOleDonors(List<OLELinkPurapDonor> oleDonors) {
303         this.oleDonors = oleDonors;
304     }
305 
306     /**
307      * Gets the itemOriginalReceivedTotalParts attribute value.
308      *
309      * @return Returns the itemOriginalReceivedTotalParts.
310      */
311     @Override
312     public KualiDecimal getItemOriginalReceivedTotalParts() {
313         return itemOriginalReceivedTotalParts;
314     }
315 
316     /**
317      * Sets the itemOriginalReceivedTotalParts attribute value.
318      *
319      * @param itemOriginalReceivedTotalParts to set.
320      */
321     @Override
322     public void setItemOriginalReceivedTotalParts(KualiDecimal itemOriginalReceivedTotalParts) {
323         this.itemOriginalReceivedTotalParts = itemOriginalReceivedTotalParts;
324     }
325 
326     /**
327      * Gets the itemOriginalReturnedTotalParts attribute value.
328      *
329      * @return Returns the itemOriginalReturnedTotalParts.
330      */
331     @Override
332     public KualiDecimal getItemOriginalReturnedTotalParts() {
333         return itemOriginalReturnedTotalParts;
334     }
335 
336     /**
337      * Sets the itemOriginalReturnedTotalParts attribute value.
338      *
339      * @param itemOriginalReturnedTotalParts to set.
340      */
341     @Override
342     public void setItemOriginalReturnedTotalParts(KualiDecimal itemOriginalReturnedTotalParts) {
343         this.itemOriginalReturnedTotalParts = itemOriginalReturnedTotalParts;
344     }
345 
346     /**
347      * Gets the itemOriginalDamagedTotalParts attribute value.
348      *
349      * @return Returns the itemOriginalDamagedTotalParts.
350      */
351     @Override
352     public KualiDecimal getItemOriginalDamagedTotalParts() {
353         return itemOriginalDamagedTotalParts;
354     }
355 
356     /**
357      * Sets the itemOriginalDamagedTotalParts attribute value.
358      *
359      * @param itemOriginalDamagedTotalParts to set.
360      */
361     @Override
362     public void setItemOriginalDamagedTotalParts(KualiDecimal itemOriginalDamagedTotalParts) {
363         this.itemOriginalDamagedTotalParts = itemOriginalDamagedTotalParts;
364     }
365 
366     /**
367      * Gets the parts received attribute value.
368      *
369      * @return Returns the itemReceivedTotalParts.
370      */
371     @Override
372     public KualiDecimal getItemReceivedTotalParts() {
373         return itemReceivedTotalParts;
374     }
375 
376     /**
377      * Sets the parts received attribute value.
378      *
379      * @param itemReceivedTotalParts to set.
380      */
381     @Override
382     public void setItemReceivedTotalParts(KualiDecimal itemReceivedTotalParts) {
383         this.itemReceivedTotalParts = itemReceivedTotalParts;
384     }
385 
386     /**
387      * Gets the parts returned attribute value.
388      *
389      * @return Returns the itemReturnedTotalParts.
390      */
391     @Override
392     public KualiDecimal getItemReturnedTotalParts() {
393         return itemReturnedTotalParts;
394     }
395 
396     /**
397      * Sets the parts returned attribute value.
398      *
399      * @param itemReturnedTotalParts to set.
400      */
401     @Override
402     public void setItemReturnedTotalParts(KualiDecimal itemReturnedTotalParts) {
403         this.itemReturnedTotalParts = itemReturnedTotalParts;
404     }
405 
406     /**
407      * Gets the parts damaged attribute value.
408      *
409      * @return Returns the itemDamagedTotalParts.
410      */
411     @Override
412     public KualiDecimal getItemDamagedTotalParts() {
413         return itemDamagedTotalParts;
414     }
415 
416     /**
417      * Sets the parts damaged attribute value.
418      *
419      * @param itemDamagedTotalParts to set.
420      */
421     @Override
422     public void setItemDamagedTotalParts(KualiDecimal itemDamagedTotalParts) {
423         this.itemDamagedTotalParts = itemDamagedTotalParts;
424     }
425 
426     /**
427      * Gets list of OleCorrectionReceivingItemExceptionNotes.
428      *
429      * @return correctionExceptionNoteList.
430      */
431     public List<OleCorrectionReceivingItemExceptionNotes> getCorrectionExceptionNoteList() {
432         return correctionExceptionNoteList;
433     }
434 
435     /**
436      * Sets list of OleCorrectionReceivingItemExceptionNotes.
437      *
438      * @param exceptionNoteList to set.
439      */
440     public void setCorrectionExceptionNoteList(List<OleCorrectionReceivingItemExceptionNotes> correctionExceptionNoteList) {
441         this.correctionExceptionNoteList = correctionExceptionNoteList;
442     }
443 
444     /**
445      * Gets exception type id.
446      *
447      * @return exceptionTypeId.
448      */
449     public Integer getExceptionTypeId() {
450         return exceptionTypeId;
451     }
452 
453     /**
454      * Sets exception type id.
455      *
456      * @param exceptionTypeId to set.
457      */
458     public void setExceptionTypeId(Integer exceptionTypeId) {
459         this.exceptionTypeId = exceptionTypeId;
460     }
461 
462     /**
463      * Gets exception notes.
464      *
465      * @return exceptionNotes.
466      */
467     public String getExceptionNotes() {
468         return exceptionNotes;
469     }
470 
471     /**
472      * Sets exception notes.
473      *
474      * @param exceptionNotes to set.
475      */
476     public void setExceptionNotes(String exceptionNotes) {
477         this.exceptionNotes = exceptionNotes;
478     }
479 
480     /**
481      * This method returns OleReceivingLineExceptionNotes class
482      *
483      * @return Class
484      */
485     public Class getExceptionNotesClass() {
486         return OleCorrectionReceivingItemExceptionNotes.class;
487     }
488 
489     /**
490      * This method adds OleCorrectionReceivingItemExceptionNotes to the exceptioNoteList.
491      *
492      * @param exceptionNotes
493      */
494     public void addExceptionNote(OleCorrectionReceivingItemExceptionNotes exceptionNotes) {
495         correctionExceptionNoteList.add(exceptionNotes);
496 
497     }
498 
499     /**
500      * This method deletes exception note from exceptionNoteList at specified index.
501      *
502      * @param lineNum
503      */
504     public void deleteExceptionNote(int lineNum) {
505         correctionExceptionNoteList.remove(lineNum);
506 
507     }
508 
509     /**
510      * Gets list of OleCorrectionReceivingItemReceiptNotes.
511      *
512      * @return correctionReceiptNoteList.
513      */
514     public List<OleCorrectionReceivingItemReceiptNotes> getCorrectionReceiptNoteList() {
515         return correctionReceiptNoteList;
516     }
517 
518     /**
519      * Sets list of OleCorrectionReceivingItemReceiptNotes.
520      *
521      * @param correctionReceiptNoteList to set.
522      */
523     public void setCorrectionReceiptNoteList(List<OleCorrectionReceivingItemReceiptNotes> correctionReceiptNoteList) {
524         this.correctionReceiptNoteList = correctionReceiptNoteList;
525     }
526 
527     /**
528      * Gets note type id.
529      *
530      * @return noteTypeId.
531      */
532     public Integer getNoteTypeId() {
533         return noteTypeId;
534     }
535 
536     /**
537      * Sets note type id.
538      *
539      * @param noteTypeId to set.
540      */
541     public void setNoteTypeId(Integer noteTypeId) {
542         this.noteTypeId = noteTypeId;
543     }
544 
545     /**
546      * Gets receipt notes.
547      *
548      * @return receiptNotes.
549      */
550     public String getReceiptNotes() {
551         return receiptNotes;
552     }
553 
554     /**
555      * Sets receipt notes.
556      *
557      * @param receiptNotes to set.
558      */
559     public void setReceiptNotes(String receiptNotes) {
560         this.receiptNotes = receiptNotes;
561     }
562 
563     /**
564      * This method returns OleLineItemReceivingReceiptNotes class
565      *
566      * @return Class
567      */
568     public Class getReceiptNotesClass() {
569         return OleCorrectionReceivingItemReceiptNotes.class;
570     }
571 
572     /**
573      * This method adds OleLineItemReceivingReceiptNotes to the receiptNoteList.
574      *
575      * @param receiptNotes
576      */
577     public void addReceiptNote(OleCorrectionReceivingItemReceiptNotes receiptNotes) {
578         correctionReceiptNoteList.add(receiptNotes);
579 
580     }
581 
582     /**
583      * This method deletes receipt note from receiptNoteList at specified index.
584      *
585      * @param lineNum
586      */
587     public void deleteReceiptNote(int lineNum) {
588         correctionReceiptNoteList.remove(lineNum);
589 
590     }
591 
592     /**
593      * Gets list of Special Handling Notes.
594      *
595      * @return correctionSpecialHandlingNoteList.
596      */
597     public List<OleCorrectionReceivingItemReceiptNotes> getCorrectionSpecialHandlingNoteList() {
598         return correctionSpecialHandlingNoteList;
599     }
600 
601     /**
602      * Sets list of Special Handling Notes.
603      *
604      * @param correctionSpecialHandlingNoteList.
605      *
606      */
607     public void setCorrectionSpecialHandlingNoteList(List<OleCorrectionReceivingItemReceiptNotes> specialHandlingNoteList) {
608         this.correctionSpecialHandlingNoteList = specialHandlingNoteList;
609     }
610 
611     /**
612      * Gets acknowledgement flag for special handling notes
613      *
614      * @return notesAck
615      */
616     public boolean isNotesAck() {
617         return notesAck;
618     }
619 
620     /**
621      * Sets acknowledgement flag for special handling notes
622      *
623      * @param notesAck
624      */
625     public void setNotesAck(boolean notesAck) {
626         this.notesAck = notesAck;
627     }
628 
629     /**
630      * Gets list of OleLineItemReceivingReceiptNotes.
631      *
632      * @return noteList.
633      */
634     public List<OleCorrectionReceivingItemReceiptNotes> getCorrectionNoteList() {
635         return correctionNoteList;
636     }
637 
638     /**
639      * Sets list of OleLineItemReceivingReceiptNotes.
640      *
641      * @param noteList to set.
642      */
643     public void setCorrectionNoteList(List<OleCorrectionReceivingItemReceiptNotes> correctionNoteList) {
644         this.correctionNoteList = correctionNoteList;
645     }
646 
647     /**
648      * This method adds OleLineItemReceivingReceiptNotes to the noteList.
649      *
650      * @param receiptNotes
651      */
652     public void addNote(OleCorrectionReceivingItemReceiptNotes receiptNotes) {
653         correctionNoteList.add(receiptNotes);
654     }
655 
656     /**
657      * This method deletes receipt note from noteList at specified index.
658      *
659      * @param lineNum
660      */
661     public void deleteNote(int lineNum) {
662         correctionNoteList.remove(lineNum);
663 
664     }
665 
666     /**
667      * Gets size of receipt notes list retrived from database
668      *
669      * @return correctionReceiptNoteListSize
670      */
671     public Integer getCorrectionReceiptNoteListSize() {
672         return correctionReceiptNoteListSize;
673     }
674 
675     /**
676      * Sets size of receipt notes list retrived from database
677      *
678      * @param correctionReceiptNoteListSize
679      */
680     public void setCorrectionReceiptNoteListSize(Integer correctionReceiptNoteListSize) {
681         this.correctionReceiptNoteListSize = correctionReceiptNoteListSize;
682     }
683 
684     public String getItemTitleId() {
685         return itemTitleId;
686     }
687 
688     public void setItemTitleId(String itemTitleId) {
689         this.itemTitleId = itemTitleId;
690     }
691 
692     public BibInfoBean getBibInfoBean() {
693         return bibInfoBean;
694     }
695 
696     public void setBibInfoBean(BibInfoBean bibInfoBean) {
697         this.bibInfoBean = bibInfoBean;
698     }
699 
700     public String getBibUUID() {
701         return bibUUID;
702     }
703 
704     public void setBibUUID(String bibUUID) {
705         this.bibUUID = bibUUID;
706     }
707 
708     public DocData getDocData() {
709         return docData;
710     }
711 
712     public void setDocData(DocData docData) {
713         this.docData = docData;
714     }
715 
716     public OleLineItemCorrectionReceivingDoc getOleLineItemReceivingCorrection() {
717         return oleLineItemReceivingCorrection;
718     }
719 
720     public void setOleLineItemReceivingCorrection(OleLineItemCorrectionReceivingDoc oleLineItemReceivingCorrection) {
721         this.oleLineItemReceivingCorrection = oleLineItemReceivingCorrection;
722     }
723 
724     public OleOrderRecord getOleOrderRecord() {
725         return oleOrderRecord;
726     }
727 
728     public void setOleOrderRecord(OleOrderRecord oleOrderRecord) {
729         this.oleOrderRecord = oleOrderRecord;
730     }
731 
732     /**
733      * Gets the itemCopiesId attribute.
734      *
735      * @return Returns the itemCopiesId.
736      */
737     public Integer getItemCopiesId() {
738         return itemCopiesId;
739     }
740 
741     /**
742      * Sets the itemCopiesId attribute value.
743      *
744      * @param itemCopiesId The itemCopiesId to set.
745      */
746     public void setItemCopiesId(Integer itemCopiesId) {
747         this.itemCopiesId = itemCopiesId;
748     }
749 
750     /**
751      * Gets the parts attribute.
752      *
753      * @return Returns the parts.
754      */
755     public KualiInteger getParts() {
756         return parts;
757     }
758 
759     /**
760      * Sets the parts attribute value.
761      *
762      * @param parts The parts to set.
763      */
764     public void setParts(KualiInteger parts) {
765         this.parts = parts;
766     }
767 
768     /**
769      * Gets the itemCopies attribute.
770      *
771      * @return Returns the itemCopies.
772      */
773     public KualiDecimal getItemCopies() {
774         return itemCopies;
775     }
776 
777     /**
778      * Sets the itemCopies attribute value.
779      *
780      * @param itemCopies The itemCopies to set.
781      */
782     public void setItemCopies(KualiDecimal itemCopies) {
783         this.itemCopies = itemCopies;
784     }
785 
786     /**
787      * Gets the partEnumeration attribute.
788      *
789      * @return Returns the partEnumeration.
790      */
791     public String getPartEnumeration() {
792         return partEnumeration;
793     }
794 
795     /**
796      * Sets the partEnumeration attribute value.
797      *
798      * @param partEnumeration The partEnumeration to set.
799      */
800     public void setPartEnumeration(String partEnumeration) {
801         this.partEnumeration = partEnumeration;
802     }
803 
804     /**
805      * Gets the locationCopies attribute.
806      *
807      * @return Returns the locationCopies.
808      */
809     public String getLocationCopies() {
810         return locationCopies;
811     }
812 
813     /**
814      * Sets the locationCopies attribute value.
815      *
816      * @param locationCopies The locationCopies to set.
817      */
818     public void setLocationCopies(String locationCopies) {
819         this.locationCopies = locationCopies;
820     }
821 
822     /**
823      * Gets the startingCopyNumber attribute.
824      *
825      * @return Returns the startingCopyNumber.
826      */
827     public KualiInteger getStartingCopyNumber() {
828         return startingCopyNumber;
829     }
830 
831     /**
832      * Sets the startingCopyNumber attribute value.
833      *
834      * @param startingCopyNumber The startingCopyNumber to set.
835      */
836     public void setStartingCopyNumber(KualiInteger startingCopyNumber) {
837         this.startingCopyNumber = startingCopyNumber;
838     }
839 
840     /**
841      * Gets the copies attribute.
842      *
843      * @return Returns the copies.
844      */
845     public List<OleCopies> getCopies() {
846         return copies;
847     }
848 
849     /**
850      * Sets the copies attribute value.
851      *
852      * @param copies The copies to set.
853      */
854     public void setCopies(List<OleCopies> copies) {
855         this.copies = copies;
856     }
857 
858     /**
859      * Gets the notes attribute.
860      *
861      * @return Returns the notes.
862      */
863     public String getNotes() {
864         return notes;
865     }
866 
867     /**
868      * Sets the notes attribute value.
869      *
870      * @param notes The notes to set.
871      */
872     public void setNotes(String notes) {
873         this.notes = notes;
874     }
875 
876     /**
877      * Gets the itemLocation attribute.
878      *
879      * @return Returns the itemLocation.
880      */
881     public String getItemLocation() {
882         return itemLocation;
883     }
884 
885     /**
886      * Sets the itemLocation attribute value.
887      *
888      * @param itemLocation The itemLocation to set.
889      */
890     public void setItemLocation(String itemLocation) {
891         this.itemLocation = itemLocation;
892     }
893 
894     /**
895      * This method takes List of UUids as parameter and creates a LinkedHashMap with instance as key and id as value. and calls
896      * Docstore's QueryServiceImpl class getWorkBibRecords method and return workBibDocument for passed instance Id.
897      *
898      * @param instanceIdsList
899      * @return List<WorkBibDocument>
900      */
901 
902 
903     // Modified for Jira OLE-1900 Starts
904 
905     /**
906      * This method will set copies into list of copies for LineItem.
907      *
908      * @param singleItem
909      * @param workBibDocument
910      * @return
911      */
912     /*public List<OleCopies> setCopiesToLineItem(WorkBibDocument workBibDocument) {
913         List<WorkInstanceDocument> instanceDocuments = workBibDocument.getWorkInstanceDocumentList();
914         List<OleCopies> copies = new ArrayList<OleCopies>();
915         for (WorkInstanceDocument workInstanceDocument : instanceDocuments) {
916             List<WorkItemDocument> itemDocuments = workInstanceDocument.getItemDocumentList();
917             StringBuffer enumeration = new StringBuffer();
918             for (int itemDocs = 0; itemDocs < itemDocuments.size(); itemDocs++) {
919                 if (itemDocs + 1 == itemDocuments.size()) {
920                     enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration());
921                 } else {
922                     enumeration = enumeration.append(itemDocuments.get(itemDocs).getEnumeration() + ",");
923                 }
924 
925             }
926             int startingCopy = 0;
927             if (this.getItemReturnedTotalParts().intValue() != 0 && null != enumeration) {
928                 String enumerationSplit = enumeration.substring(1, 2);
929                 boolean isint = checkIsEnumerationSplitIsIntegerOrNot(enumerationSplit);
930                 if (isint) {
931                     startingCopy = Integer.parseInt(enumerationSplit);
932                 }
933             }
934             int noOfCopies = workInstanceDocument.getItemDocumentList().size()
935                     / this.getItemReceivedTotalParts().intValue();
936             OleRequisitionCopies copy = new OleRequisitionCopies();
937             copy.setParts(new KualiInteger(this.getItemReceivedTotalParts().intValue()));
938             copy.setLocationCopies(workInstanceDocument.getHoldingsDocument().getLocationName());
939             copy.setItemCopies(new KualiDecimal(noOfCopies));
940             copy.setPartEnumeration(enumeration.toString());
941             copy.setStartingCopyNumber(new KualiInteger(startingCopy));
942             copies.add(copy);
943             // }
944         }
945         return copies;
946     }
947 */
948     public List<OleCopies> setCopiesToLineItem(BibTree bibTree) {
949        List<HoldingsTree> holdingsTreeList= bibTree.getHoldingsTrees();
950         List<OleCopies> copies = new ArrayList<OleCopies>();
951         for (HoldingsTree holdingsTree : holdingsTreeList) {
952             OleHoldings oleHoldings=new OleHoldings();
953             HoldingOlemlRecordProcessor holdingOlemlRecordProcessor=new HoldingOlemlRecordProcessor();
954             oleHoldings=(OleHoldings)holdingOlemlRecordProcessor.fromXML(holdingsTree.getHoldings().getContent());
955             List<Item> items = holdingsTree.getItems();
956             StringBuffer enumeration = new StringBuffer();
957             for (int itemDocs = 0; itemDocs < items.size(); itemDocs++) {
958                 if (itemDocs + 1 == items.size()) {
959                     enumeration = enumeration.append(items.get(itemDocs).getEnumeration());
960                 } else {
961                     enumeration = enumeration.append(items.get(itemDocs).getEnumeration() + ",");
962                 }
963 
964             }
965             int startingCopy = 0;
966             if (this.getItemReturnedTotalParts().intValue() != 0 && null != enumeration) {
967                 String enumerationSplit = enumeration.substring(1, 2);
968                 boolean isint = checkIsEnumerationSplitIsIntegerOrNot(enumerationSplit);
969                 if (isint) {
970                     startingCopy = Integer.parseInt(enumerationSplit);
971                 }
972             }
973             int noOfCopies = holdingsTree.getItems().size()
974                     / this.getItemReceivedTotalParts().intValue();
975             OleRequisitionCopies copy = new OleRequisitionCopies();
976             copy.setParts(new KualiInteger(this.getItemReceivedTotalParts().intValue()));
977             copy.setLocationCopies(oleHoldings.getLocation().getLocationLevel().getName());
978             copy.setItemCopies(new KualiDecimal(noOfCopies));
979             copy.setPartEnumeration(enumeration.toString());
980             copy.setStartingCopyNumber(new KualiInteger(startingCopy));
981             copies.add(copy);
982             // }
983         }
984         return copies;
985     }
986 
987     /**
988      * Gets the oleItemOriginalReceivedTotalQuantity attribute.
989      *
990      * @return Returns the oleItemOriginalReceivedTotalQuantity.
991      */
992     public KualiInteger getOleItemOriginalReceivedTotalQuantity() {
993         return new KualiInteger(super.getItemOriginalReceivedTotalQuantity().intValue());
994     }
995 
996     /**
997      * Sets the oleItemOriginalReceivedTotalQuantity attribute value.
998      *
999      * @param oleItemOriginalReceivedTotalQuantity
1000      *         The oleItemOriginalReceivedTotalQuantity to set.
1001      */
1002     public void setOleItemOriginalReceivedTotalQuantity(KualiInteger oleItemOriginalReceivedTotalQuantity) {
1003         super.setItemOriginalReceivedTotalQuantity(new KualiDecimal(oleItemOriginalReceivedTotalQuantity.intValue()));
1004     }
1005 
1006     /**
1007      * Gets the oleItemOriginalReturnedTotalQuantity attribute.
1008      *
1009      * @return Returns the oleItemOriginalReturnedTotalQuantity.
1010      */
1011     public KualiInteger getOleItemOriginalReturnedTotalQuantity() {
1012         return new KualiInteger(super.getItemOriginalReturnedTotalQuantity().intValue());
1013     }
1014 
1015     /**
1016      * Sets the oleItemOriginalReturnedTotalQuantity attribute value.
1017      *
1018      * @param oleItemOriginalReturnedTotalQuantity
1019      *         The oleItemOriginalReturnedTotalQuantity to set.
1020      */
1021     public void setOleItemOriginalReturnedTotalQuantity(KualiInteger oleItemOriginalReturnedTotalQuantity) {
1022         super.setItemOriginalReturnedTotalQuantity(new KualiDecimal(oleItemOriginalReturnedTotalQuantity.intValue()));
1023     }
1024 
1025     /**
1026      * Gets the oleItemOriginalDamagedTotalQuantity attribute.
1027      *
1028      * @return Returns the oleItemOriginalDamagedTotalQuantity.
1029      */
1030     public KualiInteger getOleItemOriginalDamagedTotalQuantity() {
1031         return new KualiInteger(super.getItemOriginalDamagedTotalQuantity().intValue());
1032     }
1033 
1034     /**
1035      * Sets the oleItemOriginalDamagedTotalQuantity attribute value.
1036      *
1037      * @param oleItemOriginalDamagedTotalQuantity
1038      *         The oleItemOriginalDamagedTotalQuantity to set.
1039      */
1040     public void setOleItemOriginalDamagedTotalQuantity(KualiInteger oleItemOriginalDamagedTotalQuantity) {
1041         super.setItemOriginalDamagedTotalQuantity(new KualiDecimal(oleItemOriginalDamagedTotalQuantity.intValue()));
1042     }
1043 
1044     /**
1045      * Gets the oleItemReceivedTotalQuantity attribute.
1046      *
1047      * @return Returns the oleItemReceivedTotalQuantity.
1048      */
1049     public KualiInteger getOleItemReceivedTotalQuantity() {
1050         return new KualiInteger(super.getItemReceivedTotalQuantity().intValue());
1051     }
1052 
1053     /**
1054      * Sets the oleItemReceivedTotalQuantity attribute value.
1055      *
1056      * @param oleItemReceivedTotalQuantity The oleItemReceivedTotalQuantity to set.
1057      */
1058     public void setOleItemReceivedTotalQuantity(KualiInteger oleItemReceivedTotalQuantity) {
1059         super.setItemReceivedTotalQuantity(new KualiDecimal(oleItemReceivedTotalQuantity.intValue()));
1060     }
1061 
1062     /**
1063      * Gets the oleItemReturnedTotalQuantity attribute.
1064      *
1065      * @return Returns the oleItemReturnedTotalQuantity.
1066      */
1067     public KualiInteger getOleItemReturnedTotalQuantity() {
1068         return new KualiInteger(super.getItemReturnedTotalQuantity().intValue());
1069     }
1070 
1071     /**
1072      * Sets the oleItemReturnedTotalQuantity attribute value.
1073      *
1074      * @param oleItemReturnedTotalQuantity The oleItemReturnedTotalQuantity to set.
1075      */
1076     public void setOleItemReturnedTotalQuantity(KualiInteger oleItemReturnedTotalQuantity) {
1077         super.setItemReturnedTotalQuantity(new KualiDecimal(oleItemReturnedTotalQuantity.intValue()));
1078     }
1079 
1080     /**
1081      * Gets the oleItemDamagedTotalQuantity attribute.
1082      *
1083      * @return Returns the oleItemDamagedTotalQuantity.
1084      */
1085     public KualiInteger getOleItemDamagedTotalQuantity() {
1086         return new KualiInteger(super.getItemDamagedTotalQuantity().intValue());
1087     }
1088 
1089     /**
1090      * Sets the oleItemDamagedTotalQuantity attribute value.
1091      *
1092      * @param oleItemDamagedTotalQuantity The oleItemDamagedTotalQuantity to set.
1093      */
1094     public void setOleItemDamagedTotalQuantity(KualiInteger oleItemDamagedTotalQuantity) {
1095         super.setItemDamagedTotalQuantity(new KualiDecimal(oleItemDamagedTotalQuantity.intValue()));
1096     }
1097 
1098     /**
1099      * Gets the oleItemOriginalReceivedTotalParts attribute.
1100      *
1101      * @return Returns the oleItemOriginalReceivedTotalParts.
1102      */
1103     public KualiInteger getOleItemOriginalReceivedTotalParts() {
1104         return new KualiInteger(getItemOriginalReceivedTotalParts().intValue());
1105     }
1106 
1107     /**
1108      * Sets the oleItemOriginalReceivedTotalParts attribute value.
1109      *
1110      * @param oleItemOriginalReceivedTotalParts
1111      *         The oleItemOriginalReceivedTotalParts to set.
1112      */
1113     public void setOleItemOriginalReceivedTotalParts(KualiInteger oleItemOriginalReceivedTotalParts) {
1114         setItemOriginalReceivedTotalParts(new KualiDecimal(oleItemOriginalReceivedTotalParts.intValue()));
1115     }
1116 
1117     /**
1118      * Gets the oleItemOriginalReturnedTotalParts attribute.
1119      *
1120      * @return Returns the oleItemOriginalReturnedTotalParts.
1121      */
1122     public KualiInteger getOleItemOriginalReturnedTotalParts() {
1123         return new KualiInteger(getItemOriginalReturnedTotalParts().intValue());
1124     }
1125 
1126     /**
1127      * Sets the oleItemOriginalReturnedTotalParts attribute value.
1128      *
1129      * @param oleItemOriginalReturnedTotalParts
1130      *         The oleItemOriginalReturnedTotalParts to set.
1131      */
1132     public void setOleItemOriginalReturnedTotalParts(KualiInteger oleItemOriginalReturnedTotalParts) {
1133         setItemOriginalReturnedTotalParts(new KualiDecimal(oleItemOriginalReturnedTotalParts.intValue()));
1134     }
1135 
1136     /**
1137      * Gets the oleItemOriginalDamagedTotalParts attribute.
1138      *
1139      * @return Returns the oleItemOriginalDamagedTotalParts.
1140      */
1141     public KualiInteger getOleItemOriginalDamagedTotalParts() {
1142         return new KualiInteger(getItemOriginalDamagedTotalParts().intValue());
1143     }
1144 
1145     /**
1146      * Sets the oleItemOriginalDamagedTotalParts attribute value.
1147      *
1148      * @param oleItemOriginalDamagedTotalParts
1149      *         The oleItemOriginalDamagedTotalParts to set.
1150      */
1151     public void setOleItemOriginalDamagedTotalParts(KualiInteger oleItemOriginalDamagedTotalParts) {
1152         setItemOriginalDamagedTotalParts(new KualiDecimal(oleItemOriginalDamagedTotalParts.intValue()));
1153     }
1154 
1155     /**
1156      * Gets the oleItemReceivedTotalParts attribute.
1157      *
1158      * @return Returns the oleItemReceivedTotalParts.
1159      */
1160     public KualiInteger getOleItemReceivedTotalParts() {
1161         return new KualiInteger(getItemReceivedTotalParts().intValue());
1162     }
1163 
1164     /**
1165      * Sets the oleItemReceivedTotalParts attribute value.
1166      *
1167      * @param oleItemReceivedTotalParts The oleItemReceivedTotalParts to set.
1168      */
1169     public void setOleItemReceivedTotalParts(KualiInteger oleItemReceivedTotalParts) {
1170         setItemReceivedTotalParts(new KualiDecimal(oleItemReceivedTotalParts.intValue()));
1171     }
1172 
1173     /**
1174      * Gets the oleItemReturnedTotalParts attribute.
1175      *
1176      * @return Returns the oleItemReturnedTotalParts.
1177      */
1178     public KualiInteger getOleItemReturnedTotalParts() {
1179         return new KualiInteger(getItemReturnedTotalParts().intValue());
1180     }
1181 
1182     /**
1183      * Sets the oleItemReturnedTotalParts attribute value.
1184      *
1185      * @param oleItemReturnedTotalParts The oleItemReturnedTotalParts to set.
1186      */
1187     public void setOleItemReturnedTotalParts(KualiInteger oleItemReturnedTotalParts) {
1188         setItemReturnedTotalParts(new KualiDecimal(oleItemReturnedTotalParts.intValue()));
1189     }
1190 
1191     /**
1192      * Gets the oleItemDamagedTotalParts attribute.
1193      *
1194      * @return Returns the oleItemDamagedTotalParts.
1195      */
1196     public KualiInteger getOleItemDamagedTotalParts() {
1197         return new KualiInteger(getItemDamagedTotalParts().intValue());
1198     }
1199 
1200     /**
1201      * Sets the oleItemDamagedTotalParts attribute value.
1202      *
1203      * @param oleItemDamagedTotalParts The oleItemDamagedTotalParts to set.
1204      */
1205     public void setOleItemDamagedTotalParts(KualiInteger oleItemDamagedTotalParts) {
1206         setItemDamagedTotalParts(new KualiDecimal(oleItemDamagedTotalParts.intValue()));
1207     }
1208 
1209     public boolean checkIsEnumerationSplitIsIntegerOrNot(String enumerationSplit) {
1210         try {
1211             int startingCopy = Integer.parseInt(enumerationSplit);
1212         } catch (NumberFormatException e) {
1213             return false;
1214         }
1215         return true;
1216     }
1217 
1218     // Modified for Jira OLE-1900 Starts
1219 
1220 
1221     public String getEnumeration() {
1222         return enumeration;
1223     }
1224 
1225     public void setEnumeration(String enumeration) {
1226         this.enumeration = enumeration;
1227     }
1228 
1229     public String getLocation() {
1230         return location;
1231     }
1232 
1233     public void setLocation(String location) {
1234         this.location = location;
1235     }
1236 
1237     public String getCopyNumber() {
1238         return copyNumber;
1239     }
1240 
1241     public void setCopyNumber(String copyNumber) {
1242         this.copyNumber = copyNumber;
1243     }
1244 
1245     public String getReceiptStatus() {
1246         return receiptStatus;
1247     }
1248 
1249     public void setReceiptStatus(String receiptStatus) {
1250         this.receiptStatus = receiptStatus;
1251     }
1252 
1253     public List<OleCopy> getCopyList() {
1254         return copyList;
1255     }
1256 
1257     public void setCopyList(List<OleCopy> copyList) {
1258         this.copyList = copyList;
1259     }
1260 }