Skip to content

Commit

Permalink
rebased on latest commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlukas committed Dec 10, 2024
1 parent 7bd246e commit c562300
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 127 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.camunda.tasklist.bootstrapping;

import io.camunda.tasklist.CamundaTaskListClient;
import io.camunda.tasklist.CamundaTaskListClientV1;
import io.camunda.tasklist.CamundaTasklistClientConfiguration;
import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
Expand All @@ -11,7 +10,7 @@
import java.time.Duration;

public class Bootstrapper {
public CamundaTaskListClient create() {
public CamundaTaskListClientV1 create() {
try {
return new CamundaTaskListClientV1(
new CamundaTasklistClientConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import io.camunda.tasklist.CamundaTaskListClient;
import io.camunda.tasklist.CamundaTaskListClientV1;
import io.camunda.tasklist.CamundaTasklistClientConfiguration;
import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
import io.camunda.tasklist.auth.JwtAuthentication;
Expand Down Expand Up @@ -46,7 +47,7 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
tasklistUrl,
zeebeClient,
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
CamundaTaskListClient client = new CamundaTaskListClientV1(configuration);
return client;
}
}
Expand Down Expand Up @@ -81,7 +82,7 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
tasklistUrl,
zeebeClient,
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
CamundaTaskListClient client = new CamundaTaskListClientV1(configuration);
return client;
}
}
Expand Down Expand Up @@ -114,7 +115,7 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
tasklistUrl,
zeebeClient,
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
CamundaTaskListClient client = new CamundaTaskListClientV1(configuration);
return client;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.camunda.tasklist;

import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
import io.camunda.tasklist.dto.Pagination;
import io.camunda.tasklist.dto.SearchType;
import io.camunda.tasklist.dto.Task;
Expand All @@ -15,21 +16,20 @@
import java.util.concurrent.Future;

public abstract class AbstractCamundaTaskListClient implements CamundaTaskListClient {
private final CamundaTaskListClientDefaultBehaviourProperties defaultBehaviourProperties;
private final DefaultProperties defaultProperties;

public AbstractCamundaTaskListClient(
CamundaTaskListClientDefaultBehaviourProperties defaultBehaviourProperties) {
this.defaultBehaviourProperties = defaultBehaviourProperties;
public AbstractCamundaTaskListClient(DefaultProperties defaultProperties) {
this.defaultProperties = defaultProperties;
}

@Override
public Task getTask(String taskId) throws TaskListException {
return getTask(taskId, defaultBehaviourProperties.defaultShouldReturnVariables());
return getTask(taskId, defaultProperties.returnVariables());
}

@Override
public List<Variable> getVariables(String taskId) throws TaskListException {
return getVariables(taskId, defaultBehaviourProperties.defaultShouldLoadTruncatedVariables());
return getVariables(taskId, defaultProperties.loadTruncatedVariables());
}

@Override
Expand All @@ -54,7 +54,7 @@ public TaskList afterOrEqual(TaskList taskList) throws TaskListException {

@Override
public void loadVariables(List<Task> tasks) throws TaskListException {
loadVariables(tasks, defaultBehaviourProperties.defaultShouldLoadTruncatedVariables());
loadVariables(tasks, defaultProperties.loadTruncatedVariables());
}

@Override
Expand Down Expand Up @@ -88,7 +88,7 @@ public void loadVariables(List<Task> tasks, boolean loadTruncated) throws TaskLi
@Override
public TaskList getTasks(TaskSearch search) throws TaskListException {
if (search.getWithVariables() == null) {
search.setWithVariables(defaultBehaviourProperties.defaultShouldReturnVariables());
search.setWithVariables(defaultProperties.returnVariables());
}
return getTasksInternal(search);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,35 @@
import io.camunda.tasklist.dto.TaskSearch.TaskByVariables;
import io.camunda.tasklist.dto.TaskState;
import io.camunda.tasklist.dto.Variable;
import io.camunda.tasklist.exception.TaskListException;
import java.util.List;
import java.util.Map;

public interface CamundaTaskListClient {
Task unclaim(String taskId) throws TaskListException;
Task unclaim(String taskId);

default Task claim(String taskId, String assignee) throws TaskListException {
default Task claim(String taskId, String assignee) {
return claim(taskId, assignee, false);
}

Task claim(String taskId, String assignee, Boolean allowOverrideAssignment)
throws TaskListException;
Task claim(String taskId, String assignee, Boolean allowOverrideAssignment);

void completeTask(String taskId, Map<String, Object> variablesMap) throws TaskListException;
void completeTask(String taskId, Map<String, Object> variablesMap);

default TaskList getTasks(Boolean assigned, TaskState state, Integer pageSize)
throws TaskListException {
default TaskList getTasks(Boolean assigned, TaskState state, Integer pageSize) {
return getTasks(
new TaskSearch()
.setAssigned(assigned)
.setState(state)
.setPagination(createPagination(pageSize)));
}

default TaskList getTasks(Boolean assigned, TaskState state, Pagination pagination)
throws TaskListException {
default TaskList getTasks(Boolean assigned, TaskState state, Pagination pagination) {
return getTasks(
new TaskSearch().setAssigned(assigned).setState(state).setPagination(pagination));
}

default TaskList getTasks(
Boolean assigned, TaskState state, boolean withVariables, Integer pageSize)
throws TaskListException {
Boolean assigned, TaskState state, boolean withVariables, Integer pageSize) {
return getTasks(
new TaskSearch()
.setAssigned(assigned)
Expand All @@ -55,8 +50,7 @@ default TaskList getTasks(
}

default TaskList getTasks(
Boolean assigned, TaskState state, boolean withVariables, Pagination pagination)
throws TaskListException {
Boolean assigned, TaskState state, boolean withVariables, Pagination pagination) {
return getTasks(
new TaskSearch()
.setAssigned(assigned)
Expand All @@ -65,24 +59,21 @@ default TaskList getTasks(
.setPagination(pagination));
}

default TaskList getAssigneeTasks(String assigneeId, TaskState state, Integer pageSize)
throws TaskListException {
default TaskList getAssigneeTasks(String assigneeId, TaskState state, Integer pageSize) {
return getTasks(
new TaskSearch()
.setAssignee(assigneeId)
.setState(state)
.setPagination(createPagination(pageSize)));
}

default TaskList getAssigneeTasks(String assigneeId, TaskState state, Pagination pagination)
throws TaskListException {
default TaskList getAssigneeTasks(String assigneeId, TaskState state, Pagination pagination) {
return getTasks(
new TaskSearch().setAssignee(assigneeId).setState(state).setPagination(pagination));
}

default TaskList getAssigneeTasks(
String assigneeId, TaskState state, boolean withVariables, Integer pageSize)
throws TaskListException {
String assigneeId, TaskState state, boolean withVariables, Integer pageSize) {
return getTasks(
new TaskSearch()
.setAssigned(true)
Expand All @@ -93,8 +84,7 @@ default TaskList getAssigneeTasks(
}

default TaskList getAssigneeTasks(
String assigneeId, TaskState state, boolean withVariables, Pagination pagination)
throws TaskListException {
String assigneeId, TaskState state, boolean withVariables, Pagination pagination) {
return getTasks(
new TaskSearch()
.setAssignee(assigneeId)
Expand All @@ -103,24 +93,21 @@ default TaskList getAssigneeTasks(
.setPagination(pagination));
}

default TaskList getGroupTasks(String group, TaskState state, Integer pageSize)
throws TaskListException {
default TaskList getGroupTasks(String group, TaskState state, Integer pageSize) {
return getTasks(
new TaskSearch()
.setCandidateGroup(group)
.setState(state)
.setPagination(createPagination(pageSize)));
}

default TaskList getGroupTasks(String group, TaskState state, Pagination pagination)
throws TaskListException {
default TaskList getGroupTasks(String group, TaskState state, Pagination pagination) {
return getTasks(
new TaskSearch().setCandidateGroup(group).setState(state).setPagination(pagination));
}

default TaskList getGroupTasks(
String group, TaskState state, boolean withVariables, Integer pageSize)
throws TaskListException {
String group, TaskState state, boolean withVariables, Integer pageSize) {
return getTasks(
new TaskSearch()
.setCandidateGroup(group)
Expand All @@ -130,8 +117,7 @@ default TaskList getGroupTasks(
}

default TaskList getGroupTasks(
String group, TaskState state, boolean withVariables, Pagination pagination)
throws TaskListException {
String group, TaskState state, boolean withVariables, Pagination pagination) {
return getTasks(
new TaskSearch()
.setCandidateGroup(group)
Expand All @@ -141,8 +127,7 @@ default TaskList getGroupTasks(
}

default TaskList getGroupsTasks(
List<String> groups, TaskState state, boolean withVariables, Pagination pagination)
throws TaskListException {
List<String> groups, TaskState state, boolean withVariables, Pagination pagination) {
return getTasks(
new TaskSearch()
.setCandidateGroups(groups)
Expand All @@ -151,40 +136,39 @@ default TaskList getGroupsTasks(
.setPagination(pagination));
}

Task getTask(String taskId) throws TaskListException;
Task getTask(String taskId);

Task getTask(String taskId, boolean withVariables) throws TaskListException;
Task getTask(String taskId, boolean withVariables);

List<Variable> getVariables(String taskId) throws TaskListException;
List<Variable> getVariables(String taskId);

List<Variable> getVariables(String taskId, boolean loadTruncated) throws TaskListException;
List<Variable> getVariables(String taskId, boolean loadTruncated);

Variable getVariable(String variableId) throws TaskListException;
Variable getVariable(String variableId);

default Form getForm(String formId, String processDefinitionId) throws TaskListException {
default Form getForm(String formId, String processDefinitionId) {
return getForm(formId, processDefinitionId, null);
}

Form getForm(String formId, String processDefinitionId, Long version) throws TaskListException;
Form getForm(String formId, String processDefinitionId, Long version);

TaskList before(TaskList taskList) throws TaskListException;
TaskList before(TaskList taskList);

TaskList beforeOrEquals(TaskList taskList) throws TaskListException;
TaskList beforeOrEquals(TaskList taskList);

TaskList after(TaskList taskList) throws TaskListException;
TaskList after(TaskList taskList);

TaskList afterOrEqual(TaskList taskList) throws TaskListException;
TaskList afterOrEqual(TaskList taskList);

TaskList getTasks(TaskSearch search) throws TaskListException;
TaskList getTasks(TaskSearch search);

default TaskList getTasks(
String group,
Boolean assigned,
String assigneeId,
TaskState state,
boolean withVariables,
Pagination pagination)
throws TaskListException {
Pagination pagination) {
return getTasks(
new TaskSearch()
.setCandidateGroup(group)
Expand Down Expand Up @@ -212,8 +196,7 @@ default TaskList getTasks(
List<String> tenantIds,
List<IncludeVariable> includeVariables,
boolean withVariables,
Pagination pagination)
throws TaskListException {
Pagination pagination) {
return getTasks(
new TaskSearch()
.setCandidateUser(candidateUser)
Expand All @@ -235,9 +218,9 @@ default TaskList getTasks(
.setPagination(pagination));
}

void loadVariables(List<Task> tasks) throws TaskListException;
void loadVariables(List<Task> tasks);

void loadVariables(List<Task> tasks, boolean loadTruncated) throws TaskListException;
void loadVariables(List<Task> tasks, boolean loadTruncated);

void saveDraftVariables(String taskId, Map<String, Object> variables) throws TaskListException;
void saveDraftVariables(String taskId, Map<String, Object> variables);
}

This file was deleted.

Loading

0 comments on commit c562300

Please sign in to comment.