Interface IWorkflowContext

  • All Superinterfaces:
    org.eclipse.core.runtime.IAdaptable

    public interface IWorkflowContext
    extends org.eclipse.core.runtime.IAdaptable
    The workflow context gives you access to all tasks and cases of all users of an application. There is a workflow context for each application and vice versa.
    Since:
    17.05.2006
    API:
    This is a public API.
    • Method Detail

      • getApplication

        IApplication getApplication()
        Gets the application this workflow context belongs to.
        Returns:
        the application
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS ApplicationRead PERMISSION OR OWNS ApplicationRead@SYSTEM PERMISSION
      • getSecurityContext

        ISecurityContext getSecurityContext()
        Gets the security context that is responsible for the security of the application this workflow context belongs to.
        Returns:
        the security context
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • createCasePropertyFilter

        IPropertyFilter<CaseProperty> createCasePropertyFilter​(CaseProperty property,
                                                               RelationalOperator operator,
                                                               Object value)

        Creates a case property filter.

        Case property filters can be used to filter cases in the findCase methods like findCases(IPropertyFilter, List, int, int, boolean)

        Example:
        IPropertyFilter filterName = ivy.wf.createCasePropertyFilter(CaseProperty.NAME, RelationalOperator.LIKE, "W%"));
        IPropertyFilter filterPriority = ivy.wf.createCasePropertyFilter(CaseProperty.PRIORITY, RelationalOperator.EQUAL, WorkflowPriority.NORMAL.intValue());
        IPropertyFilter filter = filterName.and(filterPriority);

        Parameters:
        property - the case property to filter with
        operator - the filter operator
        value - the value to filter for. Can be null. Must respect the type of the property. I.e. the name property should have a String value.
        Returns:
        case property filter
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • createTaskPropertyFilter

        IPropertyFilter<TaskProperty> createTaskPropertyFilter​(TaskProperty property,
                                                               RelationalOperator operator,
                                                               Object value)

        Creates a task property filter.

        Task property filters can be used to filter tasks in the findTask methods like findTasks(IPropertyFilter, List, int, int, boolean)

        Example:
        IPropertyFilter filterName = ivy.wf.createTaskPropertyFilter(TaskProperty.NAME, RelationalOperator.LIKE, "W%")
        IPropertyFilter filterPriority = ivy.wf.createTaskPropertyFilter(TaskProperty.PRIORITY, RelationalOperator.EQUAL, WorkflowPriority.NORMAL.intValue());
        IPropertyFilter filter = filterName.and(filterPriority);

        Parameters:
        property - the case property to filter with
        operator - the filter operator
        value - the value to filter for. Can be null. Must respect the type of the property. I.e. the name property should have a String value.
        Returns:
        task property filter
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
      • createWorkflowEventPropertyFilter

        IPropertyFilter<WorkflowEventProperty> createWorkflowEventPropertyFilter​(WorkflowEventProperty property,
                                                                                 RelationalOperator operator,
                                                                                 Object value)

        Creates a workflow event property filter.

        Workflow Event property filters can be used to filter workflow events in the findWorkflowEvent methods like findWorkflowEvents(IPropertyFilter, List, int, int, boolean)

        Example:
        IPropertyFilter filterUserName = ivy.wf.createWorkflowEventPropertyFilter(WorkflowEventProperty.USER_NAME, RelationalOperator.LIKE, "W%"));
        IPropertyFilter filterCreateCase = ivy.wf.createWorkflowEventPropertyFilter(WorkflowEventProperty.EVENT_KIND, RelationalOperator.EQUAL, WorkflowEventKind.EVENT_CREATE_CASE.intValue());
        IPropertyFilter filter = filterUserName.and(filterCreateCase);

        Parameters:
        property - the case property to filter with
        operator - the filter operator
        value - the value to filter for. Can be null. Must respect the type of the property. I.e. the username property should have a String value.
        Returns:
        workflow event property filter
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • createIntermediateEventPropertyFilter

        IPropertyFilter<IntermediateEventProperty> createIntermediateEventPropertyFilter​(IntermediateEventProperty property,
                                                                                         RelationalOperator operator,
                                                                                         Object value)

        Creates an intermediate event property filter.

        Workflow Event property filters can be used to filter workflow events in the findWorkflowEvent methods like findWorkflowEvents(IPropertyFilter, List, int, int, boolean)

        Example:
        IPropertyFilter filterTimeout = ivy.wf.createIntermediateEventPropertyFilter(IntermediateEventProperty.TIMEOUT_ACTION, RelationalOperator.EQUAL, IntermediateEventTimeoutAction.NOTHING.intValue()); IPropertyFilter filterWaiting = ivy.wf.createIntermediateEventPropertyFilter(IntermediateEventProperty.STATE, RelationalOperator.EQUAL, IntermediateEventState.WAITING.intValue()); IPropertyFilter filter = filterTimeout.or(filterWaiting);

        Parameters:
        property - the intermediate event property to filter with
        operator - the filter operator
        value - the value to filter for. Can be null. Must respect the type of the property. I.e. the taskId property should be an integer value.
        Returns:
        intermediate event property filter
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • findCase

        ICase findCase​(long caseIdentifier)
        Finds a case by its ID.
        Parameters:
        caseIdentifier - the case identifier
        Returns:
        the case or null if case is not found
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS CaseRead PERMISSION OR OWNS CaseRead@SYSTEM PERMISSION
      • findCases

        @Deprecated
        IQueryResult<ICase> findCases​(String propertyName,
                                      String propertyValue,
                                      int startIndex,
                                      int count,
                                      boolean returnAllCount)
        Deprecated.
        use CaseQuery.create().where().customField().textField(propertyName).isLike(propertyValue).executor().results(startIndex, count) instead
        Finds all cases which have an additional property with the given name and value.

        Consider to use the CaseQuery API alternatively. This fluent API makes the statement combinable with other filters and allows SQL-like value comparisons. E.g:

         CaseQuery query = CaseQuery.create()
            .where().additionalProperty("myPropertyName").isLike("myValue");
         List<ICase> cases = ivy.wf.getCaseQueryExecutor().getResults(query, startIndex, count);
        Parameters:
        propertyName - the additional property name.
        propertyValue - the additional property value
        startIndex - the index of the first case of all cases found returned. Must be >= 0.
        count - how many cases found are returned. Must be >= 0 or -1 which means return all.
        returnAllCount - if true the query result method IQueryResult.getAllCount() returns the overall cases that have been found, if false it returns -1
        Returns:
        query result with all founded cases
        Throws:
        PersistencyException - if persistency access fails
        See Also:
        IAdditionalPropertyable.setAdditionalProperty(String, String), IAdditionalPropertyable.getAdditionalProperty(String), CaseQuery, getCaseQueryExecutor()
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
        Security:
        SESSION OWNS CaseReadAll PERMISSION OR OWNS CaseReadAll@SYSTEM PERMISSION
      • getRunningCasesCount

        int getRunningCasesCount​(IProcessModelVersion processModelVersion)

        Gets the number of running cases of a process model version.

        A case is running if it is in state CaseState.CREATED or CaseState.RUNNING.

        Parameters:
        processModelVersion - the process model version to check
        Returns:
        The number of running cases in the specified PMV
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • findTask

        ITask findTask​(long taskIdentifier)
        Finds a task by its ID.
        Parameters:
        taskIdentifier - the identifier of the task
        Returns:
        the task or null if no task is found
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS TaskRead PERMISSION OR OWNS TaskRead@SYSTEM PERMISSION
      • findTasks

        @Deprecated
        IQueryResult<ITask> findTasks​(String propertyName,
                                      String propertyValue,
                                      int startIndex,
                                      int count,
                                      boolean returnAllCount)
        Deprecated.
        use TaskQuery.create().where().customField().textField(propertyName).isLike(propertyValue).executor().results(startIndex, count) instead

        Finds all tasks which have an additional property with the given name and value.

        Consider to use the TaskQuery API alternatively. This fluent API makes the statement combinable with other filters and allows SQL-like value comparisons. E.g:

         TaskQuery query = TaskQuery.create()
            .where().additionalProperty("myPropertyName").isLike("myValue");
         List<ITask> tasks = ivy.wf.getTaskQueryExecutor().getResults(query, startIndex, count);
        Parameters:
        propertyName - the additional property name
        propertyValue - the additional property value.
        startIndex - the index of the first task of all tasks found returned. Must be >= 0.
        count - how many tasks found are returned. Must be >= 0 or -1 which means all.
        returnAllCount - if true the query result method IQueryResult.getAllCount() returns the overall cases that have been found, if false it returns -1
        Returns:
        query result with all found tasks
        Throws:
        PersistencyException - if persistency access fails
        See Also:
        IAdditionalPropertyable.setAdditionalProperty(String, String), IAdditionalPropertyable.getAdditionalProperty(String), TaskQuery, getTaskQueryExecutor()
        API:
        This public API is available in IvyScript and Java. It has the visibility ADVANCED.
        Security:
        SESSION OWNS TaskReadAll PERMISSION OR OWNS TaskReadAll@SYSTEM PERMISSION
      • findWorkTasks

        IQueryResult<ITask> findWorkTasks​(IUser user,
                                          int startIndex,
                                          int count)

        Finds tasks that a given user can work on (currently working or can start).

        Note: if parameter count is specified, then this method does not provide the whole number of matching tasks on IQueryResult.getAllCount()

        Consider to use the TaskQuery API alternatively. This fluent API makes the statement combinable with other filters and allows SQL-like value comparisons. E.g:

         TaskQuery query = TaskQuery.create()
            .where().canWorkOn(user);
         List<ITask> tasks = ivy.wf.getTaskQueryExecutor().getResults(query, startIndex, count);

        Parameters:
        user - an ivy user
        startIndex - index of the first result that is returned (0..n, first entry is 0)
        count - maximum number of results to return (-1 for all)
        Returns:
        tasks that a user can work on (never null)
        Throws:
        PersistencyException - if persistency access fails
        See Also:
        findWorkTasks(IUser, IPropertyFilter, List, int, int, boolean, EnumSet), TaskQuery, getTaskQueryExecutor()
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS TaskReadAll PERMISSION OR OWNS TaskReadAll@SYSTEM PERMISSION
      • findWorkTasks

        IQueryResult<ITask> findWorkTasks​(IUser user,
                                          IPropertyFilter<TaskProperty> filter,
                                          List<PropertyOrder<TaskProperty>> order,
                                          int startIndex,
                                          int count,
                                          boolean returnAllCount,
                                          EnumSet<TaskState> includeTaskStates)

        Finds tasks that a given user can work on (currently working or can start).

        Task filter can be created with the method createTaskPropertyFilter(TaskProperty, RelationalOperator, Object).

        Consider to use the TaskQuery API alternatively. This fluent API makes the statement combinable with other filters and allows SQL-like value comparisons. E.g:

         TaskQuery query = TaskQuery.create()
            .where().canWorkOn(user)
            .and().state().isEqual(TaskState.SUSPENDED);;
         List<ITask> tasks = ivy.wf.getTaskQueryExecutor().getResults(query, startIndex, count);

        Parameters:
        user - an ivy user
        filter - additional filter for tasks (can be null)
        order - sorting order for results (ORDER BY)
        startIndex - index of the first result that is returned (0..n, first entry is 0)
        count - maximum number of results to return
        returnAllCount - whether the overall result counter should be returned (consider performance effects), see IQueryResult.getAllCount()
        includeTaskStates - only tasks with listed states will be included in result (cannot be null).
        Returns:
        tasks that a user can work on (never null)
        Throws:
        PersistencyException - if persistency access fails
        See Also:
        findWorkTasks(IUser, int, int), TaskQuery, getTaskQueryExecutor()
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS TaskReadAll PERMISSION OR OWNS TaskReadAll@SYSTEM PERMISSION
      • deleteCompletedCase

        void deleteCompletedCase​(ICase completedCase)

        Deletes the given completed case and all belonging objects (tasks, workflow events, notes, process data etc.).

        A completed case is a case that has the state CaseState.DESTROYED or CaseState.DONE or CaseState.ZOMBIE.

        This method can be used to clean up the database.

        Warning: This method deletes the data of the given case permanently. It is not possible to restore the data afterwards.

        Parameters:
        completedCase - the case to delete permanently. Must not be null
        Throws:
        PersistencyException - if persistency access fails
        IllegalStateException - if the given case is not in state CaseState.DESTROYED or CaseState.DONE or CaseState.ZOMBIE
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS CaseDelete PERMISSION OR OWNS CaseDelete@SYSTEM PERMISSION
      • getWorkflowSession

        IWorkflowSession getWorkflowSession​(ISession session)

        Gets the workflow session that belongs to the given security session. The security session and the workflow session are two interfaces to the same object. With this method you can navigate from one interface to the other.

        Parameters:
        session - the security session
        Returns:
        the workflow session that belongs to the given security session
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in Java.
      • fireIntermediateEvent

        IIntermediateEvent fireIntermediateEvent​(IIntermediateEventElement intermediateEventElement,
                                                 String eventIdentifier,
                                                 Object resultObject,
                                                 String additionalInformation)
        Fires an intermediate event.
        Parameters:
        intermediateEventElement - the intermediate event element to fire the intermediate event on.
        eventIdentifier - the event identifier.
        resultObject - the result object. Can be null.
        additionalInformation - additional information about the event.
        Returns:
        the intermediate event
        Throws:
        PersistencyException - if persistency access fails
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION IS SYSTEM
      • getTaskQueryExecutor

        ITaskQueryExecutor getTaskQueryExecutor()
        Executor for task queries on this application.
        Returns:
        task query executor
        See Also:
        TaskQuery
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS TaskReadAll PERMISSION OR OWNS TaskReadAll@SYSTEM PERMISSION
      • getCaseQueryExecutor

        ICaseQueryExecutor getCaseQueryExecutor()
        Executor for case queries on this application.
        Returns:
        case query executor
        See Also:
        CaseQuery
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
        Security:
        SESSION OWNS CaseReadAll PERMISSION OR OWNS CaseReadAll@SYSTEM PERMISSION
      • findProcessStartsBySignature

        Set<IProcessStart> findProcessStartsBySignature​(String signature)
        Finds all process starts that have the given signature. Note that the signature is only unique for one process file, there may be multiple process starts with the same signature per process model version.
        Parameters:
        signature - the signature of the searched process, i.e. mySignature(java.lang.String):java.lang.Integer
        Returns:
        all process starts in released process model versions of the application that match the given signature
        API:
        This public API is available in IvyScript and Java. It has the visibility EXPERT.
      • getStartableProcessStarts

        List<IProcessStart> getStartableProcessStarts​(IUser user)
        Returns all process start elements which the given user can start.
        Parameters:
        user -
        Returns:
        process starts
        Since:
        6.6.2
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • getStartables

        List<IWebStartable> getStartables​(IUser user)
        Returns all startables which the given user can start.
        Parameters:
        user -
        Returns:
        startables
        Since:
        6.6.2
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
      • documents

        IDocumentService documents()
        Returns a service for managing documents of this workflow context.

        Examples:

        Add a document:
        IDocument document = ivy.wf.documents().add(new Path("images/myImage.png")).write().withContentFrom(in.file);

        Get all documents:
        List<IDocument> documents = ivy.wf.documents().getAll();

        Returns:
        workflow context document service
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.
        Security:
        SESSION OWNS DocumentRead PERMISSION OR OWNS DocumentRead@SYSTEM PERMISSION
      • signals

        IBpmSignalService signals()

        A service for sending and querying signals.

        Example: send a signal:

        ivy.wf.signals().send("user:created");

        Returns:
        signal service
        Since:
        6.1.0
        API:
        This public API is available in IvyScript and Java. It has the visibility NOVICE.