jBPM distribution 6.2.0.Beta2

org.jbpm.kie.services.impl
Class RuntimeDataServiceImpl

java.lang.Object
  extended by org.jbpm.kie.services.impl.RuntimeDataServiceImpl
All Implemented Interfaces:
DeploymentEventListener, RuntimeDataService
Direct Known Subclasses:
RuntimeDataServiceCDIImpl, RuntimeDataServiceEJBImpl

public class RuntimeDataServiceImpl
extends Object
implements RuntimeDataService, DeploymentEventListener


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jbpm.services.api.RuntimeDataService
RuntimeDataService.EntryType
 
Field Summary
protected  Set<ProcessDefinition> availableProcesses
           
 
Constructor Summary
RuntimeDataServiceImpl()
           
 
Method Summary
protected
<T> Collection<T>
applyPagnition(List<T> input, org.kie.internal.query.QueryContext queryContext)
           
protected  void applyQueryContext(Map<String,Object> params, org.kie.internal.query.QueryContext queryContext)
           
protected  void applySorting(List<ProcessDefinition> input, org.kie.internal.query.QueryContext queryContext)
           
 NodeInstanceDesc getNodeInstanceForWorkItem(Long workItemId)
          Returns active node instance descriptor for given work item id, if exists.
 ProcessDefinition getProcessById(String processId)
           
 Collection<ProcessDefinition> getProcesses(org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessDefinition> getProcessesByDeploymentId(String deploymentId, org.kie.internal.query.QueryContext queryContext)
           
 ProcessDefinition getProcessesByDeploymentIdProcessId(String deploymentId, String processId)
           
 Collection<ProcessDefinition> getProcessesByFilter(String filter, org.kie.internal.query.QueryContext queryContext)
           
 Collection<String> getProcessIds(String deploymentId, org.kie.internal.query.QueryContext queryContext)
           
 ProcessInstanceDesc getProcessInstanceById(long processId)
           
 Collection<NodeInstanceDesc> getProcessInstanceFullHistory(String deploymentId, long processId, org.kie.internal.query.QueryContext queryContext)
          Returns complete trace of all executed (completed) and active nodes for given process instance id
 Collection<NodeInstanceDesc> getProcessInstanceFullHistoryByType(String deploymentId, long processId, RuntimeDataService.EntryType type, org.kie.internal.query.QueryContext queryContext)
          Returns complete trace of all events of given type (START or END) for given process instance.
protected  Collection<NodeInstanceDesc> getProcessInstanceHistory(String deploymentId, long processId, boolean completed, org.kie.internal.query.QueryContext queryContext)
           
 Collection<NodeInstanceDesc> getProcessInstanceHistoryActive(String deploymentId, long processId, org.kie.internal.query.QueryContext queryContext)
          Returns trace of all active nodes for given process instance id
 Collection<NodeInstanceDesc> getProcessInstanceHistoryCompleted(String deploymentId, long processId, org.kie.internal.query.QueryContext queryContext)
          Returns trace of all executed (completed) for given process instance id
 Collection<ProcessInstanceDesc> getProcessInstances(List<Integer> states, String initiator, org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessInstanceDesc> getProcessInstances(org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessInstanceDesc> getProcessInstancesByDeploymentId(String deploymentId, List<Integer> states, org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessInstanceDesc> getProcessInstancesByProcessDefinition(String processDefId, org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessInstanceDesc> getProcessInstancesByProcessId(List<Integer> states, String processId, String initiator, org.kie.internal.query.QueryContext queryContext)
           
 Collection<ProcessInstanceDesc> getProcessInstancesByProcessName(List<Integer> states, String processName, String initiator, org.kie.internal.query.QueryContext queryContext)
           
 UserTaskInstanceDesc getTaskById(Long taskId)
          Return a task by its taskId.
 UserTaskInstanceDesc getTaskByWorkItemId(Long workItemId)
          Return a task by its workItemId.
 List<TaskSummary> getTasksAssignedAsBusinessAdministrator(String userId, org.kie.internal.query.QueryFilter filter)
          Return a list of assigned tasks as a Business Administrator.
 List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId, List<String> groupIds, List<Status> status, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user or groups are eligible for with one of the listed statuses.
 List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId, List<String> groupIds, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user or groups are eligible for.
 List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user is eligible for.
 List<TaskSummary> getTasksAssignedAsPotentialOwnerByExpirationDateOptional(String userId, List<Status> status, Date from, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user is eligible for with one of the listed statuses and expiration date starting at from.
 List<TaskSummary> getTasksAssignedAsPotentialOwnerByStatus(String userId, List<Status> status, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user is eligible for with one of the listed statuses.
 List<Long> getTasksByProcessInstanceId(Long processInstanceId)
          Get a list of tasks the Process Instance is waiting on.
 List<TaskSummary> getTasksByStatusByProcessInstanceId(Long processInstanceId, List<Status> status, org.kie.internal.query.QueryFilter filter)
          Get a list of tasks the Process Instance is waiting on with one of the listed statuses.
 List<TaskSummary> getTasksOwned(String userId, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user has claimed.
 List<TaskSummary> getTasksOwnedByExpirationDateOptional(String userId, List<Status> strStatuses, Date from, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user has claimed with one of the listed statuses and expiration date starting at from.
 List<TaskSummary> getTasksOwnedByStatus(String userId, List<Status> status, org.kie.internal.query.QueryFilter filter)
          Return a list of tasks the user has claimed with one of the listed statuses.
 Collection<VariableDesc> getVariableHistory(long processInstanceId, String variableId, org.kie.internal.query.QueryContext queryContext)
          Returns collection of changes to given variable within scope of process instance
 Collection<VariableDesc> getVariablesCurrentState(long processInstanceId)
          Returns collections of all process variables current value for given process instance
 void onDeploy(DeploymentEvent event)
           
 void onUnDeploy(DeploymentEvent event)
           
 void setCommandService(TransactionalCommandService commandService)
           
 void setIdentityProvider(IdentityProvider identityProvider)
           
 void setTaskService(TaskService taskService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

availableProcesses

protected Set<ProcessDefinition> availableProcesses
Constructor Detail

RuntimeDataServiceImpl

public RuntimeDataServiceImpl()
Method Detail

setCommandService

public void setCommandService(TransactionalCommandService commandService)

setIdentityProvider

public void setIdentityProvider(IdentityProvider identityProvider)

setTaskService

public void setTaskService(TaskService taskService)

onDeploy

public void onDeploy(DeploymentEvent event)
Specified by:
onDeploy in interface DeploymentEventListener

onUnDeploy

public void onUnDeploy(DeploymentEvent event)
Specified by:
onUnDeploy in interface DeploymentEventListener

applyQueryContext

protected void applyQueryContext(Map<String,Object> params,
                                 org.kie.internal.query.QueryContext queryContext)

applyPagnition

protected <T> Collection<T> applyPagnition(List<T> input,
                                           org.kie.internal.query.QueryContext queryContext)

applySorting

protected void applySorting(List<ProcessDefinition> input,
                            org.kie.internal.query.QueryContext queryContext)

getProcessesByDeploymentId

public Collection<ProcessDefinition> getProcessesByDeploymentId(String deploymentId,
                                                                org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessesByDeploymentId in interface RuntimeDataService
Parameters:
deploymentId - The deployment id of the runtime.
Returns:
A list of ProcessAssetDesc instances representing processes that match the given criteria (deploymentId)

getProcessesByDeploymentIdProcessId

public ProcessDefinition getProcessesByDeploymentIdProcessId(String deploymentId,
                                                             String processId)
Specified by:
getProcessesByDeploymentIdProcessId in interface RuntimeDataService
Parameters:
deploymentId - The id of the deployment (runtime)
processId - The id of the process
Returns:
A ProcessAssetDesc instance, representing the Process that is present in the specified deployment with the specified (process) id.

getProcessesByFilter

public Collection<ProcessDefinition> getProcessesByFilter(String filter,
                                                          org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessesByFilter in interface RuntimeDataService
Parameters:
filter - A regular expression.
Returns:
A list of ProcessAssetDesc instances whose name or id matches the given regular expression.

getProcessById

public ProcessDefinition getProcessById(String processId)
Specified by:
getProcessById in interface RuntimeDataService
Parameters:
processId - The id of the process
Returns:
A ProcessAssetDesc instance, representing the Process with the specified (process) id.

getProcesses

public Collection<ProcessDefinition> getProcesses(org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcesses in interface RuntimeDataService
Returns:
A list of all available processes, in the form a of a list of ProcessAssetDesc instances.

getProcessIds

public Collection<String> getProcessIds(String deploymentId,
                                        org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessIds in interface RuntimeDataService
Parameters:
deploymentId - The deployment id of the runtime.
Returns:
A list of all available process id's for a particular deployment/runtime.

getProcessInstances

public Collection<ProcessInstanceDesc> getProcessInstances(org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstances in interface RuntimeDataService
Returns:
A list of ProcessInstanceDesc instances representing the available process instances.

getProcessInstances

public Collection<ProcessInstanceDesc> getProcessInstances(List<Integer> states,
                                                           String initiator,
                                                           org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstances in interface RuntimeDataService
Parameters:
states - A list of possible state (int) values that the ProcessInstance can have.
initiator - The initiator of the ProcessInstance.
Returns:
A list of ProcessInstanceDesc instances representing the process instances that match the given criteria (states and initiator).

getProcessInstancesByDeploymentId

public Collection<ProcessInstanceDesc> getProcessInstancesByDeploymentId(String deploymentId,
                                                                         List<Integer> states,
                                                                         org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstancesByDeploymentId in interface RuntimeDataService
Parameters:
deploymentId - The deployment id of the runtime.
states - A list of possible state (int) values that the ProcessInstance can have.
Returns:
A list of ProcessInstanceDesc instances representing the process instances that match the given criteria (deploymentId and states).

getProcessInstancesByProcessDefinition

public Collection<ProcessInstanceDesc> getProcessInstancesByProcessDefinition(String processDefId,
                                                                              org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstancesByProcessDefinition in interface RuntimeDataService
Parameters:
processDefId - The id of the process (definition)
Returns:
A list of ProcessInstanceDesc instances representing the process instances that match the given criteria (deploymentId and states).

getProcessInstanceById

public ProcessInstanceDesc getProcessInstanceById(long processId)
Specified by:
getProcessInstanceById in interface RuntimeDataService
Parameters:
processId - The id of the process (definition) used to start the ProcessInstance.
Returns:
Process instance information, in the form of a ProcessInstanceDesc instance.

getProcessInstancesByProcessId

public Collection<ProcessInstanceDesc> getProcessInstancesByProcessId(List<Integer> states,
                                                                      String processId,
                                                                      String initiator,
                                                                      org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstancesByProcessId in interface RuntimeDataService
Parameters:
states - A list of possible state (int) values that the ProcessInstance can have.
processId - The id of the Process (definition) used when starting the process instance.
initiator - The initiator of the ProcessInstance.
Returns:
A list of ProcessInstanceDesc instances representing the process instances that match the given criteria (states, processId, and initiator).

getProcessInstancesByProcessName

public Collection<ProcessInstanceDesc> getProcessInstancesByProcessName(List<Integer> states,
                                                                        String processName,
                                                                        String initiator,
                                                                        org.kie.internal.query.QueryContext queryContext)
Specified by:
getProcessInstancesByProcessName in interface RuntimeDataService
Parameters:
states - A list of possible state (int) values that the ProcessInstance can have.
processName - The name (not id!) of the Process (definition) used when starting the process instance.
initiator - The initiator of the ProcessInstance.
Returns:
A list of ProcessInstanceDesc instances representing the process instances that match the given criteria (states, processName and initiator).

getProcessInstanceHistoryActive

public Collection<NodeInstanceDesc> getProcessInstanceHistoryActive(String deploymentId,
                                                                    long processId,
                                                                    org.kie.internal.query.QueryContext queryContext)
Description copied from interface: RuntimeDataService
Returns trace of all active nodes for given process instance id

Specified by:
getProcessInstanceHistoryActive in interface RuntimeDataService
Parameters:
deploymentId - unique identifier of the deployment unit
processId - unique identifier of process instance
Returns:

getProcessInstanceHistoryCompleted

public Collection<NodeInstanceDesc> getProcessInstanceHistoryCompleted(String deploymentId,
                                                                       long processId,
                                                                       org.kie.internal.query.QueryContext queryContext)
Description copied from interface: RuntimeDataService
Returns trace of all executed (completed) for given process instance id

Specified by:
getProcessInstanceHistoryCompleted in interface RuntimeDataService
Parameters:
deploymentId - unique identifier of the deployment unit
processId - unique identifier of process instance
Returns:

getProcessInstanceHistory

protected Collection<NodeInstanceDesc> getProcessInstanceHistory(String deploymentId,
                                                                 long processId,
                                                                 boolean completed,
                                                                 org.kie.internal.query.QueryContext queryContext)

getProcessInstanceFullHistory

public Collection<NodeInstanceDesc> getProcessInstanceFullHistory(String deploymentId,
                                                                  long processId,
                                                                  org.kie.internal.query.QueryContext queryContext)
Description copied from interface: RuntimeDataService
Returns complete trace of all executed (completed) and active nodes for given process instance id

Specified by:
getProcessInstanceFullHistory in interface RuntimeDataService
Parameters:
deploymentId - The id of the deployment (runtime).
processId - The id of the process used to start the process instance.
Returns:
The NodeInstance information, in the form of a list of NodeInstanceDesc instances, that comes from a process instance that matches the given criteria (deploymentId, processId).

getProcessInstanceFullHistoryByType

public Collection<NodeInstanceDesc> getProcessInstanceFullHistoryByType(String deploymentId,
                                                                        long processId,
                                                                        RuntimeDataService.EntryType type,
                                                                        org.kie.internal.query.QueryContext queryContext)
Description copied from interface: RuntimeDataService
Returns complete trace of all events of given type (START or END) for given process instance.

Specified by:
getProcessInstanceFullHistoryByType in interface RuntimeDataService
Parameters:
deploymentId - The id of the deployment (runtime).
processId - The id of the process used to start the process instance.
type - type of events that shall be returned (START or END) - to return both use #getProcessInstanceFullHistory(String, long)
Returns:

getNodeInstanceForWorkItem

public NodeInstanceDesc getNodeInstanceForWorkItem(Long workItemId)
Description copied from interface: RuntimeDataService
Returns active node instance descriptor for given work item id, if exists.

Specified by:
getNodeInstanceForWorkItem in interface RuntimeDataService
Parameters:
workItemId - identifier of the work item
Returns:
returns node instance desc for work item if exists and is still active, otherwise null

getVariablesCurrentState

public Collection<VariableDesc> getVariablesCurrentState(long processInstanceId)
Description copied from interface: RuntimeDataService
Returns collections of all process variables current value for given process instance

Specified by:
getVariablesCurrentState in interface RuntimeDataService
Parameters:
processInstanceId - The process instance id.
Returns:
Information about variables in the specified process instance, represented by a list of VariableStateDesc instances.

getVariableHistory

public Collection<VariableDesc> getVariableHistory(long processInstanceId,
                                                   String variableId,
                                                   org.kie.internal.query.QueryContext queryContext)
Description copied from interface: RuntimeDataService
Returns collection of changes to given variable within scope of process instance

Specified by:
getVariableHistory in interface RuntimeDataService
Parameters:
processInstanceId - The process instance id.
variableId - The id of the variable
Returns:
Information about the variable with the given id in the specified process instance, represented by a list of VariableStateDesc instances.

getTaskByWorkItemId

public UserTaskInstanceDesc getTaskByWorkItemId(Long workItemId)
Description copied from interface: RuntimeDataService
Return a task by its workItemId.

Specified by:
getTaskByWorkItemId in interface RuntimeDataService
Returns:

getTaskById

public UserTaskInstanceDesc getTaskById(Long taskId)
Description copied from interface: RuntimeDataService
Return a task by its taskId.

Specified by:
getTaskById in interface RuntimeDataService
Returns:

getTasksAssignedAsBusinessAdministrator

public List<TaskSummary> getTasksAssignedAsBusinessAdministrator(String userId,
                                                                 org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of assigned tasks as a Business Administrator. Business administrators play the same role as task stakeholders but at task type level. Therefore, business administrators can perform the exact same operations as task stakeholders. Business administrators may also observe the progress of notifications.

Specified by:
getTasksAssignedAsBusinessAdministrator in interface RuntimeDataService
Returns:

getTasksAssignedAsPotentialOwner

public List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId,
                                                          org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user is eligible for.

Specified by:
getTasksAssignedAsPotentialOwner in interface RuntimeDataService
Returns:

getTasksAssignedAsPotentialOwner

public List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId,
                                                          List<String> groupIds,
                                                          org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user or groups are eligible for.

Specified by:
getTasksAssignedAsPotentialOwner in interface RuntimeDataService
Returns:

getTasksAssignedAsPotentialOwner

public List<TaskSummary> getTasksAssignedAsPotentialOwner(String userId,
                                                          List<String> groupIds,
                                                          List<Status> status,
                                                          org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user or groups are eligible for with one of the listed statuses.

Specified by:
getTasksAssignedAsPotentialOwner in interface RuntimeDataService
Returns:

getTasksAssignedAsPotentialOwnerByStatus

public List<TaskSummary> getTasksAssignedAsPotentialOwnerByStatus(String userId,
                                                                  List<Status> status,
                                                                  org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user is eligible for with one of the listed statuses.

Specified by:
getTasksAssignedAsPotentialOwnerByStatus in interface RuntimeDataService
Returns:

getTasksAssignedAsPotentialOwnerByExpirationDateOptional

public List<TaskSummary> getTasksAssignedAsPotentialOwnerByExpirationDateOptional(String userId,
                                                                                  List<Status> status,
                                                                                  Date from,
                                                                                  org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user is eligible for with one of the listed statuses and expiration date starting at from. Tasks that do not have expiration date set will also be included in the result set.

Specified by:
getTasksAssignedAsPotentialOwnerByExpirationDateOptional in interface RuntimeDataService
Returns:

getTasksOwnedByExpirationDateOptional

public List<TaskSummary> getTasksOwnedByExpirationDateOptional(String userId,
                                                               List<Status> strStatuses,
                                                               Date from,
                                                               org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user has claimed with one of the listed statuses and expiration date starting at from. Tasks that do not have expiration date set will also be included in the result set.

Specified by:
getTasksOwnedByExpirationDateOptional in interface RuntimeDataService
Returns:

getTasksOwned

public List<TaskSummary> getTasksOwned(String userId,
                                       org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user has claimed.

Specified by:
getTasksOwned in interface RuntimeDataService
Returns:

getTasksOwnedByStatus

public List<TaskSummary> getTasksOwnedByStatus(String userId,
                                               List<Status> status,
                                               org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Return a list of tasks the user has claimed with one of the listed statuses.

Specified by:
getTasksOwnedByStatus in interface RuntimeDataService
Returns:

getTasksByProcessInstanceId

public List<Long> getTasksByProcessInstanceId(Long processInstanceId)
Description copied from interface: RuntimeDataService
Get a list of tasks the Process Instance is waiting on.

Specified by:
getTasksByProcessInstanceId in interface RuntimeDataService
Returns:

getTasksByStatusByProcessInstanceId

public List<TaskSummary> getTasksByStatusByProcessInstanceId(Long processInstanceId,
                                                             List<Status> status,
                                                             org.kie.internal.query.QueryFilter filter)
Description copied from interface: RuntimeDataService
Get a list of tasks the Process Instance is waiting on with one of the listed statuses.

Specified by:
getTasksByStatusByProcessInstanceId in interface RuntimeDataService
Returns:

jBPM distribution 6.2.0.Beta2

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.