/** * Return all the responsibilities a given responsibility is child of (due to refinement * relations) * * @param childResponsibility The child responsibility */ public List<ArchEResponsibility> getParentResponsibilities( ArchEResponsibility childResponsibility) { List<ArchEResponsibility> parents = 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 if ((item.getChild() != null) && (item.getChild().equals(childResponsibility) && item.getParent() != null)) parents.add(item.getParent()); } return (parents); }
/** * Test whether there is a refinement relationship between a pair of responsibilities * * @param resp The source responsibility * @param leaf The target responsibility */ public boolean existRefinement(ArchEResponsibilityVO resp, ArchEResponsibilityVO leaf) { ArchERefinementRelationVO rel = null; for (Iterator<ArchERefinementRelationVO> it = refVOs.iterator(); it.hasNext(); ) { rel = it.next(); // TODO: Check if an equal 'by name' is needed below ArchEResponsibilityVO parent = rel.getParent(); ArchEResponsibilityVO child = rel.getChild(); if ((parent != null) && (child != null) && parent.equals(resp) && child.equals(leaf)) return (true); } return (false); }
/** * 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); }