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 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; }
@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; } }
DcsDeliverableUnitRef archive_du_ref = new DcsDeliverableUnitRef(archive_id);
DcsDeliverableUnitRef archive_du_ref = new DcsDeliverableUnitRef(archive_id);
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);
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; }
du.addParent(new DcsDeliverableUnitRef(duparent));
parents.add(new DcsDeliverableUnitRef(predecessorsParentId)); updatedStateDu.setParents(parents);
DcsDeliverableUnitRef parent_du_ref = new DcsDeliverableUnitRef(parent.getId());
du.addParent(new DcsDeliverableUnitRef(parent_entity_id));
parents.add(new DcsDeliverableUnitRef(predecessorsParentId)); updatedStateDu.setParents(parents);
DcsDeliverableUnitRef parent_du_ref = new DcsDeliverableUnitRef(parent.getId());
root_du.addCreator(getCreatorString() + ":" + getVersion()); if (parent_entity_id != null) { root_du.addParent(new DcsDeliverableUnitRef(parent_entity_id)); state_du.addParent(new DcsDeliverableUnitRef(root_du.getId())); state_du.addParent(new DcsDeliverableUnitRef(root_du_id)); DcsRelation rel = new DcsRelation();
for (DcsDeliverableUnit parent : dcp.getDeliverableUnits()) { if (rand.nextBoolean()) { du.addParent(new DcsDeliverableUnitRef(parent .getId())); break;
/** * Maps a DataItem to a Deliverable Unit. * * @param dataItem the DataItem to map * @return the DcsDeliverableUnit representing the DataItem * @throws DcpMappingException */ private DcsDeliverableUnit mapDataSetDu(String collectionId, DataItem dataItem) throws DcpMappingException { // Map DataItem and File identifiers to the DcsDeliverableUnit formerExternalRef final DcsDeliverableUnit dataSetDu = new DcsDeliverableUnit(); dataSetDu.setId(dataItem.getId()); dataSetDu.addFormerExternalRef(dataItem.getId()); // Set the type of the DcsDeliverableUnit, indicating that this DU is carrying business information // for a DataItem object dataSetDu.setType(DataItemProfile.DATASET_TYPE); // Set the title of the DcsDeliverableUnit to the DataItem name dataSetDu.setTitle(dataItem.getName()); // Set the Collection that this dataSetDu belongs to dataSetDu.addParent(new DcsDeliverableUnitRef(collectionId)); return dataSetDu; }
du.addParent(new DcsDeliverableUnitRef(masterId)); du.addParent(new DcsDeliverableUnitRef(formatId));
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);
du.addParent(new DcsDeliverableUnitRef(masterId)); du.addParent(new DcsDeliverableUnitRef(formatId));
throw new DcpMappingException("Unable to find parent business object: " + parent); } else { statedu.addParent(new DcsDeliverableUnitRef(parent_state.getRoot().getId()));