Ejemplo n.º 1
0
  public Map<String, Map> updateItemsToDocstore(List<Item> itemList) {
    org.kuali.ole.docstore.common.document.BibTrees bibTrees =
        new org.kuali.ole.docstore.common.document.BibTrees();

    org.kuali.ole.docstore.common.document.BibTree bibTree =
        new org.kuali.ole.docstore.common.document.BibTree();
    org.kuali.ole.docstore.common.document.Bib bib =
        new org.kuali.ole.docstore.common.document.Bib();
    bibTree.setBib(bib);
    bib.setId("");

    org.kuali.ole.docstore.common.document.HoldingsTree holdingsTree =
        new org.kuali.ole.docstore.common.document.HoldingsTree();
    org.kuali.ole.docstore.common.document.Holdings holdings =
        new org.kuali.ole.docstore.common.document.Holdings();
    holdings.setId("");
    holdingsTree.setHoldings(holdings);

    List<String> locationLevel = BatchBibImportUtil.getLocationLevel();

    for (Iterator<Item> iterator = itemList.iterator(); iterator.hasNext(); ) {
      Item item = iterator.next();
      if (CollectionUtils.isNotEmpty(locationLevel)) {
        populateLocationLevels(item, locationLevel);
      }
      item.buildLocationLevels(
          (org.kuali.ole.docstore.common.document.content.instance.Item) item.getContentObject());
      item.setOperation(
          org.kuali.ole.docstore.common.document.DocstoreDocument.OperationType.UPDATE);
      item.serializeContent();
      holdingsTree.getItems().add(item);
    }

    bibTree.getHoldingsTrees().add(holdingsTree);

    bibTrees.getBibTrees().add(bibTree);
    BibTrees responseBibTree = null;
    try {
      responseBibTree = getDocstoreClientLocator().getDocstoreClient().processBibTrees(bibTrees);
    } catch (Exception e) {
      e.printStackTrace();
    }
    Map<String, Map> statusMap =
        generateResultMapForBibTreeWithItemUuidAndResultType(responseBibTree);
    return statusMap;
  }
 private Bib fetchBibRecord() throws SQLException {
   Bib bib = new BibMarc();
   bib.setCreatedBy(bibResultSet.getString("CREATED_BY"));
   bib.setCreatedOn(bibResultSet.getString("DATE_CREATED"));
   if (bibResultSet.getString("STAFF_ONLY") != null) {
     bib.setStaffOnly(
         (bibResultSet.getString("STAFF_ONLY").equalsIgnoreCase("Y")
             ? Boolean.TRUE
             : Boolean.FALSE));
   }
   bib.setContent(bibResultSet.getString("CONTENT"));
   bib.setUpdatedBy(bibResultSet.getString("UPDATED_BY"));
   bib.setUpdatedOn(bibResultSet.getString("DATE_UPDATED"));
   bib.setStatus(bibResultSet.getString("STATUS"));
   bib.setStatusUpdatedBy(bibResultSet.getString("STATUS_UPDATED_BY"));
   bib.setStatusUpdatedOn(bibResultSet.getString("STATUS_UPDATED_DATE"));
   bib.setLastUpdated(bibResultSet.getString("DATE_UPDATED"));
   String uuid = bibResultSet.getString("UNIQUE_ID_PREFIX") + "-" + bibResultSet.getString(1);
   bib.setId(uuid);
   bib.setLocalId(bibResultSet.getString(1));
   return bib;
 }