private InvestigationLiteVoCollection getExistingInvestigations(OcsQASessionVo voOcsQA) { if (voOcsQA == null) return null; InvestigationLiteVoCollection voColl = new InvestigationLiteVoCollection(); for (int i = 0; voOcsQA.getCategoryQuestionAnswersIsNotNull() && i < voOcsQA.getCategoryQuestionAnswers().size(); i++) { CategoryQuestionAnswerVo categoryQuestionAnswerVo = voOcsQA.getCategoryQuestionAnswers().get(i); for (int j = 0; categoryQuestionAnswerVo.getServiceQuestionAnswersIsNotNull() && j < categoryQuestionAnswerVo.getServiceQuestionAnswers().size(); j++) { ServiceQuestionAnswerVo serviceQuestionAnswerVo = categoryQuestionAnswerVo.getServiceQuestionAnswers().get(j); for (int k = 0; serviceQuestionAnswerVo.getInvestigationQuestionAnswers() != null && k < serviceQuestionAnswerVo.getInvestigationQuestionAnswers().size(); k++) { voColl.add(serviceQuestionAnswerVo.getInvestigationQuestionAnswers().get(k).getInvestigation()); } } } return voColl; }
private void removeUnusedInvestigations(InvestigationOcsQuestionsVoCollection investigationOcsQuestionsColl, OcsQASessionVo ocsQASession) { InvestigationLiteVoCollection voExistingInvColl = getExistingInvestigations(ocsQASession); for (int i = 0; voExistingInvColl != null && i < voExistingInvColl.size(); i++) { //Check if the investigation was removed if(isInvestigationRemoved(voExistingInvColl.get(i), investigationOcsQuestionsColl)) { removeInvestigationFromVo(voExistingInvColl.get(i).getID_Investigation(), ocsQASession); } } }