public MDTPatientCustomListVo getCustomList(CustomListRefVo reVoCustomList) { if(reVoCustomList == null) throw new CodingRuntimeException("null type passed to listCustomListTypes() !"); DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(" "); String query = "from MDTPatientCustomList as pcl "; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = " "; if (reVoCustomList.getID_CustomListIsNotNull()) { hql.append(andStr + " pcl.customListType.id = :CustomListTypeId"); markers.add("CustomListTypeId"); values.add(reVoCustomList.getID_CustomList()); andStr = " and "; } if (andStr.equals(" and ")) query += " where "; query += hql.toString(); List list = factory.find(query, markers, values); if(list.size() == 0) return null; MDTPatientCustomListVoCollection coll = MDTPatientCustomListVoAssembler.createMDTPatientCustomListVoCollectionFromMDTPatientCustomList(list); return coll.get(0); }