• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #333

16 Oct 2024 07:28PM UTC coverage: 78.65% (+0.6%) from 78.085%
#333

push

github

web-flow
Fix code coverage (#2275)

22670 of 28824 relevant lines covered (78.65%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.77
/temporal-sdk/src/main/java/io/temporal/client/WorkflowOptions.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.client;
22

23
import com.google.common.base.Objects;
24
import io.temporal.api.common.v1.Callback;
25
import io.temporal.api.common.v1.Link;
26
import io.temporal.api.enums.v1.WorkflowIdConflictPolicy;
27
import io.temporal.api.enums.v1.WorkflowIdReusePolicy;
28
import io.temporal.common.*;
29
import io.temporal.common.context.ContextPropagator;
30
import io.temporal.internal.common.OptionsUtils;
31
import io.temporal.worker.Worker;
32
import io.temporal.worker.WorkerFactory;
33
import io.temporal.workflow.Workflow;
34
import java.time.Duration;
35
import java.util.Collection;
36
import java.util.List;
37
import java.util.Map;
38
import javax.annotation.Nullable;
39

40
public final class WorkflowOptions {
41

42
  public static Builder newBuilder() {
43
    return new Builder();
1✔
44
  }
45

46
  public static Builder newBuilder(WorkflowOptions options) {
47
    return new Builder(options);
1✔
48
  }
49

50
  public static WorkflowOptions getDefaultInstance() {
51
    return DEFAULT_INSTANCE;
×
52
  }
53

54
  private static final WorkflowOptions DEFAULT_INSTANCE;
55

56
  static {
57
    DEFAULT_INSTANCE = WorkflowOptions.newBuilder().build();
1✔
58
  }
1✔
59

60
  public static WorkflowOptions merge(
61
      MethodRetry methodRetry, CronSchedule cronSchedule, WorkflowOptions o) {
62
    if (o == null) {
1✔
63
      o = WorkflowOptions.newBuilder().build();
×
64
    }
65
    String cronAnnotation = cronSchedule == null ? "" : cronSchedule.value();
1✔
66
    return WorkflowOptions.newBuilder()
1✔
67
        .setWorkflowId(o.getWorkflowId())
1✔
68
        .setWorkflowIdReusePolicy(o.getWorkflowIdReusePolicy())
1✔
69
        .setWorkflowRunTimeout(o.getWorkflowRunTimeout())
1✔
70
        .setWorkflowExecutionTimeout(o.getWorkflowExecutionTimeout())
1✔
71
        .setWorkflowTaskTimeout(o.getWorkflowTaskTimeout())
1✔
72
        .setTaskQueue(o.getTaskQueue())
1✔
73
        .setRetryOptions(RetryOptions.merge(methodRetry, o.getRetryOptions()))
1✔
74
        .setCronSchedule(OptionsUtils.merge(cronAnnotation, o.getCronSchedule(), String.class))
1✔
75
        .setMemo(o.getMemo())
1✔
76
        .setSearchAttributes(o.getSearchAttributes())
1✔
77
        .setTypedSearchAttributes(o.getTypedSearchAttributes())
1✔
78
        .setContextPropagators(o.getContextPropagators())
1✔
79
        .setDisableEagerExecution(o.isDisableEagerExecution())
1✔
80
        .setStartDelay(o.getStartDelay())
1✔
81
        .setWorkflowIdConflictPolicy(o.getWorkflowIdConflictPolicy())
1✔
82
        .setStaticSummary(o.getStaticSummary())
1✔
83
        .setStaticDetails(o.getStaticDetails())
1✔
84
        .setRequestId(o.getRequestId())
1✔
85
        .setCompletionCallbacks(o.getCompletionCallbacks())
1✔
86
        .setLinks(o.getLinks())
1✔
87
        .validateBuildWithDefaults();
1✔
88
  }
89

90
  public static final class Builder {
91

92
    private String workflowId;
93

94
    private WorkflowIdReusePolicy workflowIdReusePolicy;
95

96
    private Duration workflowRunTimeout;
97

98
    private Duration workflowExecutionTimeout;
99

100
    private Duration workflowTaskTimeout;
101

102
    private String taskQueue;
103

104
    private RetryOptions retryOptions;
105

106
    private String cronSchedule;
107

108
    private Map<String, Object> memo;
109

110
    private Map<String, ?> searchAttributes;
111

112
    private SearchAttributes typedSearchAttributes;
113

114
    private List<ContextPropagator> contextPropagators;
115

116
    private boolean disableEagerExecution = true;
1✔
117

118
    private Duration startDelay;
119

120
    private WorkflowIdConflictPolicy workflowIdConflictPolicy;
121

122
    private String staticSummary;
123

124
    private String staticDetails;
125

126
    private String requestId;
127

128
    private List<Callback> completionCallbacks;
129

130
    private List<Link> links;
131

132
    private Builder() {}
1✔
133

134
    private Builder(WorkflowOptions options) {
1✔
135
      if (options == null) {
1✔
136
        return;
×
137
      }
138
      this.workflowIdReusePolicy = options.workflowIdReusePolicy;
1✔
139
      this.workflowId = options.workflowId;
1✔
140
      this.workflowTaskTimeout = options.workflowTaskTimeout;
1✔
141
      this.workflowRunTimeout = options.workflowRunTimeout;
1✔
142
      this.workflowExecutionTimeout = options.workflowExecutionTimeout;
1✔
143
      this.taskQueue = options.taskQueue;
1✔
144
      this.retryOptions = options.retryOptions;
1✔
145
      this.cronSchedule = options.cronSchedule;
1✔
146
      this.memo = options.memo;
1✔
147
      this.searchAttributes = options.searchAttributes;
1✔
148
      this.typedSearchAttributes = options.typedSearchAttributes;
1✔
149
      this.contextPropagators = options.contextPropagators;
1✔
150
      this.disableEagerExecution = options.disableEagerExecution;
1✔
151
      this.startDelay = options.startDelay;
1✔
152
      this.workflowIdConflictPolicy = options.workflowIdConflictPolicy;
1✔
153
      this.staticSummary = options.staticSummary;
1✔
154
      this.staticDetails = options.staticDetails;
1✔
155
      this.requestId = options.requestId;
1✔
156
      this.completionCallbacks = options.completionCallbacks;
1✔
157
      this.links = options.links;
1✔
158
    }
1✔
159

160
    /**
161
     * Workflow id to use when starting. If not specified a UUID is generated. Note that it is
162
     * dangerous as in case of client side retries no deduplication will happen based on the
163
     * generated id. So prefer assigning business meaningful ids if possible.
164
     */
165
    public Builder setWorkflowId(String workflowId) {
166
      this.workflowId = workflowId;
1✔
167
      return this;
1✔
168
    }
169

170
    /**
171
     * Specifies server behavior if a completed workflow with the same id exists. Note that under no
172
     * conditions Temporal allows two workflows with the same namespace and workflow id run
173
     * simultaneously. See {@line setWorkflowIdConflictPolicy} for handling a workflow id
174
     * duplication with a <b>Running</b> workflow.
175
     *
176
     * <p>Default value if not set: <b>AllowDuplicate</b>
177
     *
178
     * <ul>
179
     *   <li><b>AllowDuplicate</b> allows a new run regardless of the previous run's final status.
180
     *       The previous run still must be closed or the new run will be rejected.
181
     *   <li><b>AllowDuplicateFailedOnly</b> allows a new run if the previous run failed, was
182
     *       canceled, or terminated.
183
     *   <li><b>RejectDuplicate</b> never allows a new run, regardless of the previous run's final
184
     *       status.
185
     *   <li><b>TerminateIfRunning</b> is the same as <b>AllowDuplicate</b>, but if there exists a
186
     *       not-closed run in progress, it will be terminated.
187
     * </ul>
188
     */
189
    public Builder setWorkflowIdReusePolicy(WorkflowIdReusePolicy workflowIdReusePolicy) {
190
      this.workflowIdReusePolicy = workflowIdReusePolicy;
1✔
191
      return this;
1✔
192
    }
193

194
    /**
195
     * Specifies server behavior if a <b>Running</b> workflow with the same id exists. See {@link
196
     * #setWorkflowIdReusePolicy} for handling a workflow id duplication with a <b>Closed</b>
197
     * workflow. Cannot be set when {@link #getWorkflowIdReusePolicy()} is {@link
198
     * WorkflowIdReusePolicy#WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING}.
199
     *
200
     * <ul>
201
     *   <li><b>Fail</b> Don't start a new workflow; instead return {@link
202
     *       WorkflowExecutionAlreadyStarted}
203
     *   <li><b>UseExisting</b> Don't start a new workflow; instead return the handle for the
204
     *       running workflow.
205
     *   <li><b>TerminateExisting</b> Terminate the running workflow before starting a new one.
206
     * </ul>
207
     */
208
    public Builder setWorkflowIdConflictPolicy(WorkflowIdConflictPolicy workflowIdConflictPolicy) {
209
      this.workflowIdConflictPolicy = workflowIdConflictPolicy;
1✔
210
      return this;
1✔
211
    }
212

213
    /**
214
     * The time after which a workflow run is automatically terminated by Temporal service with
215
     * WORKFLOW_EXECUTION_TIMED_OUT status.
216
     *
217
     * <p>When a workflow reaches Workflow Run Timeout, it can't make any progress after that. Do
218
     * not rely on this timeout in workflow implementation or business logic. This timeout is not
219
     * designed to be handled in workflow code to perform any logic in case of timeout. Consider
220
     * using workflow timers instead.
221
     *
222
     * <p>If you catch yourself setting this timeout to very small values, you're likely using it
223
     * wrong.
224
     *
225
     * <p>Example: If Workflow Run Timeout is 30 seconds and the network was unavailable for 1
226
     * minute, workflows that were scheduled before the network blip will never have a chance to
227
     * make progress or react, and will be terminated. <br>
228
     * A timer that is scheduled in the workflow code using {@link Workflow#newTimer(Duration)} will
229
     * handle this situation gracefully. A workflow with such a timer will start after the network
230
     * blip. If it started before the network blip and the timer fires during the network blip, it
231
     * will get delivered after connectivity is restored and the workflow will be able to resume.
232
     */
233
    public Builder setWorkflowRunTimeout(Duration workflowRunTimeout) {
234
      this.workflowRunTimeout = workflowRunTimeout;
1✔
235
      return this;
1✔
236
    }
237

238
    /**
239
     * The time after which workflow execution (which includes run retries and continue as new) is
240
     * automatically terminated by Temporal service with WORKFLOW_EXECUTION_TIMED_OUT status.
241
     *
242
     * <p>When a workflow reaches Workflow Execution Timeout, it can't make any progress after that.
243
     * Do not rely on this timeout in workflow implementation or business logic. This timeout is not
244
     * designed to be handled in workflow code to perform any logic in case of timeout. Consider
245
     * using workflow timers instead.
246
     *
247
     * <p>If you catch yourself setting this timeout to very small values, you're likely using it
248
     * wrong.
249
     *
250
     * <p>Example: If Workflow Execution Timeout is 30 seconds and the network was unavailable for 1
251
     * minute, workflows that were scheduled before the network blip will never have a chance to
252
     * make progress or react, and will be terminated. <br>
253
     * A timer that is scheduled in the workflow code using {@link Workflow#newTimer(Duration)} will
254
     * handle this situation gracefully. A workflow with such a timer will start after the network
255
     * blip. If it started before the network blip and the timer fires during the network blip, it
256
     * will get delivered after connectivity is restored and the workflow will be able to resume.
257
     */
258
    public Builder setWorkflowExecutionTimeout(Duration workflowExecutionTimeout) {
259
      this.workflowExecutionTimeout = workflowExecutionTimeout;
1✔
260
      return this;
1✔
261
    }
262

263
    /**
264
     * Maximum execution time of a single Workflow Task. In the majority of cases there is no need
265
     * to change this timeout. Note that this timeout is not related to the overall Workflow
266
     * duration in any way. It defines for how long the Workflow can get blocked in the case of a
267
     * Workflow Worker crash.
268
     *
269
     * <p>Default is 10 seconds. Maximum value allowed by the Temporal Server is 1 minute.
270
     */
271
    public Builder setWorkflowTaskTimeout(Duration workflowTaskTimeout) {
272
      this.workflowTaskTimeout = workflowTaskTimeout;
1✔
273
      return this;
1✔
274
    }
275

276
    /**
277
     * Task queue to use for workflow tasks. It should match a task queue specified when creating a
278
     * {@link Worker} that hosts the workflow code.
279
     */
280
    public Builder setTaskQueue(String taskQueue) {
281
      this.taskQueue = taskQueue;
1✔
282
      return this;
1✔
283
    }
284

285
    public Builder setRetryOptions(RetryOptions retryOptions) {
286
      this.retryOptions = retryOptions;
1✔
287
      return this;
1✔
288
    }
289

290
    public Builder setCronSchedule(String cronSchedule) {
291
      this.cronSchedule = cronSchedule;
1✔
292
      return this;
1✔
293
    }
294

295
    /**
296
     * Specifies additional non-indexed information in result of list workflow. The type of value
297
     * can be any object that are serializable by {@link io.temporal.common.converter.DataConverter}
298
     */
299
    public Builder setMemo(Map<String, Object> memo) {
300
      this.memo = memo;
1✔
301
      return this;
1✔
302
    }
303

304
    /**
305
     * Specifies Search Attributes map {@code searchAttributes} that will be attached to the
306
     * Workflow. Search Attributes are additional indexed information attributed to workflow and
307
     * used for search and visibility.
308
     *
309
     * <p>The search attributes can be used in query of List/Scan/Count workflow APIs. The key and
310
     * its value type must be registered on Temporal server side.
311
     *
312
     * <p>Supported Java types of the value:
313
     *
314
     * <ul>
315
     *   <li>String
316
     *   <li>Long, Integer, Short, Byte
317
     *   <li>Boolean
318
     *   <li>Double
319
     *   <li>OffsetDateTime
320
     *   <li>{@link Collection} of the types above
321
     * </ul>
322
     *
323
     * @deprecated use {@link #setTypedSearchAttributes} instead.
324
     */
325
    // Workflow#upsertSearchAttributes docs needs to be kept in sync with this method
326
    @Deprecated
327
    public Builder setSearchAttributes(Map<String, ?> searchAttributes) {
328
      if (searchAttributes != null
1✔
329
          && !searchAttributes.isEmpty()
1✔
330
          && this.typedSearchAttributes != null) {
331
        throw new IllegalArgumentException(
×
332
            "Cannot have search attributes and typed search attributes");
333
      }
334
      this.searchAttributes = searchAttributes;
1✔
335
      return this;
1✔
336
    }
337

338
    /**
339
     * Specifies Search Attributes that will be attached to the Workflow. Search Attributes are
340
     * additional indexed information attributed to workflow and used for search and visibility.
341
     *
342
     * <p>The search attributes can be used in query of List/Scan/Count workflow APIs. The key and
343
     * its value type must be registered on Temporal server side.
344
     */
345
    public Builder setTypedSearchAttributes(SearchAttributes typedSearchAttributes) {
346
      if (typedSearchAttributes != null
1✔
347
          && searchAttributes != null
348
          && !searchAttributes.isEmpty()) {
×
349
        throw new IllegalArgumentException(
×
350
            "Cannot have typed search attributes and search attributes");
351
      }
352
      this.typedSearchAttributes = typedSearchAttributes;
1✔
353
      return this;
1✔
354
    }
355

356
    /**
357
     * This list of context propagators overrides the list specified on {@link
358
     * WorkflowClientOptions#getContextPropagators()}. <br>
359
     * This method is uncommon, the majority of users should just set {@link
360
     * WorkflowClientOptions#getContextPropagators()}
361
     *
362
     * @param contextPropagators specifies the list of overriding context propagators, {@code null}
363
     *     means no overriding.
364
     */
365
    public Builder setContextPropagators(@Nullable List<ContextPropagator> contextPropagators) {
366
      this.contextPropagators = contextPropagators;
1✔
367
      return this;
1✔
368
    }
369

370
    /**
371
     * If {@link WorkflowClient} is used to create a {@link WorkerFactory} that is
372
     *
373
     * <ul>
374
     *   <li>started
375
     *   <li>has a non-paused worker on the right task queue
376
     *   <li>has available workflow task executor slots
377
     * </ul>
378
     *
379
     * and such a {@link WorkflowClient} is used to start a workflow, then the first workflow task
380
     * could be dispatched on this local worker with the response to the start call if Server
381
     * supports it. This option can be used to disable this mechanism.
382
     *
383
     * <p>Default is true
384
     *
385
     * <p>WARNING: Eager start does not respect worker versioning. An eagerly started workflow may
386
     * run on any available local worker even if that worker is not in the default build ID set.
387
     *
388
     * @param disableEagerExecution if true, an eager local execution of the workflow task will
389
     *     never be requested even if it is possible.
390
     */
391
    public Builder setDisableEagerExecution(boolean disableEagerExecution) {
392
      this.disableEagerExecution = disableEagerExecution;
1✔
393
      return this;
1✔
394
    }
395

396
    /**
397
     * Time to wait before dispatching the first workflow task. A signal from signal with start will
398
     * not trigger a workflow task. Cannot be set the same time as a CronSchedule.
399
     */
400
    public Builder setStartDelay(Duration startDelay) {
401
      this.startDelay = startDelay;
1✔
402
      return this;
1✔
403
    }
404

405
    /**
406
     * Single-line fixed summary for this workflow execution that will appear in UI/CLI. This can be
407
     * in single-line Temporal Markdown format.
408
     *
409
     * <p>Default is none/empty.
410
     */
411
    @Experimental
412
    public Builder setStaticSummary(String staticSummary) {
413
      this.staticSummary = staticSummary;
1✔
414
      return this;
1✔
415
    }
416

417
    /**
418
     * General fixed details for this workflow execution that will appear in UI/CLI. This can be in
419
     * Temporal Markdown format and can span multiple lines. This is a fixed value on the workflow
420
     * that cannot be updated.
421
     *
422
     * <p>Default is none/empty.
423
     */
424
    @Experimental
425
    public Builder setStaticDetails(String staticDetails) {
426
      this.staticDetails = staticDetails;
1✔
427
      return this;
1✔
428
    }
429

430
    /**
431
     * A unique identifier for this start request.
432
     *
433
     * <p>WARNING: Not intended for User Code.
434
     */
435
    @Experimental
436
    public Builder setRequestId(String requestId) {
437
      this.requestId = requestId;
1✔
438
      return this;
1✔
439
    }
440

441
    /**
442
     * Callbacks to be called by the server when this workflow reaches a terminal state.
443
     *
444
     * <p>WARNING: Not intended for User Code.
445
     */
446
    @Experimental
447
    public Builder setCompletionCallbacks(List<Callback> completionCallbacks) {
448
      this.completionCallbacks = completionCallbacks;
1✔
449
      return this;
1✔
450
    }
451

452
    /**
453
     * Links to be associated with the workflow.
454
     *
455
     * <p>WARNING: Not intended for User Code.
456
     */
457
    @Experimental
458
    public Builder setLinks(List<Link> links) {
459
      this.links = links;
1✔
460
      return this;
1✔
461
    }
462

463
    public WorkflowOptions build() {
464
      return new WorkflowOptions(
1✔
465
          workflowId,
466
          workflowIdReusePolicy,
467
          workflowRunTimeout,
468
          workflowExecutionTimeout,
469
          workflowTaskTimeout,
470
          taskQueue,
471
          retryOptions,
472
          cronSchedule,
473
          memo,
474
          searchAttributes,
475
          typedSearchAttributes,
476
          contextPropagators,
477
          disableEagerExecution,
478
          startDelay,
479
          workflowIdConflictPolicy,
480
          staticSummary,
481
          staticDetails,
482
          requestId,
483
          completionCallbacks,
484
          links);
485
    }
486

487
    /**
488
     * Validates that all required properties are set and fills all other with default parameters.
489
     */
490
    public WorkflowOptions validateBuildWithDefaults() {
491
      return new WorkflowOptions(
1✔
492
          workflowId,
493
          workflowIdReusePolicy,
494
          workflowRunTimeout,
495
          workflowExecutionTimeout,
496
          workflowTaskTimeout,
497
          taskQueue,
498
          retryOptions,
499
          cronSchedule,
500
          memo,
501
          searchAttributes,
502
          typedSearchAttributes,
503
          contextPropagators,
504
          disableEagerExecution,
505
          startDelay,
506
          workflowIdConflictPolicy,
507
          staticSummary,
508
          staticDetails,
509
          requestId,
510
          completionCallbacks,
511
          links);
512
    }
513
  }
514

515
  private final String workflowId;
516

517
  private final WorkflowIdReusePolicy workflowIdReusePolicy;
518

519
  private final Duration workflowRunTimeout;
520

521
  private final Duration workflowExecutionTimeout;
522

523
  private final Duration workflowTaskTimeout;
524

525
  private final String taskQueue;
526

527
  private final RetryOptions retryOptions;
528

529
  private final String cronSchedule;
530

531
  private final Map<String, Object> memo;
532

533
  private final Map<String, ?> searchAttributes;
534

535
  private final SearchAttributes typedSearchAttributes;
536

537
  private final List<ContextPropagator> contextPropagators;
538

539
  private final boolean disableEagerExecution;
540

541
  private final Duration startDelay;
542

543
  private final WorkflowIdConflictPolicy workflowIdConflictPolicy;
544

545
  private final String staticSummary;
546

547
  private final String staticDetails;
548

549
  private final String requestId;
550

551
  private final List<Callback> completionCallbacks;
552

553
  private final List<Link> links;
554

555
  private WorkflowOptions(
556
      String workflowId,
557
      WorkflowIdReusePolicy workflowIdReusePolicy,
558
      Duration workflowRunTimeout,
559
      Duration workflowExecutionTimeout,
560
      Duration workflowTaskTimeout,
561
      String taskQueue,
562
      RetryOptions retryOptions,
563
      String cronSchedule,
564
      Map<String, Object> memo,
565
      Map<String, ?> searchAttributes,
566
      SearchAttributes typedSearchAttributes,
567
      List<ContextPropagator> contextPropagators,
568
      boolean disableEagerExecution,
569
      Duration startDelay,
570
      WorkflowIdConflictPolicy workflowIdConflictPolicy,
571
      String staticSummary,
572
      String staticDetails,
573
      String requestId,
574
      List<Callback> completionCallbacks,
575
      List<Link> links) {
1✔
576
    this.workflowId = workflowId;
1✔
577
    this.workflowIdReusePolicy = workflowIdReusePolicy;
1✔
578
    this.workflowRunTimeout = workflowRunTimeout;
1✔
579
    this.workflowExecutionTimeout = workflowExecutionTimeout;
1✔
580
    this.workflowTaskTimeout = workflowTaskTimeout;
1✔
581
    this.taskQueue = taskQueue;
1✔
582
    this.retryOptions = retryOptions;
1✔
583
    this.cronSchedule = cronSchedule;
1✔
584
    this.memo = memo;
1✔
585
    this.searchAttributes = searchAttributes;
1✔
586
    this.typedSearchAttributes = typedSearchAttributes;
1✔
587
    this.contextPropagators = contextPropagators;
1✔
588
    this.disableEagerExecution = disableEagerExecution;
1✔
589
    this.startDelay = startDelay;
1✔
590
    this.workflowIdConflictPolicy = workflowIdConflictPolicy;
1✔
591
    this.staticSummary = staticSummary;
1✔
592
    this.staticDetails = staticDetails;
1✔
593
    this.requestId = requestId;
1✔
594
    this.completionCallbacks = completionCallbacks;
1✔
595
    this.links = links;
1✔
596
  }
1✔
597

598
  public String getWorkflowId() {
599
    return workflowId;
1✔
600
  }
601

602
  public WorkflowIdReusePolicy getWorkflowIdReusePolicy() {
603
    return workflowIdReusePolicy;
1✔
604
  }
605

606
  public Duration getWorkflowRunTimeout() {
607
    return workflowRunTimeout;
1✔
608
  }
609

610
  public Duration getWorkflowExecutionTimeout() {
611
    return workflowExecutionTimeout;
1✔
612
  }
613

614
  public Duration getWorkflowTaskTimeout() {
615
    return workflowTaskTimeout;
1✔
616
  }
617

618
  public String getTaskQueue() {
619
    return taskQueue;
1✔
620
  }
621

622
  public RetryOptions getRetryOptions() {
623
    return retryOptions;
1✔
624
  }
625

626
  public String getCronSchedule() {
627
    return cronSchedule;
1✔
628
  }
629

630
  public Map<String, Object> getMemo() {
631
    return memo;
1✔
632
  }
633

634
  /**
635
   * @deprecated use {@link #getTypedSearchAttributes} instead.
636
   */
637
  @Deprecated
638
  public Map<String, ?> getSearchAttributes() {
639
    return searchAttributes;
1✔
640
  }
641

642
  public SearchAttributes getTypedSearchAttributes() {
643
    return typedSearchAttributes;
1✔
644
  }
645

646
  /**
647
   * @return the list of context propagators to use during this workflow. This list overrides the
648
   *     list specified on {@link WorkflowClientOptions#getContextPropagators()}, {@code null} means
649
   *     no overriding
650
   */
651
  public @Nullable List<ContextPropagator> getContextPropagators() {
652
    return contextPropagators;
1✔
653
  }
654

655
  public boolean isDisableEagerExecution() {
656
    return disableEagerExecution;
1✔
657
  }
658

659
  public @Nullable Duration getStartDelay() {
660
    return startDelay;
1✔
661
  }
662

663
  public WorkflowIdConflictPolicy getWorkflowIdConflictPolicy() {
664
    return workflowIdConflictPolicy;
1✔
665
  }
666

667
  @Experimental
668
  public String getRequestId() {
669
    return requestId;
1✔
670
  }
671

672
  @Experimental
673
  public @Nullable List<Callback> getCompletionCallbacks() {
674
    return completionCallbacks;
1✔
675
  }
676

677
  @Experimental
678
  public @Nullable List<Link> getLinks() {
679
    return links;
1✔
680
  }
681

682
  @Experimental
683
  public String getStaticSummary() {
684
    return staticSummary;
1✔
685
  }
686

687
  @Experimental
688
  public String getStaticDetails() {
689
    return staticDetails;
1✔
690
  }
691

692
  public Builder toBuilder() {
693
    return new Builder(this);
1✔
694
  }
695

696
  @Override
697
  public boolean equals(Object o) {
698
    if (this == o) return true;
1✔
699
    if (o == null || getClass() != o.getClass()) return false;
1✔
700
    WorkflowOptions that = (WorkflowOptions) o;
1✔
701
    return Objects.equal(workflowId, that.workflowId)
1✔
702
        && workflowIdReusePolicy == that.workflowIdReusePolicy
703
        && Objects.equal(workflowRunTimeout, that.workflowRunTimeout)
1✔
704
        && Objects.equal(workflowExecutionTimeout, that.workflowExecutionTimeout)
1✔
705
        && Objects.equal(workflowTaskTimeout, that.workflowTaskTimeout)
1✔
706
        && Objects.equal(taskQueue, that.taskQueue)
1✔
707
        && Objects.equal(retryOptions, that.retryOptions)
1✔
708
        && Objects.equal(cronSchedule, that.cronSchedule)
1✔
709
        && Objects.equal(memo, that.memo)
1✔
710
        && Objects.equal(searchAttributes, that.searchAttributes)
1✔
711
        && Objects.equal(typedSearchAttributes, that.typedSearchAttributes)
1✔
712
        && Objects.equal(contextPropagators, that.contextPropagators)
1✔
713
        && Objects.equal(disableEagerExecution, that.disableEagerExecution)
1✔
714
        && Objects.equal(startDelay, that.startDelay)
1✔
715
        && Objects.equal(workflowIdConflictPolicy, that.workflowIdConflictPolicy)
1✔
716
        && Objects.equal(staticSummary, that.staticSummary)
1✔
717
        && Objects.equal(staticDetails, that.staticDetails)
1✔
718
        && Objects.equal(requestId, that.requestId)
1✔
719
        && Objects.equal(completionCallbacks, that.completionCallbacks)
1✔
720
        && Objects.equal(links, that.links);
1✔
721
  }
722

723
  @Override
724
  public int hashCode() {
725
    return Objects.hashCode(
×
726
        workflowId,
727
        workflowIdReusePolicy,
728
        workflowRunTimeout,
729
        workflowExecutionTimeout,
730
        workflowTaskTimeout,
731
        taskQueue,
732
        retryOptions,
733
        cronSchedule,
734
        memo,
735
        searchAttributes,
736
        typedSearchAttributes,
737
        contextPropagators,
738
        disableEagerExecution,
×
739
        startDelay,
740
        workflowIdConflictPolicy,
741
        staticSummary,
742
        staticDetails,
743
        requestId,
744
        completionCallbacks,
745
        links);
746
  }
747

748
  @Override
749
  public String toString() {
750
    return "WorkflowOptions{"
×
751
        + "workflowId='"
752
        + workflowId
753
        + '\''
754
        + ", workflowIdReusePolicy="
755
        + workflowIdReusePolicy
756
        + ", workflowRunTimeout="
757
        + workflowRunTimeout
758
        + ", workflowExecutionTimeout="
759
        + workflowExecutionTimeout
760
        + ", workflowTaskTimeout="
761
        + workflowTaskTimeout
762
        + ", taskQueue='"
763
        + taskQueue
764
        + '\''
765
        + ", retryOptions="
766
        + retryOptions
767
        + ", cronSchedule='"
768
        + cronSchedule
769
        + '\''
770
        + ", memo="
771
        + memo
772
        + ", searchAttributes="
773
        + searchAttributes
774
        + ", typedSearchAttributes="
775
        + typedSearchAttributes
776
        + ", contextPropagators="
777
        + contextPropagators
778
        + ", disableEagerExecution="
779
        + disableEagerExecution
780
        + ", startDelay="
781
        + startDelay
782
        + ", workflowIdConflictPolicy="
783
        + workflowIdConflictPolicy
784
        + ", staticSummary="
785
        + staticSummary
786
        + ", staticDetails="
787
        + staticDetails
788
        + ", requestId="
789
        + requestId
790
        + ", completionCallbacks="
791
        + completionCallbacks
792
        + ", links="
793
        + links
794
        + '}';
795
  }
796
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc