private void open() { form.grdCategory().getRows().clear(); CategoryCollection lkpCollCategory = LookupHelper.getCategory(domain.getLookupService()); ImportResultsConfigVo voImportResultsConfig = domain.getImportResultsConfig(); form.getLocalContext().setImportResultsConfigVo(voImportResultsConfig); if(lkpCollCategory!=null) for (int i = 0 ; i < lkpCollCategory.size() ; i++) { grdCategoryRow row = form.grdCategory().getRows().newRow(); row.setColCategory(lkpCollCategory.get(i).getText()); row.setValue(lkpCollCategory.get(i)); } if(voImportResultsConfig!=null) for (int i = 0 ; i < voImportResultsConfig.getCategories().size() ; i++) { selectCategory(voImportResultsConfig.getCategories().get(i)); } }
private ImportResultsConfigVo populateInstancesData() { ImportResultsConfigVo voImportResultsConfig = new ImportResultsConfigVo(); CategoryCollection collCategory = new CategoryCollection(); for (int i = 0; i < form.grdCategory().getRows().size(); i++) { grdCategoryRow row = form.grdCategory().getRows().get(i); if(row.getColSelect()) collCategory.add(row.getValue()); } voImportResultsConfig.setCategories(collCategory); return voImportResultsConfig; }
private CategoryCollection getUsedCategories(MyOrderComponentVoCollection voCollSelectedComponents) { if (voCollSelectedComponents == null) return null; CategoryCollection category = new CategoryCollection(); for (MyOrderComponentVo component : voCollSelectedComponents) { if (component.getCategory() != null) { category.add(component.getCategory()); } if (component.getComponents() != null) { getUsedCategories(component.getComponents(), category); } } return category; }
public OcsQASessionVo removeUnusedCategoryQuestions(OcsQASessionVo ocsQASession, CategoryCollection usedCategories) { if (ocsQASession == null || ocsQASession.getCategoryQuestionAnswers() == null) return ocsQASession; for (int i = ocsQASession.getCategoryQuestionAnswers().size() - 1; i >= 0; i--) { CategoryQuestionAnswerVo categoryQuestion = ocsQASession.getCategoryQuestionAnswers().get(i); if (!usedCategories.contains(categoryQuestion.getCategory())) ocsQASession.getCategoryQuestionAnswers().remove(categoryQuestion); } return ocsQASession; }
private CategoryCollection getCategoryCollection(InvestigationOcsQuestionsVoCollection investigationOcsQuestionsColl) { CategoryCollection categoryColl = new CategoryCollection(); for (int i = 0; investigationOcsQuestionsColl != null && i < investigationOcsQuestionsColl.size(); i++) { InvestigationOcsQuestionsVo voOrderInv = investigationOcsQuestionsColl.get(i); if (voOrderInv.getInvestigationIndexIsNotNull()) { Category category = voOrderInv.getInvestigationIndex().getCategory(); if (categoryColl.indexOf(category) < 0) categoryColl.add(category); } } categoryColl.sort(); return categoryColl; }
private CategoryCollection getCategories(SelectedComponentFromSelectOrderVoCollection voColl) { CategoryCollection coll = new CategoryCollection(); for (int i = 0; voColl != null && i < voColl.size(); i++) { if(voColl.get(i).getCategoryIsNotNull()) coll.add(voColl.get(i).getCategory()); } return coll; }
private void removeUnusedCategoryQuestions(CategoryCollection categoryColl, OcsQASessionVo voOcsQASession) { if (voOcsQASession == null || voOcsQASession.getCategoryQuestionAnswers() == null) return; for (int i = voOcsQASession.getCategoryQuestionAnswers().size() - 1; i >= 0; i--) { CategoryQuestionAnswerVo question = voOcsQASession.getCategoryQuestionAnswers().get(i); if (categoryColl == null || !categoryColl.contains(question.getCategory())) { voOcsQASession.getCategoryQuestionAnswers().remove(question); } } }
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; }
public CategoryQuestionShortVoCollection listCategoryQuestions(CategoryCollection categories) { CategoryQuestions impl = (CategoryQuestions) getDomainImpl(CategoryQuestionsImpl.class); return impl.listCategoryQuestions(categories); }