/** * Test whether there is a translation relationship between a scenario and a responsibility * * @param scenario The source scenario * @param resp The target responsibility */ public boolean existTranslation(ArchEScenarioVO scenario, ArchEResponsibilityVO resp) { ArchETranslationRelationVO rel = null; for (Iterator<ArchETranslationRelationVO> it = trVOs.iterator(); it.hasNext(); ) { rel = it.next(); // TODO: Check if an equal 'by name' is needed below ArchEScenarioVO parent = rel.getParent(); ArchEResponsibilityVO child = rel.getChild(); if ((parent != null) && (child != null) && parent.equals(scenario) && child.equals(resp)) return (true); } return (false); }
/** * Return those responsibilities that are linked to a particular scenario (via translation * relations) * * @param scenario The parent scenario */ public List<ArchEResponsibility> getResponsibilitiesByScenario(ArchEScenario scenario) { List<ArchEResponsibility> responsibilitiesOfInterest = new ArrayList<ArchEResponsibility>(); ArchETranslationRelationVO item = null; for (Iterator<ArchETranslationRelationVO> it = trVOs.iterator(); it.hasNext(); ) { item = it.next(); // TODO: Check if an equal 'by name' works better here ArchEScenarioVO parent = item.getParent(); ArchEResponsibility child = item.getChild(); if ((parent != null) && parent.equals((ArchEScenarioVO) scenario) && child != null) responsibilitiesOfInterest.add(child); } return (responsibilitiesOfInterest); }