View Javadoc
1   package org.kuali.ole.util;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.jfree.util.Log;
5   import org.kuali.asr.service.ASRHelperServiceImpl;
6   import org.kuali.ole.OLEConstants;
7   import org.kuali.ole.deliver.bo.OleDeliverRequestBo;
8   import org.kuali.ole.deliver.bo.OleItemSearch;
9   import org.kuali.ole.deliver.processor.LoanProcessor;
10  import org.kuali.ole.describe.keyvalue.LocationValuesBuilder;
11  import org.kuali.ole.docstore.common.client.DocstoreClientLocator;
12  import org.kuali.ole.docstore.common.document.*;
13  import org.kuali.ole.docstore.common.document.content.enums.DocType;
14  import org.kuali.ole.docstore.common.document.content.instance.Item;
15  import org.kuali.ole.docstore.common.document.content.instance.Location;
16  import org.kuali.ole.docstore.common.document.content.instance.OleHoldings;
17  import org.kuali.ole.docstore.common.document.content.instance.xstream.HoldingOlemlRecordProcessor;
18  import org.kuali.ole.docstore.common.document.content.instance.xstream.ItemOlemlRecordProcessor;
19  import org.kuali.ole.docstore.common.search.*;
20  import org.kuali.ole.sys.context.SpringContext;
21  import org.kuali.rice.core.api.config.property.ConfigContext;
22  import org.kuali.rice.krad.util.GlobalVariables;
23  import org.kuali.rice.krad.util.KRADConstants;
24  
25  import java.util.ArrayList;
26  import java.util.HashMap;
27  import java.util.List;
28  import java.util.Map;
29  
30  /**
31   * Created with IntelliJ IDEA.
32   * User: arunag
33   * Date: 1/9/14
34   * Time: 2:48 PM
35   * To change this template use File | Settings | File Templates.
36   */
37  public class DocstoreUtil {
38      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocstoreUtil.class);
39      private DocstoreClientLocator docstoreClientLocator;
40  
41      public DocstoreClientLocator getDocstoreClientLocator() {
42          if (docstoreClientLocator == null) {
43              docstoreClientLocator = (DocstoreClientLocator) SpringContext.getService("docstoreClientLocator");
44          }
45          return docstoreClientLocator;
46      }
47  
48      public boolean isItemAvailableInDocStore(OleDeliverRequestBo oleDeliverRequestBo) {
49          ASRHelperServiceImpl asrHelperService = new ASRHelperServiceImpl();
50          LOG.info("Inside isItemAvailableInDocStore");
51          boolean available = false;
52          Map<String, String> itemMap = new HashMap<String, String>();
53          LocationValuesBuilder locationValuesBuilder = new LocationValuesBuilder();
54          String holdingsId = "";
55          String bibTitle="";
56          String bibAuthor="";
57          try {
58              try {
59                  org.kuali.ole.docstore.common.document.Item item = new ItemOleml();
60                  org.kuali.ole.docstore.common.search.SearchParams search_Params = new org.kuali.ole.docstore.common.search.SearchParams();
61                  SearchResponse searchResponse = null;
62                  search_Params.getSearchConditions().add(search_Params.buildSearchCondition("phrase", search_Params.buildSearchField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), item.ITEM_BARCODE, oleDeliverRequestBo.getItemId()), ""));
63                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), "id"));
64                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), "holdingsIdentifier"));
65                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), "Title_display"));
66                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), "Author_display"));
67                  searchResponse = getDocstoreClientLocator().getDocstoreClient().search(search_Params);
68                  for (SearchResult searchResult : searchResponse.getSearchResults()) {
69                      for (SearchResultField searchResultField : searchResult.getSearchResultFields()) {
70                          String fieldName = searchResultField.getFieldName();
71                          String fieldValue = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
72                          if (fieldName.equalsIgnoreCase("holdingsIdentifier") && !fieldValue.isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
73                              holdingsId = fieldValue;
74                          } else if (searchResultField.getFieldName().equalsIgnoreCase("Title_display") &&!fieldValue.isEmpty()) {
75                              bibTitle = searchResultField.getFieldValue();
76                          } else if (searchResultField.getFieldName().equalsIgnoreCase("Author_display") &&!fieldValue.isEmpty()) {
77                              bibAuthor = searchResultField.getFieldValue();
78                          } else  if (searchResultField.getFieldName().equalsIgnoreCase("id") &&!fieldValue.isEmpty()){
79                              oleDeliverRequestBo.setItemUuid(fieldValue);
80                          }
81                      }
82                  }
83              } catch (Exception ex) {
84                  GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, "Item Exists");
85                  LOG.error(OLEConstants.ITEM_EXIST + ex);
86              }
87              OleItemSearch itemSearchList = getOleItemSearchList(oleDeliverRequestBo.getItemUuid());
88              if (asrHelperService.isAnASRItem(itemSearchList.getShelvingLocation())) {
89                  oleDeliverRequestBo.setAsrFlag(true);
90              } else {
91                  oleDeliverRequestBo.setAsrFlag(false);
92              }
93              if (itemSearchList != null) {
94                  oleDeliverRequestBo.setTitle(itemSearchList.getTitle());
95                  oleDeliverRequestBo.setAuthor(itemSearchList.getAuthor());
96                  oleDeliverRequestBo.setCallNumber(itemSearchList.getCallNumber());
97                  oleDeliverRequestBo.setItemType(itemSearchList.getItemType());
98                  oleDeliverRequestBo.setItemLocation(itemSearchList.getShelvingLocation());
99              }
100             if(StringUtils.isNotEmpty(bibTitle)){
101                 oleDeliverRequestBo.setTitle(bibTitle);
102             }
103             if(StringUtils.isNotEmpty(bibAuthor)){
104                 oleDeliverRequestBo.setAuthor(bibAuthor);
105             }
106             LoanProcessor loanProcessor = new LoanProcessor();
107             String itemXml = loanProcessor.getItemXML(oleDeliverRequestBo.getItemUuid());
108             Item oleItem = loanProcessor.getItemPojo(itemXml);
109             oleDeliverRequestBo.setOleItem(oleItem);
110             oleDeliverRequestBo.setCopyNumber(oleItem.getCopyNumber());
111             oleDeliverRequestBo.setEnumeration(oleItem.getEnumeration());
112             oleDeliverRequestBo.setChronology(oleItem.getChronology());
113             oleDeliverRequestBo.setItemStatus(oleItem.getItemStatus().getCodeValue());
114             oleDeliverRequestBo.setClaimsReturnedFlag(oleItem.isClaimsReturnedFlag());
115             locationValuesBuilder.getLocation(oleItem, oleDeliverRequestBo, holdingsId);
116             available = true;
117         } catch (Exception e) {
118             LOG.error(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.INVAL_LOC) + e);
119         }
120         return available;
121     }
122 
123     public OleItemSearch getOleItemSearchList(String itemUuid) {
124 
125         OleItemSearch oleItemSearch = new OleItemSearch();
126         try {
127             LoanProcessor loanProcessor = new LoanProcessor();
128             org.kuali.ole.docstore.common.document.Item item = getDocstoreClientLocator().getDocstoreClient().retrieveItem(itemUuid);
129             ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
130             Item itemContent = itemOlemlRecordProcessor.fromXML(item.getContent());
131             OleHoldings oleHoldings = new HoldingOlemlRecordProcessor().fromXML(item.getHolding().getContent());
132             oleItemSearch.setTitle(item.getHolding().getBib().getTitle());
133             oleItemSearch.setAuthor(item.getHolding().getBib().getAuthor());
134             oleItemSearch.setVolumeNumber(itemContent.getVolumeNumber());
135             oleItemSearch.setBibUUID(item.getHolding().getBib().getId());
136             StringBuffer locationLevel = new StringBuffer("");
137             String location = "";
138             if (itemContent.getLocation().getLocationLevel() != null) {
139                 location = getLocation(itemContent.getLocation(), locationLevel);
140                 oleItemSearch.setShelvingLocation(location);
141             } else {
142                 oleItemSearch.setShelvingLocation(getLocation(oleHoldings.getLocation(), locationLevel));
143             }
144            /* String callNumber;
145             if(itemContent.getCallNumber()!=null && !StringUtils.isEmpty(itemContent.getCallNumber().getNumber())){
146                 callNumber = loanProcessor.getItemCallNumber(itemContent.getCallNumber());
147             }else {
148                 callNumber = loanProcessor.getItemCallNumber(oleHoldings.getCallNumber());
149             }*/
150             String itemType;
151             if(itemContent.getTemporaryItemType()!=null && itemContent.getTemporaryItemType().getCodeValue()!=null){
152                 itemType = itemContent.getTemporaryItemType().getCodeValue();
153             }else{
154                 itemType = itemContent.getItemType().getCodeValue();
155             }
156             oleItemSearch.setPublisher(item.getHolding().getBib().getPublisher());
157             oleItemSearch.setCallNumber(loanProcessor.getItemCallNumber(itemContent.getCallNumber(),oleHoldings.getCallNumber()));
158             oleItemSearch.setHoldingUUID(item.getHolding().getId());
159             oleItemSearch.setInstanceUUID(item.getHolding().getId());
160             oleItemSearch.setCopyNumber(itemContent.getCopyNumber());
161             oleItemSearch.setItemBarCode(itemContent.getAccessInformation().getBarcode());
162             oleItemSearch.setItemStatus(itemContent.getItemStatus().getFullValue());
163             oleItemSearch.setItemType(itemType);
164             oleItemSearch.setItemUUID(item.getId());
165         } catch (Exception ex) {
166             ex.printStackTrace();
167             Log.info("Item does not Exist");
168         }
169         return oleItemSearch;
170     }
171 
172 
173     public boolean isItemAvailableInDocStore(String itemBarcode) {
174         LOG.info("Inside isItemAvailableInDocStore");
175         boolean available = false;
176         try {
177             org.kuali.ole.docstore.common.document.Item item = new ItemOleml();
178             org.kuali.ole.docstore.common.search.SearchParams search_Params = new org.kuali.ole.docstore.common.search.SearchParams();
179             SearchResponse searchResponse = null;
180             search_Params.getSearchConditions().add(search_Params.buildSearchCondition("phrase", search_Params.buildSearchField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), item.ITEM_BARCODE, itemBarcode), ""));
181             search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.ID));
182             searchResponse = getDocstoreClientLocator().getDocstoreClient().search(search_Params);
183             if (searchResponse.getSearchResults() != null && searchResponse.getSearchResults().size() > 0) {
184                 available = true;
185             }
186         } catch (Exception ex) {
187 
188             LOG.error(OLEConstants.ITEM_EXIST + ex);
189         }
190         return available;
191     }
192 
193 
194     public void getSearchResultFields(SearchParams searchParams) {
195         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(),OLEConstants.ID));
196         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.ITEM_BARCODE));
197         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(DocType.HOLDINGS.getCode(), org.kuali.ole.docstore.common.document.Item.CALL_NUMBER));
198         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.ITEM_TYPE));
199         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(),OLEConstants.TEMPITEMTYPE));
200         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.ITEM_STATUS));
201         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.COPY_NUMBER));
202         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode(), Holdings.LOCATION_NAME));
203         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(DocType.ITEM.getCode(), OLEConstants.LOACTION_LEVEL_DISPLAY));
204         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.VOLUME_NUMBER));
205         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), org.kuali.ole.docstore.common.document.Item.CALL_NUMBER));
206         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode(), OLEConstants.ID));
207         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), OLEConstants.ID));
208         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), Bib.TITLE));
209         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), Bib.AUTHOR));
210         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), OLEConstants.PUBLISHERDISPLAY));
211         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.CHRONOLOGY));
212         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.ENUMARATION));
213     }
214 
215     public List<OleItemSearch> getSearchResults(SearchResponse searchResponse) {
216 
217         List<OleItemSearch> oleItemSearchList = new ArrayList<>();
218         if (searchResponse.getSearchResults() != null && searchResponse.getSearchResults().size() > 0) {
219             for (SearchResult searchResult : searchResponse.getSearchResults()) {
220                 OleItemSearch oleItemSearch = new OleItemSearch();
221                 for (SearchResultField searchResultField : searchResult.getSearchResultFields()) {
222                     String callNumber = "";
223 
224                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.CALL_NUMBER) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode())) {
225                         callNumber = searchResultField.getFieldValue();
226                     }
227                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.ID) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
228                         oleItemSearch.setItemUUID(searchResultField.getFieldValue());
229                     }
230                     if (searchResultField.getFieldName().equalsIgnoreCase(Bib.TITLE) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode())) {
231                         if (oleItemSearch.getTitle() == null) {
232                             oleItemSearch.setTitle(searchResultField.getFieldValue());
233                         }
234                     }
235                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.ID) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode())) {
236                         oleItemSearch.setHoldingUUID(searchResultField.getFieldValue());
237                         oleItemSearch.setInstanceUUID(searchResultField.getFieldValue());
238                     }
239                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.ITEM_BARCODE) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
240                         oleItemSearch.setItemBarCode(searchResultField.getFieldValue());
241                     }
242                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.CALL_NUMBER) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
243                         oleItemSearch.setCallNumber(searchResultField.getFieldValue());
244                     } else if (org.apache.commons.lang.StringUtils.isEmpty(oleItemSearch.getCallNumber())) {
245                         oleItemSearch.setCallNumber(callNumber);
246                     }
247                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.COPY_NUMBER) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
248                         oleItemSearch.setCopyNumber(searchResultField.getFieldValue());
249                     }
250                     if (searchResultField.getFieldName().equalsIgnoreCase( OLEConstants.LOACTION_LEVEL_DISPLAY) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
251                         oleItemSearch.setShelvingLocation(searchResultField.getFieldValue());
252                     }
253                     else if (StringUtils.isEmpty(oleItemSearch.getShelvingLocation()) && searchResultField.getFieldName().equalsIgnoreCase(Holdings.LOCATION_NAME) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode())) {
254                         oleItemSearch.setShelvingLocation(searchResultField.getFieldValue());
255                     }
256                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.ITEM_STATUS) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
257                         oleItemSearch.setItemStatus(searchResultField.getFieldValue());
258                     }
259                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.CHRONOLOGY) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
260                         oleItemSearch.setChronology(searchResultField.getFieldValue());
261                     }
262                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.ENUMARATION) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
263                         oleItemSearch.setEnumeration(searchResultField.getFieldValue());
264                     }
265 
266                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.TEMPITEMTYPE) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
267                         oleItemSearch.setItemType(searchResultField.getFieldValue());
268                     }
269                     else if (StringUtils.isEmpty(oleItemSearch.getItemType()) && searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.ITEM_TYPE) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
270                         oleItemSearch.setItemType(searchResultField.getFieldValue());
271                     }
272                     if (searchResultField.getFieldName().equalsIgnoreCase(org.kuali.ole.docstore.common.document.Item.VOLUME_NUMBER) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode())) {
273                         oleItemSearch.setVolumeNumber(searchResultField.getFieldValue());
274                     }
275                     if (searchResultField.getFieldName().equalsIgnoreCase(Bib.AUTHOR) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode())) {
276                         if (oleItemSearch.getAuthor() == null) {
277                             oleItemSearch.setAuthor(searchResultField.getFieldValue());
278                         }
279                     }
280                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.PUBLISHERDISPLAY) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode())) {
281                         if (oleItemSearch.getPublisher() == null) {
282                             oleItemSearch.setPublisher(searchResultField.getFieldValue());
283                         }
284                     }
285                     if (searchResultField.getFieldName().equalsIgnoreCase(OLEConstants.ID) && searchResultField.getFieldValue() != null && !searchResultField.getFieldValue().isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode())) {
286                         if (oleItemSearch.getBibUUID() == null) {
287                             oleItemSearch.setBibUUID(searchResultField.getFieldValue());
288                         }
289 
290                     }
291                 }
292                 oleItemSearchList.add(oleItemSearch);
293             }
294 
295         }
296         return oleItemSearchList;
297     }
298 
299     public String getLocation(Location location, StringBuffer locationLevel) {
300         StringBuffer locationName = new StringBuffer("");
301         if (location != null && location.getLocationLevel() != null) {
302             locationName = locationName.append(location.getLocationLevel().getName());
303             locationLevel = locationLevel.append(location.getLocationLevel().getLevel());
304             if (location.getLocationLevel().getLocationLevel() != null) {
305                 locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getName());
306                 locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLevel());
307                 if (location.getLocationLevel().getLocationLevel().getLocationLevel() != null) {
308                     locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getName());
309                     locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
310                     if (location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel() != null) {
311                         locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getName());
312                         locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
313                         if (location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel() != null) {
314                             locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getName());
315                             locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
316                         }
317                     }
318                 }
319             }
320         }
321         return locationName.toString();
322     }
323 
324     public OleHoldings getOleHoldings(String instanceUUID) throws Exception {
325         LOG.info("--Inside getOleHoldings---");
326         Holdings holdings = new Holdings();
327         holdings = getDocstoreClientLocator().getDocstoreClient().retrieveHoldings(instanceUUID);
328         HoldingOlemlRecordProcessor holdingOlemlRecordProcessor = new HoldingOlemlRecordProcessor();
329         OleHoldings oleHoldings = holdingOlemlRecordProcessor.fromXML(holdings.getContent());
330         return oleHoldings;
331     }
332 
333 }