Skip to content

Commit 2ea2de8

Browse files
jonathanlukasgithub-actions[bot]
authored andcommitted
BACKPORT-CONFLICT
1 parent 2970d1f commit 2ea2de8

File tree

9 files changed

+194
-6
lines changed

9 files changed

+194
-6
lines changed

README.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ tasklist:
9898
client-secret:
9999
```
100100
101-
Configure defaults that influence the client behaviour:
101+
Configure defaults that influence the client behavior:
102102
103103
```yaml
104104
tasklist:
@@ -107,6 +107,8 @@ tasklist:
107107
load-truncated-variables: true
108108
return-variables: true
109109
use-zeebe-user-tasks: true
110+
tenant-ids:
111+
- <default>
110112
```
111113
112114
### Plain Java
@@ -125,14 +127,24 @@ Build a Camunda Tasklist client with simple authentication:
125127

126128
```java
127129
// properties you need to provide
130+
<<<<<<< HEAD
131+
=======
132+
ApiVersion apiVersion = ApiVersion.v1;
133+
>>>>>>> 761422d (default tenant id (#370))
128134
String username = "demo";
129135
String password = "demo";
130136
URL tasklistUrl = URI.create("http://localhost:8082").toURL();
131137
boolean returnVariables = false;
132138
boolean loadTruncatedVariables = false;
133139
boolean useZeebeUserTasks = true;
140+
<<<<<<< HEAD
134141
// if you are using zeebe user tasks, you require a zeebe client as well
135142
ZeebeClient zeebeClient = zeebeClient();
143+
=======
144+
List<String> tenantIds = List.of("<default>");
145+
// if you are using camunda user tasks, you require a camunda client as well
146+
CamundaClient camundaClient = camundaClient();
147+
>>>>>>> 761422d (default tenant id (#370))
136148
// bootstrapping
137149
SimpleCredential credentials =
138150
new SimpleCredential(username, password, tasklistUrl, Duration.ofMinutes(10));
@@ -141,15 +153,26 @@ CamundaTasklistClientConfiguration configuration =
141153
new CamundaTasklistClientConfiguration(
142154
authentication,
143155
tasklistUrl,
156+
<<<<<<< HEAD
144157
zeebeClient,
145158
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
159+
=======
160+
camundaClient,
161+
new DefaultProperties(
162+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
163+
>>>>>>> 761422d (default tenant id (#370))
146164
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
147165
```
148166

149167
Build a Camunda Tasklist client with identity authentication:
150168

151169
```java
170+
<<<<<<< HEAD
152171
// properties you need to provide
172+
=======
173+
// properties you need to provide
174+
ApiVersion apiVersion = ApiVersion.v1;
175+
>>>>>>> 761422d (default tenant id (#370))
153176
String clientId = "";
154177
String clientSecret = "";
155178
String audience = "tasklist-api";
@@ -162,8 +185,14 @@ URL authUrl =
162185
boolean returnVariables = false;
163186
boolean loadTruncatedVariables = false;
164187
boolean useZeebeUserTasks = true;
188+
<<<<<<< HEAD
165189
// if you are using zeebe user tasks, you require a zeebe client as well
166190
ZeebeClient zeebeClient = zeebeClient();
191+
=======
192+
List<String> tenantIds = List.of("<default>");
193+
// if you are using camunda user tasks, you require a camunda client as well
194+
CamundaClient camundaClient = camundaClient();
195+
>>>>>>> 761422d (default tenant id (#370))
167196
// bootstrapping
168197
JwtCredential credentials =
169198
new JwtCredential(clientId, clientSecret, audience, authUrl, scope);
@@ -175,24 +204,41 @@ CamundaTasklistClientConfiguration configuration =
175204
new CamundaTasklistClientConfiguration(
176205
authentication,
177206
tasklistUrl,
207+
<<<<<<< HEAD
178208
zeebeClient,
179209
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
210+
=======
211+
camundaClient,
212+
new DefaultProperties(
213+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
214+
>>>>>>> 761422d (default tenant id (#370))
180215
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
181216
```
182217

183218
Build a Camunda Tasklist client for Saas:
184219

185220
```java
221+
<<<<<<< HEAD
186222
// properties you need to provide
223+
=======
224+
// properties you need to provide
225+
ApiVersion apiVersion = ApiVersion.v1;
226+
>>>>>>> 761422d (default tenant id (#370))
187227
String region = "";
188228
String clusterId = "";
189229
String clientId = "";
190230
String clientSecret = "";
191231
boolean returnVariables = false;
192232
boolean loadTruncatedVariables = false;
193233
boolean useZeebeUserTasks = true;
234+
<<<<<<< HEAD
194235
// if you are using zeebe user tasks, you require a zeebe client as well
195236
ZeebeClient zeebeClient = zeebeClient();
237+
=======
238+
List<String> tenantIds = List.of("<default>");
239+
// if you are using camunda user tasks, you require a camunda client as well
240+
CamundaClient camundaClient = camundaClient();
241+
>>>>>>> 761422d (default tenant id (#370))
196242
// bootstrapping
197243
URL tasklistUrl =
198244
URI.create("https://" + region + ".tasklist.camunda.io/" + clusterId).toURL();
@@ -207,8 +253,14 @@ CamundaTasklistClientConfiguration configuration =
207253
new CamundaTasklistClientConfiguration(
208254
authentication,
209255
tasklistUrl,
256+
<<<<<<< HEAD
210257
zeebeClient,
211258
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
259+
=======
260+
camundaClient,
261+
new DefaultProperties(
262+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
263+
>>>>>>> 761422d (default tenant id (#370))
212264
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
213265
```
214266

example/bootstrapping-test/src/main/java/io/camunda/tasklist/bootstrapping/Bootstrapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.camunda.tasklist.bootstrapping;
22

3+
import static io.camunda.tasklist.CamundaTasklistClientConfiguration.*;
4+
35
import io.camunda.tasklist.CamundaTaskListClient;
46
import io.camunda.tasklist.CamundaTasklistClientConfiguration;
57
import io.camunda.tasklist.CamundaTasklistClientConfiguration.DefaultProperties;
@@ -22,7 +24,7 @@ public CamundaTaskListClient create() {
2224
Duration.ofMinutes(10))),
2325
URI.create("http://localhost:8082").toURL(),
2426
null,
25-
new DefaultProperties(true, true, false)));
27+
new DefaultProperties(true, true, false, DEFAULT_TENANT_IDS)));
2628
} catch (MalformedURLException e) {
2729
throw new RuntimeException("Error while bootstrapping tasklist client", e);
2830
}

example/readme-snippets/src/main/java/io/camunda/tasklist/example/TasklistClientBootstrapper.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.net.URI;
1515
import java.net.URL;
1616
import java.time.Duration;
17+
import java.util.List;
1718

1819
public interface TasklistClientBootstrapper {
1920
static ZeebeClient zeebeClient() {
@@ -33,8 +34,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
3334
boolean returnVariables = false;
3435
boolean loadTruncatedVariables = false;
3536
boolean useZeebeUserTasks = true;
37+
<<<<<<< HEAD
3638
// if you are using zeebe user tasks, you require a zeebe client as well
3739
ZeebeClient zeebeClient = zeebeClient();
40+
=======
41+
List<String> tenantIds = List.of("<default>");
42+
// if you are using camunda user tasks, you require a camunda client as well
43+
CamundaClient camundaClient = camundaClient();
44+
>>>>>>> 761422d (default tenant id (#370))
3845
// bootstrapping
3946
SimpleCredential credentials =
4047
new SimpleCredential(username, password, tasklistUrl, Duration.ofMinutes(10));
@@ -43,8 +50,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
4350
new CamundaTasklistClientConfiguration(
4451
authentication,
4552
tasklistUrl,
53+
<<<<<<< HEAD
4654
zeebeClient,
4755
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
56+
=======
57+
camundaClient,
58+
new DefaultProperties(
59+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
60+
>>>>>>> 761422d (default tenant id (#370))
4861
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
4962
return client;
5063
}
@@ -66,8 +79,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
6679
boolean returnVariables = false;
6780
boolean loadTruncatedVariables = false;
6881
boolean useZeebeUserTasks = true;
82+
<<<<<<< HEAD
6983
// if you are using zeebe user tasks, you require a zeebe client as well
7084
ZeebeClient zeebeClient = zeebeClient();
85+
=======
86+
List<String> tenantIds = List.of("<default>");
87+
// if you are using camunda user tasks, you require a camunda client as well
88+
CamundaClient camundaClient = camundaClient();
89+
>>>>>>> 761422d (default tenant id (#370))
7190
// bootstrapping
7291
JwtCredential credentials =
7392
new JwtCredential(clientId, clientSecret, audience, authUrl, scope);
@@ -79,8 +98,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
7998
new CamundaTasklistClientConfiguration(
8099
authentication,
81100
tasklistUrl,
101+
<<<<<<< HEAD
82102
zeebeClient,
83103
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
104+
=======
105+
camundaClient,
106+
new DefaultProperties(
107+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
108+
>>>>>>> 761422d (default tenant id (#370))
84109
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
85110
return client;
86111
}
@@ -97,8 +122,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
97122
boolean returnVariables = false;
98123
boolean loadTruncatedVariables = false;
99124
boolean useZeebeUserTasks = true;
125+
<<<<<<< HEAD
100126
// if you are using zeebe user tasks, you require a zeebe client as well
101127
ZeebeClient zeebeClient = zeebeClient();
128+
=======
129+
List<String> tenantIds = List.of("<default>");
130+
// if you are using camunda user tasks, you require a camunda client as well
131+
CamundaClient camundaClient = camundaClient();
132+
>>>>>>> 761422d (default tenant id (#370))
102133
// bootstrapping
103134
URL tasklistUrl =
104135
URI.create("https://" + region + ".tasklist.camunda.io/" + clusterId).toURL();
@@ -113,8 +144,14 @@ public CamundaTaskListClient createTasklistClient() throws MalformedURLException
113144
new CamundaTasklistClientConfiguration(
114145
authentication,
115146
tasklistUrl,
147+
<<<<<<< HEAD
116148
zeebeClient,
117149
new DefaultProperties(returnVariables, loadTruncatedVariables, useZeebeUserTasks));
150+
=======
151+
camundaClient,
152+
new DefaultProperties(
153+
returnVariables, loadTruncatedVariables, useZeebeUserTasks, tenantIds));
154+
>>>>>>> 761422d (default tenant id (#370))
118155
CamundaTaskListClient client = new CamundaTaskListClient(configuration);
119156
return client;
120157
}

extension/client-java/src/main/java/io/camunda/tasklist/CamundaTaskListClient.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ public TaskList getTasks(TaskSearch search) throws TaskListException {
457457
if (search.getWithVariables() == null) {
458458
search.setWithVariables(defaultProperties.returnVariables());
459459
}
460+
<<<<<<< HEAD
460461
Pagination pagination = search.getPagination();
461462
TaskSearchRequest request = ConverterUtils.toTaskSearchRequest(search);
462463
if (pagination != null) {
@@ -477,6 +478,14 @@ public TaskList getTasks(TaskSearch search) throws TaskListException {
477478
request.sort(pagination.getSort());
478479
}
479480
return new TaskList().setItems(getTasks(request, search.getWithVariables())).setSearch(search);
481+
=======
482+
if (search.getTenantIds() == null || search.getTenantIds().isEmpty()) {
483+
search.setTenantIds(defaultProperties.tenantIds());
484+
}
485+
return new TaskList()
486+
.setItems(getTasks(toTaskSearch(search), search.getWithVariables()))
487+
.setSearch(search);
488+
>>>>>>> 761422d (default tenant id (#370))
480489
}
481490

482491
public TaskList getTasks(

extension/client-java/src/main/java/io/camunda/tasklist/CamundaTaskListClientBuilder.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.camunda.tasklist;
22

3+
import static io.camunda.tasklist.CamundaTasklistClientConfiguration.*;
4+
35
import com.fasterxml.jackson.databind.ObjectMapper;
46
import io.camunda.tasklist.auth.Authentication;
57
import io.camunda.tasklist.auth.JwtAuthentication;
@@ -13,8 +15,17 @@
1315

1416
@Deprecated
1517
public class CamundaTaskListClientBuilder {
18+
<<<<<<< HEAD
1619
private CamundaTaskListClientProperties properties = new CamundaTaskListClientProperties();
1720
private ZeebeClient zeebeClient;
21+
=======
22+
private Authentication authentication;
23+
private URL tasklistUrl;
24+
private CamundaClient camundaClient;
25+
private ApiVersion apiVersion = ApiVersion.v2;
26+
private DefaultProperties defaultProperties =
27+
new DefaultProperties(false, false, false, DEFAULT_TENANT_IDS);
28+
>>>>>>> 761422d (default tenant id (#370))
1829

1930
public CamundaTaskListClientBuilder authentication(Authentication authentication) {
2031
properties.setAuthentication(authentication);
@@ -38,12 +49,30 @@ public CamundaTaskListClientBuilder zeebeClient(ZeebeClient zeebeClient) {
3849
* @return the builder
3950
*/
4051
public CamundaTaskListClientBuilder shouldReturnVariables() {
52+
<<<<<<< HEAD
4153
properties.setDefaultShouldReturnVariables(true);
54+
=======
55+
this.defaultProperties =
56+
new DefaultProperties(
57+
true,
58+
defaultProperties.loadTruncatedVariables(),
59+
defaultProperties.useCamundaUserTasks(),
60+
defaultProperties.tenantIds());
61+
>>>>>>> 761422d (default tenant id (#370))
4262
return this;
4363
}
4464

4565
public CamundaTaskListClientBuilder shouldLoadTruncatedVariables() {
66+
<<<<<<< HEAD
4667
properties.setDefaultShouldLoadTruncatedVariables(true);
68+
=======
69+
this.defaultProperties =
70+
new DefaultProperties(
71+
defaultProperties.returnVariables(),
72+
true,
73+
defaultProperties.useCamundaUserTasks(),
74+
defaultProperties.tenantIds());
75+
>>>>>>> 761422d (default tenant id (#370))
4776
return this;
4877
}
4978

@@ -65,7 +94,31 @@ public CamundaTaskListClientBuilder cookieExpiration(Duration cookieExpiration)
6594
* client
6695
*/
6796
public CamundaTaskListClientBuilder useZeebeUserTasks() {
97+
<<<<<<< HEAD
6898
properties.setUseZeebeUserTasks(true);
99+
=======
100+
return useCamundaUserTasks();
101+
}
102+
103+
/**
104+
* Enable when using zeebe user tasks (only relevant for >8.5). Will require presence of a zeebe
105+
* client
106+
*/
107+
public CamundaTaskListClientBuilder useCamundaUserTasks() {
108+
this.defaultProperties =
109+
new DefaultProperties(
110+
defaultProperties.returnVariables(),
111+
defaultProperties.loadTruncatedVariables(),
112+
true,
113+
defaultProperties.tenantIds());
114+
return this;
115+
}
116+
117+
public CamundaTaskListClientBuilder apiVersion(ApiVersion apiVersion) {
118+
if (apiVersion != null) {
119+
this.apiVersion = apiVersion;
120+
}
121+
>>>>>>> 761422d (default tenant id (#370))
69122
return this;
70123
}
71124

extension/client-java/src/main/java/io/camunda/tasklist/CamundaTasklistClientConfiguration.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,27 @@
33
import io.camunda.tasklist.auth.Authentication;
44
import io.camunda.zeebe.client.ZeebeClient;
55
import java.net.URL;
6+
import java.util.List;
67

78
public record CamundaTasklistClientConfiguration(
89
Authentication authentication,
910
URL baseUrl,
1011
ZeebeClient zeebeClient,
1112
DefaultProperties defaultProperties) {
1213
public record DefaultProperties(
14+
<<<<<<< HEAD
1315
boolean returnVariables, boolean loadTruncatedVariables, boolean useZeebeUserTasks) {}
16+
=======
17+
boolean returnVariables,
18+
boolean loadTruncatedVariables,
19+
boolean useCamundaUserTasks,
20+
List<String> tenantIds) {}
21+
22+
public enum ApiVersion {
23+
v1,
24+
v2
25+
}
26+
27+
public static List<String> DEFAULT_TENANT_IDS = List.of("<default>");
28+
>>>>>>> 761422d (default tenant id (#370))
1429
}

0 commit comments

Comments
 (0)