private DcsCollectionRef createCollectionRef(String string) { DcsCollectionRef ref = new DcsCollectionRef(); ref.setRef(string); return ref; }
private Set<String> getCollectionRels(DcsEntity collection) { Set<String> rels = new HashSet<String>(); DcsCollection coll = (DcsCollection) collection; for (DcsEntityReference ref : coll.getMetadataRef()) { rels.add(ref.getRef()); } if (coll.getParent() != null) { rels.add(coll.getParent().getRef()); } return rels; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; DcsCollection that = (DcsCollection) o; if (coreMd != null ? !coreMd.equals(that.coreMd) : that.coreMd != null) return false; if (metadata != null ? !metadata.equals(that.metadata) : that.metadata != null) return false; if (metadataRef != null ? !metadataRef.equals(that.metadataRef) : that.metadataRef != null) return false; if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false; return true; }
/** * The collections for the deliverable unit * * @return a defensive copy of the collections */ public Set<DcsCollectionRef> getCollections() { final Set<DcsCollectionRef> collections = new HashSet<DcsCollectionRef>(this.collections.size()); for (DcsCollectionRef r : this.collections) { collections.add(new DcsCollectionRef(r)); } return collections; }
private void add_descendants(DcsEntity parent, java.util.Collection<DcsEntity> entities, Set<DcsEntity> result) { if (parent instanceof DcsCollection) { DcsCollectionRef parent_col_ref = new DcsCollectionRef(parent.getId()); DcsCollection col = (DcsCollection) entity; if (col.getParent() != null && col.getParent().equals(parent_col_ref)) { result.add(entity); add_descendants(entity, entities, result);
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (coreMd != null ? coreMd.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + (metadata != null ? metadata.hashCode() : 0); result = 31 * result + (metadataRef != null ? metadataRef.hashCode() : 0); return result; }
/** * Set the collections for the deliverable unit * * @param collections the collections, must not be <code>null</code> * @throws IllegalArgumentException if <code>collections</code> is <code>null</code> */ public void setCollections(Set<DcsCollectionRef> collections) { Assertion.notNull(collections); this.collections = new HashSet<DcsCollectionRef>(collections.size()); for (DcsCollectionRef r : collections) { Assertion.notNull(r); this.collections.add(new DcsCollectionRef(r)); } }
private void add_descendants(DcsEntity parent, java.util.Collection<DcsEntity> entities, Set<DcsEntity> result) { if (parent instanceof DcsCollection) { DcsCollectionRef parent_col_ref = new DcsCollectionRef(parent.getId()); DcsCollection col = (DcsCollection) entity; if (col.getParent() != null && col.getParent().equals(parent_col_ref)) { result.add(entity); add_descendants(entity, entities, result);
private Set<DcsCollectionRef> createCollectionRefSet(String string) { Set<DcsCollectionRef> result = new HashSet<DcsCollectionRef>(); DcsCollectionRef ref = new DcsCollectionRef(); ref.setRef(string); result.add(ref); return result; }
/** * Add a collection to the deliverable unit * * @param collection the collections, must not be <code>null</code> * @throws IllegalArgumentException if <code>collections</code> is <code>null</code> */ public void addCollection(DcsCollectionRef... collection) { Assertion.notNull(collection); for (DcsCollectionRef r : collection) { Assertion.notNull(r); this.collections.add(new DcsCollectionRef(r)); } }
private Set<String> getCollectionRels(DcsEntity collection) { Set<String> rels = new HashSet<String>(); DcsCollection coll = (DcsCollection) collection; for (DcsEntityReference ref : coll.getMetadataRef()) { rels.add(ref.getRef()); } if (coll.getParent() != null) { rels.add(coll.getParent().getRef()); } return rels; }
private static DcsCollectionRef getCollectionRef(SolrDocument doc, SolrName field) { DcsCollectionRef ref = new DcsCollectionRef(); String s = getFirst(doc, field); if (s != null) { ref.setRef(s); } return ref; }
/** Populates an example sip */ @BeforeClass public static void initExampleSips() { DcsCollection coll = new DcsCollection(); coll.setId("example:/collection"); DcsDeliverableUnit du = new DcsDeliverableUnit(); du.addCollection(new DcsCollectionRef(coll.getId())); du.setId("example:/deleverableUnit"); exampleDcp = new Dcp(); exampleDcp.addCollection(coll); exampleDcp.addDeliverableUnit(du); }
private Set<String> getCollectionEntities(String entityId, InputStream content, Metadata md, boolean initial) { Set<String> entities = new HashSet<String>(); /* selected collection is relevant */ entities.add(entityId); try { DcsCollection coll = builder.buildCollection(content); /* A collection's parent is strongly related */ if (coll.getParent() != null) { entities.add(coll.getParent().getRef()); } /* A collection's metadata is significantly related */ for (DcsEntityReference ref : coll.getMetadataRef()) { entities.add(ref.getRef()); } } catch (InvalidXmlException e) { throw new RuntimeException(e); } finally { try { content.close(); } catch (Exception e) { } } /* A collections events are strongly related, if it is the first */ addRelated(md, entities, EVENT); return entities; }
private static Set<DcsCollectionRef> getCollectionRefSet(SolrDocument doc, SolrName field) { Set<DcsCollectionRef> set = new HashSet<DcsCollectionRef>(); for (String s : setgetAll(doc, field)) { DcsCollectionRef ref = new DcsCollectionRef(); if (s != null) { ref.setRef(s); } set.add(ref); } return set; }
for (DcsCollection parent : dcp.getCollections()) { if (rand.nextBoolean()) { col.setParent(new DcsCollectionRef(parent.getId())); break;
private Set<String> getCollectionEntities(String entityId, InputStream content, Metadata md, boolean initial) { Set<String> entities = new HashSet<String>(); /* selected collection is relevant */ entities.add(entityId); try { DcsCollection coll = builder.buildCollection(content); /* A collection's parent is strongly related */ if (coll.getParent() != null) { entities.add(coll.getParent().getRef()); } /* A collection's metadata is significantly related */ for (DcsEntityReference ref : coll.getMetadataRef()) { entities.add(ref.getRef()); } } catch (InvalidXmlException e) { throw new RuntimeException(e); } finally { try { content.close(); } catch (Exception e) { } } /* A collections events are strongly related, if it is the first */ addRelated(md, entities, EVENT); return entities; }
final String id = reader.getAttribute(CollectionConverter.A_ID); if (!isEmptyOrNull(ref)) { final DcsCollectionRef collectionReference = new DcsCollectionRef(); collectionReference.setRef(ref); return collectionReference; final String parentRef = reader.getAttribute(A_REF); if (!isEmptyOrNull(parentRef)) { final DcsCollectionRef parent = new DcsCollectionRef(); parent.setRef(parentRef); collection.setParent(parent);
parent_id = ref.getRef();
final DcsCollectionRef collectionReference = new DcsCollectionRef(); collectionReference.setRef(ref); return collectionReference; final String parentRef = reader.getAttribute(A_REF); if (!isEmptyOrNull(parentRef)) { final DcsCollectionRef parent = new DcsCollectionRef(); parent.setRef(parentRef); collection.setParent(parent);