com.ibm.openpages.api.service

Interface IQuestionnaireService



  • public interface IQuestionnaireService

    Interface for the Questionnaire objects and operations.

     Gateway to questionnaire objects and operations.
     Use this service to read and update questionnaire resource ( both template and response )
    The program can be launched by this service as well.
    --- Snippet Code to Update the Questionnaire Template---- // create Template object via IResourceService Id teamplteResourceId; // Create Questionnaire Service IQuestionnaireService qs = serviceFactory.createQuestionnaireService(); // get the questionnaire resource IQuestionnaire questionnaire = qs.getQuestionnaire(teamplteResourceId); // update section questionnaire.getSections().get(0).setTitle("New Password Policy"); // serialize the update qs.saveQuestionnaire(questionnaire); --- Snippet Code to Answer the Questionnaire Assessment ---- // create Questionnaire Assessment object via the program launch Id assessmentResourceId; // Create Questionnaire Service IQuestionnaireService qs = serviceFactory.createQuestionnaireService(); // get the questionnaire resource IQuestionnaire questionnaire = qs.getQuestionnaire(assessmentResourceId); // answer text question questionnaire.getQuestions().get(0).setAnswer("My New Answer"); // add comment to a question Id questionId = questionnaire.getQuestions().get(1); IQuestionnaireFactory qf = qs.getQuestionnaireFactory(); IComment comment = qf.createComment(questionId, "My New Comment", false); questionnaire.addComment(comment); // serialize the update qs.saveQuestionnaire(questionnaire);
    Since:
    7.2
    See Also:
    IQuestionnaire, IServiceFactory
    • Method Detail

      • getQuestionnaireFactory

        IQuestionnaireFactory getQuestionnaireFactory()
        Returns the factory for creating in memory instances of objects.
        Returns:
        IQuestionnaireFactory The factory for creating in memory instances of objects.
      • getQuestionnaire

        IQuestionnaire getQuestionnaire(Id id)
        Get a questionnaire object by Id for the the current period including all sections and questions
        Parameters:
        id - (required) The Id of the object to retrieve. The object type has to be either QuestionnaireTemplate or QuestionnaireAssessment.
        Returns:
        IQuestionnaire questionnaire instance if it exists, otherwise null. The object returned is for the current period and includes all sections and questions
      • saveQuestionnaire

        IQuestionnaire saveQuestionnaire(IQuestionnaire questionnaire)
        Save a questionnaire
        Parameters:
        questionnaire - (required) The questionnaire to save
        Returns:
        IQuestionnaire The refreshed questionnaire
      • validateQuestionnaire

        void validateQuestionnaire(Id id)
        Validate if a QuestionnaireTemplate is valid. It throws an OpenPagesException with appropriate message when there is an issue with with the validation
        Parameters:
        id - : the questionnaire id to validate
      • launchProgram

        Id launchProgram(Id programId,
                       LaunchProgramOptions options)
        Launch a program - it starts a long running process which creates assessment objects for asset objects one-by-one and send e-mail to the asset owners. The long running process runs in background, and the progress/status can be tracked by the process id
        Parameters:
        programId - : the program object id
        options - : launch options
        Returns:
        id of the long running process
      • validateProgram

        ProgramValidationResult validateProgram(Id programId,
                                              LaunchProgramOptions options)
        Validate if a program is ready to launch. It throws an OpenPagesException with appropriate message when there is an issue with with the validation (For example, given object is not a program object, template object is not associated, etc. )
        Parameters:
        programId - : the program object id
        options - : launch options
        Returns:
        ProgramValidationResult
      • deleteAssessmentComments

        void deleteAssessmentComments(Id assessmentId,
                                    Id questionTemplateId,
                                    java.lang.String newComment)
        Deletes question comments for a specific assessment, and add a new comment to questions whose comments been deleted for the deleting operation.

        Permissions:

        The operation can only be performed by a super user.

        Parameters:
        assessmentId - (required)the assessment id
        questionTemplateId - (optional)the question template id, if specific, only delete comments of the question of the assessment.
        newComment - (required)the new comment
        Since:
        8.0.0.1

Licensed Materials - Property of IBM
© Copyright IBM Corp. 2013, 2018. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.