/** * Test whether there is a relation of a given type between two responsibilities. In case the * relation exists, it is returned by the method * * @param resp1 The source responsibility * @param resp2 The target responsibility * @param relationTypeVO The relation type (VO class name) */ public ArchERelation getRelation( ArchEResponsibility resp1, ArchEResponsibility resp2, String relationTypeVO) { List<ArchERelation> list = this.getRelations(relationTypeVO); ArchERelation rel = null; for (Iterator<ArchERelation> it = list.iterator(); it.hasNext(); ) { rel = it.next(); // TODO: Check if an equal 'by name' is needed below ArchEResponsibility parent = (ArchEResponsibility) rel.getParent(); ArchEResponsibility child = (ArchEResponsibility) rel.getChild(); if ((parent != null) && (child != null) && parent.equals(resp1) && child.equals(resp2)) return (rel); if ((parent != null) && (child != null) && parent.equals(resp2) && child.equals(resp1)) return (rel); } return (null); }
public ArchERelation getRelation(ArchEScenario sc, ArchEResponsibility resp) { List<ArchERelation> list = this.getRelations(ArchETranslationRelationVO.class.getName()); ArchERelation rel = null; for (Iterator<ArchERelation> it = list.iterator(); it.hasNext(); ) { rel = it.next(); // TODO: Check if an equal 'by name' is needed below ArchEScenario parent = (ArchEScenario) rel.getParent(); ArchEResponsibility child = (ArchEResponsibility) rel.getChild(); if ((parent != null) && (child != null) && parent.equals(sc) && child.equals(resp)) return (rel); } return (null); }
/** * Test if a given responsibility has been refined * * @param responsibility The parent responsibility */ public boolean isLeaf(ArchEResponsibility responsibility) { ArchERefinementRelationVO item = null; for (Iterator<ArchERefinementRelationVO> it = refVOs.iterator(); it.hasNext(); ) { item = it.next(); // TODO: Check if an equal 'by name' works better here ArchEResponsibility parent = item.getParent(); if ((parent != null) && parent.equals(responsibility) && item.getChild() != null) return (false); } return (true); }
/** * Return the refinements (children responsibilities) of a given responsibility * * @param parentResponsibility The parent responsibility */ public List<ArchEResponsibility> getChildrenResponsibilities( ArchEResponsibility parentResponsibility) { List<ArchEResponsibility> children = new ArrayList<ArchEResponsibility>(); ArchERefinementRelationVO item = null; for (Iterator<ArchERefinementRelationVO> it = refVOs.iterator(); it.hasNext(); ) { item = it.next(); // TODO: Check if an equal 'by name' works better here ArchEResponsibility parent = item.getParent(); if ((parent != null) && parent.equals(parentResponsibility) && item.getChild() != null) children.add(item.getChild()); } return (children); }