protected TestResult getTestResult(AnalysisItem analysisItem) { TestResult testResult = null; if (ResultType.DICTIONARY.matches(analysisItem.getResultType())) { testResult = testResultDAO.getTestResultsByTestAndDictonaryResult( analysisItem.getTestId(), analysisItem.getResult()); } else { List<TestResult> testResultList = testResultDAO.getTestResultsByTest(analysisItem.getTestId()); // we are assuming there is only one testResult for a numeric type // result if (!testResultList.isEmpty()) { testResult = testResultList.get(0); } } return testResult; }