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

temporalio / sdk-java / #169

pending completion
#169

push

github-actions

web-flow
Remove use of deprecated API (#1758)

4 of 4 new or added lines in 1 file covered. (100.0%)

17345 of 21558 relevant lines covered (80.46%)

0.8 hits per line

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

97.06
/temporal-sdk/src/main/java/io/temporal/internal/replay/WorkflowTaskResult.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.internal.replay;
22

23
import io.temporal.api.command.v1.Command;
24
import io.temporal.api.protocol.v1.Message;
25
import io.temporal.api.query.v1.WorkflowQueryResult;
26
import java.util.Collections;
27
import java.util.List;
28
import java.util.Map;
29

30
public final class WorkflowTaskResult {
31

32
  public static Builder newBuilder() {
33
    return new Builder();
1✔
34
  }
35

36
  public static final class Builder {
1✔
37
    private List<Command> commands;
38
    private List<Message> messages;
39
    private boolean finalCommand;
40
    private Map<String, WorkflowQueryResult> queryResults;
41
    private boolean forceWorkflowTask;
42
    private int nonfirstLocalActivityAttempts;
43

44
    public Builder setCommands(List<Command> commands) {
45
      this.commands = commands;
1✔
46
      return this;
1✔
47
    }
48

49
    public Builder setMessages(List<Message> messages) {
50
      this.messages = messages;
1✔
51
      return this;
1✔
52
    }
53

54
    public Builder setFinalCommand(boolean finalCommand) {
55
      this.finalCommand = finalCommand;
1✔
56
      return this;
1✔
57
    }
58

59
    public Builder setQueryResults(Map<String, WorkflowQueryResult> queryResults) {
60
      this.queryResults = queryResults;
1✔
61
      return this;
1✔
62
    }
63

64
    public Builder setForceWorkflowTask(boolean forceWorkflowTask) {
65
      this.forceWorkflowTask = forceWorkflowTask;
1✔
66
      return this;
1✔
67
    }
68

69
    public Builder setNonfirstLocalActivityAttempts(int nonfirstLocalActivityAttempts) {
70
      this.nonfirstLocalActivityAttempts = nonfirstLocalActivityAttempts;
1✔
71
      return this;
1✔
72
    }
73

74
    public WorkflowTaskResult build() {
75
      return new WorkflowTaskResult(
1✔
76
          commands == null ? Collections.emptyList() : commands,
1✔
77
          messages == null ? Collections.emptyList() : messages,
1✔
78
          queryResults == null ? Collections.emptyMap() : queryResults,
1✔
79
          finalCommand,
80
          forceWorkflowTask,
81
          nonfirstLocalActivityAttempts);
82
    }
83
  }
84

85
  private final List<Command> commands;
86
  private final List<Message> messages;
87
  private final boolean finalCommand;
88
  private final Map<String, WorkflowQueryResult> queryResults;
89
  private final boolean forceWorkflowTask;
90
  private final int nonfirstLocalActivityAttempts;
91

92
  private WorkflowTaskResult(
93
      List<Command> commands,
94
      List<Message> messages,
95
      Map<String, WorkflowQueryResult> queryResults,
96
      boolean finalCommand,
97
      boolean forceWorkflowTask,
98
      int nonfirstLocalActivityAttempts) {
1✔
99
    this.commands = commands;
1✔
100
    this.messages = messages;
1✔
101
    this.nonfirstLocalActivityAttempts = nonfirstLocalActivityAttempts;
1✔
102
    if (forceWorkflowTask && finalCommand) {
1✔
103
      throw new IllegalArgumentException("both forceWorkflowTask and finalCommand are true");
×
104
    }
105
    this.queryResults = queryResults;
1✔
106
    this.finalCommand = finalCommand;
1✔
107
    this.forceWorkflowTask = forceWorkflowTask;
1✔
108
  }
1✔
109

110
  public List<Command> getCommands() {
111
    return commands;
1✔
112
  }
113

114
  public List<Message> getMessages() {
115
    return messages;
1✔
116
  }
117

118
  public Map<String, WorkflowQueryResult> getQueryResults() {
119
    return queryResults;
1✔
120
  }
121

122
  /** Is this result contain a workflow completion command */
123
  public boolean isFinalCommand() {
124
    return finalCommand;
1✔
125
  }
126

127
  public boolean isForceWorkflowTask() {
128
    return forceWorkflowTask;
1✔
129
  }
130

131
  public int getNonfirstLocalActivityAttempts() {
132
    return nonfirstLocalActivityAttempts;
1✔
133
  }
134
}
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