@Override public Set<String> discover(Dcp conformingPackage) { Set<String> dataSetIdentifiers = new HashSet<String>(); if (dataSetDu != null) { dataSetIdentifiers.add(dataSetDu.getId()); } return dataSetIdentifiers; }
@Override public Set<String> discover(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); Set<String> archiveIds = new HashSet<String>(); for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATAFORMAT_REGISTRY_ENTRY_TYPE)) { archiveIds.add(du.getId()); } } return archiveIds; }
@Override public Set<String> discover(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); Set<String> archiveIds = new HashSet<String>(); for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATAFORMAT_REGISTRY_ENTRY_TYPE)) { archiveIds.add(du.getId()); } } return archiveIds; }
public Set<String> discover(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); Set<String> archiveIds = new HashSet<String>(); for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATASCHEME_REGISTRY_ENTRY_TYPE)) { archiveIds.add(du.getId()); } } return archiveIds; }
public Set<String> discover(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); Set<String> archiveIds = new HashSet<String>(); for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATASCHEME_REGISTRY_ENTRY_TYPE)) { archiveIds.add(du.getId()); } } return archiveIds; }
/** * {@inheritDoc} */ @Override public Set<String> discover(Dcp conformingPackage) { Set<String> ids = new HashSet<String>(); for (DcsDeliverableUnit du : conformingPackage.getDeliverableUnits()) { if (du.getType().equals(REGISTRY_ENTRY_DU_TYPE)) { ids.add(du.getId()); } } return ids; }
@Override public DcsDeliverableUnit determineDepositRoot(Set<DcsDeliverableUnit> candidates) { // Root du does not have another du in this list as a parent for (DcsDeliverableUnit candidate : candidates) { boolean has_local_parent = false; for (DcsDeliverableUnitRef parent : candidate.getParents()) { String parentId = parent.getRef(); for (DcsDeliverableUnit parentCandidate : candidates) { if (parentId.equals(parentCandidate.getId())) { has_local_parent = true; break; } } } if (!has_local_parent) { log.debug("Root deposit DU is: {}", candidate.getId()); return candidate; } } log.debug("Unable to find root deposit DU"); return null; } }
@Override public DcsDeliverableUnit determineDepositRoot(Set<DcsDeliverableUnit> candidates) { // Root du does not have another du in this list as a parent for (DcsDeliverableUnit candidate : candidates) { boolean has_local_parent = false; for (DcsDeliverableUnitRef parent : candidate.getParents()) { String parentId = parent.getRef(); for (DcsDeliverableUnit parentCandidate : candidates) { if (parentId.equals(parentCandidate.getId())) { has_local_parent = true; break; } } } if (!has_local_parent) { log.debug("Root deposit DU is: {}", candidate.getId()); return candidate; } } log.debug("Unable to find root deposit DU"); return null; } }
/** * {@inheritDoc} */ @Override protected DcsDeliverableUnit retrieveObjectDu(Dcp dcp) { DcsDeliverableUnit objectDu = null; Set<String> objectIds = discover(dcp); String objectId = null; Iterator<String> idIter = objectIds.iterator(); if (idIter.hasNext()) { objectId = idIter.next(); } if (objectId != null) { for (DcsDeliverableUnit du : dcp.getDeliverableUnits()) { if (du.getId().equals(objectId)) { objectDu = du; break; } } } return objectDu; }
protected DcsManifestation getFirstManifestationOf(Dcp dcp, DcsDeliverableUnit du, String man_type) { for (DcsManifestation test : dcp.getManifestations()) { if (test.getDeliverableUnit().equals(du.getId()) && test.getType().equals(man_type)) { return test; } } return null; }
public String findMasterScheme(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); String masterSchemeId = ""; for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATASCHEME_REGISTRY_ENTRY_TYPE) && du.getParents().size() == 1) { masterSchemeId = du.getId(); break; } } return masterSchemeId; } public Dcp to(DcsMetadataScheme scheme, Map<String, Object> context, String masterId, String formatId) {
public String findMasterScheme(Dcp conformingPackage) { Collection<DcsDeliverableUnit> dus = conformingPackage.getDeliverableUnits(); String masterSchemeId = ""; for (DcsDeliverableUnit du : dus) { if (du.getType().equals(METADATASCHEME_REGISTRY_ENTRY_TYPE) && du.getParents().size() == 1) { masterSchemeId = du.getId(); break; } } return masterSchemeId; } public Dcp to(DcsMetadataScheme scheme, Map<String, Object> context, String masterId, String formatId) {
/** * {@inheritDoc} */ @Override protected DcsDeliverableUnit retrieveObjectDu(Dcp dcp) { DcsDeliverableUnit objectDu = null; Set<String> objectIds = discover(dcp); String objectId = null; Iterator<String> idIter = objectIds.iterator(); if (idIter.hasNext()) { objectId = idIter.next(); } if (objectId != null) { for (DcsDeliverableUnit du : dcp.getDeliverableUnits()) { if (du.getId().equals(objectId)) { objectDu = du; break; } } } return objectDu; }
protected DcsDeliverableUnit getCurrentStateDu(Dcp dcp) { List<DcsDeliverableUnit> statedus = new ArrayList<DcsDeliverableUnit>(); for (DcsDeliverableUnit test : dcp.getDeliverableUnits()) { if (test.getType().equals(getStateDuType())) { statedus.add(test); } } // Return du without a successor next: for (DcsDeliverableUnit du : statedus) { for (DcsDeliverableUnit du2 : statedus) { String pred_id = getPredecessorId(du2); if (pred_id != null && pred_id.equals(du.getId())) { continue next; } } return du; } return null; }
private java.util.Collection<DcsEntity> filterForLatestDeliverableUnits(java.util.Collection<? extends DcsEntity> entities) { java.util.Collection<DcsEntity> result = new HashSet<DcsEntity>(); List<String> predecessorDuIds = new ArrayList<String>(); for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit)entity; for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals(DcsRelationship.IS_SUCCESSOR_OF.asString())) { predecessorDuIds.add(rel.getRef().getRef()); } } } for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { result.add(entity); continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (!predecessorDuIds.contains(du.getId())) { result.add(du); } } return result; }
/** * Asserts that {@code dcp2} contains a DU that is a successor of a DU contained in {@code dcp1}. * * @param dcp2 * @param dcp1 */ public void assertIsSuccessor(Dcp dcp2, Dcp dcp1, String type) { if (!(dcp1.getDeliverableUnits().size() > 0)) { throw new RuntimeException("Expected 'dcp1' to have at least one DU."); } DcsDeliverableUnit state_du1 = getStateDuFromCollectionDcp(dcp1, type); if (state_du1 == null) { throw new RuntimeException("Expected 'dcp1' to contain a State DU."); } // The update doesn't have the root DU if (!(dcp2.getDeliverableUnits().size() > 0)) { throw new RuntimeException("Expected 'dcp2' to have at least one DU."); } DcsDeliverableUnit state_du2 = getStateDuFromCollectionDcp(dcp2, type); if (state_du2 == null) { throw new RuntimeException("Expected 'dcp2' to contain a State DU."); } String pred_id = getPredecessorId(state_du2); if (pred_id == null) { throw new RuntimeException("Expected the State DU in 'dcp2' to contain a predecessor identifier."); } if (!(state_du1.getId().equals(pred_id))) { throw new RuntimeException("Expected the State DU in 'dcp2' to reference the State DU in 'dcp1'"); } }
private java.util.Collection<DcsEntity> filterForLatestDeliverableUnits(java.util.Collection<? extends DcsEntity> entities) { java.util.Collection<DcsEntity> result = new HashSet<DcsEntity>(); List<String> predecessorDuIds = new ArrayList<String>(); for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit)entity; for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals(DcsRelationship.IS_SUCCESSOR_OF.asString())) { predecessorDuIds.add(rel.getRef().getRef()); } } } for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { result.add(entity); continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (!predecessorDuIds.contains(du.getId())) { result.add(du); } } return result; }
if (!identifier.equals(dataSetDu.getId())) { return null;
dataSetMdManifestation.setDeliverableUnit(dataSetStateDu.getId());
SolrInputDocument doc = new SolrInputDocument(); add(doc, EntityField.ID, du.getId()); add(doc, EntityField.TYPE, EntityTypeValue.DELIVERABLE_UNIT.solrValue());