@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 } }
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()); } }
private static Set<DcsResourceIdentifier> getResourceIdentifierSet(SolrDocument doc) { Set<DcsResourceIdentifier> idSet = new HashSet<DcsResourceIdentifier>(); String[] authorities = setgetAll(doc, ResourceIdentifierField.AUTHORITY); String[] types = setgetAll(doc, ResourceIdentifierField.TYPE); String[] values = setgetAll(doc, ResourceIdentifierField.VALUE); for (int i = 0; i < values.length; i++) { DcsResourceIdentifier id = new DcsResourceIdentifier(); id.setAuthorityId(authorities[i]); id.setTypeId(types[i]); id.setIdValue(values[i]); idSet.add(id); } return idSet; }