}
protected abstract ResultBuilder newResultBuilder();
public ResultContent generateResults() throws IOException {
ResultBuilder resultBuilder = newResultBuilder();
resultBuilder.setStartTime(startTime);
if (options.getTailoringInstance() != null) {
resultBuilder.appendTailoring(options.getTailoringInstance());
}
if (options.getProfileId() != null) {
resultBuilder.setProfileId(options.getProfileId());
}
resultBuilder.setTitle(getTitle(document.getId(), options.getProfileId(),
startTime), "en-US");
resultBuilder.setTestSystem(applicationProperties.getApplicationName()
+ " " + applicationProperties.getBuildVersion());
// TODO: P5: find a way to populate the privileged and authenticated values correctly
resultBuilder.appendIdentity(System.getProperty("user.name"), false, true);
appendTargetAndFacts(resultBuilder);
// TODO: P2: investigate if included values should be limited to evaluated rules or all rules
// Currently using evaluated rules
for (RuleResult ruleResult : ruleResultMap.values()) {
resultBuilder.appendRuleResult(ruleResult, xccdfResult);
for (Map.Entry<Value, LiteralValue> entry : ruleResult.getValuesUsed().entrySet()) {
// TODO: P3: eliminate duplicate values
resultBuilder.appendSetValue(entry.getKey(), entry.getValue());
}
}
for (Score score : scores) {
resultBuilder.appendScore(score);
}
resultBuilder.setEndTime(endTime);
return resultBuilder.getResultContent();
}