private String getDisplayString(SummaryClinicalInformationDisplayVo summary) { if (summary == null) throw new CodingRuntimeException("Can not build display string for null record value."); StringBuilder displayString = new StringBuilder(); displayString.append("Authoring HCP: "); if (summary.getAuthoringInformation() != null && summary.getAuthoringInformation().getAuthoringHcp() != null) displayString.append(summary.getAuthoringInformation().getAuthoringHcp().toString()); else displayString.append(" -"); displayString.append(" Authoring Date Time: "); if (summary.getAuthoringInformation() != null && summary.getAuthoringInformation().getAuthoringDateTime() != null) displayString.append(summary.getAuthoringInformation().getAuthoringDateTime().toString()); else displayString.append(" -"); return displayString.toString(); }
private void populateRecordBrowser(SummaryClinicalInformationDisplayVoCollection summaries) { // Clear record browser form.recbrSummaryClinicalInformation().clear(); // Check records collection if (summaries == null) { form.getLocalContext().setSelectedSummaryClinicalInformation(null); return; } // Iterate records collection and add each of them to record browser for (SummaryClinicalInformationDisplayVo summary : summaries) { form.recbrSummaryClinicalInformation().newRow(summary, getDisplayString(summary)); } // If there was a selected record attempt to reselect it, else select the first record if (form.getLocalContext().getSelectedSummaryClinicalInformation() != null) { form.recbrSummaryClinicalInformation().setValue(form.getLocalContext().getSelectedSummaryClinicalInformation()); } // If no selection was performed then attempt to select first record if (form.recbrSummaryClinicalInformation().getValue() == null && summaries.size() > 0) { form.recbrSummaryClinicalInformation().setValue(summaries.get(0)); } }