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);
IQuestionnaire
,
IServiceFactory
Modifier and Type | Method and Description |
---|---|
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.
|
IQuestionnaire |
getQuestionnaire(Id id)
Get a questionnaire object by Id for the the current period including all sections and questions
|
IQuestionnaireFactory |
getQuestionnaireFactory()
Returns the factory for creating in memory instances of objects.
|
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.
|
IQuestionnaire |
saveQuestionnaire(IQuestionnaire questionnaire)
Save a questionnaire
|
ProgramValidationResult |
validateProgram(Id programId,
LaunchProgramOptions options)
Validate if a program is ready to launch.
|
void |
validateQuestionnaire(Id id)
Validate if a QuestionnaireTemplate is valid.
|
IQuestionnaireFactory getQuestionnaireFactory()
IQuestionnaire getQuestionnaire(Id id)
id
- (required) The Id of the object to retrieve.
The object type has to be either QuestionnaireTemplate or QuestionnaireAssessment.IQuestionnaire saveQuestionnaire(IQuestionnaire questionnaire)
questionnaire
- (required) The questionnaire to savevoid validateQuestionnaire(Id id)
OpenPagesException
with appropriate message
when there is an issue with with the validationid
- : the questionnaire id to validateId launchProgram(Id programId, LaunchProgramOptions options)
programId
- : the program object idoptions
- : launch optionsProgramValidationResult validateProgram(Id programId, LaunchProgramOptions options)
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. )programId
- : the program object idoptions
- : launch optionsvoid deleteAssessmentComments(Id assessmentId, Id questionTemplateId, java.lang.String newComment)
Permissions:
The operation can only be performed by a super user.
assessmentId
- (required)the assessment idquestionTemplateId
- (optional)the question template id, if specific, only delete comments of the question of the assessment.newComment
- (required)the new comment
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.