コード例 #1
0
 @Override
 public void loadDuIds(List<String> statusUrl) {
   if (statusUrl == null) return;
   if (statusUrl.size() == 0) return;
   Iterator<String> iterator = statusUrl.iterator();
   while (iterator.hasNext()) {
     URL status;
     try {
       status = new URL(iterator.next());
       InputStream inputStream = status.openStream();
       ResearchObject sip = new SeadXstreamStaxModelBuilder().buildSip(inputStream);
       for (DcsDeliverableUnit du : sip.getDeliverableUnits()) {
         for (DcsResourceIdentifier id : du.getAlternateIds()) {
           if (id.getTypeId().equalsIgnoreCase("medici")
               || id.getTypeId().equalsIgnoreCase("lowermississipppi"))
             if (!Constants.duIds.containsKey(id.getIdValue())) {
               Constants.duIds.put(id.getIdValue(), du.getId());
               break;
             }
         }
       }
     } catch (MalformedURLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (InvalidXmlException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     break; // It is enough to just load the first one
   }
 }
コード例 #2
0
  private static void addResourceIdentifierSet(
      SolrInputDocument doc, Collection<DcsResourceIdentifier> set) {
    if (set == null || set.size() == 0) {
      return;
    }

    for (DcsResourceIdentifier id : set) {
      setadd(doc, ResourceIdentifierField.AUTHORITY, id.getAuthorityId());
      setadd(doc, ResourceIdentifierField.TYPE, id.getTypeId());
      setadd(doc, ResourceIdentifierField.VALUE, id.getIdValue());
    }
  }