public VitalSignsShortVoCollection listVentChartsDates(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from VitalSigns vc "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (refCareContext != null) { hql.append(andStr + " vc.careContext.id = :rcc"); markers.add("rcc"); values.add(refCareContext.getID_CareContext()); andStr = " and "; hql.append(andStr + " vc.isVentilationChartRecord = :record"); markers.add("record"); values.add(Boolean.TRUE); andStr = " and "; } if(andStr.equals(" and ")) query += " where"; query += hql.toString(); List lst = factory.find(query, markers, values); VitalSignsShortVoCollection voVitalsShortColl = VitalSignsShortVoAssembler.createVitalSignsShortVoCollectionFromVitalSigns(lst); return voVitalsShortColl; }