예제 #1
0
  /** ===================== Private main check methods ===================== */
  private void checkForUndefinedQuestions() {
    List<Question> qlQuestions = this.qlFormData.getAllQuestions();
    List<String> qlQuestionIdNames = this.getQlQuestionIdNames(qlQuestions);
    List<QLSQuestion> qlsQuestions = this.qlsStyleSheetData.getQuestions();

    for (QLSQuestion question : qlsQuestions) {
      if (!qlQuestionIdNames.contains(question.getIdName())) {
        this.astIssueHandler.registerNewError(
            ASTQlsNodeIssueType.QLS_ERROR.UNDEFINED,
            question,
            "Attempted to define style for an undefined question " + question.getIdName() + ".");
      }
    }
  }
예제 #2
0
  private void checkForMultipleQuestionPlacements() {
    List<QLSQuestion> qlsQuestions = this.qlsStyleSheetData.getQuestions();
    List<String> qlsQuestionIdNames = new ArrayList<>();

    for (QLSQuestion question : qlsQuestions) {
      if (qlsQuestionIdNames.contains(question.getIdName())) {
        this.astIssueHandler.registerNewError(
            ASTQlsNodeIssueType.QLS_ERROR.DUPLICATE,
            question,
            "QLS Question  " + question.getIdName() + " already defined (duplicate).");
      } else {
        qlsQuestionIdNames.add(question.getIdName());
      }
    }
  }
예제 #3
0
 private List<String> getQlsQuestionIdNames(List<QLSQuestion> _qlsQuestions) {
   List<String> qlsQuestionIdNames = new ArrayList<>();
   for (QLSQuestion question : _qlsQuestions) {
     qlsQuestionIdNames.add(question.getIdName());
   }
   return qlsQuestionIdNames;
 }
예제 #4
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 + ".");
      }
    }
  }