private IChartValueAnalyte[] getAnalytesComments(IChartValueSet set) { ArrayList<IChartValueAnalyte> analytesWithComments = new ArrayList<IChartValueAnalyte>(); if (set == null) return analytesWithComments.toArray(new IChartValueAnalyte[analytesWithComments.size()]); IChartValueGroup[] groups = set.getIChartValueSetGroups(); if (groups != null && groups.length > 0) { for (int i = 0; i < groups.length; i++) { IChartValue[] analytes = groups[i].getIChartValueGroupValues(); if (analytes != null && analytes.length > 0) { for (int j = 0; j < analytes.length; j++) { IChartValue analyte = analytes[j]; if (analyte != null && analyte.getIChartValueComments() != null && analyte.getIChartValueComments().length > 0) { ChartAnalyteCommentsVo analyteWithComments = new ChartAnalyteCommentsVo(); analyteWithComments.setInvestigationName(analyte.getIChartValueInvestigationName()); analyteWithComments.setSpecimenName(analyte.getIChartValueSpecimenType()); analyteWithComments.setAnalyte(groups[i].getIChartValueGroupName()); analyteWithComments.setDate(analyte.getIChartValueDateTime()); analyteWithComments.setDisplayFlag(analyte.getIChartValueDisplayFlag()); if (analyte.getIChartValueComments() != null && analyte.getIChartValueComments().length > 0) { analyteWithComments.setComments(new ChartValueCommentVoCollection()); for (int x = 0; x < analyte.getIChartValueComments().length; x++) { if (analyte.getIChartValueComments()[x] instanceof ChartValueCommentVo) { analyteWithComments.getComments().add((ChartValueCommentVo) analyte.getIChartValueComments()[x]); } } } else { analyteWithComments.setComments(null); } analytesWithComments.add(analyteWithComments); } } } } } Collections.sort(analytesWithComments, new AnalyteCommentsComparator()); return analytesWithComments.toArray(new IChartValueAnalyte[analytesWithComments.size()]); }