add(doc, EntityField.ID, du.getId()); add(doc, EntityField.TYPE, EntityTypeValue.DELIVERABLE_UNIT.solrValue()); add(doc, CoreMetadataField.TITLE, du.getTitle()); if( du.getRights() != null ){ add(doc, CoreMetadataField.RIGHTS, du.getRights()); addRefSet(doc, du.getCollections(), DeliverableUnitField.COLLECTIONS); addRefSet(doc, du.getParents(), DeliverableUnitField.PARENT); addMetadataRefSet(doc, du.getMetadataRef(), EntityField.METADATA_REF, store); addStrings(doc, du.getFormerExternalRefs(), addStrings(doc, du.getCreators(), CoreMetadataField.CREATOR); addStrings(doc, du.getSubjects(), CoreMetadataField.SUBJECT); addMetadataSet(doc, du.getMetadata()); addRelationSet(doc, du.getRelations()); addResourceIdentifierSet(doc, du.getAlternateIds()); add(doc, CoreMetadataField.TYPE, du.getType()); if (du.isDigitalSurrogate() != null) { doc.addField(DeliverableUnitField.DIGITAL_SURROGATE.solrName(), du.isDigitalSurrogate()); if (du.getLineageId() != null && !du.getLineageId().isEmpty()) { add(doc, DeliverableUnitField.LINEAGE, du.getLineageId());
if (du.getFormerExternalRefs().contains(business_id)) { dus.add(du); String pred_id = getPredecessorId(du2); if (pred_id == null && du.getParents().isEmpty()) { rootDu = du; continue next; if (pred_id == null && !du.getParents().isEmpty() && du.getType().equals(DataFileProfile.DATAFILE_ROOTDU_TYPE)) { rootDu = du; continue next; if (pred_id != null && pred_id.equals(du.getId())) { continue next; new DcsDeliverableUnit(rootDu) : null; final DcsDeliverableUnit latestStateDuCopy = (latestStateDu != null) ? new DcsDeliverableUnit(latestStateDu) : null;
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; }
/** * 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(); }
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 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; }
final DcsDeliverableUnit du = new DcsDeliverableUnit(); du.setId(id); du.setLineageId(lineageid); final DcsCollectionRef collRef = (DcsCollectionRef) context.convertAnother(du, DcsCollectionRef.class); if (collRef != null) { du.addCollection(collRef); final DcsMetadataRef mdRef = (DcsMetadataRef) context.convertAnother(du, DcsMetadataRef.class); if (mdRef != null) { du.addMetadataRef(mdRef); final DcsMetadata md = (DcsMetadata) context.convertAnother(du, DcsMetadata.class); if (md != null) { du.addMetadata(md); DcsDeliverableUnitRef parent = new DcsDeliverableUnitRef(); parent.setRef(parentRef); du.addParent(parent); final DcsRelation rel = (DcsRelation) context.convertAnother(du, DcsRelation.class); if (rel != null) { du.addRelation(rel); du.setTitle(value); du.addCreator(value);
final DcsDeliverableUnit du = new DcsDeliverableUnit(); du.setId(UUID.randomUUID().toString()); du.setTitle(registryEntry.getDescription() == null ? "Title Not Supplied" : registryEntry.getDescription()); du.setType(REGISTRY_ENTRY_DU_TYPE); du.addFormerExternalRef(registryEntry.getId()); du.setDigitalSurrogate(false); du.addAlternateId(new DcsResourceIdentifier("", key, registryEntry.getType())); entry_file.setId(UUID.randomUUID().toString()); man.setDeliverableUnit(du.getId()); mf.setRef(new DcsFileRef(entry_file.getId())); man.addManifestationFile(mf); DcsRelation isRegistryEntryFor = new DcsRelation(DcsRelationship.IS_REGISTRY_ENTRY_FOR, objectDu.getId()); du.addRelation(isRegistryEntryFor); DcsRelation hasRegistryEntry = new DcsRelation(DcsRelationship.HAS_REGISTRY_ENTRY, du.getId()); objectDu.addRelation(hasRegistryEntry);
public DcsDeliverableUnit createDeliverableUnit(String collection, String duparent, boolean randomparents) { DcsDeliverableUnit du = new DcsDeliverableUnit(); du.setId(nextid()); du.setTitle(randomString(rand.nextInt(10) + 1, false)); du.setCreators(randomStringSet(rand.nextInt(2) + 1, rand.nextInt(10) + 1)); du.setSubjects(randomStringSet(rand.nextInt(2) + 1, rand.nextInt(5) + 1)); du.setMetadata(createMetadataSet(rand.nextInt(2))); du.setMetadataRef(createMetadataRefSet(rand.nextInt(3))); du.setFormerExternalRefs(randomStringSet(rand.nextInt(5), 10)); du.setRights(randomString(2, false)); du.setCollections(createCollectionRefSet(collection)); du.setRelations(createRelations(rand.nextInt(2))); du.setType(randomString(4, false)); du.setDigitalSurrogate(rand.nextBoolean()); du.setLineageId(randomString(10, false)); du.addParent(new DcsDeliverableUnitRef(duparent)); du.setParents(createDeliverableUnitRefSet(rand.nextInt(2))); du.setCollections(createCollectionRefSet(randomString(2, false)));
DcsDeliverableUnit state_du = new DcsDeliverableUnit(); state_du.setId(UUID.randomUUID().toString()); state_du.setTitle("title"); state_du.addCreator(CREATOR); state_du.addCreator(getCreatorString() + ":" + getVersion()); state_du.setType(getStateDuType()); DcsDeliverableUnit root_du = new DcsDeliverableUnit(); root_du.setId(UUID.randomUUID().toString()); root_du.setTitle("title"); root_du.addCreator(CREATOR); root_du.setType(ROOT_DELIVERABLE_UNIT_TYPE); 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(); state_du.addRelation(rel); state_man.setDeliverableUnit(state_du.getId()); state_mf.setRef(new DcsFileRef(state_file.getId())); state_man.addManifestationFile(state_mf);
if (candidate.getDeliverableUnit().equals(du.getId())) { man = candidate; break; log.error("Error deserializing DcsMetadataFormat serialization."); format = new DcsMetadataFormat(); format.setName(du.getTitle()); format.setVersion(METADATAFORMAT_VERSION_ONE); if (!du.getFormerExternalRefs().isEmpty()) { format.setId(du.getFormerExternalRefs().iterator().next());
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(); DcsDeliverableUnit updatedStateDu = new DcsDeliverableUnit(stateDu); Set<DcsDeliverableUnitRef> parents = new HashSet<DcsDeliverableUnitRef>(); parents.add(new DcsDeliverableUnitRef(predecessorsParentId)); updatedStateDu.setParents(parents); dcpMap.put(updatedStateDu.getId(), updatedStateDu); dcp = new Dcp(); DcpUtil.add(dcp, dcpMap.values());
@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; } }
Dcp dcp = new Dcp(); DcsDeliverableUnit du = new DcsDeliverableUnit(); DcsManifestation man = new DcsManifestation(); DcsManifestationFile mf = new DcsManifestationFile(); DcsFile file = new DcsFile(); du.setId(TOPLEVEL_DELIVERABLE_UNIT_ID); du.setTitle("title"); du.addCreator(CREATOR); du.addParent(new DcsDeliverableUnitRef(parent_entity_id)); file.setId("file"); man.setDeliverableUnit(du.getId()); mf.setRef(new DcsFileRef(file.getId())); man.addManifestationFile(mf);
if (du.getType().equals(AbstractVersioningMapper.ROOT_DELIVERABLE_UNIT_TYPE)) { rootDu = du; } else { if (du.getId().equals(predecessorId)) { itr.remove(); continue outer; new DcsDeliverableUnit(rootDu) : null; final DcsDeliverableUnit latestStateDuCopy = (latestStateDu != null) ? new DcsDeliverableUnit(latestStateDu) : null;
DcsDeliverableUnit parent_collection_root = null; for (DcsDeliverableUnitRef ref: state.getParents()) { if (root != null && root.getId().equals(ref.getRef())) { continue; String business_id = get_business_id(du); if (du.getTitle().equals(COLLECTION_TITLE) && du.getType().equals(ROOT_DELIVERABLE_UNIT_TYPE)) { if (business_id.equals(collection.getId())) { root = du; kid_results.clear(); java.util.Collection<DcsDeliverableUnit> kids = parentSearcher.getParentsOf(root.getId(), DcsDeliverableUnit.class); if (kid.getId().equals(state.getId()) || !kid.getType().equals(getStateDuType()) || !kid.getTitle().equals(COLLECTION_TITLE)) { continue; if (latest.getId().equals(kid.getId())) { kid_results.add(kid_collection_id);
@Override public Set<String> discover(Dcp conformingPackage) { Set<String> dataSetIdentifiers = new HashSet<String>(); if (dataSetDu != null) { dataSetIdentifiers.add(dataSetDu.getId()); } return dataSetIdentifiers; }
du_map.put(du.getId(), du); ancestrymap.put(du.getId(), ancestors); for (DcsCollectionRef col_ref : check.getCollections()) { updateAncestry(ancestrymap, du.getId(), col_ref); for (DcsDeliverableUnitRef ref : check.getParents()) { String parent_id = null; for (DcsEntityReference ref : du.getMetadataRef()) { updateAncestry(ancestrymap, ref, du.getId());
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; }
root_id = current_state.getRoot().getId(); state_pred_id = current_state.getLatestState().getId(); statedu.addAlternateId(res); statedu.addFormerExternalRef(collection.getId()); statedu.setTitle(COLLECTION_TITLE); dus.add(rootDu); rootDu.addFormerExternalRef(collection.getId()); rootDu.setTitle(COLLECTION_TITLE); throw new DcpMappingException("Unable to find parent business object: " + parent); } else { statedu.addParent(new DcsDeliverableUnitRef(parent_state.getRoot().getId()));