protected String getNameForId(ReportSpecificationList list) { String selection = list.getSelection(); for (IdValuePair pair : list.getList()) { if (selection.equals(pair.getId())) { return pair.getValue(); } } return ""; }
private List<NonNumericTests> getNonNumericTests(List<ReferralItem> referralItems) { DictionaryDAO dictionaryDAO = new DictionaryDAOImpl(); Set<String> testIdSet = new HashSet<String>(); for (ReferralItem item : referralItems) { for (IdValuePair pair : item.getTestSelectionList()) { testIdSet.add(pair.getId()); } } List<NonNumericTests> nonNumericTestList = new ArrayList<NonNumericTests>(); TestResultDAO testResultDAO = new TestResultDAOImpl(); for (String testId : testIdSet) { List<TestResult> testResultList = testResultDAO.getActiveTestResultsByTest(testId); if (!(testResultList == null || testResultList.isEmpty())) { NonNumericTests nonNumericTests = new NonNumericTests(); nonNumericTests.testId = testId; nonNumericTests.testType = testResultList.get(0).getTestResultType(); boolean isSelectList = ResultType.isDictionaryVariant(nonNumericTests.testType); if (isSelectList) { List<IdValuePair> dictionaryValues = new ArrayList<IdValuePair>(); for (TestResult testResult : testResultList) { if (ResultType.isDictionaryVariant(testResult.getTestResultType())) { String resultName = dictionaryDAO.getDictionaryById(testResult.getValue()).getLocalizedName(); dictionaryValues.add(new IdValuePair(testResult.getValue(), resultName)); } } nonNumericTests.dictionaryValues = dictionaryValues; } if (nonNumericTests.testType != null) { nonNumericTestList.add(nonNumericTests); } } } return nonNumericTestList; }