Esempio n. 1
0
  private void checkWidgetTypeCompatibilityInQuestion() {
    List<QLSQuestion> qlsQuestions = this.qlsStyleSheetData.getQuestions();
    HashMap<String, Type> questionTypes = this.qlFormData.getallQuestionTypes();

    for (QLSQuestion question : qlsQuestions) {
      AbstractQLSWidget questionWidget = question.getWidget();
      List<Type> supportedQuestionTypes = questionWidget.getSupportedQuestionTypes();
      Type questionType = questionTypes.get(question.getIdName());

      // if questionType == null that means question is not
      // contained in the qlForm, is reported as QLS_ERROR.UNDEFINED
      if (questionType != null && !supportedQuestionTypes.contains(questionType)) {
        this.astIssueHandler.registerNewError(
            ASTQlsNodeIssueType.QLS_ERROR.WRONG_WIDGET_TYPE,
            question,
            "Wrong widget " + questionWidget + " for question type " + questionType + ".");
      }
    }
  }