this.checkSystem = checkSystem;
}
public AssessmentFile resolve(Check check, CheckContentRef contentRef) {
SourceContext context = check.getContext();
SourceContextData contextData = sourceContextToSourceContextDataMap.get(context);
if (contextData == null) {
contextData = new SourceContextData(context);
sourceContextToSourceContextDataMap.put(context, contextData);
}
String href = contentRef.getHref();
SourceContext resolvedContext = contextData.resolveHref(href);
AssessmentFile retval = null;
if (resolvedContext != null) {
if (sourceContextToAssessmentFileMap.containsKey(resolvedContext)) {
retval = sourceContextToAssessmentFileMap.get(resolvedContext);
} else {
try {
retval = checkSystem.newAssessmentFile(resolvedContext);
sourceContextToAssessmentFileMap.put(resolvedContext, retval);
} catch (IOException e) {
log.error("Unable to create assessment file for content: "+resolvedContext.getId(), e);
retval = null;
} catch (XmlException e) {
log.error("Unable to create assessment file for content: "+resolvedContext.getId(), e);
retval = null;
}
}
} // else do nothing
return retval;