private void performParentSearch(LinkedList<DcsEntity> result, String archive_id) { //This mocks the parent search it ignores the parent id and just returns everything that parent isn't null for (Map.Entry<String, Set<DcsEntity>> entry : archiveUtil.getEntities().entrySet()) { for (DcsEntity entity : entry.getValue()) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; for (DcsDeliverableUnitRef parentRef : du.getParents()) { if (parentRef.getRef().equalsIgnoreCase(archive_id)) { if (!result.contains(du)) { result.add(du); } } } } } }
private void performParentSearch(LinkedList<DcsEntity> result, String archive_id) { //This mocks the parent search it ignores the parent id and just returns everything that parent isn't null for (Map.Entry<String, Set<DcsEntity>> entry : archiveUtil.getEntities().entrySet()) { for (DcsEntity entity : entry.getValue()) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; for (DcsDeliverableUnitRef parentRef : du.getParents()) { if (parentRef.getRef().equalsIgnoreCase(archive_id)) { if (!result.contains(du)) { result.add(du); } } } } } }
@Override public <T extends DcsEntity> Collection<T> getParentsOf(String entityId, Class<T> constraint) { Collection<DcsEntity> results = new HashSet<DcsEntity>(); for (Set<DcsEntity> entity_set: archiveUtil.getEntities().values()) { for (DcsEntity entity: entity_set) { if (constraint.isInstance(entity)) { if (constraint == DcsDeliverableUnit.class) { DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (du.getParents().contains(new DcsDeliverableUnitRef(entityId))) { results.add(du); } } } } } Collection<T> constrainedResults = new HashSet<T>(results.size()); for (DcsEntity e : results) { if (e.getClass() == constraint) { constrainedResults.add(constraint.cast(e)); } } return constrainedResults; } }
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) {
@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; } }
DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (du.getId().equals(archive_id) || du.getParents().contains(archive_du_ref)) { result.add(entity); add_descendants(entity, entities, descendants);
DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (du.getId().equals(archive_id) || du.getParents().contains(archive_du_ref)) { result.add(entity); add_descendants(entity, entities, descendants);
private Set<String> getDeliverableUnitRefs(DcsEntity deliverableUnit) { Set<String> rels = new HashSet<String>(); DcsDeliverableUnit du = (DcsDeliverableUnit) deliverableUnit; for (DcsEntityReference ref : du.getCollections()) { rels.add(ref.getRef()); } for (DcsEntityReference ref : du.getMetadataRef()) { rels.add(ref.getRef()); } for (DcsEntityReference ref : du.getParents()) { rels.add(ref.getRef()); } for (DcsRelation ref : du.getRelations()) { rels.add(ref.getRef().getRef()); } return rels; }
private Set<String> getDeliverableUnitRefs(DcsEntity deliverableUnit) { Set<String> rels = new HashSet<String>(); DcsDeliverableUnit du = (DcsDeliverableUnit) deliverableUnit; for (DcsEntityReference ref : du.getCollections()) { rels.add(ref.getRef()); } for (DcsEntityReference ref : du.getMetadataRef()) { rels.add(ref.getRef()); } for (DcsEntityReference ref : du.getParents()) { rels.add(ref.getRef()); } for (DcsRelation ref : du.getRelations()) { rels.add(ref.getRef().getRef()); } return rels; }
for (DcsEntityReference ref : du.getParents()) { entities.add(ref.getRef());
for (DcsEntityReference ref : du.getParents()) { entities.add(ref.getRef());
String pred_id = getPredecessorId(du2); if (pred_id == null && du.getParents().isEmpty()) { rootDu = du; continue next;
for (DcsDeliverableUnitRef parentBusinessIdRef : ((DcsDeliverableUnit) archivedEntity).getParents()) { if (idMap.containsKey(parentBusinessIdRef.getRef())) { parentBusinessIdRef.setRef(idMap.get(parentBusinessIdRef.getRef()));
for (DcsDeliverableUnitRef parentBusinessIdRef : ((DcsDeliverableUnit) archivedEntity).getParents()) { if (idMap.containsKey(parentBusinessIdRef.getRef())) { parentBusinessIdRef.setRef(idMap.get(parentBusinessIdRef.getRef()));
for (DcsDeliverableUnitRef ref : check.getParents()) { String parent_id = null;
/** * Copy constructor for a DcsDeliverableUnit. The state of <code>toCopy</code> is copied * to this. * * @param toCopy the deliverable unit to copy, must not be <code>null</code> * @throws IllegalArgumentException if <code>toCopy</code> is <code>null</code> */ public DcsDeliverableUnit(DcsDeliverableUnit toCopy) { super(toCopy); this.coreMd = toCopy.getCoreMd(); this.collections = toCopy.getCollections(); this.metadata = toCopy.getMetadata(); this.metadataRefs = toCopy.getMetadataRef(); this.relations = toCopy.getRelations(); this.formerExternalRefs = toCopy.getFormerExternalRefs(); this.isDigitalSurrogate = toCopy.isDigitalSurrogate(); this.parents = toCopy.getParents(); }
DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (du.getParents().contains(parent_du_ref)) { result.add(entity); add_descendants(entity, entities, result);
addRefSet(doc, du.getParents(), DeliverableUnitField.PARENT); addMetadataRefSet(doc, du.getMetadataRef(), EntityField.METADATA_REF, store);