private GeneralQuestionAnswerVoCollection getServiceQuestions(ServiceQuestionShortVoCollection serviceConfigQuestions, ServiceLiteVo voServiceLite) { GeneralQuestionAnswerVoCollection serviceQuestions = new GeneralQuestionAnswerVoCollection(); for (int i = 0; serviceConfigQuestions != null && i < serviceConfigQuestions.size(); i++) { ServiceQuestionShortVo serviceQuestionShortVo = serviceConfigQuestions.get(i); boolean askedForEveryInvestigation = serviceQuestionShortVo.getAskForInvestigationsIsNotNull() && serviceQuestionShortVo.getAskForInvestigations().booleanValue(); if(askedForEveryInvestigation == false && serviceQuestionShortVo.getService().equals(voServiceLite)) { GeneralQuestionAnswerVo voGQA = createNewServiceQuestion(serviceQuestionShortVo); if(voGQA != null) serviceQuestions.add(voGQA); } } return serviceQuestions; }
public ServiceQuestionShortVoCollection listServiceQuestionsByServiceIds(Integer[] serviceIds) { if(serviceIds == null || serviceIds.length == 0) return null; StringBuffer hqlStart = new StringBuffer(); String hql; hqlStart.append("select distinct serQuest from ServiceQuestion serQuest where serQuest.service.id in ( "); for (int i = 0; i < serviceIds.length; i++) hqlStart.append(serviceIds[i].toString() + ","); if (hqlStart.toString().endsWith(",")) hql = hqlStart.toString().substring(0, hqlStart.length() - 1); else hql = hqlStart.toString(); hql += " ) order by systemInformation.creationDateTime"; List list = getDomainFactory().find(hql); return ServiceQuestionShortVoAssembler.createServiceQuestionShortVoCollectionFromServiceQuestion(list); }
private void populateListControl(ServiceQuestionShortVoCollection voCollServiceQuestions) { for (int j = 0; voCollServiceQuestions != null && j < voCollServiceQuestions.size(); j++) { ServiceQuestionShortVo voServiceQuestion = voCollServiceQuestions.get(j); GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow(); setServiceQuestion(row, voServiceQuestion); } }
private void open() { clearInstanceControls(); ServiceRefVo service = form.qmbService().getValue(); if (service != null) { ServiceQuestionShortVoCollection voCollServiceQuestions = domain.listServiceQuestions(service); populateListControl(voCollServiceQuestions); } enableContextMenu(); }
private ServiceQuestionShortVoCollection populateInstancesData() { ServiceQuestionShortVoCollection voCollServiceQuestions = new ServiceQuestionShortVoCollection(); for (int i = 0; i < form.grdDetails().getRows().size(); i++) { ServiceQuestionShortVo voServiceQShort = form.grdDetails().getRows().get(i).getValue(); voServiceQShort.setService(form.qmbService().getValue()); voServiceQShort.setAskForInvestigations(form.grdDetails().getRows().get(i).getcolAskForInvestigation()?Boolean.TRUE:Boolean.FALSE); voServiceQShort.setIsMandatory(new Boolean(form.grdDetails().getRows().get(i).getcolMandatory())); voCollServiceQuestions.add(voServiceQShort); } return voCollServiceQuestions; }
private void buildServiceQuestions(Category category, CategoryQuestionAnswerVo voCategoryQuestionAnswerVo, ServiceQuestionShortVoCollection serviceConfigQuestions, GeneralQuestionAnswerVoCollection askedInEveryInvestigations, InvestigationOcsQuestionsVo voInvOcs) { if (voInvOcs != null) { Category investigationCategory = voInvOcs.getInvestigationIndexIsNotNull() && voInvOcs.getInvestigationIndex().getCategoryIsNotNull() ? voInvOcs.getInvestigationIndex().getCategory() : null; if (investigationCategory != null && investigationCategory.equals(category)) { ServiceLiteVo serviceVo = voInvOcs.getProviderServiceIsNotNull() && voInvOcs.getProviderService().getLocationServiceIsNotNull() ? voInvOcs.getProviderService().getLocationService().getService() : null; if(serviceVo != null) { ServiceQuestionAnswerVo voServiceQA = getInstServiceQuestionAnswerFromConfigService(serviceConfigQuestions, voCategoryQuestionAnswerVo, askedInEveryInvestigations, serviceVo, voInvOcs); boolean questionsAdded = voServiceQA != null && voServiceQA.getServiceQuestionAnswersIsNotNull() && voServiceQA.getServiceQuestionAnswers().size() > 0; boolean investigationQuestionsAdded = voServiceQA != null && voServiceQA.getInvestigationQuestionAnswersIsNotNull() && voServiceQA.getInvestigationQuestionAnswers().size() > 0; //Add the Service only if there is at least one Service or Investigation Question if(questionsAdded || investigationQuestionsAdded) { if (voCategoryQuestionAnswerVo.getServiceQuestionAnswers() == null) voCategoryQuestionAnswerVo.setServiceQuestionAnswers(new ServiceQuestionAnswerVoCollection()); int index = voCategoryQuestionAnswerVo.getServiceQuestionAnswers().indexOf(voServiceQA); if(index < 0) voCategoryQuestionAnswerVo.getServiceQuestionAnswers().add(voServiceQA); else voCategoryQuestionAnswerVo.getServiceQuestionAnswers().set(index, voServiceQA); } } } } else { voCategoryQuestionAnswerVo.setServiceQuestionAnswers(null); } }
public ServiceQuestionShortVoCollection listInformationMessagesForService(Integer serviceId) { if(serviceId == null) throw new CodingRuntimeException("serviceId is null in method listInformationMessagesForService"); String hql = "select distinct serQuest from ServiceQuestion serQuest where serQuest.service.id = :idService and serQuest.questionInformation.isQuestion = :isQuestion"; List list = getDomainFactory().find(hql, new String[]{"idService","isQuestion"}, new Object[]{ serviceId, Boolean.FALSE}); if(list != null && list.size() > 0) return ServiceQuestionShortVoAssembler.createServiceQuestionShortVoCollectionFromServiceQuestion(list); return null; }
public OcsQASessionVo setOcsQASessionAnswers(OcsQASessionVo voOcsQASession, CategoryQuestionShortVoCollection categoryConfigQuestions, ServiceQuestionShortVoCollection serviceConfigQuestions, InvestigationOcsQuestionsVoCollection investigationOcsQuestionsColl) { //Everything is driven by the Investigations if(investigationOcsQuestionsColl == null || investigationOcsQuestionsColl.size() == 0) return null; if(voOcsQASession == null) throw new CodingRuntimeException("Cannot set answers for null OcsQASessionVo"); if(voOcsQASession.getCategoryQuestionAnswers() == null) voOcsQASession.setCategoryQuestionAnswers(new CategoryQuestionAnswerVoCollection()); //Get a list of top Categories CategoryCollection categoryColl = getCategoryCollection(investigationOcsQuestionsColl); //Add new Category /Investigations/Service Questions for (int i = 0; i < categoryColl.size(); i++) { Category category = categoryColl.get(i); for (int j = 0; investigationOcsQuestionsColl != null && j < investigationOcsQuestionsColl.size(); j++) { InvestigationOcsQuestionsVo voInvestigation = investigationOcsQuestionsColl.get(j); CategoryQuestionAnswerVo voCategoryQuestionAnswerVo = getCategoryQuestionAnswer(category, voOcsQASession); if(voInvestigation.getInvestigationIndex().getCategory().equals(category) && isInvestigationAdded(voInvestigation, voOcsQASession) == false) { //Category Questions Hierarchy buildCategoryQuestions(category, voCategoryQuestionAnswerVo, categoryConfigQuestions); //Get Questions that have to be asked in every Investigations GeneralQuestionAnswerVoCollection askedInEveryInvestigations = getQuestionsToBeAskedInEveryInvestigation(category, categoryConfigQuestions, serviceConfigQuestions, voInvestigation); //Build Service and Investigation Questions buildServiceQuestions(category, voCategoryQuestionAnswerVo, serviceConfigQuestions, askedInEveryInvestigations, voInvestigation); //Aa CategoryQuestionAnswerVo if there is at least one Question added if(isAtLeastOneQuestionAdded(voCategoryQuestionAnswerVo)) { int index = voOcsQASession.getCategoryQuestionAnswers().indexOf(voCategoryQuestionAnswerVo); if(index < 0) voOcsQASession.getCategoryQuestionAnswers().add(voCategoryQuestionAnswerVo); else voOcsQASession.getCategoryQuestionAnswers().set(index, voCategoryQuestionAnswerVo); } if(voInvestigation.getProviderService() == null) { if(voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers() == null) voCategoryQuestionAnswerVo.setClinicalInvestigationQuestionAnswers(new InvestigationQuestionAnswerVoCollection()); InvestigationQuestionAnswerVo voInvQuestionAnswer = getInstInvestigationQuestionAnswerFromConfigInvestigation(voInvestigation, voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers(), askedInEveryInvestigations); voCategoryQuestionAnswerVo.getClinicalInvestigationQuestionAnswers().add(voInvQuestionAnswer); voOcsQASession.getCategoryQuestionAnswers().add(voCategoryQuestionAnswerVo); } } } } removeUnusedCategoryQuestions(categoryColl, voOcsQASession); removeUnusedInvestigations(investigationOcsQuestionsColl, voOcsQASession); return voOcsQASession; }
private GeneralQuestionAnswerVoCollection getQuestionsToBeAskedInEveryInvestigation(Category category, CategoryQuestionShortVoCollection categoryConfigQuestions, ServiceQuestionShortVoCollection serviceConfigQuestions, InvestigationOcsQuestionsVo voInvOcs) { //Category Questions GeneralQuestionAnswerVoCollection voColl = new GeneralQuestionAnswerVoCollection(); for (int i = 0; categoryConfigQuestions != null && i < categoryConfigQuestions.size(); i++) { CategoryQuestionShortVo categoryQuestion = categoryConfigQuestions.get(i); if(categoryQuestion.getOCRRCategoryIsNotNull() && categoryQuestion.getOCRRCategory().equals(category)) { if(categoryQuestion.getAskForInvestigationsIsNotNull() && categoryQuestion.getAskForInvestigations().booleanValue()) { //WDEV-3332 if(isCategoryQuestionActive(categoryQuestion)) { GeneralQuestionAnswerVo voGCQ = createNewCategoryQuestion(categoryQuestion); if(voGCQ != null) voColl.add(voGCQ); } } } } //Service Questions Category investigationCategory = voInvOcs != null && voInvOcs.getInvestigationIndexIsNotNull() && voInvOcs.getInvestigationIndex().getCategoryIsNotNull()?voInvOcs.getInvestigationIndex().getCategory():null; if(investigationCategory != null && investigationCategory .equals(category)) { for (int j = 0; serviceConfigQuestions != null && j < serviceConfigQuestions.size(); j++) { ServiceQuestionShortVo voServiceQ = serviceConfigQuestions.get(j); if(voServiceQ.getAskForInvestigationsIsNotNull() && voServiceQ.getAskForInvestigations().booleanValue()) { if(isSameService(voServiceQ, voInvOcs)) { GeneralQuestionAnswerVo voGSQ = createNewServiceQuestion(voServiceQ); if(voGSQ != null) voColl.add(voGSQ); } } } } return voColl; }
public ServiceQuestionShortVoCollection listActiveServiceQuestions(Integer serviceId) { ServiceQuestions impl = (ServiceQuestions) getDomainImpl(ServiceQuestionsImpl.class); ServiceRefVo voServiceRef = new ServiceRefVo(); voServiceRef.setID_Service(serviceId); return impl.listServiceQuestions(voServiceRef); }