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 = SpringContext.getBean(DocstoreClientLocator.class);
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          try {
56              try {
57                  org.kuali.ole.docstore.common.document.Item item = new ItemOleml();
58                  org.kuali.ole.docstore.common.search.SearchParams search_Params = new org.kuali.ole.docstore.common.search.SearchParams();
59                  SearchResponse searchResponse = null;
60                  search_Params.getSearchConditions().add(search_Params.buildSearchCondition("", search_Params.buildSearchField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), item.ITEM_BARCODE, oleDeliverRequestBo.getItemId()), ""));
61                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), "id"));
62                  search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode(), "id"));
63                  searchResponse = getDocstoreClientLocator().getDocstoreClient().search(search_Params);
64                  for (SearchResult searchResult : searchResponse.getSearchResults()) {
65                      for (SearchResultField searchResultField : searchResult.getSearchResultFields()) {
66                          String fieldName = searchResultField.getFieldName();
67                          String fieldValue = searchResultField.getFieldValue() != null ? searchResultField.getFieldValue() : "";
68                          if (fieldName.equalsIgnoreCase(OLEConstants.ID) && !fieldValue.isEmpty() && searchResultField.getDocType().equalsIgnoreCase(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode())) {
69                              holdingsId = fieldValue;
70                          } else {
71                              oleDeliverRequestBo.setItemUuid(fieldValue);
72                              String itemUUID = fieldValue;
73                          }
74                      }
75                  }
76              } catch (Exception ex) {
77                  GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, "Item Exists");
78                  LOG.error(OLEConstants.ITEM_EXIST + ex);
79              }
80              OleItemSearch itemSearchList = getOleItemSearchList(oleDeliverRequestBo.getItemUuid());
81              if (asrHelperService.isAnASRItem(itemSearchList.getShelvingLocation())) {
82                  oleDeliverRequestBo.setAsrFlag(true);
83              } else {
84                  oleDeliverRequestBo.setAsrFlag(false);
85              }
86              if (itemSearchList != null) {
87                  oleDeliverRequestBo.setTitle(itemSearchList.getTitle());
88                  oleDeliverRequestBo.setAuthor(itemSearchList.getAuthor());
89                  oleDeliverRequestBo.setCallNumber(itemSearchList.getCallNumber());
90                  oleDeliverRequestBo.setItemType(itemSearchList.getItemType());
91                  oleDeliverRequestBo.setItemLocation(itemSearchList.getShelvingLocation());
92              }
93              LoanProcessor loanProcessor = new LoanProcessor();
94              String itemXml = loanProcessor.getItemXML(oleDeliverRequestBo.getItemUuid());
95              Item oleItem = loanProcessor.getItemPojo(itemXml);
96              oleDeliverRequestBo.setOleItem(oleItem);
97              oleDeliverRequestBo.setCopyNumber(oleItem.getCopyNumber());
98              oleDeliverRequestBo.setItemStatus(oleItem.getItemStatus().getCodeValue());
99              oleDeliverRequestBo.setClaimsReturnedFlag(oleItem.isClaimsReturnedFlag());
100             locationValuesBuilder.getLocation(oleItem, oleDeliverRequestBo, holdingsId);
101             available = true;
102         } catch (Exception e) {
103             LOG.error(ConfigContext.getCurrentContextConfig().getProperty(OLEConstants.INVAL_LOC) + e);
104         }
105         return available;
106     }
107 
108     public OleItemSearch getOleItemSearchList(String itemUuid) {
109 
110         OleItemSearch oleItemSearch = new OleItemSearch();
111         try {
112             LoanProcessor loanProcessor = new LoanProcessor();
113             org.kuali.ole.docstore.common.document.Item item = getDocstoreClientLocator().getDocstoreClient().retrieveItem(itemUuid);
114             ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
115             Item itemContent = itemOlemlRecordProcessor.fromXML(item.getContent());
116             OleHoldings oleHoldings = new HoldingOlemlRecordProcessor().fromXML(item.getHolding().getContent());
117             oleItemSearch.setTitle(item.getHolding().getBib().getTitle());
118             oleItemSearch.setAuthor(item.getHolding().getBib().getAuthor());
119             oleItemSearch.setVolumeNumber(itemContent.getVolumeNumber());
120             oleItemSearch.setBibUUID(item.getHolding().getBib().getId());
121             StringBuffer locationLevel = new StringBuffer("");
122             String location = "";
123             if (itemContent.getLocation().getLocationLevel() != null) {
124                 location = getLocation(itemContent.getLocation(), locationLevel);
125                 oleItemSearch.setShelvingLocation(location);
126             } else {
127                 oleItemSearch.setShelvingLocation(getLocation(oleHoldings.getLocation(), locationLevel));
128             }
129             String callNumber;
130             if(itemContent.getCallNumber()!=null && !StringUtils.isEmpty(itemContent.getCallNumber().getNumber())){
131                 callNumber = itemContent.getCallNumber().getNumber();
132             }else {
133                 callNumber = loanProcessor.getItemCallNumber(oleHoldings.getCallNumber());
134             }
135             String itemType;
136             if(itemContent.getTemporaryItemType()!=null && itemContent.getTemporaryItemType().getCodeValue()!=null){
137                 itemType = itemContent.getTemporaryItemType().getCodeValue();
138             }else{
139                 itemType = itemContent.getItemType().getCodeValue();
140             }
141             oleItemSearch.setPublisher(item.getHolding().getBib().getPublisher());
142             oleItemSearch.setCallNumber(callNumber);
143             oleItemSearch.setHoldingUUID(item.getHolding().getId());
144             oleItemSearch.setInstanceUUID(item.getHolding().getId());
145             oleItemSearch.setCopyNumber(itemContent.getCopyNumber());
146             oleItemSearch.setItemBarCode(itemContent.getAccessInformation().getBarcode());
147             oleItemSearch.setItemStatus(itemContent.getItemStatus().getFullValue());
148             oleItemSearch.setItemType(itemType);
149             oleItemSearch.setItemUUID(item.getId());
150         } catch (Exception ex) {
151             ex.printStackTrace();
152             Log.info("Item does not Exist");
153         }
154         return oleItemSearch;
155     }
156 
157 
158     public boolean isItemAvailableInDocStore(String itemBarcode) {
159         LOG.info("Inside isItemAvailableInDocStore");
160         boolean available = false;
161         try {
162             org.kuali.ole.docstore.common.document.Item item = new ItemOleml();
163             org.kuali.ole.docstore.common.search.SearchParams search_Params = new org.kuali.ole.docstore.common.search.SearchParams();
164             SearchResponse searchResponse = null;
165             search_Params.getSearchConditions().add(search_Params.buildSearchCondition("", search_Params.buildSearchField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), item.ITEM_BARCODE, itemBarcode), ""));
166             search_Params.getSearchResultFields().add(search_Params.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.ID));
167             searchResponse = getDocstoreClientLocator().getDocstoreClient().search(search_Params);
168             if (searchResponse.getSearchResults() != null && searchResponse.getSearchResults().size() > 0) {
169                 available = true;
170             }
171         } catch (Exception ex) {
172 
173             LOG.error(OLEConstants.ITEM_EXIST + ex);
174         }
175         return available;
176     }
177 
178 
179     public void getSearchResultFields(SearchParams searchParams) {
180         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(),OLEConstants.ID));
181         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));
182         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(DocType.HOLDINGS.getCode(), org.kuali.ole.docstore.common.document.Item.CALL_NUMBER));
183         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));
184         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(),OLEConstants.TEMPITEMTYPE));
185         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));
186         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));
187         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode(), Holdings.LOCATION_NAME));
188         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(DocType.ITEM.getCode(), OLEConstants.LOACTION_LEVEL_DISPLAY));
189         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));
190         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));
191         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.HOLDINGS.getCode(), OLEConstants.ID));
192         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), OLEConstants.ID));
193         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), Bib.TITLE));
194         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), Bib.AUTHOR));
195         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.BIB.getCode(), OLEConstants.PUBLISHERDISPLAY));
196         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.CHRONOLOGY));
197         searchParams.getSearchResultFields().add(searchParams.buildSearchResultField(org.kuali.ole.docstore.common.document.content.enums.DocType.ITEM.getCode(), OLEConstants.ENUMARATION));
198     }
199 
200     public List<OleItemSearch> getSearchResults(SearchResponse searchResponse) {
201 
202         List<OleItemSearch> oleItemSearchList = new ArrayList<>();
203         if (searchResponse.getSearchResults() != null && searchResponse.getSearchResults().size() > 0) {
204             for (SearchResult searchResult : searchResponse.getSearchResults()) {
205                 OleItemSearch oleItemSearch = new OleItemSearch();
206                 for (SearchResultField searchResultField : searchResult.getSearchResultFields()) {
207                     String callNumber = "";
208 
209                     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())) {
210                         callNumber = searchResultField.getFieldValue();
211                     }
212                     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())) {
213                         oleItemSearch.setItemUUID(searchResultField.getFieldValue());
214                     }
215                     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())) {
216                         if (oleItemSearch.getTitle() == null) {
217                             oleItemSearch.setTitle(searchResultField.getFieldValue());
218                         }
219                     }
220                     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())) {
221                         oleItemSearch.setHoldingUUID(searchResultField.getFieldValue());
222                         oleItemSearch.setInstanceUUID(searchResultField.getFieldValue());
223                     }
224                     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())) {
225                         oleItemSearch.setItemBarCode(searchResultField.getFieldValue());
226                     }
227                     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())) {
228                         oleItemSearch.setCallNumber(searchResultField.getFieldValue());
229                     } else if (org.apache.commons.lang.StringUtils.isEmpty(oleItemSearch.getCallNumber())) {
230                         oleItemSearch.setCallNumber(callNumber);
231                     }
232                     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())) {
233                         oleItemSearch.setCopyNumber(searchResultField.getFieldValue());
234                     }
235                     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())) {
236                         oleItemSearch.setShelvingLocation(searchResultField.getFieldValue());
237                     }
238                     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())) {
239                         oleItemSearch.setShelvingLocation(searchResultField.getFieldValue());
240                     }
241                     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())) {
242                         oleItemSearch.setItemStatus(searchResultField.getFieldValue());
243                     }
244                     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())) {
245                         oleItemSearch.setChronology(searchResultField.getFieldValue());
246                     }
247                     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())) {
248                         oleItemSearch.setEnumeration(searchResultField.getFieldValue());
249                     }
250 
251                     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())) {
252                         oleItemSearch.setItemType(searchResultField.getFieldValue());
253                     }
254                     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())) {
255                         oleItemSearch.setItemType(searchResultField.getFieldValue());
256                     }
257                     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())) {
258                         oleItemSearch.setVolumeNumber(searchResultField.getFieldValue());
259                     }
260                     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())) {
261                         if (oleItemSearch.getAuthor() == null) {
262                             oleItemSearch.setAuthor(searchResultField.getFieldValue());
263                         }
264                     }
265                     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())) {
266                         if (oleItemSearch.getPublisher() == null) {
267                             oleItemSearch.setPublisher(searchResultField.getFieldValue());
268                         }
269                     }
270                     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())) {
271                         if (oleItemSearch.getBibUUID() == null) {
272                             oleItemSearch.setBibUUID(searchResultField.getFieldValue());
273                         }
274 
275                     }
276                 }
277                 oleItemSearchList.add(oleItemSearch);
278             }
279 
280         }
281         return oleItemSearchList;
282     }
283 
284     public String getLocation(Location location, StringBuffer locationLevel) {
285         StringBuffer locationName = new StringBuffer("");
286         if (location != null && location.getLocationLevel() != null) {
287             locationName = locationName.append(location.getLocationLevel().getName());
288             locationLevel = locationLevel.append(location.getLocationLevel().getLevel());
289             if (location.getLocationLevel().getLocationLevel() != null) {
290                 locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getName());
291                 locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLevel());
292                 if (location.getLocationLevel().getLocationLevel().getLocationLevel() != null) {
293                     locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getName());
294                     locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
295                     if (location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel() != null) {
296                         locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getName());
297                         locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
298                         if (location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel() != null) {
299                             locationName = locationName.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getName());
300                             locationLevel = locationLevel.append("/").append(location.getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLocationLevel().getLevel());
301                         }
302                     }
303                 }
304             }
305         }
306         return locationName.toString();
307     }
308 
309     public OleHoldings getOleHoldings(String instanceUUID) throws Exception {
310         LOG.info("--Inside getOleHoldings---");
311         Holdings holdings = new Holdings();
312         holdings = getDocstoreClientLocator().getDocstoreClient().retrieveHoldings(instanceUUID);
313         HoldingOlemlRecordProcessor holdingOlemlRecordProcessor = new HoldingOlemlRecordProcessor();
314         OleHoldings oleHoldings = holdingOlemlRecordProcessor.fromXML(holdings.getContent());
315         return oleHoldings;
316     }
317 
318 }