public ShiftDetailsVoCollection listShiftDetailsByCareContext(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from ShiftDetails t "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); if (refCareContext == null) return null; hql.append(" t.careContext.id = :cc"); markers.add("cc"); values.add(refCareContext.getID_CareContext()); query += " where "; query += hql.toString(); List shiftList = factory.find(query, markers, values); return ShiftDetailsVoAssembler.createShiftDetailsVoCollectionFromShiftDetails(shiftList).sort(SortOrder.DESCENDING); }
public ShiftDetailsVoCollection listShiftDetails(CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); String query = "from ShiftDetails as s1_1 where (s1_1.id in (select distinct vc.shiftDetails.id from VentilationChart vc) and s1_1.careContext.id = :care) "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); markers.add("care"); values.add(refCareContext.getID_CareContext()); List lst = factory.find(query, markers, values); ShiftDetailsVoCollection voShiftDetailsVoCollection = ShiftDetailsVoAssembler.createShiftDetailsVoCollectionFromShiftDetails(lst).sort(SortOrder.DESCENDING); return voShiftDetailsVoCollection; }
public ShiftDetailsVo getShiftDetails(DateTime startDate, CareContextRefVo refCareContext) { DomainFactory factory = getDomainFactory(); String filter = " from ShiftDetails sd "; String andStr = " "; StringBuffer filterString = new StringBuffer(); ArrayList markerNames = new ArrayList(); ArrayList markerValues = new ArrayList(); if (refCareContext != null) { filterString.append(" sd.careContext.id = :careContext "); markerNames.add("careContext"); markerValues.add(refCareContext.getID_CareContext()); andStr = " and "; } if(startDate != null) { filterString.append(andStr + " sd.startDateTime = :dateFrom "); markerNames.add("dateFrom"); markerValues.add(startDate.getJavaDate()); } if(andStr.equals(" and ")) filter += " where "; filter += filterString.toString(); List list = factory.find(filter, markerNames, markerValues); if(list != null && list.size() > 0) return ShiftDetailsVoAssembler.create((ShiftDetails) list.get(0)); return null; }