Class ProcessCaseRepository

java.lang.Object
com.aquima.interactions.process.impl.ProcessCaseRepository

public class ProcessCaseRepository extends Object
Utility wrapper for the case dao. Adds logic to the dao layer.
Since:
9.1
Author:
A. Pragt
  • Constructor Details

    • ProcessCaseRepository

      public ProcessCaseRepository(IProcessCaseDao caseDao)
    • ProcessCaseRepository

      public ProcessCaseRepository(IProcessCaseDao caseDao, IProcessEngineSettings settings)
      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).
      legacyToggles - the legacy toggles
      Throws:
      ProcessDataAccessException - if something goes wrong during the data access operation.
  • Method Details

    • getCase

      public ICaseModel getCase(long caseId)
      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)
      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

      public long[] findCaseIdsWithTasks(String appId, String[] guids)
      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)
      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 returned

      If eventName is not null, only cases with open incoming message event tasks waiting for the specified event will be returned

      If 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).
      caseIds - the case ids to search in (optional, 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)
      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)
    • updateCaseDisplayName

      public ICaseModel updateCaseDisplayName(long caseId, IMultilingualText displayName)
    • acquireCaseLock

      public ICaseModel acquireCaseLock(long caseId, String userId)
      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 case
      userId - The userId of the user that locks the case
      Returns:
      updated casemodel
      Throws:
      ProcessDataAccessException - if something goes wrong during the data access operation.
    • unlockCase

      public ICaseModel unlockCase(long caseId)
    • acquireTaskLock

      public ITaskModel acquireTaskLock(long taskId)
      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

      public void deleteCase(long caseId)
    • getTask

      public ITaskModel getTask(long taskId)
      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.
    • getChildTasks

      public ITaskModel[] getChildTasks(long taskParentId)
    • getTasksForCase

      public ITaskModel[] getTasksForCase(long caseId)
    • findOpenEventsForCaseByEventName

      public ITaskModel[] findOpenEventsForCaseByEventName(long caseId, String eventName)
    • findTasks

      public ITaskModel[] findTasks(Long caseId, TaskType type, TaskStatusType status, String assignee, DateTimeValue timeOutBefore)
    • findTasks

      public ITaskModel[] findTasks(Long caseId, TaskType type, TaskStatusType status, String[] nodeIds)
    • openRootTask

      public ITaskModel openRootTask(long caseId, String taskName, GUID nodeId)
    • openGroupTask

      public ITaskModel openGroupTask(long caseId, long parentId, String taskName, GUID nodeId)
    • openConditionalTask

      public ITaskModel openConditionalTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue timeoutDate, boolean isAdHoc)
    • openTimerTask

      public ITaskModel openTimerTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, DateTimeValue timeoutDate, boolean isAdHoc)
    • openEventTask

      public ITaskModel openEventTask(long caseId, long parentId, String taskName, GUID nodeId, DateTimeValue startDate, String eventName, boolean isAdHoc)
    • openDynamicTask

      public ITaskModel openDynamicTask(long caseId, String taskName, DateTimeValue startDate, IMultilingualText displayName)
    • openCallTask

      public ITaskModel openCallTask(long caseId, Long parentId, String name, GUID nodeId, DateTimeValue timeoutDate, boolean isConditional, boolean isRequired)
    • 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)
    • setTaskStatus

      public ITaskModel setTaskStatus(ITaskModel task, TaskStatusType status)
    • setTaskPriority

      public ITaskModel setTaskPriority(ITaskModel task, Integer priority, DateTimeValue lastPriorityCheck)
    • setTaskLastPriorityCheck

      public ITaskModel setTaskLastPriorityCheck(ITaskModel task, DateTimeValue lastPriorityCheck)
    • setTaskAssignment

      public ITaskModel setTaskAssignment(ITaskModel task, IAssigneeInfo assigneeInfo)
    • setTaskAssignment

      public ITaskModel setTaskAssignment(ITaskModel task, IAssigneeInfo assigneeInfo, boolean isAssigneeSetByUser)
    • setTaskRequired

      public ITaskModel setTaskRequired(ITaskModel task, boolean isRequired)
    • completeTask

      public ITaskModel completeTask(ITaskModel task, String executedBy)
    • 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)
    • updateTaskExitState

      public ITaskModel updateTaskExitState(long taskId, String newExitState)
    • setTaskStartDate

      public ITaskModel setTaskStartDate(long id, DateTimeValue startDate)
    • updateTaskDueDate

      public ITaskModel updateTaskDueDate(long taskId, DateTimeValue dueDate)
    • updateTaskTimeoutDate

      public ITaskModel updateTaskTimeoutDate(long taskId, DateTimeValue timeoutDate)
    • updateTaskUnauthorizedUsers

      public ITaskModel updateTaskUnauthorizedUsers(long taskId, String[] unauthorizedUsers)
    • getAvailableTasks

      public ITaskModel[] getAvailableTasks(Long caseId, String userId)
    • getUnassignedTasks

      public ITaskModel[] getUnassignedTasks()
    • getExtendedTasks

      public ITaskQueryResult[] getExtendedTasks(TaskCriteria filterContext)
    • getExtendedCases

      public ICaseQueryResult[] getExtendedCases(CaseCriteria filterContext)
    • getInstancesForCase

      public ICaseDataInstance[] getInstancesForCase(long caseId)
    • getInstancesForCases

      public Map<Long,ICaseDataInstance[]> getInstancesForCases(long[] caseIds)
    • createInstance

      public ICaseDataInstance createInstance(long caseId, String entityName, GUID instanceId, String instanceName)
    • deleteInstance

      public void deleteInstance(long instanceId)
    • getValuesForCase

      public ICaseDataValue[] getValuesForCase(long caseId)
    • getValuesForInstances

      public Map<Long,ICaseDataValue[]> getValuesForInstances(long[] instanceIds)
    • createValue

      public ICaseDataValue createValue(long instanceId, String attributeName, IValue attrValue)
    • updateValue

      public ICaseDataValue updateValue(long instanceId, String attributeName, IValue attrValue)
    • deleteValue

      public void deleteValue(long instanceId, String attributeName)
    • getStartedTasks

      public ITaskModel[] getStartedTasks(String appId)
    • createEvent

      public ICaseEventModel createEvent(ApplicationID appId, String name, Long caseId, Long taskId, CaseEventType type, CaseEventStatusType status, Date timestamp, String user, Map<String,IValue> content)
    • replayEvent

      public ICaseEventModel replayEvent(ICaseEventModel originalEvent, Long caseId, String user)
      Creates a replay copy of the event with the given id.
      Parameters:
      originalEvent - original event that needs to be replayed
      caseId - the id of the event to be replayed
      user - user to use to replay the event
      Returns:
      the created event or null if the original event could not be found
    • findTimerEvent

      public ICaseEventModel findTimerEvent(Long caseId, Long taskId)
    • setCaseEventStatus

      public void setCaseEventStatus(ICaseEventModel caseEvent, CaseEventStatusType status)
    • findCaseEventById

      public ICaseEventModel findCaseEventById(Long eventId)
    • findAllCaseEvents

      public ICaseEventModel[] findAllCaseEvents()
    • findCaseEventsByCriteria

      public ICaseEventModel[] findCaseEventsByCriteria(CaseEventCriteria criteria)
    • findDelayedEvents

      public ICaseEventModel[] findDelayedEvents(long caseId)
      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
      Since:
      9.6
    • delayEvent

      public void delayEvent(long caseId, ICaseEventModel caseEventModel)
      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 case
      caseEventModel - the event
      Since:
      9.6
    • clearDelayedEvent

      public void clearDelayedEvent(long caseId, long eventId)
      Notifies the persistence layer that an event is no longer delayed.
      Parameters:
      caseId - the ID of the case
      eventId - the ID of the event
      Since:
      9.6
    • findByCriteria

      public TaskViewResult findByCriteria(TaskViewCriteria criteria)
    • findByCriteria

      public CaseViewResult findByCriteria(CaseViewCriteria criteria)
    • isCaseLocked

      public boolean isCaseLocked(long caseId)