private void addParentRequirmentFieldToContext(TestOutcome testOutcome, Map<String, Object> context) {
Optional<Requirement> parentRequirement = requirementsService.getParentRequirementFor(testOutcome);
Optional<Story> featureOrStory = Optional.fromNullable(testOutcome.getUserStory());
String parentTitle = null;
if (parentRequirement.isPresent()) {
parentTitle = parentRequirement.get().getName();
context.put("parentRequirement", parentRequirement);
context.put("featureOrStory", Optional.absent());
context.put("parentTitle", parentTitle);
context.put("parentLink", reportNameProvider.forRequirement(parentRequirement.get()));
} else if (featureOrStory.isPresent()) {
parentTitle = featureOrStory.get().getName();
context.put("parentRequirement", Optional.absent());
context.put("featureOrStory",featureOrStory);
context.put("parentTitle", parentTitle);
context.put("parentLink", reportNameProvider.forTag(featureOrStory.get().asTag()));
}
TagFilter tagFilter = new TagFilter(getEnvironmentVariables());
Set<TestTag> filteredTags = tagFilter.removeTagsOfType(testOutcome.getTags(), "story");
if (parentTitle != null) {
filteredTags = tagFilter.removeTagsWithName(filteredTags, parentTitle);
}
context.put("filteredTags", filteredTags);
}