Class QuestionnaireServiceImpl
java.lang.Object
com.flowable.questionnaire.service.QuestionnaireServiceImpl
- All Implemented Interfaces:
QuestionnaireService
@Transactional(readOnly=true) public class QuestionnaireServiceImpl extends java.lang.Object implements QuestionnaireService
A default implementation for the questionnaire service.
- Author:
- Filip Hrisafov, Micha Kiener
-
Field Summary
Fields Modifier and Type Field Description protected org.flowable.engine.HistoryServicehistoryServiceprotected com.fasterxml.jackson.databind.ObjectMapperobjectMapperstatic java.lang.StringPARAM_NAME_CONVERSATION_IDstatic java.lang.StringQUESTIONNAIRE_PROCESS_TYPEprotected org.flowable.engine.RepositoryServicerepositoryServiceprotected org.flowable.engine.RuntimeServiceruntimeServiceprotected org.flowable.engine.TaskServicetaskServicestatic java.lang.StringVAR_NAME_ANSWER_VARIABLEstatic java.lang.StringVAR_NAME_FLOWABLE_PROCESS_DEFINITION_IDstatic java.lang.StringVAR_NAME_FLOWABLE_TASK_DEFINITION_IDstatic java.lang.StringVAR_NAME_MODEL_STARTSstatic java.lang.StringVAR_NAME_PARAMETERSstatic java.lang.StringVAR_NAME_QUESTION_TASK_IDstatic java.lang.StringVAR_NAME_QUESTIONSstatic java.lang.StringVAR_NAME_SELECTED_ANSWER_IDstatic java.lang.StringVAR_NAME_STARTstatic java.lang.StringVAR_NAME_TASK_MODEL_IDstatic java.lang.StringVAR_PROCESS_TYPE -
Constructor Summary
Constructors Constructor Description QuestionnaireServiceImpl(org.flowable.engine.RepositoryService repositoryService, org.flowable.engine.RuntimeService runtimeService, org.flowable.engine.TaskService taskService, org.flowable.engine.HistoryService historyService, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and Type Method Description voiddeleteQuestionnaire(java.lang.String id)Deletes the selected questionnaire instance with the given id.protected com.flowable.questionnaire.service.ProcessInstanceWrapperfindProcessInstance(java.lang.String id)QuestionnairefindQuestionnaire(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.protected QuestionnairegetQuestionnaire(java.lang.String id, boolean onlyCurrentQuestion, com.flowable.questionnaire.service.ProcessInstanceWrapper processInstance, org.flowable.bpmn.model.BpmnModel model, java.lang.String lang)QuestionnairegetQuestionnaire(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.protected java.util.List<? extends org.flowable.task.api.TaskInfo>getTasks(java.lang.String questionnaireId, boolean onlyCurrentQuestion)QuestionnaireselectAnswer(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.protected QuestionnairestartQuestionnaire(java.lang.String modelId, java.lang.String modelKey, java.lang.String parentId, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.String language, java.lang.String start)QuestionnairestartQuestionnaireByModelKey(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.
-
Field Details
-
VAR_NAME_SELECTED_ANSWER_ID
public static final java.lang.String VAR_NAME_SELECTED_ANSWER_ID- See Also:
- Constant Field Values
-
VAR_NAME_FLOWABLE_PROCESS_DEFINITION_ID
public static final java.lang.String VAR_NAME_FLOWABLE_PROCESS_DEFINITION_ID- See Also:
- Constant Field Values
-
VAR_NAME_FLOWABLE_TASK_DEFINITION_ID
public static final java.lang.String VAR_NAME_FLOWABLE_TASK_DEFINITION_ID- See Also:
- Constant Field Values
-
VAR_NAME_TASK_MODEL_ID
public static final java.lang.String VAR_NAME_TASK_MODEL_ID- See Also:
- Constant Field Values
-
VAR_NAME_QUESTIONS
public static final java.lang.String VAR_NAME_QUESTIONS- See Also:
- Constant Field Values
-
VAR_NAME_PARAMETERS
public static final java.lang.String VAR_NAME_PARAMETERS- See Also:
- Constant Field Values
-
VAR_NAME_QUESTION_TASK_ID
public static final java.lang.String VAR_NAME_QUESTION_TASK_ID- See Also:
- Constant Field Values
-
VAR_NAME_START
public static final java.lang.String VAR_NAME_START- See Also:
- Constant Field Values
-
VAR_NAME_ANSWER_VARIABLE
public static final java.lang.String VAR_NAME_ANSWER_VARIABLE- See Also:
- Constant Field Values
-
VAR_NAME_MODEL_STARTS
public static final java.lang.String VAR_NAME_MODEL_STARTS- See Also:
- Constant Field Values
-
VAR_PROCESS_TYPE
public static final java.lang.String VAR_PROCESS_TYPE- See Also:
- Constant Field Values
-
QUESTIONNAIRE_PROCESS_TYPE
public static final java.lang.String QUESTIONNAIRE_PROCESS_TYPE- See Also:
- Constant Field Values
-
PARAM_NAME_CONVERSATION_ID
public static final java.lang.String PARAM_NAME_CONVERSATION_ID- See Also:
- Constant Field Values
-
repositoryService
protected final org.flowable.engine.RepositoryService repositoryService -
runtimeService
protected final org.flowable.engine.RuntimeService runtimeService -
taskService
protected final org.flowable.engine.TaskService taskService -
historyService
protected final org.flowable.engine.HistoryService historyService -
objectMapper
protected final com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
QuestionnaireServiceImpl
public QuestionnaireServiceImpl(org.flowable.engine.RepositoryService repositoryService, org.flowable.engine.RuntimeService runtimeService, org.flowable.engine.TaskService taskService, org.flowable.engine.HistoryService historyService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
getQuestionnaireModels
Description copied from interface:QuestionnaireServiceReturns a list of available questionnaire models to start questionnaire instances for.- Specified by:
getQuestionnaireModelsin interfaceQuestionnaireService- 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
public java.util.List<java.lang.String> getQuestionnaireStartingOptions(java.lang.String modelKey, java.lang.String lang)Description copied from interface:QuestionnaireServiceReturns 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.- Specified by:
getQuestionnaireStartingOptionsin interfaceQuestionnaireService- Parameters:
modelKey- the global id or model name of the questionnaire model to return its starting optionslang- 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
@Transactional public 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)Description copied from interface:QuestionnaireServiceStarts 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.- Specified by:
startQuestionnaireByModelKeyin interfaceQuestionnaireService- Parameters:
key- the global id of the questionnaire model to start a new instance forparameters- the optional map of parameters to be set on the questionnaire instancelanguage- 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
-
startQuestionnaire
protected Questionnaire startQuestionnaire(java.lang.String modelId, java.lang.String modelKey, java.lang.String parentId, java.util.Map<java.lang.String,java.lang.Object> parameters, java.lang.String language, java.lang.String start) -
getQuestionnaire
public Questionnaire getQuestionnaire(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)Description copied from interface:QuestionnaireServiceReturns 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.- Specified by:
getQuestionnairein interfaceQuestionnaireService- Parameters:
id- the id of the questionnaire to be returnedonlyCurrentQuestion-trueif only the current question should be returned,falseif all the previous and answered questions should be returned as welllang- 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
public Questionnaire findQuestionnaire(java.lang.String id, boolean onlyCurrentQuestion, java.lang.String lang)Description copied from interface:QuestionnaireServiceReturns 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.- Specified by:
findQuestionnairein interfaceQuestionnaireService- Parameters:
id- the id of the questionnaire to be returnedonlyCurrentQuestion-trueif only the current question should be returned,falseif all the previous and answered questions should be returned as welllang- 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
-
getQuestionnaire
protected Questionnaire getQuestionnaire(java.lang.String id, boolean onlyCurrentQuestion, com.flowable.questionnaire.service.ProcessInstanceWrapper processInstance, org.flowable.bpmn.model.BpmnModel model, java.lang.String lang) -
findProcessInstance
protected com.flowable.questionnaire.service.ProcessInstanceWrapper findProcessInstance(java.lang.String id) -
getTasks
protected java.util.List<? extends org.flowable.task.api.TaskInfo> getTasks(java.lang.String questionnaireId, boolean onlyCurrentQuestion) -
selectAnswer
@Transactional public 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)Description copied from interface:QuestionnaireServiceSelects 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.- Specified by:
selectAnswerin interfaceQuestionnaireService- Parameters:
questionnaireId- the id of the questionnaire to answer the current questionanswerId- the id of the answer to select for the current questionparameters- the optional map of parameters attached to the answer, if neededonlyCurrentQuestion-trueif only the next question should be returned,falseif all the previous and answered questions should be returned as welllang- 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
@Transactional public void deleteQuestionnaire(java.lang.String id)Description copied from interface:QuestionnaireServiceDeletes the selected questionnaire instance with the given id.- Specified by:
deleteQuestionnairein interfaceQuestionnaireService- Parameters:
id- the id of the questionnaire instance to be deleted
-