private Set<DcsDeliverableUnitRef> createDeliverableUnitRefSet(int size) { Set<DcsDeliverableUnitRef> set = new HashSet<DcsDeliverableUnitRef>(); for (int i = 0; i < size; i++) { set.add(new DcsDeliverableUnitRef(randomString(3, false))); } return set; }
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 static Set<DcsDeliverableUnitRef> getDeliverableUnitRefSet( SolrDocument doc, SolrName field) { Set<DcsDeliverableUnitRef> set = new HashSet<DcsDeliverableUnitRef>(); for (String s : setgetAll(doc, field)) { DcsDeliverableUnitRef ref = new DcsDeliverableUnitRef(); if (s != null) { ref.setRef(s); } set.add(ref); } return set; }
String parent = stateDu.getParents().iterator().next().getRef(); Map<String, DcsEntity> dcpMap = DcpUtil.asMap(dcp); if (dcpMap.containsKey(parent)) { String predecessorsParentId = predecessorStateDu.getParents().iterator().next().getRef(); parents.add(new DcsDeliverableUnitRef(predecessorsParentId)); updatedStateDu.setParents(parents);
String parent = stateDu.getParents().iterator().next().getRef(); Map<String, DcsEntity> dcpMap = DcpUtil.asMap(dcp); if (dcpMap.containsKey(parent)) { String predecessorsParentId = predecessorStateDu.getParents().iterator().next().getRef(); parents.add(new DcsDeliverableUnitRef(predecessorsParentId)); updatedStateDu.setParents(parents);
@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; } }
final DcsDeliverableUnitRef duRef = new DcsDeliverableUnitRef(); duRef.setRef(ref); return duRef; final String parentRef = reader.getAttribute(A_REF); if (!isEmptyOrNull(parentRef)) { DcsDeliverableUnitRef parent = new DcsDeliverableUnitRef(); parent.setRef(parentRef); du.addParent(parent);
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); } } } } } }
DcsDeliverableUnitRef archive_du_ref = new DcsDeliverableUnitRef(archive_id);
final DcsDeliverableUnitRef duRef = new DcsDeliverableUnitRef(); duRef.setRef(ref); return duRef; final String parentRef = reader.getAttribute(A_REF); if (!isEmptyOrNull(parentRef)) { DcsDeliverableUnitRef parent = new DcsDeliverableUnitRef(); parent.setRef(parentRef); du.addParent(parent);
@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; } }
DcsDeliverableUnitRef archive_du_ref = new DcsDeliverableUnitRef(archive_id);
@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; } }
if (! (((DcsDeliverableUnit) entity).getType().equals(DataItemProfile.DATASET_STATE_TYPE) || ((DcsDeliverableUnit) entity).getType().equals(DataItemProfile.DATASET_TYPE))) continue; if (((DcsDeliverableUnit) entity).getParents().contains(new DcsDeliverableUnitRef(du.getId()))) { dus.add((DcsDeliverableUnit) entity);
parent_id = ref.getRef();
private DcsDeliverableUnit mapDataSetStateDu(String rootDuId, String predecesorDuId, DataItem dataItem) { final DcsDeliverableUnit dataSetStateDu = new DcsDeliverableUnit(); dataSetStateDu.setId("DataItemStateDu-" + UUID.randomUUID().toString()); dataSetStateDu.addFormerExternalRef(dataItem.getId()); dataSetStateDu.setType(DataItemProfile.DATASET_STATE_TYPE); dataSetStateDu.addParent(new DcsDeliverableUnitRef(rootDuId)); dataSetStateDu.setTitle(dataItem.getName()); if (predecesorDuId != null) { DcsRelation isSuccessorOf = new DcsRelation(DcsRelationship.IS_SUCCESSOR_OF, predecesorDuId); dataSetStateDu.addRelation(isSuccessorOf); } return dataSetStateDu; }
if (parentRef.getRef().equals(dataSetDu.getId())) { hasCorrectParent = true; break;
du.addParent(new DcsDeliverableUnitRef(duparent));