Class ProcessCaseRepository
java.lang.Object
com.aquima.interactions.process.impl.ProcessCaseRepository
Utility wrapper for the case dao. Adds logic to the dao layer.
- Since:
- 9.1
- Author:
- A. Pragt
-
Constructor Summary
ConstructorsConstructorDescriptionProcessCaseRepository
(IProcessCaseDao caseDao) ProcessCaseRepository
(IProcessCaseDao caseDao, IProcessEngineSettings settings) Creates a new instance.ProcessCaseRepository
(IProcessCaseDao caseDao, IProcessEngineSettings settings, ILegacyToggles legacyToggles) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionacquireCaseLock
(long caseId, String userId) Method for setting a Case to locked.acquireTaskLock
(long taskId) Method for setting a Task to Started(which means locked).void
clearDelayedEvent
(long caseId, long eventId) Notifies the persistence layer that an event is no longer delayed.completeTask
(ITaskModel task, String executedBy) createCase
(String name, String appId, IMultilingualText displayName) createEvent
(ApplicationID appId, String name, Long caseId, Long taskId, CaseEventType type, CaseEventStatusType status, Date timestamp, String user, Map<String, IValue> content) createInstance
(long caseId, String entityName, GUID instanceId, String instanceName) createValue
(long instanceId, String attributeName, IValue attrValue) void
delayEvent
(long caseId, ICaseEventModel caseEventModel) Delays the event with the given id for the case with the given id.void
deleteCase
(long caseId) void
deleteInstance
(long instanceId) void
deleteValue
(long instanceId, String attributeName) findByCriteria
(CaseViewCriteria criteria) findByCriteria
(TaskViewCriteria criteria) findCaseEventById
(Long eventId) findCaseEventsByCriteria
(CaseEventCriteria criteria) long[]
findCaseIdsWithTasks
(String appId, String[] guids) Finds the IDs of cases that have open tasks with the specified node IDs.findCases
(CaseStatusType status, String appId) This method returns all the cases with a certain status for a specific application.findDelayedEvents
(long caseId) Returns events whose processing has have been delayed due to the case being locked.findOpenEventsForCaseByEventName
(long caseId, String eventName) findTasks
(Long caseId, TaskType type, TaskStatusType status, String[] nodeIds) findTasks
(Long caseId, TaskType type, TaskStatusType status, String assignee, DateTimeValue timeOutBefore) findTimerEvent
(Long caseId, Long taskId) long[]
findWaitingCaseIds
(String appId, DateTimeValue currentTime, boolean ignoreLocked) Finds the id of the cases that are in the waiting state.findWaitingCases
(String appId, String eventName, Set<Long> caseIds) Returns cases that have an open incoming message event task waiting for an event with the specified name.getAvailableTasks
(Long caseId, String userId) getCase
(long caseId) This method returns the case for the specified id.getChildTasks
(long taskParentId) getExtendedCases
(CaseCriteria filterContext) getExtendedTasks
(TaskCriteria filterContext) getInstancesForCase
(long caseId) getInstancesForCases
(long[] caseIds) getStartedTasks
(String appId) getTask
(long taskId) This method returns the task of a certain id.getTasksForCase
(long caseId) getValuesForCase
(long caseId) getValuesForInstances
(long[] instanceIds) boolean
isCaseLocked
(long caseId) openCallTask
(long caseId, Long parentId, String name, GUID nodeId, DateTimeValue timeoutDate, boolean isConditional, boolean isRequired) openConditionalTask
(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue timeoutDate, boolean isAdHoc) openDynamicTask
(long caseId, String taskName, DateTimeValue startDate, IMultilingualText displayName) openEventTask
(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, String eventName, boolean isAdHoc) openGroupTask
(long caseId, long parentId, String taskName, GUID nodeId) openRootTask
(long caseId, String taskName, GUID nodeId) openTask
(long caseId, Long parentId, String taskName, IAssigneeInfo assignee, GUID nodeId, DateTimeValue startDate, DateTimeValue timeoutDate, DateTimeValue dueDate, boolean isConditional, boolean isRequired, boolean isUserSet, Integer priority, DateTimeValue lastPriorityCheck, Map<String, String> properties, String[] unauthorizedUserIds, IMultilingualText displayName) openTimerTask
(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, DateTimeValue timeoutDate, boolean isAdHoc) replayEvent
(ICaseEventModel originalEvent, Long caseId, String user) Creates a replay copy of the event with the given id.void
setCaseEventStatus
(ICaseEventModel caseEvent, CaseEventStatusType status) setTaskAssignment
(ITaskModel task, IAssigneeInfo assigneeInfo) setTaskAssignment
(ITaskModel task, IAssigneeInfo assigneeInfo, boolean isAssigneeSetByUser) setTaskLastPriorityCheck
(ITaskModel task, DateTimeValue lastPriorityCheck) setTaskPriority
(ITaskModel task, Integer priority, DateTimeValue lastPriorityCheck) setTaskRequired
(ITaskModel task, boolean isRequired) setTaskStartDate
(long id, DateTimeValue startDate) setTaskStatus
(ITaskModel task, TaskStatusType status) unlockCase
(long caseId) updateCaseDisplayName
(long caseId, IMultilingualText displayName) updateTask
(long id, TaskStatusType status, IAssigneeInfo assignee, DateTimeValue timeoutDate, String exitState, String executedBy, boolean isRequired, boolean isUserSet, Integer priority, DateTimeValue lastPriorityCheck, IMultilingualText displayName) updateTaskDueDate
(long taskId, DateTimeValue dueDate) updateTaskExitState
(long taskId, String newExitState) updateTaskTimeoutDate
(long taskId, DateTimeValue timeoutDate) updateTaskUnauthorizedUsers
(long taskId, String[] unauthorizedUsers) updateValue
(long instanceId, String attributeName, IValue attrValue)
-
Constructor Details
-
ProcessCaseRepository
-
ProcessCaseRepository
Creates a new instance. If the settings parameter is given, then the global and application-specific IgnoreMode setting will be upheld.- Parameters:
caseDao
- the underlying DAO.settings
- the process engine settings (may be null).- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
ProcessCaseRepository
public ProcessCaseRepository(IProcessCaseDao caseDao, IProcessEngineSettings settings, ILegacyToggles legacyToggles) Creates a new instance. If the settings parameter is given, then the global and application-specific IgnoreMode setting will be upheld.- Parameters:
caseDao
- the underlying DAO.settings
- the process engine settings (may be null).- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
-
Method Details
-
getCase
This method returns the case for the specified id.- Parameters:
caseId
- The id of the case.- Returns:
- The model for the specified case, or null if the case could not be found.
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
findCases
public ICaseModel[] findCases(CaseStatusType status, String appId) throws ProcessDataAccessException This method returns all the cases with a certain status for a specific application.- Parameters:
status
- The status of the case.appId
- The corresponding application id.- Returns:
- A list of case model objects.
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
findCaseIdsWithTasks
Finds the IDs of cases that have open tasks with the specified node IDs.- Parameters:
appId
- The corresponding application id.guids
- task node ids.- Returns:
- the matching case IDs.
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
findWaitingCases
public ICaseModel[] findWaitingCases(String appId, String eventName, Set<Long> caseIds) throws ProcessDataAccessException Returns cases that have an open incoming message event task waiting for an event with the specified name.If
appId
is not null, only cases with a matching application ID will be returnedIf
eventName
is not null, only cases with open incoming message event tasks waiting for the specified event will be returnedIf
caseIds
is not null, only cases having their ID in this set will be returned- Parameters:
appId
- the application ID of the matching cases (may be null).eventName
- the name of the event (may be null).- Returns:
- the matching cases.
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
findWaitingCaseIds
public long[] findWaitingCaseIds(String appId, DateTimeValue currentTime, boolean ignoreLocked) throws ProcessDataAccessException Finds the id of the cases that are in the waiting state.- Parameters:
appId
- The corresponding application id.currentTime
- Current time.ignoreLocked
- Flag indicating if locked should be ignored or not.- Returns:
- A list of matching case model ids.
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
createCase
public ICaseModel createCase(String name, String appId, IMultilingualText displayName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
updateCaseDisplayName
public ICaseModel updateCaseDisplayName(long caseId, IMultilingualText displayName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
acquireCaseLock
Method for setting a Case to locked. Will return null when the case is already locked or does not exist.- Parameters:
caseId
- The caseId of the to be locked caseuserId
- The userId of the user that locks the case- Returns:
- updated casemodel
- Throws:
ProcessDataAccessException
- if something goes wrong during the data access operation.
-
unlockCase
- Throws:
ProcessDataAccessException
-
acquireTaskLock
public ITaskModel acquireTaskLock(long taskId) throws StartProcessTaskException, UnknownTaskException Method for setting a Task to Started(which means locked). Will throw a StartProcessTaskException when the task does not have the status 'open'. Only open tasks kan be started, tasks with a different status should never be set to started.- Parameters:
taskId
- The taskId of the task to be set to started- Returns:
- updated taskModel
- Throws:
StartProcessTaskException
- when the requested task for taskId does not have the status 'open'UnknownTaskException
- when the requested task for taskId does not exist
-
deleteCase
- Throws:
ProcessDataAccessException
-
getTask
This method returns the task of a certain id.- Parameters:
taskId
- The id of the task.- Returns:
- The model for the task, or null if a task model with the given id is not found.
- Throws:
ProcessDataAccessException
-
getChildTasks
- Throws:
ProcessDataAccessException
-
getTasksForCase
- Throws:
ProcessDataAccessException
-
findOpenEventsForCaseByEventName
public ITaskModel[] findOpenEventsForCaseByEventName(long caseId, String eventName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
findTasks
public ITaskModel[] findTasks(Long caseId, TaskType type, TaskStatusType status, String assignee, DateTimeValue timeOutBefore) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
findTasks
public ITaskModel[] findTasks(Long caseId, TaskType type, TaskStatusType status, String[] nodeIds) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openRootTask
public ITaskModel openRootTask(long caseId, String taskName, GUID nodeId) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openGroupTask
public ITaskModel openGroupTask(long caseId, long parentId, String taskName, GUID nodeId) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openConditionalTask
public ITaskModel openConditionalTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue timeoutDate, boolean isAdHoc) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openTimerTask
public ITaskModel openTimerTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, DateTimeValue timeoutDate, boolean isAdHoc) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openEventTask
public ITaskModel openEventTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, String eventName, boolean isAdHoc) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openDynamicTask
public ITaskModel openDynamicTask(long caseId, String taskName, DateTimeValue startDate, IMultilingualText displayName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openCallTask
public ITaskModel openCallTask(long caseId, Long parentId, String name, GUID nodeId, DateTimeValue timeoutDate, boolean isConditional, boolean isRequired) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
openTask
public ITaskModel openTask(long caseId, Long parentId, String taskName, IAssigneeInfo assignee, GUID nodeId, DateTimeValue startDate, DateTimeValue timeoutDate, DateTimeValue dueDate, boolean isConditional, boolean isRequired, boolean isUserSet, Integer priority, DateTimeValue lastPriorityCheck, Map<String, String> properties, String[] unauthorizedUserIds, IMultilingualText displayName) throws ProcessDataAccessException- Throws:
ProcessDataAccessException
-
setTaskStatus
public ITaskModel setTaskStatus(ITaskModel task, TaskStatusType status) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
setTaskPriority
public ITaskModel setTaskPriority(ITaskModel task, Integer priority, DateTimeValue lastPriorityCheck) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
setTaskLastPriorityCheck
public ITaskModel setTaskLastPriorityCheck(ITaskModel task, DateTimeValue lastPriorityCheck) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
setTaskAssignment
-
setTaskAssignment
public ITaskModel setTaskAssignment(ITaskModel task, IAssigneeInfo assigneeInfo, boolean isAssigneeSetByUser) -
setTaskRequired
-
completeTask
public ITaskModel completeTask(ITaskModel task, String executedBy) throws ProcessDataAccessException, AppException -
updateTask
public ITaskModel updateTask(long id, TaskStatusType status, IAssigneeInfo assignee, DateTimeValue timeoutDate, String exitState, String executedBy, boolean isRequired, boolean isUserSet, Integer priority, DateTimeValue lastPriorityCheck, IMultilingualText displayName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
updateTaskExitState
-
setTaskStartDate
-
updateTaskDueDate
-
updateTaskTimeoutDate
-
updateTaskUnauthorizedUsers
public ITaskModel updateTaskUnauthorizedUsers(long taskId, String[] unauthorizedUsers) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
getAvailableTasks
- Throws:
ProcessDataAccessException
-
getUnassignedTasks
- Throws:
ProcessDataAccessException
-
getExtendedTasks
public ITaskQueryResult[] getExtendedTasks(TaskCriteria filterContext) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
getExtendedCases
public ICaseQueryResult[] getExtendedCases(CaseCriteria filterContext) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
getInstancesForCase
- Throws:
ProcessDataAccessException
-
getInstancesForCases
public Map<Long,ICaseDataInstance[]> getInstancesForCases(long[] caseIds) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
createInstance
public ICaseDataInstance createInstance(long caseId, String entityName, GUID instanceId, String instanceName) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
deleteInstance
- Throws:
ProcessDataAccessException
-
getValuesForCase
- Throws:
ProcessDataAccessException
-
getValuesForInstances
public Map<Long,ICaseDataValue[]> getValuesForInstances(long[] instanceIds) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
createValue
public ICaseDataValue createValue(long instanceId, String attributeName, IValue attrValue) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
updateValue
public ICaseDataValue updateValue(long instanceId, String attributeName, IValue attrValue) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
deleteValue
- Throws:
ProcessDataAccessException
-
getStartedTasks
- Throws:
ProcessDataAccessException
-
createEvent
public ICaseEventModel createEvent(ApplicationID appId, String name, Long caseId, Long taskId, CaseEventType type, CaseEventStatusType status, Date timestamp, String user, Map<String, IValue> content) throws ProcessDataAccessException- Throws:
ProcessDataAccessException
-
replayEvent
public ICaseEventModel replayEvent(ICaseEventModel originalEvent, Long caseId, String user) throws ProcessDataAccessException Creates a replay copy of the event with the given id.- Parameters:
originalEvent
- original event that needs to be replayedcaseId
- the id of the event to be replayeduser
- user to use to replay the event- Returns:
- the created event or null if the original event could not be found
- Throws:
ProcessDataAccessException
-
findTimerEvent
- Throws:
ProcessDataAccessException
-
setCaseEventStatus
public void setCaseEventStatus(ICaseEventModel caseEvent, CaseEventStatusType status) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
findCaseEventById
- Throws:
ProcessDataAccessException
-
findAllCaseEvents
- Throws:
ProcessDataAccessException
-
findCaseEventsByCriteria
public ICaseEventModel[] findCaseEventsByCriteria(CaseEventCriteria criteria) throws ProcessDataAccessException - Throws:
ProcessDataAccessException
-
findDelayedEvents
Returns events whose processing has have been delayed due to the case being locked. The returned events are in ordered by timestamp ascending.- Parameters:
caseId
- the ID of the case for which delayed events are retrieved- Returns:
- the delayed events for the given case, never null
- Throws:
ProcessDataAccessException
- Since:
- 9.6
-
delayEvent
public void delayEvent(long caseId, ICaseEventModel caseEventModel) throws ProcessDataAccessException Delays the event with the given id for the case with the given id. If the event with the given id is already delayed for the given case, this method has no effect.- Parameters:
caseId
- the ID of the casecaseEventModel
- the event- Throws:
ProcessDataAccessException
- Since:
- 9.6
-
clearDelayedEvent
Notifies the persistence layer that an event is no longer delayed.- Parameters:
caseId
- the ID of the caseeventId
- the ID of the event- Throws:
ProcessDataAccessException
- Since:
- 9.6
-
findByCriteria
- Throws:
ProcessDataAccessException
-
findByCriteria
- Throws:
ProcessDataAccessException
-
isCaseLocked
public boolean isCaseLocked(long caseId)
-