public AssessmentOverview getAssessmentDetailsByCareContext(CareContextRefVo voCareContextRef) { DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from AdmissionAssessment t "; ArrayList<String> markers = new ArrayList<String>(); ArrayList<Integer> values = new ArrayList<Integer>(); String andStr = " "; if (voCareContextRef != null) { hql.append(andStr + " t.careContext.id = :rcc"); markers.add("rcc"); values.add(voCareContextRef.getID_CareContext()); andStr = " and "; hql.append(andStr + " t.isRIE is null"); } if (markers.size() > 0) query += " where "; query += hql.toString(); List assessmentList = factory.find(query, markers, values); if (assessmentList != null && assessmentList.size() > 0) { AssessmentOverview voAssmnt = AssessmentOverviewAssembler.create((AdmissionAssessment) assessmentList.get(0)); return voAssmnt; } else { return null; } }