public DcsRelation(DcsRelation toCopy) { this.relUri = toCopy.getRelUri(); this.ref = toCopy.getRef(); }
private String getPredecessorId(DcsDeliverableUnit du) { for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals( DcsRelationship.IS_SUCCESSOR_OF.asString())) { if (rel.getRef() == null || rel.getRef().getRef() == null) { return null; } return rel.getRef().getRef(); } } return null; }
/** * Returns the identifier of the predecessor of the supplied {@code du}, or null if the DU has no predecessors. * * @param du the deliverable unit * @return the identifier of the predecessor, or null */ public String getPredecessorId(DcsDeliverableUnit du) { for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals( DcsRelationship.IS_SUCCESSOR_OF.asString())) { if (rel.getRef() == null || rel.getRef().getRef() == null) { return null; } return rel.getRef().getRef(); } } return null; }
/** * Returns the identifier of the predecessor of the supplied {@code du}, or null if the DU has no predecessors. * * @param du the deliverable unit * @return the identifier of the predecessor, or null */ public String getPredecessorId(DcsDeliverableUnit du) { for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals( DcsRelationship.IS_SUCCESSOR_OF.asString())) { if (rel.getRef() == null || rel.getRef().getRef() == null) { return null; } return rel.getRef().getRef(); } } return null; }
private static void addRelationSet(SolrInputDocument doc, Collection<DcsRelation> set) { if (set == null || set.size() == 0) { return; } for (DcsRelation rel : set) { setadd(doc, RelationField.TARGET, rel.getRef() == null ? null : rel .getRef().getRef()); setadd(doc, RelationField.RELATION, rel.getRelUri()); if (rel.getRef() != null && rel.getRelUri() != null) { doc.addField(RELATION_FIELD_PREFIX + rel.getRelUri(), rel.getRef().getRef()); } } }
private java.util.Collection<DcsEntity> filterForLatestDeliverableUnits(java.util.Collection<? extends DcsEntity> entities) { java.util.Collection<DcsEntity> result = new HashSet<DcsEntity>(); List<String> predecessorDuIds = new ArrayList<String>(); for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit)entity; for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals(DcsRelationship.IS_SUCCESSOR_OF.asString())) { predecessorDuIds.add(rel.getRef().getRef()); } } } for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { result.add(entity); continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (!predecessorDuIds.contains(du.getId())) { result.add(du); } } return result; }
private java.util.Collection<DcsEntity> filterForLatestDeliverableUnits(java.util.Collection<? extends DcsEntity> entities) { java.util.Collection<DcsEntity> result = new HashSet<DcsEntity>(); List<String> predecessorDuIds = new ArrayList<String>(); for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { continue; } DcsDeliverableUnit du = (DcsDeliverableUnit)entity; for (DcsRelation rel : du.getRelations()) { if (rel.getRelUri().equals(DcsRelationship.IS_SUCCESSOR_OF.asString())) { predecessorDuIds.add(rel.getRef().getRef()); } } } for (DcsEntity entity : entities) { if (!(entity instanceof DcsDeliverableUnit)) { result.add(entity); continue; } DcsDeliverableUnit du = (DcsDeliverableUnit) entity; if (!predecessorDuIds.contains(du.getId())) { result.add(du); } } return result; }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DcsRelation rel = (DcsRelation) source; if (rel.getRef() != null) { writer.addAttribute(A_REF, rel.getRef().getRef()); } if (!isEmptyOrNull(rel.getRelUri())) { writer.addAttribute(A_REL, rel.getRelUri()); } }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); final DcsRelation rel = (DcsRelation) source; if (rel.getRef() != null) { writer.addAttribute(A_REF, rel.getRef().getRef()); } if (!isEmptyOrNull(rel.getRelUri())) { writer.addAttribute(A_REL, rel.getRelUri()); } }
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; }
DcsEntityReference target_ref = rel.getRef();
+ "_" + RelationField.TARGET.solrName(), rel .getRef().getRef());