private void editQuestion() { Object objQInfo; if(isDialog()) objQInfo = form.lyrTrees().tabPageSelect().grdListedQuestions().getValue(); else objQInfo = form.lyrTrees().tabPageSearch().grdQuestions().getValue(); if(objQInfo == null || (objQInfo instanceof QuestionInformationShortVo == false)) { engine.showMessage("Please select a record"); return; } form.getGlobalContext().Admin.setIsNewQuestion(new Boolean(false)); QuestionInformationVo voSelectedQuestion = domain.getQuestion(((QuestionInformationShortVo)objQInfo).getID_QuestionInformation()); form.getGlobalContext().Admin.setSelectedQuestion(voSelectedQuestion); engine.open(form.getForms().Core.QuestionAnswer); }
private void editQuestion(AssessmentQuestionVo assessmentQuestionVo) { if (assessmentQuestionVo == null) return; QuestionInformationVo voQInfo = assessmentQuestionVo.getQuestion(); form.getLocalContext().setVoQuestionInformation(voQInfo); clearQuestionControls(); populateControlsFromData(voQInfo); form.lyrTabs().tabNewQuestion().lyrDetails().tabGeneral().txtURL().setValue(assessmentQuestionVo.getURL()); form.lyrTabs().tabNewQuestion().lyrDetails().tabGeneral().txtProtocol().setValue(assessmentQuestionVo.getProtocol()); form.lyrTabs().tabNewQuestion().lyrDetails().tabLegend().richTextLegend().setValue(assessmentQuestionVo.getLegendText()); form.setMode(FormMode.EDIT); setIsNewQuestion(new Boolean(false)); enableTabNewQuestion(true); enableTabSearchQuestion(false); showTabNewQuestion(); }
private void editQuestion(QuestionInformationShortVo voQInfoShort) { QuestionInformationVo voQInfo = null; if (voQInfoShort != null && voQInfoShort.getID_QuestionInformationIsNotNull()) { voQInfo = domain.getQuestion(voQInfoShort.getID_QuestionInformation()); form.getLocalContext().setVoQuestionInformation(voQInfo); } clearQuestionControls(); populateControlsFromData(voQInfo); setIsNewQuestion(new Boolean(false)); enableTabNewQuestion(true); boolean isPrimaryQuestion = voQInfo != null && voQInfo .getQuestionTypeIsNotNull() && voQInfo .getQuestionType().equals(QuestionType.PRIMARY)?true:false; if(isDialog()) enableTabSearchQuestion(false); else { enableTabListQuestion(false); showClassificationTree(isPrimaryQuestion); } showTabNewQuestion(); form.setMode(FormMode.EDIT); }
protected QuestionInformationVo populateDataFromScreen(QuestionInformationVo voQInfo) { // Populate the controls that cannot be binded IntRange ageRange = form.lyrTabs().tabNewQuestion().lyrDetails().tabGeneral().irbAgeRange().getValue(); voQInfo.setAgeRangeMax(ageRange != null ? ageRange.getMax() : null); voQInfo.setAgeRangeMin(ageRange != null ? ageRange.getMin() : null); if(voQInfo.getID_QuestionInformation() == null) voQInfo.setQuestionType(form.getGlobalContext().Core.getQuestionType()); voQInfo.setClassification(getClassification()); //voQInfo.setKeywords(getKewords()); boolean isClone = voQInfo.getID_QuestionInformationIsNotNull() && voQInfo.getID_QuestionInformation() == -1; voQInfo.setAnswerTypes(getAnswerTypes(isClone ? null : voQInfo.getAnswerTypes(), isClone)); voQInfo.setTaxonomyMap(form.lyrTabs().tabNewQuestion().lyrDetails().tabTaxonomy().customTaxonomy().getValue()); super.populateDataFromScreen(voQInfo); voQInfo.setLegendText(form.lyrTabs().tabNewQuestion().lyrDetails().tabLegend().richTextLegend().getValue()); if(isClone) { voQInfo.setID_QuestionInformation(null); } return voQInfo; }
private void populateClassification(QuestionInformationVo voQInfo) { if (voQInfo != null && voQInfo.getClassificationIsNotNull()) { QuestionClassification qClassInfo; TreeNode node; for (int j = 0; j < voQInfo.getClassification().size(); j++) { qClassInfo = voQInfo.getClassification().get(j); for (int i = 0; i < form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().getNodes().size(); i++) { node = form.lyrTabs().tabNewQuestion().lyrDetails().tabClasification().treClassification().getNodes().get(i); if (qClassInfo.equals(node.getValue())) node.setChecked(true); if (node.getNodes() != null && node.getNodes().size() > 0) setClassificationValue(qClassInfo, node); } } } }
private void loadQuestion() { form.grdAnswerType().getRows().clear(); QuestionInformationVo voQInfo = form.getGlobalContext().Admin.getSelectedQuestion(); if(voQInfo != null) { //Populated binded controls super.populateScreenFromData(voQInfo); form.cmbStatus().setValue(voQInfo.getStatus()); loadClassification(voQInfo); populateTaxonomy(voQInfo); populateAnswerTypes(voQInfo); form.irbAgeRange().setValue(new IntRange(voQInfo.getAgeRangeMin(), voQInfo.getAgeRangeMax())); } }
private void loadClassification(QuestionInformationVo voQInfo) { if(voQInfo != null && voQInfo.getClassificationIsNotNull()) { QuestionClassification qClassInfo; TreeNode node; for(int j=0; j<voQInfo.getClassification().size(); j++) { qClassInfo = voQInfo.getClassification().get(j); for(int i=0; i<form.treClassification().getNodes().size(); i++) { node = form.treClassification().getNodes().get(i); if(qClassInfo.equals(node.getValue())) node.setChecked(true); if(node.getNodes() != null && node.getNodes().size() > 0) setClassificationValue(qClassInfo, node); } } } }
private boolean isQuestionInvalidForPatient(QuestionInformationVo question) { PatientAssessmentInfoVo patInfo = form.getLocalContext().getPatientInfo(); if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull()) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()))) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() > question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge() < question.getAgeRangeMin())) return true; return false; }
private ArrayList<String> validateGraphicAnswer(PatientGraphicAssessmentQuestionAnswerVo answer, ArrayList<String> errors) { if (errors == null) errors = new ArrayList<String>(); if (answer == null || answer.getGraphicQuestion() == null || answer.getPatientAnswers() == null) return errors; QuestionInformationVo question = answer.getGraphicQuestion().getQuestion(); PatientAssessmentAnswerVoCollection patientAnswers = answer.getPatientAnswers(); Boolean isMandatory = answer.getIsMandatory(); validateAllAnswers(errors, question, patientAnswers, isMandatory); return errors; }
private boolean isQuestionInvalidForPatient(QuestionInformationVo question) { if (patInfo == null) return false; if (question.getGenderSpecificIsNotNull() ) { if (GenderSpecific.MALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.MALE.equals(patInfo.getSex()))) return true; else if (GenderSpecific.FEMALE.equals(question.getGenderSpecific()) && (!patInfo.getSexIsNotNull() || !Sex.FEMALE.equals(patInfo.getSex()) )) return true; } if (question.getAgeRangeMaxIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()>question.getAgeRangeMax())) return true; if (question.getAgeRangeMinIsNotNull() && (!patInfo.getAgeIsNotNull() || patInfo.getAge()<question.getAgeRangeMin())) return true; return false; }
@SuppressWarnings("unchecked") private ArrayList validateAnswer(PatientAssessmentQuestionVo assessmentQuestion, ArrayList errors) { if(errors == null) errors = new ArrayList(); if(assessmentQuestion == null || assessmentQuestion.getAssessmentQuestion() == null || assessmentQuestion.getPatientAnswers() == null) return errors; QuestionInformationVo question = assessmentQuestion.getAssessmentQuestion().getQuestion(); PatientAssessmentAnswerVoCollection patientAnswers = assessmentQuestion.getPatientAnswers(); Boolean isMandatory = assessmentQuestion.getIsMandatory(); validateAllAnswers(errors, question, patientAnswers, isMandatory); return errors; }
@SuppressWarnings("unchecked") private ArrayList validateGraphicAnswer(PatientGraphicAssessmentQuestionAnswerVo answer, ArrayList errors) { if(errors == null) errors = new ArrayList(); if(answer == null || answer.getGraphicQuestion() == null || answer.getPatientAnswers() == null) return errors; QuestionInformationVo question = answer.getGraphicQuestion().getQuestion(); if (isQuestionInvalidForPatient(question)) return errors; PatientAssessmentAnswerVoCollection patientAnswers = answer.getPatientAnswers(); Boolean isMandatory = answer.getIsMandatory(); validateAllAnswers(errors, question, patientAnswers, isMandatory); return errors; }
@SuppressWarnings("unchecked") private ArrayList validateGraphicFindingAnswer(PatientGraphicAssessmentFindingQuestionAnswerVo answer, ArrayList errors) { if(errors == null) errors = new ArrayList(); if(answer == null || answer.getGraphicFindingQuestion() == null || answer.getPatientAnswers() == null) return errors; QuestionInformationVo question = answer.getGraphicFindingQuestion().getQuestion(); PatientAssessmentAnswerVoCollection patientAnswers = answer.getPatientAnswers(); Boolean isMandatory = answer.getIsMandatory(); validateAllAnswers(errors, question, patientAnswers, isMandatory); return errors; }
private grdListedQuestionsRow getChildListNode(QuestionClassification item, QuestionInformationShortVo voQInfo) { grdListedQuestionsRow parentRow, childRow; //Children for(int i=0; i<form.lyrTrees().tabPageSelect().grdListedQuestions().getRows().size(); i++) { parentRow = form.lyrTrees().tabPageSelect().grdListedQuestions().getRows().get(i); for(int k=0; parentRow != null && k<parentRow.getRows().size(); k++) { childRow = parentRow.getRows().get(k); Object objValue = childRow.getValue(); if(objValue instanceof QuestionClassification) { if(item.equals(objValue)) { //Check for duplicates for(int x=0; x<childRow.getRows().size(); x++) { Object value = childRow.getRows().get(x).getValue(); if(value instanceof QuestionInformationVo && value.equals(voQInfo)) return null; } return childRow.getRows().newRow(); } } } } return null; }
private grdSelectedQuestionsRow getChildSelNode(QuestionClassification item, QuestionInformationShortVo voQInfo) { grdSelectedQuestionsRow parentRow, childRow; //Children for(int i=0; i<form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().size(); i++) { parentRow = form.lyrTrees().tabPageSelect().grdSelectedQuestions().getRows().get(i); for(int k=0; parentRow != null && k<parentRow.getRows().size(); k++) { childRow = parentRow.getRows().get(k); Object objValue = childRow.getValue(); if(objValue instanceof QuestionClassification) { if(item.equals(objValue)) { //Check for duplicates for(int x=0; x<childRow.getRows().size(); x++) { Object value = childRow.getRows().get(x).getValue(); if(value instanceof QuestionInformationVo && value.equals(voQInfo)) return null; } return childRow.getRows().newRow(); } } } } return null; }
private boolean voAddedToParent(QuestionInformationShortVo voQInfo) { for(int i=0; i<form.lyrTrees().tabPageSearch().grdQuestions().getRows().size(); i++) { for(int j=0; j<form.lyrTrees().tabPageSearch().grdQuestions().getRows().get(i).getRows().size(); j++) { Object objValue = form.lyrTrees().tabPageSearch().grdQuestions().getRows().get(i).getRows().get(j); if(objValue instanceof QuestionInformationVo && ((QuestionInformationVo)objValue).equals(voQInfo)) { return true; } } } return false; }