public CategoryQuestionShortVoCollection listCategoryQuestions(ims.ocrr.vo.lookups.CategoryCollection categories) { if (categories == null || categories.size() == 0) return null; StringBuffer hql = new StringBuffer(); hql.append("from CategoryQuestion as c1_1 where"); hql.append(" c1_1.oCRRCategory.id in ("); for (int i = 0; i < categories.size(); i++) { hql.append(categories.get(i).getID()); if (i < (categories.size() - 1)) hql.append(", "); } hql.append(") order by systemInformation.creationDateTime"); List list = getDomainFactory().find(hql.toString()); return CategoryQuestionShortVoAssembler.createCategoryQuestionShortVoCollectionFromCategoryQuestion(list); }
private void populateListControl(CategoryQuestionShortVoCollection voCollCatQuestions) { for (int j = 0; voCollCatQuestions != null && j < voCollCatQuestions.size(); j++) { CategoryQuestionShortVo voCategoryQuestionShortVo = voCollCatQuestions.get(j); GenForm.grdDetailsRow row = form.grdDetails().getRows().newRow(); setCategoryQuestion(row, voCategoryQuestionShortVo); } }
private void open() { clearInstanceControls(); Category category = form.cmbCategory().getValue(); if (category != null) { CategoryQuestionShortVoCollection voCollCatQuestions = domain.listCategoryQuestions(category).sort(); populateListControl(voCollCatQuestions); } enableContextMenu(); form.getLocalContext().setUnsavedQuestions(false); }
private CategoryQuestionShortVoCollection populateInstancesData() { CategoryQuestionShortVoCollection voCollCategoryQuestions = new CategoryQuestionShortVoCollection(); for (int i = 0; i < form.grdDetails().getRows().size(); i++) { CategoryQuestionShortVo voCatQShort = form.grdDetails().getRows().get(i).getValue(); voCatQShort.setOCRRCategory(form.cmbCategory().getValue()); voCatQShort.setIsMandatory(new Boolean(form.grdDetails().getRows().get(i).getcolMandatory())); voCatQShort.setAskForInvestigations(form.grdDetails().getRows().get(i).getcolAskForInvestigation()?Boolean.TRUE:Boolean.FALSE); voCollCategoryQuestions.add(voCatQShort); } return voCollCategoryQuestions; }
private void buildCategoryQuestions(Category category, CategoryQuestionAnswerVo voCategoryQuestionAnswer, CategoryQuestionShortVoCollection categoryConfigQuestions) { // Add the Category question if now added before if (categoryConfigQuestions != null && categoryConfigQuestions.size() > 0) { if (voCategoryQuestionAnswer.getCategoryQuestionAnswers() == null) voCategoryQuestionAnswer.setCategoryQuestionAnswers(new GeneralQuestionAnswerVoCollection()); for (int i = 0; i < categoryConfigQuestions.size(); i++) { CategoryQuestionShortVo categoryQuestionShortVo = categoryConfigQuestions.get(i); if (categoryQuestionShortVo.getOCRRCategoryIsNotNull() && categoryQuestionShortVo.getOCRRCategory().equals(category)) { boolean categoryQuestionAdded = isCategoryQuestionAdded(voCategoryQuestionAnswer, categoryQuestionShortVo.getQuestionInformation()); boolean askedForEveryInvestigation = categoryQuestionShortVo.getAskForInvestigationsIsNotNull() && categoryQuestionShortVo.getAskForInvestigations().booleanValue(); //Don't add duplicated questions or questions marked as "Ask for every Investigation" if (categoryQuestionAdded == false && askedForEveryInvestigation == false && isCategoryQuestionActive(categoryQuestionShortVo)) voCategoryQuestionAnswer.getCategoryQuestionAnswers().add(createNewCategoryQuestion(categoryQuestionShortVo)); } } } else { // Clear category questions voCategoryQuestionAnswer.setCategoryQuestionAnswers(null); } }
/** * listCategoryQuestions */ public CategoryQuestionShortVoCollection listCategoryQuestions(ims.ocrr.vo.lookups.Category category) { if(category == null) throw new CodingRuntimeException("category parameter is null - listCategoryQuestions"); List list = getDomainFactory().find("from CategoryQuestion cat where cat.oCRRCategory = :category order by systemInformation.creationDateTime", new String[]{"category"}, new Object[]{getDomLookup(category)}); return CategoryQuestionShortVoAssembler.createCategoryQuestionShortVoCollectionFromCategoryQuestion(list); }
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 CategoryQuestionShortVoCollection listActiveCategoryQuestions(Category category) { CategoryQuestions impl = (CategoryQuestions) getDomainImpl(CategoryQuestionsImpl.class); return impl.listCategoryQuestions(category); }
public CategoryQuestionShortVoCollection listCategoryQuestions(Category category) { CategoryQuestions impl = (CategoryQuestions) getDomainImpl(CategoryQuestionsImpl.class); return impl.listCategoryQuestions(category); }
public CategoryQuestionShortVoCollection listCategoryQuestions(CategoryCollection categories) { CategoryQuestions impl = (CategoryQuestions) getDomainImpl(CategoryQuestionsImpl.class); return impl.listCategoryQuestions(categories); }