View Javadoc
1   package org.kuali.ole.docstore.common.document;
2   
3   import com.thoughtworks.xstream.converters.ConversionException;
4   import org.apache.commons.lang3.StringUtils;
5   import org.apache.log4j.Logger;
6   import org.kuali.ole.docstore.common.document.content.enums.DocCategory;
7   import org.kuali.ole.docstore.common.document.content.enums.DocFormat;
8   import org.kuali.ole.docstore.common.document.content.enums.DocType;
9   import org.kuali.ole.docstore.common.document.content.instance.*;
10  import org.kuali.ole.docstore.common.document.content.instance.xstream.ItemOlemlRecordProcessor;
11  import org.kuali.ole.docstore.common.document.factory.JAXBContextFactory;
12  
13  import javax.xml.bind.Marshaller;
14  import javax.xml.bind.Unmarshaller;
15  import javax.xml.bind.annotation.*;
16  import javax.xml.transform.stream.StreamSource;
17  import java.io.ByteArrayInputStream;
18  import java.io.StringWriter;
19  import java.util.ArrayList;
20  import java.util.List;
21  import java.util.Map;
22  
23  
24  /**
25   * <p>Java class for item complex type.
26   * <p/>
27   * <p>The following schema fragment specifies the expected content contained within this class.
28   * <p/>
29   * <pre>
30   * &lt;complexType name="item">
31   *   &lt;complexContent>
32   *     &lt;extension base="{}docstoreDocument">
33   *       &lt;sequence>
34   *         &lt;element name="callNumberType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
35   *         &lt;element name="callNumberPrefix" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
36   *         &lt;element name="itemStatus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
37   *         &lt;element name="volumeNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
38   *         &lt;element name="itemType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
39   *         &lt;element name="locationName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
40   *         &lt;element name="chronology" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
41   *         &lt;element name="enumeration" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
42   *         &lt;element name="copyNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
43   *         &lt;element name="barcode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
44   *         &lt;element name="shelvingOrder" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
45   *         &lt;element name="location" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
46   *         &lt;element name="callNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
47   *         &lt;element name="holding" type="{}holdings" minOccurs="0"/>
48   *       &lt;/sequence>
49   *     &lt;/extension>
50   *   &lt;/complexContent>
51   * &lt;/complexType>
52   * </pre>
53   */
54  @XmlAccessorType(XmlAccessType.FIELD)
55  @XmlType(name = "item", propOrder = {
56          "callNumberType",
57          "callNumberPrefix",
58          "itemStatus",
59          "volumeNumber",
60          "itemType",
61          "locationName",
62          "chronology",
63          "enumeration",
64          "copyNumber",
65          "barcode",
66          "shelvingOrder",
67          "location",
68          "callNumber",
69          "holding",
70          "isAnalytic",
71          "holdings"
72  })
73  @XmlRootElement(name = "itemDoc")
74  
75  public class Item
76          extends DocstoreDocument implements Comparable<Item> {
77  
78      private static final Logger LOG = Logger.getLogger(Item.class);
79      public static final String CALL_NUMBER = "CALLNUMBER";
80      public static final String CALL_NUMBER_TYPE = "CALLNUMBERTYPE";
81      public static final String CALL_NUMBER_PREFIX = "CALLNUMBERPREFIX";
82      public static final String HOLDINGS_CALL_NUMBER = "HOLDINGSCALLNUMBER";
83      public static final String HOLDINGS_CALL_NUMBER_TYPE = "HOLDINGSCALLNUMBERTYPE";
84      public static final String HOLDINGS_CALL_NUMBER_PREFIX = "HOLDINGSCALLNUMBERPREFIX";
85      public static final String LOCATION = "LOCATION";
86      public static final String HOLDINGS_LOCATION_LEVEL1 = "HOLDINGSLOCATIONLEVEL1";
87      public static final String HOLDINGS_LOCATION_LEVEL2 = "HOLDINGSLOCATIONLEVEL2";
88      public static final String HOLDINGS_LOCATION_LEVEL3 = "HOLDINGSLOCATIONLEVEL3";
89      public static final String HOLDINGS_LOCATION_LEVEL4 = "HOLDINGSLOCATIONLEVEL4";
90      public static final String HOLDINGS_LOCATION_LEVEL5 = "HOLDINGSLOCATIONLEVEL5";
91      public static final String VENDOR_LINE_ITEM_IDENTIFIER = "VENDORLINEITEMIDENTIFIER";
92      public static final String SHELVING_ORDER = "SHELVINGORDER";
93      public static final String ITEM_BARCODE = "ITEMBARCODE";
94      public static final String COPY_NUMBER = "COPYNUMBER";
95      public static final String HOLDINGS_COPY_NUMBER = "HOLDINGSCOPYNUMBER";
96      public static final String ENUMERATION = "ENUMERATION";
97      public static final String CHRONOLOGY = "CHRONOLOGY";
98      public static final String ITEM_TYPE = "ITEMTYPE";
99      public static final String VOLUME_NUMBER = "VOLUMENUMBER";
100     public static final String ITEM_STATUS = "ITEMSTATUS";
101     public static final String ITEMIDENTIFIER = "ITEMIDENTIFIER";
102     public static final String DONOR_CODE = "DONORCODE";
103     public static final String DONOR_NOTE = "DONORNOTE";
104     public static final String DONOR_PUBLIC = "DONORPUBLICDISPLAY";
105     public static final String DESTINATION_FIELD_ITEM_ITEM_BARCODE = "Item Barcode";
106     public static final String DESTINATION_FIELD_CALL_NUMBER = "Call Number";
107     public static final String DESTINATION_FIELD_COPY_NUMBER = "Copy Number";
108     public static final String DESTINATION_FIELD_CALL_NUMBER_TYPE = "Call Number Type";
109     public static final String DESTINATION_FIELD_CALL_NUMBER_TYPE_PREFIX = "Call Number Prefix";
110     public static final String DESTINATION_ITEM_TYPE = "Item Type";
111     public static final String DESTINATION_ITEM_STATUS = "Item Status";
112     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER = "Holdings Call Number";
113     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_TYPE = "Holdings Call Number Type";
114     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_COPY_NUMBER = "Holdings Copy Number";
115     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_PREFIX = "Holdings Call Number Prefix";
116     public static final String DESTINATION_FIELD_LOCATION_LEVEL_1 = "Location Level1";
117     public static final String DESTINATION_FIELD_LOCATION_LEVEL_2 = "Location Level2";
118     public static final String DESTINATION_FIELD_LOCATION_LEVEL_3 = "Location Level3";
119     public static final String DESTINATION_FIELD_LOCATION_LEVEL_4 = "Location Level4";
120     public static final String DESTINATION_FIELD_LOCATION_LEVEL_5 = "Location Level5";
121     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_1 = "Holdings Location Level1";
122     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_2 = "Holdings Location Level2";
123     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_3 = "Holdings Location Level3";
124     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_4 = "Holdings Location Level4";
125     public static final String DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_5 = "Holdings Location Level5";
126     public static final String DESTINATION_FIELD_ITEM_VENDOR_LINE_ITEM_IDENTIFIER = "Vendor Line Item Identifier";
127     public static final String DUE_DATE_TIME = "DUE_DATE_TIME";
128     public static final String NO_OF_RENEWAL = "NO_OF_RENEWAL";
129 
130     @XmlTransient
131     private String holdingsCallNumber;
132     @XmlTransient
133     private String holdingsCallNumberType;
134     @XmlTransient
135     private String holdingsCopyNumber;
136     @XmlTransient
137     private String holdingsCallNumberPrefix;
138     @XmlTransient
139     private String holdingsLocationLevel1;
140     @XmlTransient
141     private String holdingsLocationLevel2;
142     @XmlTransient
143     private String holdingsLocationLevel3;
144     @XmlTransient
145     private String holdingsLocationLevel4;
146     @XmlTransient
147     private String holdingsLocationLevel5;
148 
149 
150     @XmlTransient
151     protected boolean dataMappingFlag;
152 
153     public boolean isDataMappingFlag() {
154         return dataMappingFlag;
155     }
156 
157     public void setDataMappingFlag(boolean dataMappingFlag) {
158         this.dataMappingFlag = dataMappingFlag;
159     }
160 
161     protected String callNumberType;
162     protected String callNumberPrefix;
163     protected String itemStatus;
164     protected String volumeNumber;
165     protected String itemType;
166     protected String locationName;
167     protected String chronology;
168     protected String enumeration;
169     protected String copyNumber;
170     protected String barcode;
171     protected String shelvingOrder;
172     protected String location;
173     protected String callNumber;
174     @XmlElement(name = "holdingsDoc")
175     protected Holdings holding;
176     @XmlElement(name = "holdingsDocs")
177     protected List<Holdings> holdings;
178     protected boolean isAnalytic = false;
179     @XmlTransient
180     protected String locationLevel1;
181     @XmlTransient
182     protected String locationLevel2;
183     @XmlTransient
184     protected String locationLevel3;
185     @XmlTransient
186     protected String locationLevel4;
187     @XmlTransient
188     protected String locationLevel5;
189 
190     @XmlTransient
191     protected String level1Location;
192     @XmlTransient
193     protected String level2Location;
194     @XmlTransient
195     protected String level3Location;
196     @XmlTransient
197     protected String level4Location;
198     @XmlTransient
199     protected String level5Location;
200 
201     public String getLevel1Location() {
202         return level1Location;
203     }
204 
205     public void setLevel1Location(String level1Location) {
206         this.level1Location = level1Location;
207     }
208 
209     public String getLevel5Location() {
210         return level5Location;
211     }
212 
213     public void setLevel5Location(String level5Location) {
214         this.level5Location = level5Location;
215     }
216 
217     public String getLevel4Location() {
218         return level4Location;
219     }
220 
221     public void setLevel4Location(String level4Location) {
222         this.level4Location = level4Location;
223     }
224 
225     public String getLevel3Location() {
226         return level3Location;
227     }
228 
229     public void setLevel3Location(String level3Location) {
230         this.level3Location = level3Location;
231     }
232 
233     public String getLevel2Location() {
234         return level2Location;
235     }
236 
237     public void setLevel2Location(String level2Location) {
238         this.level2Location = level2Location;
239     }
240 
241     public Item() {
242         category = DocCategory.WORK.getCode();
243         type = DocType.ITEM.getCode();
244         format = DocFormat.OLEML.getCode();
245     }
246 
247     public String getLocationLevel1() {
248         return locationLevel1;
249     }
250 
251     public void setLocationLevel1(String locationLevel1) {
252         this.locationLevel1 = locationLevel1;
253     }
254 
255     public String getLocationLevel2() {
256         return locationLevel2;
257     }
258 
259     public void setLocationLevel2(String locationLevel2) {
260         this.locationLevel2 = locationLevel2;
261     }
262 
263     public String getLocationLevel3() {
264         return locationLevel3;
265     }
266 
267     public void setLocationLevel3(String locationLevel3) {
268         this.locationLevel3 = locationLevel3;
269     }
270 
271     public String getLocationLevel4() {
272         return locationLevel4;
273     }
274 
275     public void setLocationLevel4(String locationLevel4) {
276         this.locationLevel4 = locationLevel4;
277     }
278 
279     public String getLocationLevel5() {
280 
281         return locationLevel5;
282     }
283 
284     public void setLocationLevel5(String locationLevel5) {
285         this.locationLevel5 = locationLevel5;
286     }
287 
288     /**
289      * Gets the value of the callNumberType property.
290      *
291      * @return possible object is
292      *         {@link String }
293      */
294     public String getCallNumberType() {
295         return callNumberType;
296     }
297 
298     /**
299      * Sets the value of the callNumberType property.
300      *
301      * @param value allowed object is
302      *              {@link String }
303      */
304     public void setCallNumberType(String value) {
305         this.callNumberType = value;
306     }
307 
308     /**
309      * Gets the value of the callNumberPrefix property.
310      *
311      * @return possible object is
312      *         {@link String }
313      */
314     public String getCallNumberPrefix() {
315         return callNumberPrefix;
316     }
317 
318     /**
319      * Sets the value of the callNumberPrefix property.
320      *
321      * @param value allowed object is
322      *              {@link String }
323      */
324     public void setCallNumberPrefix(String value) {
325         this.callNumberPrefix = value;
326     }
327 
328     /**
329      * Gets the value of the itemStatus property.
330      *
331      * @return possible object is
332      *         {@link String }
333      */
334     public String getItemStatus() {
335         return itemStatus;
336     }
337 
338     /**
339      * Sets the value of the itemStatus property.
340      *
341      * @param value allowed object is
342      *              {@link String }
343      */
344     public void setItemStatus(String value) {
345         this.itemStatus = value;
346     }
347 
348     /**
349      * Gets the value of the volumeNumber property.
350      *
351      * @return possible object is
352      *         {@link String }
353      */
354     public String getVolumeNumber() {
355         return volumeNumber;
356     }
357 
358     /**
359      * Sets the value of the volumeNumber property.
360      *
361      * @param value allowed object is
362      *              {@link String }
363      */
364     public void setVolumeNumber(String value) {
365         this.volumeNumber = value;
366     }
367 
368     /**
369      * Gets the value of the itemType property.
370      *
371      * @return possible object is
372      *         {@link String }
373      */
374     public String getItemType() {
375         return itemType;
376     }
377 
378     /**
379      * Sets the value of the itemType property.
380      *
381      * @param value allowed object is
382      *              {@link String }
383      */
384     public void setItemType(String value) {
385         this.itemType = value;
386     }
387 
388     /**
389      * Gets the value of the locationName property.
390      *
391      * @return possible object is
392      *         {@link String }
393      */
394     public String getLocationName() {
395         return locationName;
396     }
397 
398     /**
399      * Sets the value of the locationName property.
400      *
401      * @param value allowed object is
402      *              {@link String }
403      */
404     public void setLocationName(String value) {
405         this.locationName = value;
406     }
407 
408     /**
409      * Gets the value of the chronology property.
410      *
411      * @return possible object is
412      *         {@link String }
413      */
414     public String getChronology() {
415         return chronology;
416     }
417 
418     /**
419      * Sets the value of the chronology property.
420      *
421      * @param value allowed object is
422      *              {@link String }
423      */
424     public void setChronology(String value) {
425         this.chronology = value;
426     }
427 
428     /**
429      * Gets the value of the enumeration property.
430      *
431      * @return possible object is
432      *         {@link String }
433      */
434     public String getEnumeration() {
435         return enumeration;
436     }
437 
438     /**
439      * bib.java
440      * Sets the value of the enumeration property.
441      *
442      * @param value allowed object is
443      *              {@link String }
444      */
445     public void setEnumeration(String value) {
446         this.enumeration = value;
447     }
448 
449     /**
450      * Gets the value of the copyNumber property.
451      *
452      * @return possible object is
453      *         {@link String }
454      */
455     public String getCopyNumber() {
456         return copyNumber;
457     }
458 
459     /**
460      * Sets the value of the copyNumber property.
461      *
462      * @param value allowed object is
463      *              {@link String }
464      */
465     public void setCopyNumber(String value) {
466         this.copyNumber = value;
467     }
468 
469     /**
470      * Gets the value of the barcode property.
471      *
472      * @return possible object is
473      *         {@link String }
474      */
475     public String getBarcode() {
476         return barcode;
477     }
478 
479     /**
480      * Sets the value of the barcode property.
481      *
482      * @param value allowed object is
483      *              {@link String }
484      */
485     public void setBarcode(String value) {
486         this.barcode = value;
487     }
488 
489     /**
490      * Gets the value of the shelvingOrder property.
491      *
492      * @return possible object is
493      *         {@link String }
494      */
495     public String getShelvingOrder() {
496         return shelvingOrder;
497     }
498 
499     /**
500      * Sets the value of the shelvingOrder property.
501      *
502      * @param value allowed object is
503      *              {@link String }
504      */
505     public void setShelvingOrder(String value) {
506         this.shelvingOrder = value;
507     }
508 
509     /**
510      * Gets the value of the location property.
511      *
512      * @return possible object is
513      *         {@link String }
514      */
515     public String getLocation() {
516         return location;
517     }
518 
519     /**
520      * Sets the value of the location property.
521      *
522      * @param value allowed object is
523      *              {@link String }
524      */
525     public void setLocation(String value) {
526         this.location = value;
527     }
528 
529     /**
530      * Gets the value of the callNumber property.
531      *
532      * @return possible object is
533      *         {@link String }
534      */
535     public String getCallNumber() {
536         return callNumber;
537     }
538 
539     /**
540      * Sets the value of the callNumber property.
541      *
542      * @param value allowed object is
543      *              {@link String }
544      */
545     public void setCallNumber(String value) {
546         this.callNumber = value;
547     }
548 
549     /**
550      * Gets the value of the holding property.
551      *
552      * @return possible object is
553      *         {@link Holdings }
554      */
555     public Holdings getHolding() {
556         return holding;
557     }
558 
559     /**
560      * Sets the value of the holding property.
561      *
562      * @param value allowed object is
563      *              {@link Holdings }
564      */
565     public void setHolding(Holdings value) {
566         this.holding = value;
567     }
568 
569     public boolean isAnalytic() {
570         return isAnalytic;
571     }
572 
573     public void setAnalytic(boolean analytic) {
574         isAnalytic = analytic;
575     }
576 
577     public List<Holdings> getHoldings() {
578         return holdings;
579     }
580 
581     public void setHoldings(List<Holdings> holdings) {
582         this.holdings = holdings;
583     }
584 
585     @Override
586     public String serialize(Object object) {
587         String result = null;
588         Item item = (Item) object;
589         try {
590             StringWriter sw = new StringWriter();
591             Marshaller jaxbMarshaller = JAXBContextFactory.getInstance().getMarshaller(Item.class);
592             synchronized (jaxbMarshaller) {
593             jaxbMarshaller.marshal(item, sw);
594             }
595             result = sw.toString();
596         } catch (Exception e) {
597             LOG.error("Exception ", e);
598         }
599         return result;
600     }
601 
602     @Override
603     public Object deserialize(String content) {
604         Item item = new Item();
605         try {
606             Unmarshaller unmarshaller = JAXBContextFactory.getInstance().getUnMarshaller(Item.class);
607             ByteArrayInputStream input = new ByteArrayInputStream(content.getBytes("UTF-8"));
608             synchronized (unmarshaller) {
609                 item = unmarshaller.unmarshal(new StreamSource(input), Item.class).getValue();
610             }
611         } catch (Exception e) {
612             LOG.error("Exception ", e);
613         }
614         return item;
615     }
616 
617     @Override
618     public Object deserializeContent(Object object) {
619 
620 
621         return null;  //To change body of implemented methods use File | Settings | File Templates.
622     }
623 
624     @Override
625     public Object deserializeContent(String content) {
626         return null;  //To change body of implemented methods use File | Settings | File Templates.
627     }
628 
629     @Override
630     public String serializeContent(Object object) {
631         if (object == null) {
632             object = getContentObject();
633         }
634         LocationLevel locationLevel1 = new LocationLevel();
635         LocationLevel locationLevel2 = new LocationLevel();
636         LocationLevel locationLevel3 = new LocationLevel();
637         LocationLevel locationLevel4 = new LocationLevel();
638         LocationLevel locationLevel5 = new LocationLevel();
639 
640         locationLevel1.setName(getLocationLevel1());
641         locationLevel2.setName(getLocationLevel2());
642         locationLevel3.setName(getLocationLevel3());
643         locationLevel4.setName(getLocationLevel4());
644         locationLevel5.setName(getLocationLevel5());
645         locationLevel1.setLocationLevel(locationLevel2);
646         locationLevel2.setLocationLevel(locationLevel3);
647         locationLevel3.setLocationLevel(locationLevel4);
648         locationLevel4.setLocationLevel(locationLevel5);
649         Location locationPojo = new Location();
650         locationPojo.setLocationLevel(locationLevel1);
651         org.kuali.ole.docstore.common.document.content.instance.Item itemPojo = (org.kuali.ole.docstore.common.document.content.instance.Item) object;
652         itemPojo.setLocation(locationPojo);
653         ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
654         String itemXml = itemOlemlRecordProcessor.toXML(itemPojo);
655         return itemXml;
656     }
657 
658     public void serializeContent() {
659         if (contentObject == null) {
660             return;
661         }
662         Location locationPojo = buildLocationObj();
663         org.kuali.ole.docstore.common.document.content.instance.Item itemPojo = (org.kuali.ole.docstore.common.document.content.instance.Item) contentObject;
664         itemPojo.setLocation(locationPojo);
665         ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
666         content = itemOlemlRecordProcessor.toXML(itemPojo);
667     }
668 
669     public void setField(String docField, String fieldValue) {
670         org.kuali.ole.docstore.common.document.content.instance.Item itemPojo = (org.kuali.ole.docstore.common.document.content.instance.Item) getContentObject();
671 
672 
673         if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_ITEM_BARCODE)) {
674             if (itemPojo.getAccessInformation() == null) {
675                 AccessInformation accessInformation = new AccessInformation();
676                 itemPojo.setAccessInformation(accessInformation);
677             }
678             itemPojo.getAccessInformation().setBarcode(fieldValue);
679         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER)) {
680 
681             buildItemCallNumber(itemPojo);
682             itemPojo.getCallNumber().setNumber(fieldValue);
683             String callNumberType = itemPojo.getCallNumber().getShelvingScheme().getCodeValue();
684             if(StringUtils.isEmpty(callNumberType) || callNumberType.equals(NO_INFO_CALL_NUMBER_TYPE_CODE)) {
685                 itemPojo.getCallNumber().getShelvingScheme().setCodeValue("NONE");
686             }
687         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER_TYPE)) {
688             buildItemCallNumber(itemPojo);
689             itemPojo.getCallNumber().getShelvingScheme().setCodeValue(fieldValue);
690             setDataMappingFlag(true);
691         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER_TYPE_PREFIX)) {
692             buildItemCallNumber(itemPojo);
693             itemPojo.getCallNumber().setPrefix(fieldValue);
694         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_COPY_NUMBER)) {
695             itemPojo.setCopyNumber(fieldValue);
696         } else if (docField.equalsIgnoreCase(DESTINATION_ITEM_TYPE)) {
697             ItemType itemType1 = new ItemType();
698             itemType1.setCodeValue(fieldValue);
699             itemPojo.setItemType(itemType1);
700         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER)) {
701             setHoldingsCallNumber(fieldValue);
702         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_1)) {
703             setLocationLevel1(fieldValue);
704         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_2)) {
705             setLocationLevel2(fieldValue);
706         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_3)) {
707             setLocationLevel3(fieldValue);
708         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_4)) {
709             setLocationLevel4(fieldValue);
710         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_5)) {
711             setLocationLevel5(fieldValue);
712         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_TYPE)) {
713             setHoldingsCallNumberType(fieldValue);
714         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_1)) {
715             setHoldingsLocationLevel1(fieldValue);
716         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_2)) {
717             setHoldingsLocationLevel2(fieldValue);
718         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_3)) {
719             setHoldingsLocationLevel3(fieldValue);
720         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_4)) {
721             setHoldingsLocationLevel4(fieldValue);
722         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_5)) {
723             setHoldingsLocationLevel5(fieldValue);
724         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_COPY_NUMBER)) {
725             setHoldingsCopyNumber(fieldValue);
726         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_PREFIX)) {
727             setHoldingsCallNumberPrefix(fieldValue);
728         } else if (docField.equalsIgnoreCase(DESTINATION_ITEM_STATUS)) {
729             ItemStatus itemStatus1 = new ItemStatus();
730             itemStatus1.setCodeValue(fieldValue);
731             itemPojo.setItemStatus(itemStatus1);
732         } else if (docField.equalsIgnoreCase(ENUMERATION)) {
733             itemPojo.setEnumeration(fieldValue);
734         } else if (docField.equalsIgnoreCase(CHRONOLOGY)) {
735             itemPojo.setChronology(fieldValue);
736         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_VENDOR_LINE_ITEM_IDENTIFIER)) {
737             itemPojo.setVendorLineItemIdentifier(fieldValue);
738         } else if (docField.equalsIgnoreCase(DUE_DATE_TIME)) {
739             itemPojo.setDueDateTime(fieldValue);
740         } else if (docField.equalsIgnoreCase(NO_OF_RENEWAL)) {
741             itemPojo.setNumberOfRenew(Integer.valueOf(fieldValue));
742         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_CODE) || docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_PUBLIC_DISPLAY) || docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_NOTE)) {
743             DonorInfo donorInfo = null;
744             if (itemPojo.getDonorInfo() != null && itemPojo.getDonorInfo().size() > 0) {
745                 for (DonorInfo existingDonorInfo : itemPojo.getDonorInfo()) {
746                   buildDonorInfo(docField, fieldValue, itemPojo, existingDonorInfo, false);
747                 }
748             } else {
749                 donorInfo = new DonorInfo();
750                 buildDonorInfo(docField, fieldValue, itemPojo, donorInfo, false);
751             }
752         }
753     }
754 
755     private void buildDonorInfo(String docField, String fieldValue, org.kuali.ole.docstore.common.document.content.instance.Item itemPojo, DonorInfo donorInfo, boolean isDefault) {
756         if (docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_CODE)) {
757             if (donorInfo.getDonorCode() == null) {
758                 donorInfo.setDonorCode(fieldValue);
759             } else if (!isDefault) {
760                 donorInfo.setDonorCode(fieldValue);
761             }
762         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_PUBLIC_DISPLAY)) {
763             if (donorInfo.getDonorPublicDisplay() == null) {
764                 donorInfo.setDonorPublicDisplay(fieldValue);
765             } else if (!isDefault) {
766                 donorInfo.setDonorPublicDisplay(fieldValue);
767             }
768         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_NOTE)) {
769             if (donorInfo.getDonorNote() == null) {
770                 donorInfo.setDonorNote(fieldValue);
771             } else if (!isDefault) {
772                 donorInfo.setDonorNote(fieldValue);
773             }
774         }
775         if (itemPojo.getDonorInfo() == null || itemPojo.getDonorInfo().size() == 0) {
776             itemPojo.getDonorInfo().add(donorInfo);
777         }
778     }
779 
780     private void buildItemCallNumber(org.kuali.ole.docstore.common.document.content.instance.Item itemPojo) {
781         if (itemPojo.getCallNumber() == null) {
782             CallNumber callNumberPojo = new CallNumber();
783             ShelvingOrder shelvingOrder1 = new ShelvingOrder();
784             ShelvingScheme shelvingScheme1 = new ShelvingScheme();
785             callNumberPojo.setShelvingScheme(shelvingScheme1);
786             callNumberPojo.setShelvingOrder(shelvingOrder1);
787             itemPojo.setCallNumber(callNumberPojo);
788         } else {
789             if (itemPojo.getCallNumber().getShelvingOrder() == null) {
790                 ShelvingOrder shelvingOrder1 = new ShelvingOrder();
791                 itemPojo.getCallNumber().setShelvingOrder(shelvingOrder1);
792             }
793             if (itemPojo.getCallNumber().getShelvingScheme() == null) {
794                 ShelvingScheme shelvingScheme1 = new ShelvingScheme();
795                 itemPojo.getCallNumber().setShelvingScheme(shelvingScheme1);
796             }
797         }
798     }
799 
800     public Object getContentObject() {
801         if (contentObject == null) {
802             contentObject = new org.kuali.ole.docstore.common.document.content.instance.Item();
803             if (content != null) {
804                 ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
805                 contentObject = itemOlemlRecordProcessor.fromXML(content);
806             }
807         }
808         return contentObject;
809     }
810 
811 
812     public  Location buildLocationObj() {
813 
814         LocationLevel locationLevel1 = new LocationLevel();
815         locationLevel1.setName(getLocationLevel1());
816         locationLevel1.setLevel(getLevel1Location());
817         LocationLevel locationLevel2 = new LocationLevel();
818         locationLevel2.setName(getLocationLevel2());
819         locationLevel2.setLevel(getLevel2Location());
820         LocationLevel locationLevel3 = new LocationLevel();
821         locationLevel3.setName(getLocationLevel3());
822         locationLevel3.setLevel(getLevel3Location());
823         LocationLevel locationLevel4 = new LocationLevel();
824         locationLevel4.setName(getLocationLevel4());
825         locationLevel4.setLevel(getLevel4Location());
826         LocationLevel locationLevel5 = new LocationLevel();
827         locationLevel5.setName(getLocationLevel5());
828         locationLevel5.setLevel(getLevel5Location());
829 
830         List<LocationLevel> locationLevels = new ArrayList<>();
831 
832         if (StringUtils.isNotEmpty(locationLevel1.getName())) {
833             locationLevels.add(locationLevel1);
834         }
835         if (StringUtils.isNotEmpty(locationLevel2.getName())) {
836             locationLevels.add(locationLevel2);
837         }
838         if (StringUtils.isNotEmpty(locationLevel3.getName())) {
839             locationLevels.add(locationLevel3);
840         }
841         if (StringUtils.isNotEmpty(locationLevel4.getName())) {
842             locationLevels.add(locationLevel4);
843         }
844         if (StringUtils.isNotEmpty(locationLevel5.getName())) {
845             locationLevels.add(locationLevel5);
846         }
847 
848         int locationLevelSize = locationLevels.size();
849 
850         for (int i = 0; i < locationLevelSize; i++) {
851             if ((locationLevelSize - 1) != i) {
852                 locationLevels.get(i).setLocationLevel(locationLevels.get(i + 1));
853             }
854         }
855 
856         Location locationPojo = new Location();
857         if (locationLevels.size() > 0) {
858             locationPojo.setLocationLevel(locationLevels.get(0));
859         }
860 
861         return locationPojo;
862     }
863 
864 
865     @Override
866     public int compareTo(Item o) {
867         return this.getSortedValue().compareTo(o.getSortedValue());
868     }
869 
870 
871     public void setItem(Item itemIncoming) throws ConversionException {
872         ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
873         org.kuali.ole.docstore.common.document.content.instance.Item incomingItemContent = itemOlemlRecordProcessor.fromXML(itemIncoming.getContent());
874         org.kuali.ole.docstore.common.document.content.instance.Item existingItemContent = itemOlemlRecordProcessor.fromXML(this.getContent());
875 
876         this.setId(existingItemContent.getItemIdentifier());
877 
878         if (StringUtils.isNotBlank(itemIncoming.getUpdatedBy())) {
879             this.updatedBy = itemIncoming.getUpdatedBy();
880         } else {
881             this.updatedBy = "UNKNOWN";
882         }
883         if (incomingItemContent.getLocation() != null) {
884             existingItemContent.setLocation(incomingItemContent.getLocation());
885         }
886         if (incomingItemContent.getCallNumber() != null) {
887             existingItemContent.setCallNumber(incomingItemContent.getCallNumber());
888         }
889         if (StringUtils.isNotBlank(incomingItemContent.getChronology())) {
890             existingItemContent.setChronology(incomingItemContent.getChronology());
891         }
892         if (StringUtils.isNotBlank(incomingItemContent.getEnumeration())) {
893             existingItemContent.setEnumeration(incomingItemContent.getEnumeration());
894         }
895         if (StringUtils.isNotBlank(incomingItemContent.getCopyNumber())) {
896             existingItemContent.setCopyNumber(incomingItemContent.getCopyNumber());
897         }
898         if (incomingItemContent.getItemStatus() != null) {
899             existingItemContent.setItemStatus(incomingItemContent.getItemStatus());
900         }
901         if (incomingItemContent.getItemType() != null) {
902             existingItemContent.setItemType(incomingItemContent.getItemType());
903         }
904         if (StringUtils.isNotBlank(incomingItemContent.getBarcodeARSL())) {
905             existingItemContent.setBarcodeARSL(incomingItemContent.getBarcodeARSL());
906         }
907         if (StringUtils.isNotBlank(incomingItemContent.getVolumeNumber())) {
908             existingItemContent.setVolumeNumber(incomingItemContent.getVolumeNumber());
909         }
910         if (StringUtils.isNotBlank(incomingItemContent.getCheckinNote())) {
911             existingItemContent.setCheckinNote(incomingItemContent.getCheckinNote());
912         }
913         if (StringUtils.isNotBlank(incomingItemContent.getCurrentBorrower())) {
914             existingItemContent.setCurrentBorrower(incomingItemContent.getCurrentBorrower());
915         }
916         if (StringUtils.isNotBlank(incomingItemContent.getClaimsReturnedFlagCreateDate())) {
917             existingItemContent.setClaimsReturnedFlagCreateDate(incomingItemContent.getClaimsReturnedFlagCreateDate());
918         }
919         if (StringUtils.isNotBlank(incomingItemContent.getAnalytic())) {
920             existingItemContent.setAnalytic(incomingItemContent.getAnalytic());
921         }
922         if (StringUtils.isNotBlank(incomingItemContent.getDueDateTime())) {
923             existingItemContent.setDueDateTime(incomingItemContent.getDueDateTime());
924         }
925         if (StringUtils.isNotBlank(incomingItemContent.getDamagedItemNote())) {
926             existingItemContent.setDamagedItemNote(incomingItemContent.getDamagedItemNote());
927         }
928         if (StringUtils.isNotBlank(incomingItemContent.getItemStatusEffectiveDate())) {
929             existingItemContent.setItemStatusEffectiveDate(incomingItemContent.getItemStatusEffectiveDate());
930         }
931         if (StringUtils.isNotBlank(incomingItemContent.getMissingPieceEffectiveDate())) {
932             existingItemContent.setMissingPieceEffectiveDate(incomingItemContent.getMissingPieceEffectiveDate());
933         }
934         if (StringUtils.isNotBlank(incomingItemContent.getClaimsReturnedNote())) {
935             existingItemContent.setClaimsReturnedNote(incomingItemContent.getClaimsReturnedNote());
936         }
937         if (StringUtils.isNotBlank(incomingItemContent.getProxyBorrower())) {
938             existingItemContent.setProxyBorrower(incomingItemContent.getProxyBorrower());
939         }
940         if (StringUtils.isNotBlank(incomingItemContent.getMissingPieceFlagNote())) {
941             existingItemContent.setMissingPieceFlagNote(incomingItemContent.getMissingPieceFlagNote());
942         }
943         if (StringUtils.isNotBlank(incomingItemContent.getMissingPiecesCount())) {
944             existingItemContent.setMissingPiecesCount(incomingItemContent.getMissingPiecesCount());
945         }
946         if (incomingItemContent.getAccessInformation() != null) {
947             if(StringUtils.isNotBlank(incomingItemContent.getAccessInformation().getBarcode())) {
948                 existingItemContent.getAccessInformation().setBarcode(incomingItemContent.getAccessInformation().getBarcode());
949             }
950             if(incomingItemContent.getAccessInformation().getUri()!=null){
951                 existingItemContent.getAccessInformation().setUri(incomingItemContent.getAccessInformation().getUri());
952             }
953         }
954         if (incomingItemContent.getTemporaryItemType() != null) {
955             existingItemContent.setTemporaryItemType(incomingItemContent.getTemporaryItemType());
956         }
957         if (incomingItemContent.getStatisticalSearchingCode() != null) {
958             existingItemContent.setStatisticalSearchingCode(incomingItemContent.getStatisticalSearchingCode());
959         }
960         if (incomingItemContent.getNumberOfCirculations() != null) {
961             existingItemContent.setNumberOfCirculations(incomingItemContent.getNumberOfCirculations());
962         }
963         if (incomingItemContent.getDonorInfo() != null) {
964             existingItemContent.setDonorInfo(incomingItemContent.getDonorInfo());
965         }
966         if (incomingItemContent.getMissingPieceItemRecordList() != null) {
967             existingItemContent.setMissingPieceItemRecordList(incomingItemContent.getMissingPieceItemRecordList());
968         }
969         if(incomingItemContent.getItemClaimsReturnedRecords() != null){
970             existingItemContent.setItemClaimsReturnedRecords(incomingItemContent.getItemClaimsReturnedRecords());
971         }
972         if(incomingItemContent.getItemDamagedRecords() != null){
973             existingItemContent.setItemDamagedRecords(incomingItemContent.getItemDamagedRecords());
974         }
975         if (incomingItemContent.getHighDensityStorage() != null) {
976             existingItemContent.setHighDensityStorage(incomingItemContent.getHighDensityStorage());
977         }
978         if (incomingItemContent.getNote() != null) {
979             existingItemContent.setNote(incomingItemContent.getNote());
980         }
981         if (incomingItemContent.getFormerIdentifier() != null) {
982             existingItemContent.setFormerIdentifier(incomingItemContent.getFormerIdentifier());
983         }
984         if (StringUtils.isNotBlank(incomingItemContent.getVolumeNumberLabel())) {
985             existingItemContent.setVolumeNumberLabel(incomingItemContent.getVolumeNumberLabel());
986         }
987         if (StringUtils.isNotBlank(incomingItemContent.getVendorLineItemIdentifier())) {
988             existingItemContent.setVendorLineItemIdentifier(incomingItemContent.getVendorLineItemIdentifier());
989         }
990         if (StringUtils.isNotBlank(incomingItemContent.getPurchaseOrderLineItemIdentifier())) {
991             existingItemContent.setPurchaseOrderLineItemIdentifier(incomingItemContent.getPurchaseOrderLineItemIdentifier());
992         }
993         if (StringUtils.isNotBlank(incomingItemContent.getResourceIdentifier())) {
994             existingItemContent.setResourceIdentifier(incomingItemContent.getResourceIdentifier());
995         }
996         if (incomingItemContent.isStaffOnlyFlag() != existingItemContent.isStaffOnlyFlag()) {
997             existingItemContent.setStaffOnlyFlag(incomingItemContent.isStaffOnlyFlag());
998             this.setStaffOnly(incomingItemContent.isStaffOnlyFlag());
999 
1000         }
1001         this.setContent(itemOlemlRecordProcessor.toXML(existingItemContent));
1002     }
1003 
1004 
1005     public void setDefaultField(String docField, String fieldValue) {
1006 
1007         org.kuali.ole.docstore.common.document.content.instance.Item itemPojo = (org.kuali.ole.docstore.common.document.content.instance.Item) getContentObject();
1008 
1009 
1010         if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_ITEM_BARCODE)) {
1011             if (itemPojo.getAccessInformation() == null) {
1012                 AccessInformation accessInformation = new AccessInformation();
1013                 itemPojo.setAccessInformation(accessInformation);
1014             }
1015 
1016             if (itemPojo.getAccessInformation().getBarcode() == null) {
1017                 itemPojo.getAccessInformation().setBarcode(fieldValue);
1018             }
1019 
1020         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER)) {
1021 
1022             buildItemCallNumber(itemPojo);
1023             itemPojo.getCallNumber().setNumber(fieldValue);
1024             String callNumberType = itemPojo.getCallNumber().getShelvingScheme().getCodeValue();
1025             if(StringUtils.isEmpty(callNumberType)) {
1026                 itemPojo.getCallNumber().getShelvingScheme().setCodeValue("NONE");
1027             }
1028         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER_TYPE) ) {
1029             buildItemCallNumber(itemPojo);
1030             if (itemPojo.getCallNumber().getShelvingScheme().getCodeValue() == null || !isDataMappingFlag()) {
1031                 itemPojo.getCallNumber().getShelvingScheme().setCodeValue(fieldValue);
1032             }
1033 
1034         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_CALL_NUMBER_TYPE_PREFIX)) {
1035             buildItemCallNumber(itemPojo);
1036             if (itemPojo.getCallNumber().getPrefix() == null) {
1037                 itemPojo.getCallNumber().setPrefix(fieldValue);
1038             }
1039 
1040         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_COPY_NUMBER)) {
1041             if (itemPojo.getCopyNumber() == null) {
1042                 itemPojo.setCopyNumber(fieldValue);
1043             }
1044 
1045         } else if (docField.equalsIgnoreCase(DESTINATION_ITEM_TYPE)) {
1046             ItemType itemType1 = new ItemType();
1047             itemType1.setCodeValue(fieldValue);
1048             itemPojo.setItemType(itemType1);
1049         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER)) {
1050             setHoldingsCallNumber(fieldValue);
1051 
1052         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_1)) {
1053             if (getLevel1Location() == null) {
1054                 setLocationLevel1(fieldValue);
1055             }
1056 
1057         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_2)) {
1058             if (getLevel2Location() == null) {
1059                 setLocationLevel2(fieldValue);
1060             }
1061         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_3)) {
1062             if (getLevel3Location() == null) {
1063                 setLocationLevel3(fieldValue);
1064             }
1065         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_4)) {
1066             if (getLevel4Location() == null) {
1067                 setLocationLevel4(fieldValue);
1068             }
1069         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_LOCATION_LEVEL_5)) {
1070             if (getLevel5Location() == null) {
1071                 setLocationLevel5(fieldValue);
1072             }
1073         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_TYPE)) {
1074             setHoldingsCallNumberType(fieldValue);
1075         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_1)) {
1076             setHoldingsLocationLevel1(fieldValue);
1077         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_2)) {
1078             setHoldingsLocationLevel2(fieldValue);
1079         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_3)) {
1080             setHoldingsLocationLevel3(fieldValue);
1081         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_4)) {
1082             setHoldingsLocationLevel4(fieldValue);
1083         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_5)) {
1084             setHoldingsLocationLevel5(fieldValue);
1085         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_COPY_NUMBER)) {
1086             setHoldingsCopyNumber(fieldValue);
1087         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_PREFIX)) {
1088             setHoldingsCallNumberPrefix(fieldValue);
1089         } else if (docField.equalsIgnoreCase(DESTINATION_ITEM_STATUS)) {
1090             if(itemPojo.getItemStatus() == null){
1091                 ItemStatus itemStatus1 = new ItemStatus();
1092                 itemStatus1.setCodeValue(fieldValue);
1093                 itemPojo.setItemStatus(itemStatus1);
1094             }
1095         } else if (docField.equalsIgnoreCase(ENUMERATION)) {
1096             if (itemPojo.getEnumeration() == null) {
1097                 itemPojo.setEnumeration(fieldValue);
1098             }
1099         } else if (docField.equalsIgnoreCase(CHRONOLOGY)) {
1100             if (itemPojo.getChronology() == null) {
1101                 itemPojo.setChronology(fieldValue);
1102             }
1103         } else if (docField.equalsIgnoreCase(VENDOR_LINE_ITEM_IDENTIFIER)) {
1104             if (itemPojo.getVendorLineItemIdentifier() == null) {
1105                 itemPojo.setVendorLineItemIdentifier(fieldValue);
1106             }
1107         } else if (docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_CODE) || docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_PUBLIC_DISPLAY) || docField.equalsIgnoreCase(DESTINATION_FIELD_DONOR_NOTE)) {
1108             DonorInfo donorInfo = null;
1109             if (itemPojo.getDonorInfo().size() > 0) {
1110                 for (DonorInfo donorInfo1 : itemPojo.getDonorInfo()) {
1111                     buildDonorInfo(docField, fieldValue, itemPojo, donorInfo1, true);
1112                 }
1113             } else {
1114                 donorInfo = new DonorInfo();
1115                 buildDonorInfo(docField, fieldValue, itemPojo, donorInfo, true);
1116             }
1117         }
1118 
1119     }
1120 
1121 
1122     public String getItemHoldingsDataMappingValue(Map<String, String> itemDocFields) {
1123 
1124         StringBuilder itemDataValue = new StringBuilder();
1125 
1126 
1127         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER) && getHoldingsCallNumber() != null) {
1128             itemDataValue.append(getHoldingsCallNumber());
1129         }
1130 
1131         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_PREFIX) && getHoldingsCallNumberPrefix() != null) {
1132             itemDataValue.append(getHoldingsCallNumberPrefix());
1133         }
1134         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_CALL_NUMBER_TYPE) && getHoldingsCallNumberType() != null) {
1135             itemDataValue.append(getHoldingsCallNumberType());
1136         }
1137 
1138         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_COPY_NUMBER) &&  getHoldingsCopyNumber() != null) {
1139             itemDataValue.append(getHoldingsCopyNumber());
1140         }
1141 
1142         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_1) && getHoldingsLocationLevel1() != null) {
1143             itemDataValue.append(getHoldingsLocationLevel1());
1144         }
1145         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_2) && getHoldingsLocationLevel2() != null) {
1146             itemDataValue.append(getHoldingsLocationLevel2());
1147         }
1148         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_3) && getHoldingsLocationLevel3() != null) {
1149             itemDataValue.append(getHoldingsLocationLevel3());
1150         }
1151         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_4) && getHoldingsLocationLevel4() != null) {
1152             itemDataValue.append(getHoldingsLocationLevel4());
1153         }
1154         if (itemDocFields.containsKey(DESTINATION_FIELD_ITEM_HOLDINGS_LOCATION_LEVEL_5) && getHoldingsLocationLevel5() != null) {
1155             itemDataValue.append(getHoldingsLocationLevel5());
1156 
1157         }
1158         return itemDataValue.toString();
1159     }
1160 
1161 
1162     public String getHoldingsCallNumber() {
1163         return holdingsCallNumber;
1164     }
1165 
1166     public void setHoldingsCallNumber(String holdingsCallNumber) {
1167         this.holdingsCallNumber = holdingsCallNumber;
1168     }
1169 
1170     public String getHoldingsCallNumberType() {
1171         return holdingsCallNumberType;
1172     }
1173 
1174     public void setHoldingsCallNumberType(String holdingsCallNumberType) {
1175         this.holdingsCallNumberType = holdingsCallNumberType;
1176     }
1177 
1178     public String getHoldingsCopyNumber() {
1179         return holdingsCopyNumber;
1180     }
1181 
1182     public void setHoldingsCopyNumber(String holdingsCopyNumber) {
1183         this.holdingsCopyNumber = holdingsCopyNumber;
1184     }
1185 
1186     public String getHoldingsCallNumberPrefix() {
1187         return holdingsCallNumberPrefix;
1188     }
1189 
1190     public void setHoldingsCallNumberPrefix(String holdingsCallNumberPrefix) {
1191         this.holdingsCallNumberPrefix = holdingsCallNumberPrefix;
1192     }
1193 
1194     public String getHoldingsLocationLevel1() {
1195         return holdingsLocationLevel1;
1196     }
1197 
1198     public void setHoldingsLocationLevel1(String holdingsLocationLevel1) {
1199         this.holdingsLocationLevel1 = holdingsLocationLevel1;
1200     }
1201 
1202     public String getHoldingsLocationLevel2() {
1203         return holdingsLocationLevel2;
1204     }
1205 
1206     public void setHoldingsLocationLevel2(String holdingsLocationLevel2) {
1207         this.holdingsLocationLevel2 = holdingsLocationLevel2;
1208     }
1209 
1210     public String getHoldingsLocationLevel3() {
1211         return holdingsLocationLevel3;
1212     }
1213 
1214     public void setHoldingsLocationLevel3(String holdingsLocationLevel3) {
1215         this.holdingsLocationLevel3 = holdingsLocationLevel3;
1216     }
1217 
1218     public String getHoldingsLocationLevel4() {
1219         return holdingsLocationLevel4;
1220     }
1221 
1222     public void setHoldingsLocationLevel4(String holdingsLocationLevel4) {
1223         this.holdingsLocationLevel4 = holdingsLocationLevel4;
1224     }
1225 
1226     public String getHoldingsLocationLevel5() {
1227         return holdingsLocationLevel5;
1228     }
1229 
1230     public void setHoldingsLocationLevel5(String holdingsLocationLevel5) {
1231         this.holdingsLocationLevel5 = holdingsLocationLevel5;
1232     }
1233 
1234     public void buildLocationLevels(org.kuali.ole.docstore.common.document.content.instance.Item item) {
1235         if (item != null) {
1236             if (item.getLocation() != null) {
1237                 LocationLevel locationLevel = item.getLocation().getLocationLevel();
1238                 setLocationLevel1(getLocationLevelName(locationLevel, level1Location));
1239                 setLocationLevel2(getLocationLevelName(locationLevel, level2Location));
1240                 setLocationLevel3(getLocationLevelName(locationLevel, level3Location));
1241                 setLocationLevel4(getLocationLevelName(locationLevel, level4Location));
1242                 setLocationLevel5(getLocationLevelName(locationLevel, level5Location));
1243             }
1244         }
1245     }
1246 
1247     private String getLocationLevelName(LocationLevel locationLevel, String level) {
1248         if (locationLevel == null || org.apache.commons.lang.StringUtils.isEmpty(locationLevel.getLevel())) return null;
1249         if (locationLevel.getLevel().equalsIgnoreCase(level)) return locationLevel.getName();
1250         return getLocationLevelName(locationLevel.getLocationLevel(), level);
1251     }
1252 }