com.ibm.openpages.api.questionnaire

## Interface IQuestion

- All Superinterfaces:
    IQuestionnaireBase

      public interface IQuestion
      extends IQuestionnaireBase

  This is an interface to access a question for both template and assessment.
  Category:
    Questionnaire

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `getAnswer()` Returns answer of the question.
    `IUser` | `getAnsweredBy()` Returns the user who last answered
    `java.util.Date` | `getAnsweredOnDate()` Returns the timestamp when the answer was persisted
    `AnswerType` | `getAnswerType()` Returns answer type
    `java.lang.Float` | `getMaxRiskScore()` Returns maximum risk score of the question.
    `java.util.List<IQuestionOption>` | `getOptions()` Returns list of `IQuestionOption` for a selection question.
    `java.util.List<java.lang.String>` | `getRequires()` Returns the list of evidence types required by this question for the question to be considered complete.
    `java.lang.Float` | `getScore()` Returns score of the question.
    `QuestionStatus` | `getStatus()` Returns the status of the question
    `java.util.List<IQuestionTableColumn>` | `getTableColumns()` Returns list of `IQuestionTableColumn` for a selection question.
    `IQuestionDependency` | `getVisibilityDependency()` Returns a question dependency object that represents visibility dependency.
    `int` | `getWeight()` Returns weight of the question.
    `boolean` | `hasRequiredEvidences()` Returns a flag to indicate if the question meets all the required evidences.
    `boolean` | `isHidden()` Returns a flag to indicate if the question is hidden because of the visibility dependency condition.
    `boolean` | `isShowAttachmentTab()` Returns a flag to indicate if need to show the question attachment tab.
    `boolean` | `isShowCommentTab()` Returns a flag to indicate if need to show the question comment tab.
    `void` | `setAnswer(java.lang.Object answer)` Sets answer of the question.
    `void` | `setAnswerType(AnswerType aType)` Sets answer type of the question
    `void` | `setOptions(java.util.List<IQuestionOption> options)` Sets options for selection question.
    `void` | `setRequires(java.util.List<java.lang.String> requires)` Sets the list of evidence types required by this question for the question to be considered complete.
    `void` | `setShowAttachmentTab(boolean showAttachmentTab)` Sets if need to show the question attachment tab
    `void` | `setShowCommentTab(boolean showCommentTab)` Sets if need to show the question comment tab
    `void` | `setStatus(QuestionStatus status)` Sets the status of the question
    `void` | `setTableColumns(java.util.List<IQuestionTableColumn> columns)` Sets table columns for selection question.
    `void` | `setVisibilityDependency(IQuestionDependency questiondependency)` Sets a question dependency object.
    `void` | `setWeight(int weight)` Sets weight of the question.

    - ### Methods inherited from interface com.ibm.openpages.api.questionnaire.IQuestionnaireBase

      `getDescription, getId, getOrder, getParentId, getRationale, getReference, getReportID, getTitle, setDescription, setOrder, setRationale, setReference, setTitle`

- - ### Method Detail

    - #### getAnswerType

          AnswerType getAnswerType()

      Returns answer type
      Returns:
        answer type enum

    - #### setAnswerType

          void setAnswerType(AnswerType aType)

      Sets answer type of the question
      Parameters:
        `aType` - answer type enum

    - #### getOptions

          java.util.List<IQuestionOption> getOptions()

      Returns list of `IQuestionOption` for a selection question. Options are only applicable to `AnswerType.RADIO` and `AnswerType.MULTI_CHECK`.
      Returns:
        list of `IQuestionOption`

    - #### setOptions

          void setOptions(java.util.List<IQuestionOption> options)

      Sets options for selection question.
      Parameters:
        `options` - list of `IQuestionOption`

    - #### setTableColumns

          void setTableColumns(java.util.List<IQuestionTableColumn> columns)

      Sets table columns for selection question.
      Parameters:
        `columns` - list of `IQuestionTableColumn`

    - #### getTableColumns

          java.util.List<IQuestionTableColumn> getTableColumns()

      Returns list of `IQuestionTableColumn` for a selection question. Options are only applicable to `AnswerType.TABLE_ANSWER`.
      Returns:
        list of `IQuestionTableColumn`

    - #### getVisibilityDependency

          IQuestionDependency getVisibilityDependency()

      Returns a question dependency object that represents visibility dependency. This question is visible in the responder UI only when the dependency condition is met.
      Returns:
        `IQuestionDependency`

    - #### setVisibilityDependency

          void setVisibilityDependency(IQuestionDependency questiondependency)

      Sets a question dependency object. This question is visible in the responder UI only when the dependency condition is met.
      Parameters:
        `questiondependency` - `IQuestionDependency`

    - #### setWeight

          void setWeight(int weight)

      Sets weight of the question.
      Parameters:
        `weight` -

    - #### getWeight

          int getWeight()

      Returns weight of the question.
      Returns:
        weight

    - #### getScore

          java.lang.Float getScore()

      Returns score of the question.
      Returns:
        score

    - #### getMaxRiskScore

          java.lang.Float getMaxRiskScore()

      Returns maximum risk score of the question.
      Returns:
        maximum risk

    - #### isHidden

          boolean isHidden()

      Returns a flag to indicate if the question is hidden because of the visibility dependency condition.
      Returns:
        hidden flag

    - #### hasRequiredEvidences

          boolean hasRequiredEvidences()

      Returns a flag to indicate if the question meets all the required evidences. When the question does not require any evidences, this flag is true.
      Returns:
        flag to indicate if the question meets all the required evidences

    - #### getAnswer

          java.lang.Object getAnswer()

      Returns answer of the question. The type of the returning answer is determined by the `AnswerType`.
      - `AnswerType.RADIO` : The answer type is `Integer` which corresponds to `IQuestionOption.getValue()`
      - `AnswerType.MULTI_CHECK` : The answer type is `List` of `Integer` which corresponds to `IQuestionOption.getValue()`
      - `AnswerType.TEXT`, `AnswerType.TEXT_AREA` : The answer type is `String`
      - `AnswerType.TABLE_ANSWER` : The answer type is `List` of `List` of `String` which are cell values of a table answer
      The answer can be null when the question is not answered, or when the question is a template object ( as opposed to an assessment object ).
      Returns:
        answer

    - #### setAnswer

          void setAnswer(java.lang.Object answer)

      Sets answer of the question. Refer to `getAnswer()` for the acceptable object type. Otherwise, this call throws an `IllegalArgumentException`. The answer can be null when it is unanswered.
      Parameters:
        `answer` -

    - #### getRequires

          java.util.List<java.lang.String> getRequires()

      Returns the list of evidence types required by this question for the question to be considered complete.
      Returns:
        List of strings (e.g., ["comment", "attachment"] )

    - #### setRequires

          void setRequires(java.util.List<java.lang.String> requires)

      Sets the list of evidence types required by this question for the question to be considered complete.
      Parameters:
        `requires` - List of strings (e.g., ["comment", "attachment"] )

    - #### getAnsweredOnDate

          java.util.Date getAnsweredOnDate()

      Returns the timestamp when the answer was persisted
      Returns:
        the answered timestamp

    - #### getAnsweredBy

          IUser getAnsweredBy()

      Returns the user who last answered
      Returns:
        `IUser`

    - #### getStatus

          QuestionStatus getStatus()

      Returns the status of the question
      Returns:
        `QuestionStatus`

    - #### setStatus

          void setStatus(QuestionStatus status)

      Sets the status of the question
      Parameters:
        `status` - `QuestionStatus`

    - #### isShowCommentTab

          boolean isShowCommentTab()

      Returns a flag to indicate if need to show the question comment tab.
      Returns:
        show comment tab flag

    - #### setShowCommentTab

          void setShowCommentTab(boolean showCommentTab)

      Sets if need to show the question comment tab
      Parameters:
        `showCommentTab` -

    - #### isShowAttachmentTab

          boolean isShowAttachmentTab()

      Returns a flag to indicate if need to show the question attachment tab.
      Returns:
        show attachment tab flag

    - #### setShowAttachmentTab

          void setShowAttachmentTab(boolean showAttachmentTab)

      Sets if need to show the question attachment tab
      Parameters:
        `showAttachmentTab` -

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2020. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.