Interface QuestionnaireService

All Known Implementing Classes:
QuestionnaireServiceImpl

public interface QuestionnaireService
The Java API for the questionnaire service.
Author:
Filip Hrisafov, Micha Kiener
  • Method Summary

    Modifier and Type Method Description
    void deleteQuestionnaire​(java.lang.String id)
    Deletes the selected questionnaire instance with the given id.
    Questionnaire findQuestionnaire​(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)
    Returns the questionnaire instance with the given id, containing the current question (if still at least one open) and optionally the previous questions as well, if requested.
    Questionnaire getQuestionnaire​(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)
    Returns the questionnaire instance with the given id, containing the current question (if still at least one open) and optionally the previous questions as well, if requested.
    java.util.List<QuestionnaireModel> getQuestionnaireModels​(java.lang.String lang)
    Returns a list of available questionnaire models to start questionnaire instances for.
    java.util.List<java.lang.String> getQuestionnaireStartingOptions​(java.lang.String modelKey, java.lang.String lang)
    Returns the list of available starting options for the requested questionnaire.
    Questionnaire selectAnswer​(java.lang.String questionnaireId, java.lang.String answerId, java.util.Map<java.lang.String,​java.lang.Object> parameters, boolean onlyCurrentQuestion, java.lang.String lang)
    Selects an answer of the current question for the specified questionnaire given by its id with optional parameters if needed and returns the questionnaire data with the next question to be answered.
    Questionnaire startQuestionnaireByModelKey​(java.lang.String key, java.lang.String parentId, java.util.Map<java.lang.String,​java.lang.Object> parameters, java.lang.String language, java.lang.String start)
    Starts a new questionnaire instance based on the specified model given by its global id with an optional map of parameters added to the questionnaire instance.
  • Method Details

    • getQuestionnaireModels

      java.util.List<QuestionnaireModel> getQuestionnaireModels​(java.lang.String lang)
      Returns a list of available questionnaire models to start questionnaire instances for.
      Parameters:
      lang - the optional language in which the starting options need to be returned (defaults to the language of the edoras one user)
      Returns:
      the list of available questionnaire models
    • getQuestionnaireStartingOptions

      java.util.List<java.lang.String> getQuestionnaireStartingOptions​(java.lang.String modelKey, java.lang.String lang)
      Returns the list of available starting options for the requested questionnaire. One of the returned starting options might be used as the start parameter when starting (creating) a new questionnaire.
      Parameters:
      modelKey - the global id or model name of the questionnaire model to return its starting options
      lang - the optional language in which the starting options need to be returned (defaults to the language of the edoras one user)
      Returns:
      the list of available starting options, must not be empty or null
    • startQuestionnaireByModelKey

      Questionnaire startQuestionnaireByModelKey​(java.lang.String key, java.lang.String parentId, java.util.Map<java.lang.String,​java.lang.Object> parameters, java.lang.String language, java.lang.String start)
      Starts a new questionnaire instance based on the specified model given by its global id with an optional map of parameters added to the questionnaire instance.
      Parameters:
      key - the global id of the questionnaire model to start a new instance for
      parameters - the optional map of parameters to be set on the questionnaire instance
      language - the optional language to set the questionnaire instance to (defaults to 'en' if not set)
      start - the optional starting point for the questionnaire instance, defaults to 'default', if not provided
      Returns:
      the questionnaire instance being started, containing the first question to be answered
    • getQuestionnaire

      Questionnaire getQuestionnaire​(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)
      Returns the questionnaire instance with the given id, containing the current question (if still at least one open) and optionally the previous questions as well, if requested.
      Parameters:
      id - the id of the questionnaire to be returned
      onlyCurrentQuestion - true if only the current question should be returned, false if all the previous and answered questions should be returned as well
      lang - the optional language in which the starting options need to be returned (defaults to the language of the edoras one user)
      Returns:
      the questionnaire instance
    • findQuestionnaire

      Questionnaire findQuestionnaire​(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)
      Returns the questionnaire instance with the given id, containing the current question (if still at least one open) and optionally the previous questions as well, if requested.
      Parameters:
      id - the id of the questionnaire to be returned
      onlyCurrentQuestion - true if only the current question should be returned, false if all the previous and answered questions should be returned as well
      lang - the optional language in which the starting options need to be returned (defaults to the language of the edoras one user)
      Returns:
      the questionnaire instance
    • selectAnswer

      Questionnaire selectAnswer​(java.lang.String questionnaireId, java.lang.String answerId, java.util.Map<java.lang.String,​java.lang.Object> parameters, boolean onlyCurrentQuestion, java.lang.String lang)
      Selects an answer of the current question for the specified questionnaire given by its id with optional parameters if needed and returns the questionnaire data with the next question to be answered.
      Parameters:
      questionnaireId - the id of the questionnaire to answer the current question
      answerId - the id of the answer to select for the current question
      parameters - the optional map of parameters attached to the answer, if needed
      onlyCurrentQuestion - true if only the next question should be returned, false if all the previous and answered questions should be returned as well
      lang - the optional language in which the starting options need to be returned (defaults to the language of the edoras one user)
      Returns:
      the questionnaire data with the next current question to be answered and optional with all previous questions and answers selected
    • deleteQuestionnaire

      void deleteQuestionnaire​(java.lang.String id)
      Deletes the selected questionnaire instance with the given id.
      Parameters:
      id - the id of the questionnaire instance to be deleted