private MedicationRouteVoCollection getRoutes(DynamicGridRowCollection rows) { if (rows == null) return null; MedicationRouteVoCollection result = new MedicationRouteVoCollection(); for (int i = 0 ; i < rows.size() ; i++) { if (rows.get(i).getValue() instanceof MedicationRouteVo) { MedicationRouteVo x = (MedicationRouteVo) rows.get(i).getValue(); x.setRouteUnits(getUnits(rows.get(i).getRows())); if (x.getRouteIsNotNull() || x.getRouteUnitsIsNotNull()) { result.add(x); } } } if (result.size() == 0) return null; return result; }