private QuestionAnswerTypeVoCollection getAnswerTypes() { //Get the active ones - from the grid QuestionAnswerTypeVoCollection voColl = form.grdAnswerType().getValues(); //Add the inactive ones QuestionAnswerTypeVoCollection voInactiveColl = form.getLocalContext().getInactiveAnswerTypes(); QuestionAnswerTypeVo voQAnswType; if(voInactiveColl != null) { for (int i = 0; i < voInactiveColl.size(); i++) { voQAnswType = voInactiveColl.get(i); voColl.add(voQAnswType); } } return voColl; }
private boolean isAtLeastOneActive() { QuestionInformationVo voQInfo = form.getLocalContext().getVoQuestionInformation(); PreActiveActiveInactiveStatus currentStatus = form.lyrTabs().tabNewQuestion().cmbStatus().getValue(); PreActiveActiveInactiveStatus previousStatus = voQInfo != null?voQInfo.getStatus():null; if(isPreviousStatusNotActive(currentStatus, previousStatus)) { //Check at least one Answer Type QuestionAnswerTypeVoCollection voColl = getAnswerTypes(null, true); int answersCount = voColl != null?voColl.size():0; boolean oneActive = answersCount == 0?true:false; for(int i=0; voColl != null && i<voColl.size(); i++) { if(voColl.get(i).getActiveStatus().booleanValue() == true) { oneActive = true; break; } } if(oneActive == false) { form.getGlobalContext().Core.setYesNoDialogMessage("Warning: at least one Answer Type should be active. Do you want to continue?"); engine.open(form.getForms().Core.YesNoDialog); return false; } } return true; }
private boolean hasSeparator(QuestionAnswerTypeVoCollection voColl) { for (int i = 0; i < voColl.size(); i++) { if(voColl.get(i).getAnswerTypeIsNotNull() && voColl.get(i).getAnswerType().equals(QuestionAnswerType.SEPARATOR)) return true; } return false; }
private boolean hasOtherThanSeparatorType(QuestionAnswerTypeVoCollection voColl) { for (int i = 0; i < voColl.size(); i++) { if(voColl.get(i).getAnswerTypeIsNotNull() && !voColl.get(i).getAnswerType().equals(QuestionAnswerType.SEPARATOR) && voColl.get(i).getActiveStatusIsNotNull() && voColl.get(i).getActiveStatus()) return true; } return false; }
private void cloneQuestion(QuestionInformationShortVo voQInfoShort) { clearQuestionControls(); initialiseNewQuestion(); enableTabNewQuestion(true); enableTabListQuestion(false); showClassificationTree(true); form.getGlobalContext().Core.setQuestionType(QuestionType.PRIMARY); form.lyrTabs().tabNewQuestion().setCaption(ADD_QUESTION); QuestionInformationVo voQInfo = null; if (voQInfoShort != null && voQInfoShort.getID_QuestionInformationIsNotNull()) { voQInfo = domain.getQuestion(voQInfoShort.getID_QuestionInformation()); voQInfo.clearIDAndVersion(); //WDEV-17026 if (voQInfo.getTaxonomyMap() == null) { voQInfo.setTaxonomyMap(new TaxonomyMapCollection()); } voQInfo.setKeywords(new KeywordVoCollection()); if (voQInfo.getKeywords() == null) { voQInfo.setTaxonomyMap(new TaxonomyMapCollection()); } if(voQInfo.getAnswerTypes() != null) { QuestionAnswerTypeVoCollection answers = new QuestionAnswerTypeVoCollection(); for(int x = 0; x < voQInfo.getAnswerTypes().size(); x++) { QuestionAnswerTypeVo answer = voQInfo.getAnswerTypes().get(x); answer.clearIDAndVersion(); if(answer.getOptions() != null) { AnswerOptionVoCollection options = new AnswerOptionVoCollection(); for(int y = 0; y < answer.getOptions().size(); y++) { AnswerOptionVo option = answer.getOptions().get(y); if(option != null) { option.clearIDAndVersion(); options.add(option); } } answer.setOptions(options); } answers.add(answer); } voQInfo.setAnswerTypes(answers); } voQInfo.setID_QuestionInformation(-1); voQInfo.setStatus(PreActiveActiveInactiveStatus.PREACTIVE); form.getLocalContext().setVoQuestionInformation(voQInfo); populateControlsFromData(voQInfo); this.form.lyrTabs().tabNewQuestion().cmbStatus().setValue(PreActiveActiveInactiveStatus.PREACTIVE); } enableContextMenu(); }
private void addLookupToInactiveList(QuestionAnswerTypeVo voQAnsType) { QuestionAnswerTypeVoCollection voColl = form.getLocalContext().getInactiveAnswerTypesIsNotNull() ? form.getLocalContext().getInactiveAnswerTypes() : new QuestionAnswerTypeVoCollection(); voColl.add(voQAnsType); form.getLocalContext().setInactiveAnswerTypes(voColl); }
private void addLookupToInactiveList(QuestionAnswerTypeVo voQAnsType) { QuestionAnswerTypeVoCollection voColl = form.getLocalContext().getInactiveAnswerTypesIsNotNull()?form.getLocalContext().getInactiveAnswerTypes():new QuestionAnswerTypeVoCollection(); voColl.add(voQAnsType); form.getLocalContext().setInactiveAnswerTypes(voColl); }