public class CaseServiceImpl extends Object implements CaseService
Constructor and Description |
---|
CaseServiceImpl() |
Modifier and Type | Method and Description |
---|---|
String |
addCaseComment(String caseId,
String author,
String comment,
String... restrictedTo)
Adds new comment to the case
|
void |
addDataToCaseFile(String caseId,
Map<String,Object> data,
String... restrictedTo)
Adds complete map to case file of given case.
|
void |
addDataToCaseFile(String caseId,
String name,
Object value,
String... restrictedTo)
Adds given named value into case file of given case.
|
Long |
addDynamicSubprocess(Long processInstanceId,
String processId,
Map<String,Object> parameters)
Adds new subprocess (identified by process id) to case.
|
Long |
addDynamicSubprocess(String caseId,
String processId,
Map<String,Object> parameters)
Adds new subprocess (identified by process id) to given process instance.
|
Long |
addDynamicSubprocessToStage(Long processInstanceId,
String stage,
String processId,
Map<String,Object> parameters)
Adds new subprocess (identified by process id) to case.
|
Long |
addDynamicSubprocessToStage(String caseId,
String stage,
String processId,
Map<String,Object> parameters)
Adds new subprocess (identified by process id) to given process instance.
|
void |
addDynamicTask(Long processInstanceId,
TaskSpecification taskSpecification)
Adds new user task to specified process instance.
|
void |
addDynamicTask(String caseId,
TaskSpecification taskSpecification)
Adds new user task to specified case.
|
void |
addDynamicTaskToStage(Long processInstanceId,
String stage,
TaskSpecification taskSpecification)
Adds new user task to specified case and stage on given process instance.
|
void |
addDynamicTaskToStage(String caseId,
String stage,
TaskSpecification taskSpecification)
Adds new user task to specified case and stage.
|
void |
assignToCaseRole(String caseId,
String role,
org.kie.api.task.model.OrganizationalEntity entity)
Assigns given entity (user or group) to case role for a given case.
|
void |
cancelCase(String caseId)
Cancels case with given case id (including all attached process instances if any).
|
void |
closeCase(String caseId,
String comment)
Closes case with given case id (including all attached process instances if any).
|
void |
destroyCase(String caseId)
Permanently destroys case identified by given case id.
|
Collection<CommentInstance> |
getCaseComments(String caseId,
CommentSortBy sortBy,
org.kie.api.runtime.query.QueryContext queryContext)
Returns all case comments sorted with given sortBy
|
Collection<CommentInstance> |
getCaseComments(String caseId,
org.kie.api.runtime.query.QueryContext queryContext)
Returns all case comments sorted by date
|
protected CaseEventSupport |
getCaseEventSupport(String deploymentId) |
CaseFileInstance |
getCaseFileInstance(String caseId)
Returns Case file for give case id
|
CaseInstance |
getCaseInstance(String caseId)
Returns case instance (only if it's active) identified by given case id - does not load case file, roles, milestones nor stages.
|
CaseInstance |
getCaseInstance(String caseId,
boolean withData,
boolean withRoles,
boolean withMilestones,
boolean withStages)
Returns case instance (only if it's active) identified by given case id with options on what should be fetched
|
Collection<CaseRoleInstance> |
getCaseRoleAssignments(String caseId)
Returns role assignments for given case
|
protected CaseFileInstance |
internalGetCaseFileInstance(String caseId,
String deploymentId) |
protected void |
internalTriggerAdHocFragment(ProcessInstanceDesc pi,
String fragmentName,
Object data) |
protected boolean |
isEmpty(Collection<?> data) |
CaseFileInstance |
newCaseFileInstance(String deploymentId,
String caseDefinition,
Map<String,Object> data)
Builds and returns new CaseFileInstance with given data.
|
CaseFileInstance |
newCaseFileInstance(String deploymentId,
String caseDefinition,
Map<String,Object> data,
Map<String,org.kie.api.task.model.OrganizationalEntity> rolesAssignment)
Builds and returns new CaseFileInstance with given data and roles assignments.
|
CaseFileInstance |
newCaseFileInstanceWithRestrictions(String deploymentId,
String caseDefinition,
Map<String,Object> data,
Map<String,List<String>> accessRestrictions)
Builds and returns new CaseFileInstance with given data.
|
CaseFileInstance |
newCaseFileInstanceWithRestrictions(String deploymentId,
String caseDefinition,
Map<String,Object> data,
Map<String,org.kie.api.task.model.OrganizationalEntity> rolesAssignment,
Map<String,List<String>> accessRestrictions)
Builds and returns new CaseFileInstance with given data and roles assignments.
|
org.kie.api.task.model.Group |
newGroup(String groupId)
Creates new group with given id;
|
TaskSpecification |
newHumanTaskSpec(String taskName,
String description,
String actorIds,
String groupIds,
Map<String,Object> parameters)
Returns new TaskSpecification describing user task so it can be created as dynamic task.
|
TaskSpecification |
newTaskSpec(String nodeType,
String nodeName,
Map<String,Object> parameters)
Returns new TaskSpecification describing generic (work item based) task so it can be added as dynamic task.
|
org.kie.api.task.model.User |
newUser(String userId)
Creates new user with given id;
|
void |
removeCaseComment(String caseId,
String commentId)
Removes given comment from the case comments list
|
void |
removeDataFromCaseFile(String caseId,
List<String> variableNames)
Removes given variables (stored under variableNames) from case file of given case.
|
void |
removeDataFromCaseFile(String caseId,
String name)
Removes given variable (stored under name) from case file of given case.
|
void |
removeFromCaseRole(String caseId,
String role,
org.kie.api.task.model.OrganizationalEntity entity)
Removes given entity (user or group) from the case role for a given case.
|
void |
reopenCase(String caseId,
String deploymentId,
String caseDefinitionId)
Reopens case given by case id by starting another instance of case definition.
|
void |
reopenCase(String caseId,
String deploymentId,
String caseDefinitionId,
Map<String,Object> data)
Reopens case given by case id by starting another instance of case definition.
|
void |
setAuthorizationManager(AuthorizationManager authorizationManager) |
void |
setCaseIdGenerator(CaseIdGenerator caseIdGenerator) |
void |
setCaseRuntimeDataService(CaseRuntimeDataService caseRuntimeDataService) |
void |
setCommandService(TransactionalCommandService commandService) |
void |
setDeploymentService(DeploymentService deploymentService) |
void |
setIdentityProvider(org.kie.internal.identity.IdentityProvider identityProvider) |
void |
setProcessService(ProcessService processService) |
void |
setRuntimeDataService(RuntimeDataService runtimeDataService) |
String |
startCase(String deploymentId,
String caseDefinitionId)
Starts a new case for given definition with empty case file.
|
String |
startCase(String deploymentId,
String caseDefinitionId,
CaseFileInstance caseFile)
Starts a new case for given definition with given case file.
|
void |
triggerAdHocFragment(Long processInstanceId,
String fragmentName,
Object data)
Triggers given by fragmentName adhoc element (such as task, milestone) within given process instance
|
void |
triggerAdHocFragment(Long processInstanceId,
String stage,
String fragmentName,
Object data)
Triggers given by fragmentName adhoc element (such as task, milestone) within given process instance and stage
|
void |
triggerAdHocFragment(String caseId,
String fragmentName,
Object data)
Triggers given by fragmentName adhoc element (such as task, milestone) within given case.
|
void |
triggerAdHocFragment(String caseId,
String stage,
String fragmentName,
Object data)
Triggers given by fragmentName adhoc element (such as task, milestone) within given case and stage.
|
void |
updateCaseComment(String caseId,
String commentId,
String author,
String text,
String... restrictedTo)
Updated given comment with entire text provided
|
protected ProcessInstanceDesc |
verifyCaseIdExisted(String caseId) |
protected ProcessInstanceDesc |
verifyCaseIdExists(String caseId) |
public void setProcessService(ProcessService processService)
public void setRuntimeDataService(RuntimeDataService runtimeDataService)
public void setDeploymentService(DeploymentService deploymentService)
public void setCaseRuntimeDataService(CaseRuntimeDataService caseRuntimeDataService)
public void setCaseIdGenerator(CaseIdGenerator caseIdGenerator)
public void setCommandService(TransactionalCommandService commandService)
public void setAuthorizationManager(AuthorizationManager authorizationManager)
public void setIdentityProvider(org.kie.internal.identity.IdentityProvider identityProvider)
public String startCase(String deploymentId, String caseDefinitionId)
CaseService
CASE-XXXXXXXXX
where XXXXXXX
is generated value for the prefixstartCase
in interface CaseService
deploymentId
- deployment id of project that case definition belongs tocaseDefinitionId
- id of case definitionpublic String startCase(String deploymentId, String caseDefinitionId, CaseFileInstance caseFile)
CaseService
CASE-XXXXXXXXX
where XXXXXXX
is generated value for the prefixstartCase
in interface CaseService
deploymentId
- deployment id of project that case definition belongs tocaseDefinitionId
- id of case definitioncaseFile
- initial case file to be used for this casepublic CaseFileInstance getCaseFileInstance(String caseId) throws CaseNotFoundException
CaseService
getCaseFileInstance
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic CaseInstance getCaseInstance(String caseId) throws CaseNotFoundException
CaseService
CaseService.getCaseInstance(String, boolean, boolean, boolean, boolean)
for more advanced fetch options.getCaseInstance
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic CaseInstance getCaseInstance(String caseId, boolean withData, boolean withRoles, boolean withMilestones, boolean withStages) throws CaseNotFoundException
CaseService
getCaseInstance
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodwithData
- determines if case file should be loadedwithRoles
- determines if role assignments should be loadedwithMilestones
- determines if milestones should be loadedwithStages
- determines with stages should be loadedCaseNotFoundException
- thrown in case case was not found with given idpublic void closeCase(String caseId, String comment) throws CaseNotFoundException
CaseService
closeCase
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic void cancelCase(String caseId) throws CaseNotFoundException
CaseService
cancelCase
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic void destroyCase(String caseId) throws CaseNotFoundException
CaseService
destroyCase
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic void reopenCase(String caseId, String deploymentId, String caseDefinitionId) throws CaseNotFoundException
CaseService
reopenCase
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methoddeploymentId
- deployment id of project that case definition belongs tocaseDefinitionId
- id of case definitionCaseNotFoundException
- thrown in case case was not found with given idpublic void reopenCase(String caseId, String deploymentId, String caseDefinitionId, Map<String,Object> data) throws CaseNotFoundException
CaseService
reopenCase
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methoddeploymentId
- deployment id of project that case definition belongs tocaseDefinitionId
- id of case definitiondata
- additional data to be set on case fileCaseNotFoundException
- thrown in case case was not found with given idpublic void addDynamicTask(String caseId, TaskSpecification taskSpecification) throws CaseNotFoundException
CaseService
CaseService.addDynamicTask(Long, TaskSpecification)
should be usedaddDynamicTask
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodtaskSpecification
- complete specification that defines the type of a task to be addedCaseNotFoundException
- thrown in case case was not found with given idpublic void addDynamicTask(Long processInstanceId, TaskSpecification taskSpecification) throws ProcessInstanceNotFoundException
CaseService
addDynamicTask
in interface CaseService
processInstanceId
- unique process instance idtaskSpecification
- complete specification that defines the type of a task to be addedProcessInstanceNotFoundException
public void addDynamicTaskToStage(String caseId, String stage, TaskSpecification taskSpecification) throws CaseNotFoundException, StageNotFoundException
CaseService
CaseService.addDynamicTaskToStage(Long, String, TaskSpecification)
should be usedaddDynamicTaskToStage
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodstage
- id or name of the stage there the task should be addedtaskSpecification
- complete specification that defines the type of a task to be addedCaseNotFoundException
- thrown in case case was not found with given idStageNotFoundException
- thrown in case stage does not existpublic void addDynamicTaskToStage(Long processInstanceId, String stage, TaskSpecification taskSpecification) throws CaseNotFoundException, StageNotFoundException
CaseService
addDynamicTaskToStage
in interface CaseService
processInstanceId
- unique process instance idstage
- id or name of the stage there the task should be addedtaskSpecification
- complete specification that defines the type of a task to be addedCaseNotFoundException
- thrown in case case was not found with given idStageNotFoundException
- thrown in case stage does not existpublic Long addDynamicSubprocess(String caseId, String processId, Map<String,Object> parameters) throws CaseNotFoundException
CaseService
addDynamicSubprocess
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodprocessId
- identifier of the process to be addedparameters
- optional parameters for the subprocessCaseNotFoundException
- thrown in case case was not found with given idpublic Long addDynamicSubprocess(Long processInstanceId, String processId, Map<String,Object> parameters) throws CaseNotFoundException
CaseService
addDynamicSubprocess
in interface CaseService
processInstanceId
- unique process instance idprocessId
- identifier of the process to be addedparameters
- optional parameters for the subprocessCaseNotFoundException
- thrown in case case was not found with given idpublic Long addDynamicSubprocessToStage(String caseId, String stage, String processId, Map<String,Object> parameters) throws CaseNotFoundException
CaseService
addDynamicSubprocessToStage
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase method CaseService.addDynamicSubprocess(Long, String, Map)
method should be used instead.stage
- id or name of the stage there the task should be addedprocessId
- identifier of the process to be addedparameters
- optional parameters for the subprocessCaseNotFoundException
- thrown in case case was not found with given idpublic Long addDynamicSubprocessToStage(Long processInstanceId, String stage, String processId, Map<String,Object> parameters) throws CaseNotFoundException
CaseService
addDynamicSubprocessToStage
in interface CaseService
processInstanceId
- unique process instance idstage
- id or name of the stage there the task should be addedprocessId
- identifier of the process to be addedparameters
- optional parameters for the subprocessCaseNotFoundException
- thrown in case case was not found with given idpublic void triggerAdHocFragment(String caseId, String fragmentName, Object data) throws CaseNotFoundException
CaseService
CaseService.triggerAdHocFragment(Long, String, Object)
method should be used insteadtriggerAdHocFragment
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodfragmentName
- name of the element that can be triggereddata
- optional data to be given when triggering the nodeCaseNotFoundException
public void triggerAdHocFragment(Long processInstanceId, String fragmentName, Object data) throws CaseNotFoundException
CaseService
triggerAdHocFragment
in interface CaseService
processInstanceId
- unique process instance idfragmentName
- name of the element that can be triggereddata
- optional data to be given when triggering the nodeCaseNotFoundException
- thrown in case case was not found with given idpublic void triggerAdHocFragment(String caseId, String stage, String fragmentName, Object data) throws CaseNotFoundException
CaseService
CaseService.triggerAdHocFragment(Long, String, String, Object)
method should be used insteadtriggerAdHocFragment
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodstage
- id or name of the stage there the task should be addedfragmentName
- name of the element that can be triggereddata
- optional data to be given when triggering the nodeCaseNotFoundException
public void triggerAdHocFragment(Long processInstanceId, String stage, String fragmentName, Object data) throws CaseNotFoundException
CaseService
triggerAdHocFragment
in interface CaseService
processInstanceId
- unique process instance idstage
- id or name of the stage there the task should be addedfragmentName
- name of the element that can be triggereddata
- optional data to be given when triggering the nodeCaseNotFoundException
- thrown in case case was not found with given idpublic void addDataToCaseFile(String caseId, String name, Object value, String... restrictedTo) throws CaseNotFoundException
CaseService
addDataToCaseFile
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodname
- unique name for given value to be put into case filevalue
- actual value to be added to case filerestrictedTo
- optional case roles that this data should be restricted toCaseNotFoundException
- thrown in case case was not found with given idpublic void addDataToCaseFile(String caseId, Map<String,Object> data, String... restrictedTo) throws CaseNotFoundException
CaseService
addDataToCaseFile
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methoddata
- key value representing data to be added to case filerestrictedTo
- optional case roles that this data should be restricted toCaseNotFoundException
- thrown in case case was not found with given idpublic void removeDataFromCaseFile(String caseId, String name) throws CaseNotFoundException
CaseService
removeDataFromCaseFile
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodname
- variable name that should be removed from case fileCaseNotFoundException
- thrown in case case was not found with given idpublic void removeDataFromCaseFile(String caseId, List<String> variableNames) throws CaseNotFoundException
CaseService
removeDataFromCaseFile
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodvariableNames
- list of variables to be removed from the case fileCaseNotFoundException
- thrown in case case was not found with given idpublic void assignToCaseRole(String caseId, String role, org.kie.api.task.model.OrganizationalEntity entity) throws CaseNotFoundException
CaseService
assignToCaseRole
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodrole
- name of the role entity should be assigned toentity
- user or group to be assigned to given roleCaseNotFoundException
- thrown in case case was not found with given idpublic void removeFromCaseRole(String caseId, String role, org.kie.api.task.model.OrganizationalEntity entity) throws CaseNotFoundException
CaseService
removeFromCaseRole
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodrole
- name of the role entity should be assigned toentity
- entity user or group to be assigned to given roleCaseNotFoundException
- thrown in case case was not found with given idpublic Collection<CaseRoleInstance> getCaseRoleAssignments(String caseId) throws CaseNotFoundException
CaseService
getCaseRoleAssignments
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic Collection<CommentInstance> getCaseComments(String caseId, org.kie.api.runtime.query.QueryContext queryContext) throws CaseNotFoundException
CaseService
getCaseComments
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodCaseNotFoundException
- thrown in case case was not found with given idpublic Collection<CommentInstance> getCaseComments(String caseId, CommentSortBy sortBy, org.kie.api.runtime.query.QueryContext queryContext) throws CaseNotFoundException
CaseService
getCaseComments
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodsortBy
- defines how to sort commentsCaseNotFoundException
- thrown in case case was not found with given idpublic String addCaseComment(String caseId, String author, String comment, String... restrictedTo) throws CaseNotFoundException
CaseService
addCaseComment
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodauthor
- author of the commentcomment
- actual comment (text)restrictedTo
- optional case roles that this data should be restricted toCaseNotFoundException
- thrown in case case was not found with given idpublic void updateCaseComment(String caseId, String commentId, String author, String text, String... restrictedTo) throws CaseNotFoundException
CaseService
updateCaseComment
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodcommentId
- unique id of the commentauthor
- author of the commenttext
- updated text of the commentrestrictedTo
- optional case roles that this data should be restricted toCaseNotFoundException
- thrown in case case was not found with given idpublic void removeCaseComment(String caseId, String commentId) throws CaseNotFoundException
CaseService
removeCaseComment
in interface CaseService
caseId
- unique case id in the format PREFIX-GENERATED_ID as described on startCase methodcommentId
- unique id of the commentCaseNotFoundException
- thrown in case case was not found with given idpublic CaseFileInstance newCaseFileInstance(String deploymentId, String caseDefinition, Map<String,Object> data)
CaseService
newCaseFileInstance
in interface CaseService
deploymentId
- deployment that case belongs tocaseDefinition
- id of the case definition to be able to properly setup case filedata
- initial data for case filepublic CaseFileInstance newCaseFileInstanceWithRestrictions(String deploymentId, String caseDefinition, Map<String,Object> data, Map<String,List<String>> accessRestrictions)
CaseService
newCaseFileInstanceWithRestrictions
in interface CaseService
deploymentId
- deployment that case belongs tocaseDefinition
- id of the case definition to be able to properly setup case filedata
- initial data for case fileaccessRestrictions
- access restrictions to data that defines what case roles are allowed to add and manipulate given datapublic CaseFileInstance newCaseFileInstance(String deploymentId, String caseDefinition, Map<String,Object> data, Map<String,org.kie.api.task.model.OrganizationalEntity> rolesAssignment)
CaseService
newCaseFileInstance
in interface CaseService
deploymentId
- deployment that case belongs tocaseDefinition
- id of the case definition to be able to properly setup case filedata
- initial data for case filerolesAssignment
- initial role assignmentpublic CaseFileInstance newCaseFileInstanceWithRestrictions(String deploymentId, String caseDefinition, Map<String,Object> data, Map<String,org.kie.api.task.model.OrganizationalEntity> rolesAssignment, Map<String,List<String>> accessRestrictions)
CaseService
newCaseFileInstanceWithRestrictions
in interface CaseService
deploymentId
- deployment that case belongs tocaseDefinition
- id of the case definition to be able to properly setup case filedata
- initial data for case filerolesAssignment
- initial role assignmentaccessRestrictions
- access restrictions to data that defines what case roles are allowed to add and manipulate given datapublic TaskSpecification newHumanTaskSpec(String taskName, String description, String actorIds, String groupIds, Map<String,Object> parameters)
CaseService
newHumanTaskSpec
in interface CaseService
taskName
- - mandatory name of the taskdescription
- - optional description of the taskactorIds
- - optional list (comma separated) of actors to be assignedgroupIds
- - optional list (comma separated) of groups to be assignedparameters
- - optional parameters (task inputs)public TaskSpecification newTaskSpec(String nodeType, String nodeName, Map<String,Object> parameters)
CaseService
newTaskSpec
in interface CaseService
nodeType
- - type of a node (same as used for registering work item handler)nodeName
- - name of the node to be assigned on taskparameters
- - optional parameters (task inputs)public org.kie.api.task.model.User newUser(String userId)
CaseService
newUser
in interface CaseService
userId
- user id to be used when creating User instancepublic org.kie.api.task.model.Group newGroup(String groupId)
CaseService
newGroup
in interface CaseService
groupId
- group id to be used when creating Group instanceprotected CaseFileInstance internalGetCaseFileInstance(String caseId, String deploymentId)
protected void internalTriggerAdHocFragment(ProcessInstanceDesc pi, String fragmentName, Object data) throws CaseNotFoundException
CaseNotFoundException
protected ProcessInstanceDesc verifyCaseIdExists(String caseId) throws CaseNotFoundException
CaseNotFoundException
protected ProcessInstanceDesc verifyCaseIdExisted(String caseId) throws CaseNotFoundException
CaseNotFoundException
protected CaseEventSupport getCaseEventSupport(String deploymentId)
protected boolean isEmpty(Collection<?> data)
Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.