/** @param relative The story, before which the new story should be placed. Optional. */ public Requirement createNewRequirement(Requirement relative, boolean before, boolean split) { Requirement item = new Requirement(this); if (split) { String theme = relative.getLabel(); List<String> themes = relative.getThemes(); if (!themes.contains(theme)) themes.add(theme); relative.setThemes(themes); relative.setDirty(true); item.setEpic(relative); item.setThemes(themes); item.setDescription(relative.getDescription()); item.setTestDescription(relative.getTestDescription()); item.setQualitys(relative.getQualitys()); } if (relative == null) { updateRequirementsOrder(); } else { List<Requirement> requirements = getProductBacklogRequirements(); requirements.remove(item); Collections.sort(requirements, getRequirementsOrderComparator()); int idx = requirements.indexOf(relative); if (!before) idx++; requirements.add(idx, item); updateRequirementsOrder(requirements); } getDao().createRequirement(item); return item; }
public List<String> getThemes() { Set<String> themes = new HashSet<String>(); for (Requirement requirement : getRequirements()) { if (requirement.isClosed()) continue; themes.addAll(requirement.getThemes()); } for (Issue issue : getIssues()) { if (issue.isClosed()) continue; themes.addAll(issue.getThemes()); } List<String> ret = new ArrayList<String>(themes); Collections.sort(ret); return ret; }