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

temporalio / sdk-java / #431

18 Nov 2026 09:28PM UTC coverage: 71.813% (+0.01%) from 71.8%
#431

push

github

web-flow
Include inherited fields in service stub options toString (#3152)

* Include inherited fields in service stub options toString

WorkflowServiceStubsOptions.toString rendered only the five fields
declared on the subclass, silently dropping every field inherited from
ServiceStubsOptions. Target, TLS settings, timeouts, and headers were
absent from the output, which is exactly the connection information
wanted when diagnosing a client from logs.

OperatorServiceStubsOptions and CloudServiceStubsOptions had no
toString at all and fell back to Object.toString, logging as an
unreadable identity hash.

Extract the field rendering on ServiceStubsOptions into a
package-private toStringFields helper and have each subclass inline it
alongside its own fields. The helper is package-private because all
four classes live in io.temporal.serviceclient, so this adds no public
API surface.

Also include apiKeyProvided, which already participates in equals and
hashCode but was omitted from toString. The API key itself is held by a
metadata provider and is still never rendered.

Fixes #2148.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Render header names instead of header values in toString

Metadata.toString renders header values in the clear. The previous
commit propagated the inherited headers field into
WorkflowServiceStubsOptions, OperatorServiceStubsOptions, and
CloudServiceStubsOptions, which would have newly exposed any credential
supplied through setHeaders, such as a static Authorization header.

Render the header names only. This keeps the diagnostic signal that
matters when reading the output, whether a header is configured and
which ones, without printing what they contain.

Also add a regression test for the missing separator before
congestionInitialInterval in RpcRetryOptions.toString.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Add changelog entry for service stub options toString

Co-Authored-By: Claude Opus 5.5 <noreply@anthro... (continued)

8779 of 14371 branches covered (61.09%)

Branch coverage included in aggregate %.

5 of 6 new or added lines in 4 files covered. (83.33%)

892 existing lines in 36 files now uncovered.

34625 of 46069 relevant lines covered (75.16%)

0.75 hits per line

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

85.91
/temporal-sdk/src/main/java/io/temporal/workflow/ChildWorkflowOptions.java
1
package io.temporal.workflow;
2

3
import static io.temporal.internal.common.OptionsUtils.roundUpToSeconds;
4

5
import com.google.common.base.Objects;
6
import io.temporal.api.enums.v1.ParentClosePolicy;
7
import io.temporal.api.enums.v1.WorkflowIdReusePolicy;
8
import io.temporal.common.*;
9
import io.temporal.common.context.ContextPropagator;
10
import io.temporal.failure.CanceledFailure;
11
import io.temporal.failure.ChildWorkflowFailure;
12
import io.temporal.failure.TimeoutFailure;
13
import io.temporal.internal.common.OptionsUtils;
14
import java.time.Duration;
15
import java.util.ArrayList;
16
import java.util.Collections;
17
import java.util.List;
18
import java.util.Map;
19

20
public final class ChildWorkflowOptions {
21

22
  public static Builder newBuilder() {
23
    return new Builder();
1 ✔
24
  }
25

26
  public static Builder newBuilder(ChildWorkflowOptions options) {
27
    return new Builder(options);
1 ✔
28
  }
29

30
  public static ChildWorkflowOptions getDefaultInstance() {
UNCOV
31
    return DEFAULT_INSTANCE;
×
32
  }
33

34
  private static final ChildWorkflowOptions DEFAULT_INSTANCE;
35

36
  static {
37
    DEFAULT_INSTANCE = ChildWorkflowOptions.newBuilder().build();
1 ✔
38
  }
1 ✔
39

40
  public static final class Builder {
41

42
    private String namespace;
43
    private String workflowId;
44
    private WorkflowIdReusePolicy workflowIdReusePolicy;
45
    private Duration workflowRunTimeout;
46
    private Duration workflowExecutionTimeout;
47
    private Duration workflowTaskTimeout;
48
    private String taskQueue;
49
    private RetryOptions retryOptions;
50
    private String cronSchedule;
51
    private ParentClosePolicy parentClosePolicy;
52
    private Map<String, Object> memo;
53
    private Map<String, Object> searchAttributes;
54
    private SearchAttributes typedSearchAttributes;
55
    private List<ContextPropagator> contextPropagators;
56
    private ChildWorkflowCancellationType cancellationType;
57

58
    @SuppressWarnings("deprecation")
59
    private VersioningIntent versioningIntent;
60

61
    private String staticSummary;
62
    private String staticDetails;
63
    private List<EventGroup> eventGroups;
64
    private Priority priority;
65
    private VersioningOverride versioningOverride;
66

67
    private Builder() {}
68

69
    @SuppressWarnings("deprecation")
70
    private Builder(ChildWorkflowOptions options) {
1 ✔
71
      if (options == null) {
1 ✔
72
        return;
1 ✔
73
      }
74
      this.namespace = options.getNamespace();
1 ✔
75
      this.workflowId = options.getWorkflowId();
1 ✔
76
      this.workflowIdReusePolicy = options.getWorkflowIdReusePolicy();
1 ✔
77
      this.workflowRunTimeout = options.getWorkflowRunTimeout();
1 ✔
78
      this.workflowExecutionTimeout = options.getWorkflowExecutionTimeout();
1 ✔
79
      this.workflowTaskTimeout = options.getWorkflowTaskTimeout();
1 ✔
80
      this.taskQueue = options.getTaskQueue();
1 ✔
81
      this.retryOptions = options.getRetryOptions();
1 ✔
82
      this.cronSchedule = options.getCronSchedule();
1 ✔
83
      this.parentClosePolicy = options.getParentClosePolicy();
1 ✔
84
      this.memo = options.getMemo();
1 ✔
85
      this.searchAttributes = options.getSearchAttributes();
1 ✔
86
      this.typedSearchAttributes = options.getTypedSearchAttributes();
1 ✔
87
      this.contextPropagators = options.getContextPropagators();
1 ✔
88
      this.cancellationType = options.getCancellationType();
1 ✔
89
      this.versioningIntent = options.getVersioningIntent();
1 ✔
90
      this.staticSummary = options.getStaticSummary();
1 ✔
91
      this.staticDetails = options.getStaticDetails();
1 ✔
92
      if (!options.eventGroups.isEmpty()) {
1 ✔
93
        this.eventGroups = new ArrayList<>(options.eventGroups);
1 ✔
94
      }
95
      this.priority = options.getPriority();
1 ✔
96
      this.versioningOverride = options.getVersioningOverride();
1 ✔
97
    }
1 ✔
98

99
    /**
100
     * Specify namespace in which workflow should be started.
101
     *
102
     * <p>TODO: Resolve conflict with WorkflowClient namespace.
103
     *
104
     * @deprecated Cross-namespace child workflow execution is disabled by default in Temporal
105
     *     Server since version 1.30.1 (via {@code system.enableCrossNamespaceCommands} dynamic
106
     *     config flag). Setting this option will fail unless that flag is explicitly re-enabled on
107
     *     the server. This field may be removed at some point in the future.
108
     */
109
    @Deprecated
110
    public Builder setNamespace(String namespace) {
111
      this.namespace = namespace;
1 ✔
112
      return this;
1 ✔
113
    }
114

115
    /**
116
     * Workflow id to use when starting. If not specified a UUID is generated. Note that it is
117
     * dangerous as in case of client side retries no deduplication will happen based on the
118
     * generated id. So prefer assigning business meaningful ids if possible.
119
     */
120
    public Builder setWorkflowId(String workflowId) {
121
      this.workflowId = workflowId;
1 ✔
122
      return this;
1 ✔
123
    }
124

125
    /**
126
     * Specifies server behavior if a completed workflow with the same id exists. Note that under no
127
     * conditions Temporal allows two workflows with the same namespace and workflow id run
128
     * simultaneously.
129
     *
130
     * <ul>
131
     *   <li>AllowDuplicate is the default value. It allows new run independently of the previous
132
     *       run closure status.
133
     *   <li>AllowDuplicateFailedOnly means that workflow can start if previous run failed or was
134
     *       canceled or terminated.
135
     *   <li>RejectDuplicate doesn't allow new run independently of the previous run closure status.
136
     * </ul>
137
     */
138
    public Builder setWorkflowIdReusePolicy(WorkflowIdReusePolicy workflowIdReusePolicy) {
139
      this.workflowIdReusePolicy = workflowIdReusePolicy;
1 ✔
140
      return this;
1 ✔
141
    }
142

143
    /**
144
     * The time after which child workflow run is automatically terminated by Temporal service with
145
     * CHILD_WORKFLOW_EXECUTION_TIMED_OUT status. <br>
146
     * Parent workflow receives {@link ChildWorkflowFailure} exception with {@link TimeoutFailure}
147
     * cause from the child's {@link Promise} if this happens.
148
     *
149
     * <p>When a workflow reaches Workflow Run Timeout, it can't make any progress after that. Do
150
     * not rely on this timeout in workflow implementation or business logic. This timeout is not
151
     * designed to be handled in workflow code to perform any logic in case of timeout. Consider
152
     * using workflow timers instead.
153
     *
154
     * <p>If you catch yourself setting this timeout to very small values, you're likely using it
155
     * wrong.
156
     *
157
     * <p>Example: If Workflow Run Timeout is 30 seconds and the network was unavailable for 1
158
     * minute, workflows that were scheduled before the network blip will never have a chance to
159
     * make progress or react, and will be terminated. <br>
160
     * A timer that is scheduled in the workflow code using {@link Workflow#newTimer(Duration)} will
161
     * handle this situation gracefully. A workflow with such a timer will start after the network
162
     * blip. If it started before the network blip and the timer fires during the network blip, it
163
     * will get delivered after connectivity is restored and the workflow will be able to resume.
164
     */
165
    public Builder setWorkflowRunTimeout(Duration workflowRunTimeout) {
166
      this.workflowRunTimeout = workflowRunTimeout;
1 ✔
167
      return this;
1 ✔
168
    }
169

170
    /**
171
     * The time after which child workflow execution (which includes run retries and continue as
172
     * new) is automatically terminated by Temporal service with WORKFLOW_EXECUTION_TIMED_OUT
173
     * status. <br>
174
     * Parent workflow receives {@link ChildWorkflowFailure} exception with {@link TimeoutFailure}
175
     * cause from the child's {@link Promise} if this happens.
176
     *
177
     * <p>When a workflow reaches Workflow Execution Timeout, it can't make any progress after that.
178
     * Do not rely on this timeout in workflow implementation or business logic. This timeout is not
179
     * designed to be handled in workflow code to perform any logic in case of timeout. Consider
180
     * using workflow timers instead.
181
     *
182
     * <p>If you catch yourself setting this timeout to very small values, you're likely using it
183
     * wrong.
184
     *
185
     * <p>Example: If Workflow Execution Timeout is 30 seconds and the network was unavailable for 1
186
     * minute, workflows that were scheduled before the network blip will never have a chance to
187
     * make progress or react, and will be terminated. <br>
188
     * A timer that is scheduled in the workflow code using {@link Workflow#newTimer(Duration)} will
189
     * handle this situation gracefully. A workflow with such a timer will start after the network
190
     * blip. If it started before the network blip and the timer fires during the network blip, it
191
     * will get delivered after connectivity is restored and the workflow will be able to resume.
192
     */
193
    public Builder setWorkflowExecutionTimeout(Duration workflowExecutionTimeout) {
194
      this.workflowExecutionTimeout = workflowExecutionTimeout;
1 ✔
195
      return this;
1 ✔
196
    }
197

198
    /**
199
     * Maximum execution time of a single workflow task. Default is 10 seconds. Maximum accepted
200
     * value is 120 seconds.
201
     */
202
    public Builder setWorkflowTaskTimeout(Duration workflowTaskTimeout) {
203
      if (roundUpToSeconds(workflowTaskTimeout) > 120) {
1 !
UNCOV
204
        throw new IllegalArgumentException(
×
205
            "WorkflowTaskTimeout over two minutes: " + workflowTaskTimeout);
206
      }
207
      this.workflowTaskTimeout = workflowTaskTimeout;
1 ✔
208
      return this;
1 ✔
209
    }
210

211
    /**
212
     * Task queue to use for workflow tasks. It should match a task queue specified when creating a
213
     * {@link io.temporal.worker.Worker} that hosts the workflow code.
214
     */
215
    public Builder setTaskQueue(String taskQueue) {
216
      this.taskQueue = taskQueue;
1 ✔
217
      return this;
1 ✔
218
    }
219

220
    /**
221
     * RetryOptions that define how child workflow is retried in case of failure. Default is null
222
     * which is no reties.
223
     */
224
    public Builder setRetryOptions(RetryOptions retryOptions) {
225
      this.retryOptions = retryOptions;
1 ✔
226
      return this;
1 ✔
227
    }
228

229
    public Builder setCronSchedule(String cronSchedule) {
230
      this.cronSchedule = cronSchedule;
1 ✔
231
      return this;
1 ✔
232
    }
233

234
    /** Specifies how this workflow reacts to the death of the parent workflow. */
235
    public Builder setParentClosePolicy(ParentClosePolicy parentClosePolicy) {
236
      this.parentClosePolicy = parentClosePolicy;
1 ✔
237
      return this;
1 ✔
238
    }
239

240
    /** Specifies additional non-indexed information in result of list workflow. */
241
    public Builder setMemo(Map<String, Object> memo) {
242
      this.memo = memo;
1 ✔
243
      return this;
1 ✔
244
    }
245

246
    /**
247
     * Specifies additional indexed information in result of list workflow.
248
     *
249
     * @deprecated use {@link #setTypedSearchAttributes} instead.
250
     */
251
    @Deprecated
252
    public Builder setSearchAttributes(Map<String, Object> searchAttributes) {
253
      if (searchAttributes != null
1 !
254
          && !searchAttributes.isEmpty()
1 !
255
          && this.typedSearchAttributes != null) {
UNCOV
256
        throw new IllegalArgumentException(
×
257
            "Cannot have search attributes and typed search attributes");
258
      }
259
      this.searchAttributes = searchAttributes;
1 ✔
260
      return this;
1 ✔
261
    }
262

263
    /** Specifies additional indexed information in result of list workflow. */
264
    public Builder setTypedSearchAttributes(SearchAttributes typedSearchAttributes) {
265
      if (typedSearchAttributes != null
1 !
266
          && searchAttributes != null
UNCOV
267
          && !searchAttributes.isEmpty()) {
×
UNCOV
268
        throw new IllegalArgumentException(
×
269
            "Cannot have typed search attributes and search attributes");
270
      }
271
      this.typedSearchAttributes = typedSearchAttributes;
1 ✔
272
      return this;
1 ✔
273
    }
274

275
    /** Specifies the list of context propagators to use during this workflow. */
276
    public Builder setContextPropagators(List<ContextPropagator> contextPropagators) {
277
      this.contextPropagators = contextPropagators;
1 ✔
278
      return this;
1 ✔
279
    }
280

281
    /**
282
     * In case of a child workflow cancellation it fails with a {@link CanceledFailure}. The type
283
     * defines at which point the exception is thrown.
284
     */
285
    public Builder setCancellationType(ChildWorkflowCancellationType cancellationType) {
286
      this.cancellationType = cancellationType;
1 ✔
287
      return this;
1 ✔
288
    }
289

290
    public Builder setMethodRetry(MethodRetry r) {
291
      retryOptions = RetryOptions.merge(r, retryOptions);
1 ✔
292
      return this;
1 ✔
293
    }
294

295
    public Builder setCronSchedule(CronSchedule c) {
296
      String cronAnnotation = c == null ? "" : c.value();
1 ✔
297
      cronSchedule = OptionsUtils.merge(cronAnnotation, cronSchedule, String.class);
1 ✔
298
      return this;
1 ✔
299
    }
300

301
    /**
302
     * Specifies whether this child workflow should run on a worker with a compatible Build Id or
303
     * not. See the variants of {@link VersioningIntent}.
304
     *
305
     * @deprecated Worker Versioning is now deprecated please migrate to the <a
306
     *     href="https://docs.temporal.io/worker-deployments">Worker Deployment API</a>.
307
     */
308
    @Deprecated
309
    public Builder setVersioningIntent(VersioningIntent versioningIntent) {
310
      this.versioningIntent = versioningIntent;
1 ✔
311
      return this;
1 ✔
312
    }
313

314
    /**
315
     * Single-line fixed summary for this workflow execution that will appear in UI/CLI. This can be
316
     * in single-line Temporal Markdown format.
317
     *
318
     * <p>Default is none/empty.
319
     */
320
    public Builder setStaticSummary(String staticSummary) {
321
      this.staticSummary = staticSummary;
1 ✔
322
      return this;
1 ✔
323
    }
324

325
    /**
326
     * General fixed details for this workflow execution that will appear in UI/CLI. This can be in
327
     * Temporal Markdown format and can span multiple lines. This is a fixed value on the workflow
328
     * that cannot be updated.
329
     *
330
     * <p>Default is none/empty.
331
     */
332
    public Builder setStaticDetails(String staticDetails) {
333
      this.staticDetails = staticDetails;
1 ✔
334
      return this;
1 ✔
335
    }
336

337
    /**
338
     * Event Groups to associate with the commands that start and cancel this child workflow. Calls
339
     * accumulate.
340
     *
341
     * @see EventGroup
342
     */
343
    @Experimental
344
    public Builder addEventGroups(EventGroup... eventGroups) {
345
      if (eventGroups.length == 0) return this;
1 !
346
      if (this.eventGroups == null) {
1 !
347
        this.eventGroups = new ArrayList<>(eventGroups.length);
1 ✔
348
      }
349
      for (EventGroup group : eventGroups) {
1 ✔
350
        this.eventGroups.add(java.util.Objects.requireNonNull(group, "eventGroups"));
1 ✔
351
      }
352
      return this;
1 ✔
353
    }
354

355
    /**
356
     * Associates the given Event Groups, in addition to any already added. Calls accumulate.
357
     *
358
     * @see EventGroup
359
     */
360
    @Experimental
361
    public Builder addEventGroups(List<EventGroup> eventGroups) {
UNCOV
362
      return addEventGroups(eventGroups.toArray(new EventGroup[0]));
×
363
    }
364

365
    /**
366
     * Optional priority settings that control relative ordering of task processing when tasks are
367
     * backed up in a queue.
368
     */
369
    public Builder setPriority(Priority priority) {
370
      this.priority = priority;
1 ✔
371
      return this;
1 ✔
372
    }
373

374
    /**
375
     * Sets an explicit versioning override for this child, independently of the parent's
376
     * versioning. If unset, the child normally inherits the parent's effective versioning behavior
377
     * and deployment version, subject to task queue and deployment compatibility.
378
     *
379
     * <p>Supports {@link VersioningOverride.PinnedVersioningOverride}, {@link
380
     * VersioningOverride.AutoUpgradeVersioningOverride}, and {@link
381
     * VersioningOverride.OneTimeVersioningOverride}. If the server rejects the override, the child
382
     * start fails with a {@link ChildWorkflowFailure} caused by {@link
383
     * io.temporal.failure.InvalidVersioningOverrideFailure}.
384
     *
385
     * <p>Requires Temporal Server 1.32.0 or later.
386
     */
387
    @Experimental
388
    public Builder setVersioningOverride(VersioningOverride versioningOverride) {
UNCOV
389
      this.versioningOverride = versioningOverride;
×
UNCOV
390
      return this;
×
391
    }
392

393
    /**
394
     * Merges the provided override options into this builder. Any non-null fields in the override
395
     * will take precedence over the fields in this builder, with the following exceptions:
396
     *
397
     * <ul>
398
     *   <li>{@code contextPropagators} lists are concatenated instead of replaced, matching {@link
399
     *       io.temporal.activity.ActivityOptions.Builder#mergeActivityOptions(
400
     *       io.temporal.activity.ActivityOptions)}.
401
     *   <li>The mutually exclusive {@code searchAttributes} and {@code typedSearchAttributes} are
402
     *       merged as a single logical field: an override that specifies either flavor replaces
403
     *       both, so the merged options never carry both flavors at once.
404
     *   <li>A {@code versioningIntent} of {@link VersioningIntent#VERSIONING_INTENT_UNSPECIFIED} is
405
     *       treated as unset.
406
     * </ul>
407
     *
408
     * @param override ChildWorkflowOptions that overrides the current builder values.
409
     * @return this builder.
410
     */
411
    @SuppressWarnings("deprecation")
412
    public Builder mergeChildWorkflowOptions(ChildWorkflowOptions override) {
413
      if (override == null) {
1 ✔
414
        return this;
1 ✔
415
      }
416
      this.namespace = (override.getNamespace() == null) ? this.namespace : override.getNamespace();
1 ✔
417
      this.workflowId =
1 ✔
418
          (override.getWorkflowId() == null) ? this.workflowId : override.getWorkflowId();
1 ✔
419
      this.workflowIdReusePolicy =
1 ✔
420
          (override.getWorkflowIdReusePolicy() == null)
1 ✔
421
              ? this.workflowIdReusePolicy
1 ✔
422
              : override.getWorkflowIdReusePolicy();
1 ✔
423
      this.workflowRunTimeout =
1 ✔
424
          (override.getWorkflowRunTimeout() == null)
1 ✔
425
              ? this.workflowRunTimeout
1 ✔
426
              : override.getWorkflowRunTimeout();
1 ✔
427
      this.workflowExecutionTimeout =
1 ✔
428
          (override.getWorkflowExecutionTimeout() == null)
1 ✔
429
              ? this.workflowExecutionTimeout
1 ✔
430
              : override.getWorkflowExecutionTimeout();
1 ✔
431
      this.workflowTaskTimeout =
1 ✔
432
          (override.getWorkflowTaskTimeout() == null)
1 ✔
433
              ? this.workflowTaskTimeout
1 ✔
434
              : override.getWorkflowTaskTimeout();
1 ✔
435
      this.taskQueue = (override.getTaskQueue() == null) ? this.taskQueue : override.getTaskQueue();
1 ✔
436
      this.retryOptions =
1 ✔
437
          (override.getRetryOptions() == null) ? this.retryOptions : override.getRetryOptions();
1 ✔
438
      this.cronSchedule =
1 ✔
439
          (override.getCronSchedule() == null) ? this.cronSchedule : override.getCronSchedule();
1 ✔
440
      this.parentClosePolicy =
1 ✔
441
          (override.getParentClosePolicy() == null)
1 ✔
442
              ? this.parentClosePolicy
1 ✔
443
              : override.getParentClosePolicy();
1 ✔
444
      this.memo = (override.getMemo() == null) ? this.memo : override.getMemo();
1 ✔
445
      // searchAttributes and typedSearchAttributes are mutually exclusive (the setters reject
446
      // mixing them), so they are merged as one logical field: an override specifying either
447
      // flavor replaces both, otherwise the merged options could carry both flavors and fail at
448
      // child-scheduling time.
449
      if (override.getSearchAttributes() != null || override.getTypedSearchAttributes() != null) {
1 ✔
450
        this.searchAttributes = override.getSearchAttributes();
1 ✔
451
        this.typedSearchAttributes = override.getTypedSearchAttributes();
1 ✔
452
      }
453
      if (this.contextPropagators == null) {
1 ✔
454
        this.contextPropagators = override.getContextPropagators();
1 ✔
455
      } else if (override.getContextPropagators() != null) {
1 ✔
456
        List<ContextPropagator> mergedPropagators = new ArrayList<>(this.contextPropagators);
1 ✔
457
        mergedPropagators.addAll(override.getContextPropagators());
1 ✔
458
        this.contextPropagators = mergedPropagators;
1 ✔
459
      }
460
      this.cancellationType =
1 ✔
461
          (override.getCancellationType() == null)
1 ✔
462
              ? this.cancellationType
1 ✔
463
              : override.getCancellationType();
1 ✔
464
      if (override.getVersioningIntent() != null
1 ✔
465
          && override.getVersioningIntent() != VersioningIntent.VERSIONING_INTENT_UNSPECIFIED) {
1 ✔
466
        this.versioningIntent = override.getVersioningIntent();
1 ✔
467
      }
468
      this.staticSummary =
1 ✔
469
          (override.getStaticSummary() == null) ? this.staticSummary : override.getStaticSummary();
1 ✔
470
      this.staticDetails =
1 ✔
471
          (override.getStaticDetails() == null) ? this.staticDetails : override.getStaticDetails();
1 ✔
472
      if (!override.eventGroups.isEmpty()) {
1 !
UNCOV
473
        if (this.eventGroups == null) {
×
UNCOV
474
          this.eventGroups = new ArrayList<>(override.eventGroups);
×
475
        } else {
UNCOV
476
          this.eventGroups.addAll(override.eventGroups);
×
477
        }
478
      }
479
      this.priority = (override.getPriority() == null) ? this.priority : override.getPriority();
1 ✔
480
      this.versioningOverride =
1 ✔
481
          (override.getVersioningOverride() == null)
1 !
482
              ? this.versioningOverride
1 ✔
483
              : override.getVersioningOverride();
1 ✔
484
      return this;
1 ✔
485
    }
486

487
    public ChildWorkflowOptions build() {
488
      return new ChildWorkflowOptions(
1 ✔
489
          namespace,
490
          workflowId,
491
          workflowIdReusePolicy,
492
          workflowRunTimeout,
493
          workflowExecutionTimeout,
494
          workflowTaskTimeout,
495
          taskQueue,
496
          retryOptions,
497
          cronSchedule,
498
          parentClosePolicy,
499
          memo,
500
          searchAttributes,
501
          typedSearchAttributes,
502
          contextPropagators,
503
          cancellationType,
504
          versioningIntent,
505
          staticSummary,
506
          staticDetails,
507
          eventGroups,
508
          priority,
509
          versioningOverride);
510
    }
511

512
    @SuppressWarnings("deprecation")
513
    public ChildWorkflowOptions validateAndBuildWithDefaults() {
514
      return new ChildWorkflowOptions(
1 ✔
515
          namespace,
516
          workflowId,
517
          workflowIdReusePolicy,
518
          workflowRunTimeout,
519
          workflowExecutionTimeout,
520
          workflowTaskTimeout,
521
          taskQueue,
522
          retryOptions,
523
          cronSchedule,
524
          parentClosePolicy,
525
          memo,
526
          searchAttributes,
527
          typedSearchAttributes,
528
          contextPropagators,
529
          cancellationType == null
1 ✔
530
              ? ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED
1 ✔
531
              : cancellationType,
1 ✔
532
          versioningIntent == null
1 ✔
533
              ? VersioningIntent.VERSIONING_INTENT_UNSPECIFIED
1 ✔
534
              : versioningIntent,
1 ✔
535
          staticSummary,
536
          staticDetails,
537
          eventGroups,
538
          priority,
539
          versioningOverride);
540
    }
541
  }
542

543
  private final String namespace;
544
  private final String workflowId;
545
  private final WorkflowIdReusePolicy workflowIdReusePolicy;
546
  private final Duration workflowRunTimeout;
547
  private final Duration workflowExecutionTimeout;
548
  private final Duration workflowTaskTimeout;
549
  private final String taskQueue;
550
  private final RetryOptions retryOptions;
551
  private final String cronSchedule;
552
  private final ParentClosePolicy parentClosePolicy;
553
  private final Map<String, Object> memo;
554
  private final Map<String, Object> searchAttributes;
555
  private final SearchAttributes typedSearchAttributes;
556
  private final List<ContextPropagator> contextPropagators;
557
  private final ChildWorkflowCancellationType cancellationType;
558

559
  @SuppressWarnings("deprecation")
560
  private final VersioningIntent versioningIntent;
561

562
  private final String staticSummary;
563
  private final String staticDetails;
564
  private final List<EventGroup> eventGroups;
565
  private final Priority priority;
566
  private final VersioningOverride versioningOverride;
567

568
  private ChildWorkflowOptions(
569
      String namespace,
570
      String workflowId,
571
      WorkflowIdReusePolicy workflowIdReusePolicy,
572
      Duration workflowRunTimeout,
573
      Duration workflowExecutionTimeout,
574
      Duration workflowTaskTimeout,
575
      String taskQueue,
576
      RetryOptions retryOptions,
577
      String cronSchedule,
578
      ParentClosePolicy parentClosePolicy,
579
      Map<String, Object> memo,
580
      Map<String, Object> searchAttributes,
581
      SearchAttributes typedSearchAttributes,
582
      List<ContextPropagator> contextPropagators,
583
      ChildWorkflowCancellationType cancellationType,
584
      @SuppressWarnings("deprecation") VersioningIntent versioningIntent,
585
      String staticSummary,
586
      String staticDetails,
587
      List<EventGroup> eventGroups,
588
      Priority priority,
589
      VersioningOverride versioningOverride) {
1 ✔
590
    this.namespace = namespace;
1 ✔
591
    this.workflowId = workflowId;
1 ✔
592
    this.workflowIdReusePolicy = workflowIdReusePolicy;
1 ✔
593
    this.workflowRunTimeout = workflowRunTimeout;
1 ✔
594
    this.workflowExecutionTimeout = workflowExecutionTimeout;
1 ✔
595
    this.workflowTaskTimeout = workflowTaskTimeout;
1 ✔
596
    this.taskQueue = taskQueue;
1 ✔
597
    this.retryOptions = retryOptions;
1 ✔
598
    this.cronSchedule = cronSchedule;
1 ✔
599
    this.parentClosePolicy = parentClosePolicy;
1 ✔
600
    this.memo = memo;
1 ✔
601
    this.searchAttributes = searchAttributes;
1 ✔
602
    this.typedSearchAttributes = typedSearchAttributes;
1 ✔
603
    this.contextPropagators = contextPropagators;
1 ✔
604
    this.cancellationType = cancellationType;
1 ✔
605
    this.versioningIntent = versioningIntent;
1 ✔
606
    this.staticSummary = staticSummary;
1 ✔
607
    this.staticDetails = staticDetails;
1 ✔
608
    this.eventGroups =
1 ✔
609
        eventGroups == null || eventGroups.isEmpty()
1 !
610
            ? Collections.emptyList()
1 ✔
611
            : Collections.unmodifiableList(new ArrayList<>(eventGroups));
1 ✔
612
    this.priority = priority;
1 ✔
613
    this.versioningOverride = versioningOverride;
1 ✔
614
  }
1 ✔
615

616
  /**
617
   * @deprecated Cross-namespace child workflow execution is disabled by default in Temporal Server
618
   *     since version 1.30.1 (via {@code system.enableCrossNamespaceCommands} dynamic config flag).
619
   *     Setting this option will fail unless that flag is explicitly re-enabled on the server. This
620
   *     field may be removed at some point in the future.
621
   */
622
  @Deprecated
623
  public String getNamespace() {
624
    return namespace;
1 ✔
625
  }
626

627
  public String getWorkflowId() {
628
    return workflowId;
1 ✔
629
  }
630

631
  public WorkflowIdReusePolicy getWorkflowIdReusePolicy() {
632
    return workflowIdReusePolicy;
1 ✔
633
  }
634

635
  public Duration getWorkflowRunTimeout() {
636
    return workflowRunTimeout;
1 ✔
637
  }
638

639
  public Duration getWorkflowExecutionTimeout() {
640
    return workflowExecutionTimeout;
1 ✔
641
  }
642

643
  public Duration getWorkflowTaskTimeout() {
644
    return workflowTaskTimeout;
1 ✔
645
  }
646

647
  public String getTaskQueue() {
648
    return taskQueue;
1 ✔
649
  }
650

651
  public RetryOptions getRetryOptions() {
652
    return retryOptions;
1 ✔
653
  }
654

655
  public String getCronSchedule() {
656
    return cronSchedule;
1 ✔
657
  }
658

659
  public ParentClosePolicy getParentClosePolicy() {
660
    return parentClosePolicy;
1 ✔
661
  }
662

663
  public Map<String, Object> getMemo() {
664
    return memo;
1 ✔
665
  }
666

667
  /**
668
   * @deprecated use {@link #getTypedSearchAttributes} instead.
669
   */
670
  @Deprecated
671
  public Map<String, Object> getSearchAttributes() {
672
    return searchAttributes;
1 ✔
673
  }
674

675
  public SearchAttributes getTypedSearchAttributes() {
676
    return typedSearchAttributes;
1 ✔
677
  }
678

679
  public List<ContextPropagator> getContextPropagators() {
680
    return contextPropagators;
1 ✔
681
  }
682

683
  public ChildWorkflowCancellationType getCancellationType() {
684
    return cancellationType;
1 ✔
685
  }
686

687
  /**
688
   * @deprecated Worker Versioning is now deprecated please migrate to the <a
689
   *     href="https://docs.temporal.io/worker-deployments">Worker Deployment API</a>.
690
   */
691
  @Deprecated
692
  public VersioningIntent getVersioningIntent() {
693
    return versioningIntent;
1 ✔
694
  }
695

696
  public String getStaticSummary() {
697
    return staticSummary;
1 ✔
698
  }
699

700
  public String getStaticDetails() {
701
    return staticDetails;
1 ✔
702
  }
703

704
  /**
705
   * @see Builder#addEventGroups(EventGroup...)
706
   */
707
  @Experimental
708
  public List<EventGroup> getEventGroups() {
709
    return eventGroups;
1 ✔
710
  }
711

712
  public Priority getPriority() {
713
    return priority;
1 ✔
714
  }
715

716
  /**
717
   * Returns the explicit child workflow versioning override, or null if unset.
718
   *
719
   * @see Builder#setVersioningOverride(VersioningOverride)
720
   */
721
  @Experimental
722
  public VersioningOverride getVersioningOverride() {
723
    return versioningOverride;
1 ✔
724
  }
725

726
  public Builder toBuilder() {
727
    return new Builder(this);
1 ✔
728
  }
729

730
  @Override
731
  public boolean equals(Object o) {
732
    if (this == o) return true;
1 ✔
733
    if (o == null || getClass() != o.getClass()) return false;
1 !
734
    ChildWorkflowOptions that = (ChildWorkflowOptions) o;
1 ✔
735
    return Objects.equal(namespace, that.namespace)
1 !
736
        && Objects.equal(workflowId, that.workflowId)
1 !
737
        && workflowIdReusePolicy == that.workflowIdReusePolicy
738
        && Objects.equal(workflowRunTimeout, that.workflowRunTimeout)
1 !
739
        && Objects.equal(workflowExecutionTimeout, that.workflowExecutionTimeout)
1 !
740
        && Objects.equal(workflowTaskTimeout, that.workflowTaskTimeout)
1 !
741
        && Objects.equal(taskQueue, that.taskQueue)
1 !
742
        && Objects.equal(retryOptions, that.retryOptions)
1 !
743
        && Objects.equal(cronSchedule, that.cronSchedule)
1 !
744
        && parentClosePolicy == that.parentClosePolicy
745
        && Objects.equal(memo, that.memo)
1 !
746
        && Objects.equal(searchAttributes, that.searchAttributes)
1 !
747
        && Objects.equal(typedSearchAttributes, that.typedSearchAttributes)
1 !
748
        && Objects.equal(contextPropagators, that.contextPropagators)
1 !
749
        && cancellationType == that.cancellationType
750
        && versioningIntent == that.versioningIntent
751
        && Objects.equal(staticSummary, that.staticSummary)
1 !
752
        && Objects.equal(staticDetails, that.staticDetails)
1 !
753
        && Objects.equal(eventGroups, that.eventGroups)
1 !
754
        && Objects.equal(priority, that.priority)
1 !
755
        && Objects.equal(versioningOverride, that.versioningOverride);
1 !
756
  }
757

758
  @Override
759
  public int hashCode() {
UNCOV
760
    return Objects.hashCode(
×
761
        namespace,
762
        workflowId,
763
        workflowIdReusePolicy,
764
        workflowRunTimeout,
765
        workflowExecutionTimeout,
766
        workflowTaskTimeout,
767
        taskQueue,
768
        retryOptions,
769
        cronSchedule,
770
        parentClosePolicy,
771
        memo,
772
        searchAttributes,
773
        typedSearchAttributes,
774
        contextPropagators,
775
        cancellationType,
776
        versioningIntent,
777
        staticSummary,
778
        staticDetails,
779
        eventGroups,
780
        priority,
781
        versioningOverride);
782
  }
783

784
  @Override
785
  public String toString() {
UNCOV
786
    return "ChildWorkflowOptions{"
×
787
        + "namespace='"
788
        + namespace
789
        + '\''
790
        + ", workflowId='"
791
        + workflowId
792
        + '\''
793
        + ", workflowIdReusePolicy="
794
        + workflowIdReusePolicy
795
        + ", workflowRunTimeout="
796
        + workflowRunTimeout
797
        + ", workflowExecutionTimeout="
798
        + workflowExecutionTimeout
799
        + ", workflowTaskTimeout="
800
        + workflowTaskTimeout
801
        + ", taskQueue='"
802
        + taskQueue
803
        + '\''
804
        + ", retryOptions="
805
        + retryOptions
806
        + ", cronSchedule='"
807
        + cronSchedule
808
        + '\''
809
        + ", parentClosePolicy="
810
        + parentClosePolicy
811
        + ", memo="
812
        + memo
813
        + ", searchAttributes="
814
        + searchAttributes
815
        + ", typedSearchAttributes="
816
        + typedSearchAttributes
817
        + ", contextPropagators="
818
        + contextPropagators
819
        + ", cancellationType="
820
        + cancellationType
821
        + ", versioningIntent="
822
        + versioningIntent
823
        + ", staticSummary="
824
        + staticSummary
825
        + ", staticDetails="
826
        + staticDetails
827
        + ", eventGroups="
828
        + eventGroups
829
        + ", priority="
830
        + priority
831
        + ", versioningOverride="
832
        + versioningOverride
833
        + '}';
834
  }
835
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc