View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.core.flowable.api;
20  
21  import java.util.List;
22  import org.apache.syncope.common.lib.to.WorkflowTask;
23  import org.apache.syncope.common.lib.to.WorkflowTaskExecInput;
24  import org.apache.syncope.core.provisioning.api.UserWorkflowResult;
25  
26  public interface WorkflowTaskManager {
27  
28      /**
29       * Gets variable value.
30       * Returns null when no variable value is found with the given name or when the value is set to null.
31       *
32       * @param <T> variable type
33       * @param executionId id of execution, cannot be null.
34       * @param variableName name of variable, cannot be null.
35       * @param variableClass class of variable, cannot be null.
36       * @return the variable value or null if the variable is undefined or the value of the variable is null.
37       * @throws org.flowable.common.engine.api.FlowableObjectNotFoundException
38       * when no execution is found for the given executionId.
39       * @throws ClassCastException
40       * when cannot cast variable to given class
41       */
42      <T> T getVariable(String executionId, String variableName, Class<T> variableClass);
43  
44      /**
45       * Updates or create sa variable for an execution.
46       *
47       * @param executionId id of execution to set variable in, cannot be null.
48       * @param variableName name of variable to set, cannot be null.
49       * @param value value to set; when null is passed, the variable is not removed, only it's value will be set to null
50       * @throws org.flowable.common.engine.api.FlowableObjectNotFoundException
51       * when no execution is found for the given executionId.
52       */
53      void setVariable(String executionId, String variableName, Object value);
54  
55      /**
56       * Get tasks available for execution, for given user.
57       *
58       * @param userKey user key
59       * @return available tasks
60       */
61      List<WorkflowTask> getAvailableTasks(String userKey);
62  
63      /**
64       * Execute a task on an user.
65       *
66       * @param workflowTaskExecInput input for task execution
67       * @return user after task execution
68       */
69      UserWorkflowResult<String> executeNextTask(WorkflowTaskExecInput workflowTaskExecInput);
70  }