/** * Function used to retrieve the questions and answers for an investigation */ public InvestigationQuestionAnswerVoCollection getInvestigationQuestionsAnswers(InvestigationRefVo investigation, OcsOrderSessionRefVo orderDetails) { if (investigation == null || orderDetails == null) return null; StringBuilder query = new StringBuilder(); query.append("SELECT questions FROM OcsOrderSession AS ocsorder LEFT JOIN ocsorder.clinicalInfo AS clinInfo LEFT JOIN clinInfo.categoryQuestionAnswers AS category "); query.append(" LEFT JOIN category.serviceQuestionAnswers AS serviceQA LEFT JOIN serviceQA.investigationQuestionAnswers AS questions "); query.append(" LEFT JOIN questions.investigation AS investigation"); query.append(" WHERE ocsorder.id = :ID_ORDERDETAILS AND investigation.id = :ID_INVESTIGATION"); ArrayList<String> paramNames = new ArrayList<String>(); ArrayList<Object> paramValues = new ArrayList<Object>(); paramNames.add("ID_ORDERDETAILS"); paramValues.add(orderDetails.getID_OcsOrderSession()); paramNames.add("ID_INVESTIGATION"); paramValues.add(investigation.getID_Investigation()); return InvestigationQuestionAnswerVoAssembler.createInvestigationQuestionAnswerVoCollectionFromInvestigationQuestionAnswer(getDomainFactory().find(query.toString(), paramNames, paramValues)); }