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

uber / cadence-java-client / 2616

06 Nov 2024 07:00PM UTC coverage: 76.181% (-2.0%) from 78.135%
2616

Pull #945

buildkite

shijiesheng
remove unneeded file
Pull Request #945: fix unimplementented methods of TestWorkflowEnvironment

4 of 10 new or added lines in 2 files covered. (40.0%)

414 existing lines in 7 files now uncovered.

14770 of 19388 relevant lines covered (76.18%)

0.76 hits per line

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

98.02
/src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java
1
/*
2
 *  Modifications Copyright (c) 2017-2021 Uber Technologies Inc.
3
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
 *
5
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
6
 *  use this file except in compliance with the License. A copy of the License is
7
 *  located at
8
 *
9
 *  http://aws.amazon.com/apache2.0
10
 *
11
 *  or in the "license" file accompanying this file. This file is distributed on
12
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
 *  express or implied. See the License for the specific language governing
14
 *  permissions and limitations under the License.
15
 */
16
package com.uber.cadence.internal.compatibility.thrift;
17

18
import static com.uber.cadence.EventType.ActivityTaskCancelRequested;
19
import static com.uber.cadence.EventType.ActivityTaskCanceled;
20
import static com.uber.cadence.EventType.ActivityTaskCompleted;
21
import static com.uber.cadence.EventType.ActivityTaskFailed;
22
import static com.uber.cadence.EventType.ActivityTaskScheduled;
23
import static com.uber.cadence.EventType.ActivityTaskStarted;
24
import static com.uber.cadence.EventType.ActivityTaskTimedOut;
25
import static com.uber.cadence.EventType.CancelTimerFailed;
26
import static com.uber.cadence.EventType.ChildWorkflowExecutionCanceled;
27
import static com.uber.cadence.EventType.ChildWorkflowExecutionCompleted;
28
import static com.uber.cadence.EventType.ChildWorkflowExecutionFailed;
29
import static com.uber.cadence.EventType.ChildWorkflowExecutionStarted;
30
import static com.uber.cadence.EventType.ChildWorkflowExecutionTerminated;
31
import static com.uber.cadence.EventType.ChildWorkflowExecutionTimedOut;
32
import static com.uber.cadence.EventType.DecisionTaskCompleted;
33
import static com.uber.cadence.EventType.DecisionTaskFailed;
34
import static com.uber.cadence.EventType.DecisionTaskScheduled;
35
import static com.uber.cadence.EventType.DecisionTaskStarted;
36
import static com.uber.cadence.EventType.DecisionTaskTimedOut;
37
import static com.uber.cadence.EventType.ExternalWorkflowExecutionCancelRequested;
38
import static com.uber.cadence.EventType.ExternalWorkflowExecutionSignaled;
39
import static com.uber.cadence.EventType.MarkerRecorded;
40
import static com.uber.cadence.EventType.RequestCancelActivityTaskFailed;
41
import static com.uber.cadence.EventType.RequestCancelExternalWorkflowExecutionFailed;
42
import static com.uber.cadence.EventType.RequestCancelExternalWorkflowExecutionInitiated;
43
import static com.uber.cadence.EventType.SignalExternalWorkflowExecutionFailed;
44
import static com.uber.cadence.EventType.SignalExternalWorkflowExecutionInitiated;
45
import static com.uber.cadence.EventType.StartChildWorkflowExecutionFailed;
46
import static com.uber.cadence.EventType.StartChildWorkflowExecutionInitiated;
47
import static com.uber.cadence.EventType.TimerCanceled;
48
import static com.uber.cadence.EventType.TimerFired;
49
import static com.uber.cadence.EventType.TimerStarted;
50
import static com.uber.cadence.EventType.UpsertWorkflowSearchAttributes;
51
import static com.uber.cadence.EventType.WorkflowExecutionCancelRequested;
52
import static com.uber.cadence.EventType.WorkflowExecutionCanceled;
53
import static com.uber.cadence.EventType.WorkflowExecutionCompleted;
54
import static com.uber.cadence.EventType.WorkflowExecutionContinuedAsNew;
55
import static com.uber.cadence.EventType.WorkflowExecutionFailed;
56
import static com.uber.cadence.EventType.WorkflowExecutionSignaled;
57
import static com.uber.cadence.EventType.WorkflowExecutionStarted;
58
import static com.uber.cadence.EventType.WorkflowExecutionTerminated;
59
import static com.uber.cadence.EventType.WorkflowExecutionTimedOut;
60
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.cancelExternalWorkflowExecutionFailedCause;
61
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.childWorkflowExecutionFailedCause;
62
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.continueAsNewInitiator;
63
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.decisionTaskFailedCause;
64
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.decisionTaskTimedOutCause;
65
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.parentClosePolicy;
66
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.signalExternalWorkflowExecutionFailedCause;
67
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.timeoutType;
68
import static com.uber.cadence.internal.compatibility.thrift.EnumMapper.workflowIdReusePolicy;
69
import static com.uber.cadence.internal.compatibility.thrift.Helpers.byteStringToArray;
70
import static com.uber.cadence.internal.compatibility.thrift.Helpers.durationToSeconds;
71
import static com.uber.cadence.internal.compatibility.thrift.Helpers.timeToUnixNano;
72
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.activityType;
73
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.externalInitiatedId;
74
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.externalWorkflowExecution;
75
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.failureDetails;
76
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.failureReason;
77
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.header;
78
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.memo;
79
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentDomainName;
80
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentInitiatedId;
81
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.parentWorkflowExecution;
82
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.payload;
83
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.resetPoints;
84
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.retryPolicy;
85
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.searchAttributes;
86
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.taskList;
87
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowExecution;
88
import static com.uber.cadence.internal.compatibility.thrift.TypeMapper.workflowType;
89

90
import com.uber.cadence.ActivityTaskCancelRequestedEventAttributes;
91
import com.uber.cadence.ActivityTaskCanceledEventAttributes;
92
import com.uber.cadence.ActivityTaskCompletedEventAttributes;
93
import com.uber.cadence.ActivityTaskFailedEventAttributes;
94
import com.uber.cadence.ActivityTaskScheduledEventAttributes;
95
import com.uber.cadence.ActivityTaskStartedEventAttributes;
96
import com.uber.cadence.ActivityTaskTimedOutEventAttributes;
97
import com.uber.cadence.CancelTimerFailedEventAttributes;
98
import com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes;
99
import com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes;
100
import com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes;
101
import com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes;
102
import com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes;
103
import com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes;
104
import com.uber.cadence.DecisionTaskCompletedEventAttributes;
105
import com.uber.cadence.DecisionTaskFailedEventAttributes;
106
import com.uber.cadence.DecisionTaskScheduledEventAttributes;
107
import com.uber.cadence.DecisionTaskStartedEventAttributes;
108
import com.uber.cadence.DecisionTaskTimedOutEventAttributes;
109
import com.uber.cadence.ExternalWorkflowExecutionCancelRequestedEventAttributes;
110
import com.uber.cadence.ExternalWorkflowExecutionSignaledEventAttributes;
111
import com.uber.cadence.History;
112
import com.uber.cadence.HistoryEvent;
113
import com.uber.cadence.MarkerRecordedEventAttributes;
114
import com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes;
115
import com.uber.cadence.RequestCancelExternalWorkflowExecutionFailedEventAttributes;
116
import com.uber.cadence.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes;
117
import com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes;
118
import com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes;
119
import com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes;
120
import com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes;
121
import com.uber.cadence.TimerCanceledEventAttributes;
122
import com.uber.cadence.TimerFiredEventAttributes;
123
import com.uber.cadence.TimerStartedEventAttributes;
124
import com.uber.cadence.UpsertWorkflowSearchAttributesEventAttributes;
125
import com.uber.cadence.WorkflowExecutionCancelRequestedEventAttributes;
126
import com.uber.cadence.WorkflowExecutionCanceledEventAttributes;
127
import com.uber.cadence.WorkflowExecutionCompletedEventAttributes;
128
import com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes;
129
import com.uber.cadence.WorkflowExecutionFailedEventAttributes;
130
import com.uber.cadence.WorkflowExecutionSignaledEventAttributes;
131
import com.uber.cadence.WorkflowExecutionStartedEventAttributes;
132
import com.uber.cadence.WorkflowExecutionTerminatedEventAttributes;
133
import com.uber.cadence.WorkflowExecutionTimedOutEventAttributes;
134
import java.util.ArrayList;
135
import java.util.List;
136

137
class HistoryMapper {
×
138

139
  static History history(com.uber.cadence.api.v1.History t) {
UNCOV
140
    if (t == null || t == com.uber.cadence.api.v1.History.getDefaultInstance()) {
×
141
      return null;
×
142
    }
UNCOV
143
    History history = new History();
×
UNCOV
144
    history.setEvents(historyEventArray(t.getEventsList()));
×
UNCOV
145
    return history;
×
146
  }
147

148
  static List<HistoryEvent> historyEventArray(List<com.uber.cadence.api.v1.HistoryEvent> t) {
UNCOV
149
    if (t == null) {
×
150
      return null;
×
151
    }
UNCOV
152
    List<HistoryEvent> v = new ArrayList<>();
×
UNCOV
153
    for (int i = 0; i < t.size(); i++) {
×
UNCOV
154
      v.add(historyEvent(t.get(i)));
×
155
    }
UNCOV
156
    return v;
×
157
  }
158

159
  static HistoryEvent historyEvent(com.uber.cadence.api.v1.HistoryEvent e) {
160
    if (e == null || e == com.uber.cadence.api.v1.HistoryEvent.getDefaultInstance()) {
1✔
161
      return null;
×
162
    }
163
    HistoryEvent event = new HistoryEvent();
1✔
164
    event.setEventId(e.getEventId());
1✔
165
    event.setTimestamp(timeToUnixNano(e.getEventTime()));
1✔
166
    event.setVersion(e.getVersion());
1✔
167
    event.setTaskId(e.getTaskId());
1✔
168

169
    if (e.getWorkflowExecutionStartedEventAttributes()
1✔
170
        != com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes.getDefaultInstance()) {
1✔
171
      event.setEventType(WorkflowExecutionStarted);
1✔
172
      event.setWorkflowExecutionStartedEventAttributes(
1✔
173
          workflowExecutionStartedEventAttributes(e.getWorkflowExecutionStartedEventAttributes()));
1✔
174
    } else if (e.getWorkflowExecutionCompletedEventAttributes()
1✔
175
        != com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes.getDefaultInstance()) {
1✔
176
      event.setEventType(WorkflowExecutionCompleted);
1✔
177
      event.setWorkflowExecutionCompletedEventAttributes(
1✔
178
          workflowExecutionCompletedEventAttributes(
1✔
179
              e.getWorkflowExecutionCompletedEventAttributes()));
1✔
180
    } else if (e.getWorkflowExecutionFailedEventAttributes()
1✔
181
        != com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes.getDefaultInstance()) {
1✔
182
      event.setEventType(WorkflowExecutionFailed);
1✔
183
      event.setWorkflowExecutionFailedEventAttributes(
1✔
184
          workflowExecutionFailedEventAttributes(e.getWorkflowExecutionFailedEventAttributes()));
1✔
185
    } else if (e.getWorkflowExecutionTimedOutEventAttributes()
1✔
186
        != com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes.getDefaultInstance()) {
1✔
187
      event.setEventType(WorkflowExecutionTimedOut);
1✔
188
      event.setWorkflowExecutionTimedOutEventAttributes(
1✔
189
          workflowExecutionTimedOutEventAttributes(
1✔
190
              e.getWorkflowExecutionTimedOutEventAttributes()));
1✔
191
    } else if (e.getDecisionTaskScheduledEventAttributes()
1✔
192
        != com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) {
1✔
193
      event.setEventType(DecisionTaskScheduled);
1✔
194
      event.setDecisionTaskScheduledEventAttributes(
1✔
195
          decisionTaskScheduledEventAttributes(e.getDecisionTaskScheduledEventAttributes()));
1✔
196
    } else if (e.getDecisionTaskStartedEventAttributes()
1✔
197
        != com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) {
1✔
198
      event.setEventType(DecisionTaskStarted);
1✔
199
      event.setDecisionTaskStartedEventAttributes(
1✔
200
          decisionTaskStartedEventAttributes(e.getDecisionTaskStartedEventAttributes()));
1✔
201
    } else if (e.getDecisionTaskCompletedEventAttributes()
1✔
202
        != com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) {
1✔
203
      event.setEventType(DecisionTaskCompleted);
1✔
204
      event.setDecisionTaskCompletedEventAttributes(
1✔
205
          decisionTaskCompletedEventAttributes(e.getDecisionTaskCompletedEventAttributes()));
1✔
206
    } else if (e.getDecisionTaskTimedOutEventAttributes()
1✔
207
        != com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) {
1✔
208
      event.setEventType(DecisionTaskTimedOut);
1✔
209
      event.setDecisionTaskTimedOutEventAttributes(
1✔
210
          decisionTaskTimedOutEventAttributes(e.getDecisionTaskTimedOutEventAttributes()));
1✔
211
    } else if (e.getDecisionTaskFailedEventAttributes()
1✔
212
        != com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) {
1✔
213
      event.setEventType(DecisionTaskFailed);
1✔
214
      event.setDecisionTaskFailedEventAttributes(
1✔
215
          decisionTaskFailedEventAttributes(e.getDecisionTaskFailedEventAttributes()));
1✔
216
    } else if (e.getActivityTaskScheduledEventAttributes()
1✔
217
        != com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) {
1✔
218
      event.setEventType(ActivityTaskScheduled);
1✔
219
      event.setActivityTaskScheduledEventAttributes(
1✔
220
          activityTaskScheduledEventAttributes(e.getActivityTaskScheduledEventAttributes()));
1✔
221
    } else if (e.getActivityTaskStartedEventAttributes()
1✔
222
        != com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) {
1✔
223
      event.setEventType(ActivityTaskStarted);
1✔
224
      event.setActivityTaskStartedEventAttributes(
1✔
225
          activityTaskStartedEventAttributes(e.getActivityTaskStartedEventAttributes()));
1✔
226
    } else if (e.getActivityTaskCompletedEventAttributes()
1✔
227
        != com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) {
1✔
228
      event.setEventType(ActivityTaskCompleted);
1✔
229
      event.setActivityTaskCompletedEventAttributes(
1✔
230
          activityTaskCompletedEventAttributes(e.getActivityTaskCompletedEventAttributes()));
1✔
231
    } else if (e.getActivityTaskFailedEventAttributes()
1✔
232
        != com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) {
1✔
233
      event.setEventType(ActivityTaskFailed);
1✔
234
      event.setActivityTaskFailedEventAttributes(
1✔
235
          activityTaskFailedEventAttributes(e.getActivityTaskFailedEventAttributes()));
1✔
236
    } else if (e.getActivityTaskTimedOutEventAttributes()
1✔
237
        != com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) {
1✔
238
      event.setEventType(ActivityTaskTimedOut);
1✔
239
      event.setActivityTaskTimedOutEventAttributes(
1✔
240
          activityTaskTimedOutEventAttributes(e.getActivityTaskTimedOutEventAttributes()));
1✔
241
    } else if (e.getTimerStartedEventAttributes()
1✔
242
        != com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) {
1✔
243
      event.setEventType(TimerStarted);
1✔
244
      event.setTimerStartedEventAttributes(
1✔
245
          timerStartedEventAttributes(e.getTimerStartedEventAttributes()));
1✔
246
    } else if (e.getTimerFiredEventAttributes()
1✔
247
        != com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) {
1✔
248
      event.setEventType(TimerFired);
1✔
249
      event.setTimerFiredEventAttributes(
1✔
250
          timerFiredEventAttributes(e.getTimerFiredEventAttributes()));
1✔
251
    } else if (e.getActivityTaskCancelRequestedEventAttributes()
1✔
252
        != com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes
253
            .getDefaultInstance()) {
1✔
254
      event.setEventType(ActivityTaskCancelRequested);
1✔
255
      event.setActivityTaskCancelRequestedEventAttributes(
1✔
256
          activityTaskCancelRequestedEventAttributes(
1✔
257
              e.getActivityTaskCancelRequestedEventAttributes()));
1✔
258
    } else if (e.getRequestCancelActivityTaskFailedEventAttributes()
1✔
259
        != com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes
260
            .getDefaultInstance()) {
1✔
261
      event.setEventType(RequestCancelActivityTaskFailed);
1✔
262
      event.setRequestCancelActivityTaskFailedEventAttributes(
1✔
263
          requestCancelActivityTaskFailedEventAttributes(
1✔
264
              e.getRequestCancelActivityTaskFailedEventAttributes()));
1✔
265
    } else if (e.getActivityTaskCanceledEventAttributes()
1✔
266
        != com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) {
1✔
267
      event.setEventType(ActivityTaskCanceled);
1✔
268
      event.setActivityTaskCanceledEventAttributes(
1✔
269
          activityTaskCanceledEventAttributes(e.getActivityTaskCanceledEventAttributes()));
1✔
270
    } else if (e.getTimerCanceledEventAttributes()
1✔
271
        != com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) {
1✔
272
      event.setEventType(TimerCanceled);
1✔
273
      event.setTimerCanceledEventAttributes(
1✔
274
          timerCanceledEventAttributes(e.getTimerCanceledEventAttributes()));
1✔
275
    } else if (e.getCancelTimerFailedEventAttributes()
1✔
276
        != com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) {
1✔
277
      event.setEventType(CancelTimerFailed);
1✔
278
      event.setCancelTimerFailedEventAttributes(
1✔
279
          cancelTimerFailedEventAttributes(e.getCancelTimerFailedEventAttributes()));
1✔
280
    } else if (e.getMarkerRecordedEventAttributes()
1✔
281
        != com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) {
1✔
282
      event.setEventType(MarkerRecorded);
1✔
283
      event.setMarkerRecordedEventAttributes(
1✔
284
          markerRecordedEventAttributes(e.getMarkerRecordedEventAttributes()));
1✔
285
    } else if (e.getWorkflowExecutionSignaledEventAttributes()
1✔
286
        != com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes.getDefaultInstance()) {
1✔
287
      event.setEventType(WorkflowExecutionSignaled);
1✔
288
      event.setWorkflowExecutionSignaledEventAttributes(
1✔
289
          workflowExecutionSignaledEventAttributes(
1✔
290
              e.getWorkflowExecutionSignaledEventAttributes()));
1✔
291
    } else if (e.getWorkflowExecutionTerminatedEventAttributes()
1✔
292
        != com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes
293
            .getDefaultInstance()) {
1✔
294
      event.setEventType(WorkflowExecutionTerminated);
1✔
295
      event.setWorkflowExecutionTerminatedEventAttributes(
1✔
296
          workflowExecutionTerminatedEventAttributes(
1✔
297
              e.getWorkflowExecutionTerminatedEventAttributes()));
1✔
298
    } else if (e.getWorkflowExecutionCancelRequestedEventAttributes()
1✔
299
        != com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes
300
            .getDefaultInstance()) {
1✔
301
      event.setEventType(WorkflowExecutionCancelRequested);
1✔
302
      event.setWorkflowExecutionCancelRequestedEventAttributes(
1✔
303
          workflowExecutionCancelRequestedEventAttributes(
1✔
304
              e.getWorkflowExecutionCancelRequestedEventAttributes()));
1✔
305
    } else if (e.getWorkflowExecutionCanceledEventAttributes()
1✔
306
        != com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes.getDefaultInstance()) {
1✔
307
      event.setEventType(WorkflowExecutionCanceled);
1✔
308
      event.setWorkflowExecutionCanceledEventAttributes(
1✔
309
          workflowExecutionCanceledEventAttributes(
1✔
310
              e.getWorkflowExecutionCanceledEventAttributes()));
1✔
311
    } else if (e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes()
1✔
312
        != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes
313
            .getDefaultInstance()) {
1✔
314
      event.setEventType(RequestCancelExternalWorkflowExecutionInitiated);
1✔
315
      event.setRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(
1✔
316
          requestCancelExternalWorkflowExecutionInitiatedEventAttributes(
1✔
317
              e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes()));
1✔
318
    } else if (e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes()
1✔
319
        != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes
320
            .getDefaultInstance()) {
1✔
321
      event.setEventType(RequestCancelExternalWorkflowExecutionFailed);
1✔
322
      event.setRequestCancelExternalWorkflowExecutionFailedEventAttributes(
1✔
323
          requestCancelExternalWorkflowExecutionFailedEventAttributes(
1✔
324
              e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes()));
1✔
325
    } else if (e.getExternalWorkflowExecutionCancelRequestedEventAttributes()
1✔
326
        != com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes
327
            .getDefaultInstance()) {
1✔
328
      event.setEventType(ExternalWorkflowExecutionCancelRequested);
1✔
329
      event.setExternalWorkflowExecutionCancelRequestedEventAttributes(
1✔
330
          externalWorkflowExecutionCancelRequestedEventAttributes(
1✔
331
              e.getExternalWorkflowExecutionCancelRequestedEventAttributes()));
1✔
332
    } else if (e.getWorkflowExecutionContinuedAsNewEventAttributes()
1✔
333
        != com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes
334
            .getDefaultInstance()) {
1✔
335
      event.setEventType(WorkflowExecutionContinuedAsNew);
1✔
336
      event.setWorkflowExecutionContinuedAsNewEventAttributes(
1✔
337
          workflowExecutionContinuedAsNewEventAttributes(
1✔
338
              e.getWorkflowExecutionContinuedAsNewEventAttributes()));
1✔
339
    } else if (e.getStartChildWorkflowExecutionInitiatedEventAttributes()
1✔
340
        != com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes
341
            .getDefaultInstance()) {
1✔
342
      event.setEventType(StartChildWorkflowExecutionInitiated);
1✔
343
      event.setStartChildWorkflowExecutionInitiatedEventAttributes(
1✔
344
          startChildWorkflowExecutionInitiatedEventAttributes(
1✔
345
              e.getStartChildWorkflowExecutionInitiatedEventAttributes()));
1✔
346
    } else if (e.getStartChildWorkflowExecutionFailedEventAttributes()
1✔
347
        != com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes
348
            .getDefaultInstance()) {
1✔
349
      event.setEventType(StartChildWorkflowExecutionFailed);
1✔
350
      event.setStartChildWorkflowExecutionFailedEventAttributes(
1✔
351
          startChildWorkflowExecutionFailedEventAttributes(
1✔
352
              e.getStartChildWorkflowExecutionFailedEventAttributes()));
1✔
353
    } else if (e.getChildWorkflowExecutionStartedEventAttributes()
1✔
354
        != com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes
355
            .getDefaultInstance()) {
1✔
356
      event.setEventType(ChildWorkflowExecutionStarted);
1✔
357
      event.setChildWorkflowExecutionStartedEventAttributes(
1✔
358
          childWorkflowExecutionStartedEventAttributes(
1✔
359
              e.getChildWorkflowExecutionStartedEventAttributes()));
1✔
360
    } else if (e.getChildWorkflowExecutionCompletedEventAttributes()
1✔
361
        != com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes
362
            .getDefaultInstance()) {
1✔
363
      event.setEventType(ChildWorkflowExecutionCompleted);
1✔
364
      event.setChildWorkflowExecutionCompletedEventAttributes(
1✔
365
          childWorkflowExecutionCompletedEventAttributes(
1✔
366
              e.getChildWorkflowExecutionCompletedEventAttributes()));
1✔
367
    } else if (e.getChildWorkflowExecutionFailedEventAttributes()
1✔
368
        != com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes
369
            .getDefaultInstance()) {
1✔
370
      event.setEventType(ChildWorkflowExecutionFailed);
1✔
371
      event.setChildWorkflowExecutionFailedEventAttributes(
1✔
372
          childWorkflowExecutionFailedEventAttributes(
1✔
373
              e.getChildWorkflowExecutionFailedEventAttributes()));
1✔
374
    } else if (e.getChildWorkflowExecutionCanceledEventAttributes()
1✔
375
        != com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes
376
            .getDefaultInstance()) {
1✔
377
      event.setEventType(ChildWorkflowExecutionCanceled);
1✔
378
      event.setChildWorkflowExecutionCanceledEventAttributes(
1✔
379
          childWorkflowExecutionCanceledEventAttributes(
1✔
380
              e.getChildWorkflowExecutionCanceledEventAttributes()));
1✔
381
    } else if (e.getChildWorkflowExecutionTimedOutEventAttributes()
1✔
382
        != com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes
383
            .getDefaultInstance()) {
1✔
384
      event.setEventType(ChildWorkflowExecutionTimedOut);
1✔
385
      event.setChildWorkflowExecutionTimedOutEventAttributes(
1✔
386
          childWorkflowExecutionTimedOutEventAttributes(
1✔
387
              e.getChildWorkflowExecutionTimedOutEventAttributes()));
1✔
388
    } else if (e.getChildWorkflowExecutionTerminatedEventAttributes()
1✔
389
        != com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes
390
            .getDefaultInstance()) {
1✔
391
      event.setEventType(ChildWorkflowExecutionTerminated);
1✔
392
      event.setChildWorkflowExecutionTerminatedEventAttributes(
1✔
393
          childWorkflowExecutionTerminatedEventAttributes(
1✔
394
              e.getChildWorkflowExecutionTerminatedEventAttributes()));
1✔
395
    } else if (e.getSignalExternalWorkflowExecutionInitiatedEventAttributes()
1✔
396
        != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes
397
            .getDefaultInstance()) {
1✔
398
      event.setEventType(SignalExternalWorkflowExecutionInitiated);
1✔
399
      event.setSignalExternalWorkflowExecutionInitiatedEventAttributes(
1✔
400
          signalExternalWorkflowExecutionInitiatedEventAttributes(
1✔
401
              e.getSignalExternalWorkflowExecutionInitiatedEventAttributes()));
1✔
402
    } else if (e.getSignalExternalWorkflowExecutionFailedEventAttributes()
1✔
403
        != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes
404
            .getDefaultInstance()) {
1✔
405
      event.setEventType(SignalExternalWorkflowExecutionFailed);
1✔
406
      event.setSignalExternalWorkflowExecutionFailedEventAttributes(
1✔
407
          signalExternalWorkflowExecutionFailedEventAttributes(
1✔
408
              e.getSignalExternalWorkflowExecutionFailedEventAttributes()));
1✔
409
    } else if (e.getExternalWorkflowExecutionSignaledEventAttributes()
1✔
410
        != com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes
411
            .getDefaultInstance()) {
1✔
412
      event.setEventType(ExternalWorkflowExecutionSignaled);
1✔
413
      event.setExternalWorkflowExecutionSignaledEventAttributes(
1✔
414
          externalWorkflowExecutionSignaledEventAttributes(
1✔
415
              e.getExternalWorkflowExecutionSignaledEventAttributes()));
1✔
416
    } else if (e.getUpsertWorkflowSearchAttributesEventAttributes()
1✔
417
        != com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes
418
            .getDefaultInstance()) {
1✔
419
      event.setEventType(UpsertWorkflowSearchAttributes);
1✔
420
      event.setUpsertWorkflowSearchAttributesEventAttributes(
1✔
421
          upsertWorkflowSearchAttributesEventAttributes(
1✔
422
              e.getUpsertWorkflowSearchAttributesEventAttributes()));
1✔
423
    } else {
424
      throw new IllegalArgumentException("unknown event type");
×
425
    }
426
    return event;
1✔
427
  }
428

429
  static ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes(
430
      com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes t) {
431
    if (t == null
1✔
432
        || t
433
            == com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes
434
                .getDefaultInstance()) {
1✔
435
      return null;
1✔
436
    }
437
    ActivityTaskCancelRequestedEventAttributes res =
1✔
438
        new ActivityTaskCancelRequestedEventAttributes();
439
    res.setActivityId(t.getActivityId());
1✔
440
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
441
    return res;
1✔
442
  }
443

444
  static ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes(
445
      com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes t) {
446
    if (t == null
1✔
447
        || t == com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) {
1✔
448
      return null;
1✔
449
    }
450
    ActivityTaskCanceledEventAttributes res = new ActivityTaskCanceledEventAttributes();
1✔
451
    res.setDetails(payload(t.getDetails()));
1✔
452
    res.setLatestCancelRequestedEventId(t.getLatestCancelRequestedEventId());
1✔
453
    res.setScheduledEventId(t.getScheduledEventId());
1✔
454
    res.setStartedEventId(t.getStartedEventId());
1✔
455
    res.setIdentity(t.getIdentity());
1✔
456
    return res;
1✔
457
  }
458

459
  static ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes(
460
      com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes t) {
461
    if (t == null
1✔
462
        || t == com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) {
1✔
463
      return null;
1✔
464
    }
465
    ActivityTaskCompletedEventAttributes res = new ActivityTaskCompletedEventAttributes();
1✔
466
    res.setResult(payload(t.getResult()));
1✔
467
    res.setScheduledEventId(t.getScheduledEventId());
1✔
468
    res.setStartedEventId(t.getStartedEventId());
1✔
469
    res.setIdentity(t.getIdentity());
1✔
470
    return res;
1✔
471
  }
472

473
  static ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes(
474
      com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes t) {
475
    if (t == null
1✔
476
        || t == com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) {
1✔
477
      return null;
1✔
478
    }
479
    ActivityTaskFailedEventAttributes res = new ActivityTaskFailedEventAttributes();
1✔
480
    res.setReason(failureReason(t.getFailure()));
1✔
481
    res.setDetails(failureDetails(t.getFailure()));
1✔
482
    res.setScheduledEventId(t.getScheduledEventId());
1✔
483
    res.setStartedEventId(t.getStartedEventId());
1✔
484
    res.setIdentity(t.getIdentity());
1✔
485
    return res;
1✔
486
  }
487

488
  static ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes(
489
      com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes t) {
490
    if (t == null
1✔
491
        || t == com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) {
1✔
492
      return null;
1✔
493
    }
494
    ActivityTaskScheduledEventAttributes res = new ActivityTaskScheduledEventAttributes();
1✔
495
    res.setActivityId(t.getActivityId());
1✔
496
    res.setActivityType(activityType(t.getActivityType()));
1✔
497
    res.setDomain(t.getDomain());
1✔
498
    res.setTaskList(taskList(t.getTaskList()));
1✔
499
    res.setInput(payload(t.getInput()));
1✔
500
    res.setScheduleToCloseTimeoutSeconds(durationToSeconds(t.getScheduleToCloseTimeout()));
1✔
501
    res.setScheduleToStartTimeoutSeconds(durationToSeconds(t.getScheduleToStartTimeout()));
1✔
502
    res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout()));
1✔
503
    res.setHeartbeatTimeoutSeconds(durationToSeconds(t.getHeartbeatTimeout()));
1✔
504
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
505
    res.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
1✔
506
    res.setHeader(header(t.getHeader()));
1✔
507
    return res;
1✔
508
  }
509

510
  static ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes(
511
      com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes t) {
512
    if (t == null
1✔
513
        || t == com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) {
1✔
514
      return null;
1✔
515
    }
516
    ActivityTaskStartedEventAttributes res = new ActivityTaskStartedEventAttributes();
1✔
517
    res.setScheduledEventId(t.getScheduledEventId());
1✔
518
    res.setIdentity(t.getIdentity());
1✔
519
    res.setRequestId(t.getRequestId());
1✔
520
    res.setAttempt(t.getAttempt());
1✔
521
    res.setLastFailureReason(failureReason(t.getLastFailure()));
1✔
522
    res.setLastFailureDetails(failureDetails(t.getLastFailure()));
1✔
523
    return res;
1✔
524
  }
525

526
  static ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes(
527
      com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes t) {
528
    if (t == null
1✔
529
        || t == com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) {
1✔
530
      return null;
1✔
531
    }
532
    ActivityTaskTimedOutEventAttributes res = new ActivityTaskTimedOutEventAttributes();
1✔
533
    res.setDetails(payload(t.getDetails()));
1✔
534
    res.setScheduledEventId(t.getScheduledEventId());
1✔
535
    res.setStartedEventId(t.getStartedEventId());
1✔
536
    res.setTimeoutType(EnumMapper.timeoutType(t.getTimeoutType()));
1✔
537
    res.setLastFailureReason(failureReason(t.getLastFailure()));
1✔
538
    res.setLastFailureDetails(failureDetails(t.getLastFailure()));
1✔
539
    return res;
1✔
540
  }
541

542
  static CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes(
543
      com.uber.cadence.api.v1.CancelTimerFailedEventAttributes t) {
544
    if (t == null
1✔
545
        || t == com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) {
1✔
546
      return null;
1✔
547
    }
548
    CancelTimerFailedEventAttributes res = new CancelTimerFailedEventAttributes();
1✔
549
    res.setTimerId(t.getTimerId());
1✔
550
    res.setCause(t.getCause());
1✔
551
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
552
    res.setIdentity(t.getIdentity());
1✔
553
    return res;
1✔
554
  }
555

556
  static ChildWorkflowExecutionCanceledEventAttributes
557
      childWorkflowExecutionCanceledEventAttributes(
558
          com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes t) {
559
    if (t == null
1✔
560
        || t
561
            == com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes
562
                .getDefaultInstance()) {
1✔
563
      return null;
1✔
564
    }
565
    ChildWorkflowExecutionCanceledEventAttributes res =
1✔
566
        new ChildWorkflowExecutionCanceledEventAttributes();
567
    res.setDomain(t.getDomain());
1✔
568
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
569
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
570
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
571
    res.setStartedEventId(t.getStartedEventId());
1✔
572
    res.setDetails(payload(t.getDetails()));
1✔
573
    return res;
1✔
574
  }
575

576
  static ChildWorkflowExecutionCompletedEventAttributes
577
      childWorkflowExecutionCompletedEventAttributes(
578
          com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes t) {
579
    if (t == null
1✔
580
        || t
581
            == com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes
582
                .getDefaultInstance()) {
1✔
583
      return null;
1✔
584
    }
585
    ChildWorkflowExecutionCompletedEventAttributes res =
1✔
586
        new ChildWorkflowExecutionCompletedEventAttributes();
587
    res.setDomain(t.getDomain());
1✔
588
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
589
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
590
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
591
    res.setStartedEventId(t.getStartedEventId());
1✔
592
    res.setResult(payload(t.getResult()));
1✔
593
    return res;
1✔
594
  }
595

596
  static ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes(
597
      com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes t) {
598
    if (t == null
1✔
599
        || t
600
            == com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes
601
                .getDefaultInstance()) {
1✔
602
      return null;
1✔
603
    }
604
    ChildWorkflowExecutionFailedEventAttributes res =
1✔
605
        new ChildWorkflowExecutionFailedEventAttributes();
606
    res.setDomain(t.getDomain());
1✔
607
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
608
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
609
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
610
    res.setStartedEventId(t.getStartedEventId());
1✔
611
    res.setReason(failureReason(t.getFailure()));
1✔
612
    res.setDetails(failureDetails(t.getFailure()));
1✔
613
    return res;
1✔
614
  }
615

616
  static ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes(
617
      com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes t) {
618
    if (t == null
1✔
619
        || t
620
            == com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes
621
                .getDefaultInstance()) {
1✔
622
      return null;
1✔
623
    }
624
    ChildWorkflowExecutionStartedEventAttributes res =
1✔
625
        new ChildWorkflowExecutionStartedEventAttributes();
626
    res.setDomain(t.getDomain());
1✔
627
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
628
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
629
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
630
    res.setHeader(header(t.getHeader()));
1✔
631
    return res;
1✔
632
  }
633

634
  static ChildWorkflowExecutionTerminatedEventAttributes
635
      childWorkflowExecutionTerminatedEventAttributes(
636
          com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes t) {
637
    if (t == null
1✔
638
        || t
639
            == com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes
640
                .getDefaultInstance()) {
1✔
641
      return null;
1✔
642
    }
643
    ChildWorkflowExecutionTerminatedEventAttributes res =
1✔
644
        new ChildWorkflowExecutionTerminatedEventAttributes();
645
    res.setDomain(t.getDomain());
1✔
646
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
647
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
648
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
649
    res.setStartedEventId(t.getStartedEventId());
1✔
650
    return res;
1✔
651
  }
652

653
  static ChildWorkflowExecutionTimedOutEventAttributes
654
      childWorkflowExecutionTimedOutEventAttributes(
655
          com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes t) {
656
    if (t == null
1✔
657
        || t
658
            == com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes
659
                .getDefaultInstance()) {
1✔
660
      return null;
1✔
661
    }
662
    ChildWorkflowExecutionTimedOutEventAttributes res =
1✔
663
        new ChildWorkflowExecutionTimedOutEventAttributes();
664
    res.setDomain(t.getDomain());
1✔
665
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
666
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
667
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
668
    res.setStartedEventId(t.getStartedEventId());
1✔
669
    res.setTimeoutType(EnumMapper.timeoutType(t.getTimeoutType()));
1✔
670
    return res;
1✔
671
  }
672

673
  static DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes(
674
      com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes t) {
675
    if (t == null
1✔
676
        || t == com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) {
1✔
677
      return null;
1✔
678
    }
679
    DecisionTaskFailedEventAttributes res = new DecisionTaskFailedEventAttributes();
1✔
680
    res.setScheduledEventId(t.getScheduledEventId());
1✔
681
    res.setStartedEventId(t.getStartedEventId());
1✔
682
    res.setCause(decisionTaskFailedCause(t.getCause()));
1✔
683
    res.setReason(failureReason(t.getFailure()));
1✔
684
    res.setDetails(failureDetails(t.getFailure()));
1✔
685
    res.setIdentity(t.getIdentity());
1✔
686
    res.setBaseRunId(t.getBaseRunId());
1✔
687
    res.setNewRunId(t.getNewRunId());
1✔
688
    res.setForkEventVersion(t.getForkEventVersion());
1✔
689
    res.setBinaryChecksum(t.getBinaryChecksum());
1✔
690
    return res;
1✔
691
  }
692

693
  static DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes(
694
      com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes t) {
695
    if (t == null
1✔
696
        || t == com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) {
1✔
697
      return null;
1✔
698
    }
699
    DecisionTaskScheduledEventAttributes res = new DecisionTaskScheduledEventAttributes();
1✔
700
    res.setTaskList(taskList(t.getTaskList()));
1✔
701
    res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout()));
1✔
702
    res.setAttempt(t.getAttempt());
1✔
703
    return res;
1✔
704
  }
705

706
  static DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes(
707
      com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes t) {
708
    if (t == null
1✔
709
        || t == com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) {
1✔
710
      return null;
1✔
711
    }
712
    DecisionTaskStartedEventAttributes res = new DecisionTaskStartedEventAttributes();
1✔
713
    res.setScheduledEventId(t.getScheduledEventId());
1✔
714
    res.setIdentity(t.getIdentity());
1✔
715
    res.setRequestId(t.getRequestId());
1✔
716
    return res;
1✔
717
  }
718

719
  static DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes(
720
      com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes t) {
721
    if (t == null
1✔
722
        || t == com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) {
1✔
723
      return null;
1✔
724
    }
725
    DecisionTaskCompletedEventAttributes res = new DecisionTaskCompletedEventAttributes();
1✔
726
    res.setScheduledEventId(t.getScheduledEventId());
1✔
727
    res.setStartedEventId(t.getStartedEventId());
1✔
728
    res.setIdentity(t.getIdentity());
1✔
729
    res.setBinaryChecksum(t.getBinaryChecksum());
1✔
730
    res.setExecutionContext(byteStringToArray(t.getExecutionContext()));
1✔
731
    return res;
1✔
732
  }
733

734
  static DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes(
735
      com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes t) {
736
    if (t == null
1✔
737
        || t == com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) {
1✔
738
      return null;
1✔
739
    }
740
    DecisionTaskTimedOutEventAttributes res = new DecisionTaskTimedOutEventAttributes();
1✔
741
    res.setScheduledEventId(t.getScheduledEventId());
1✔
742
    res.setStartedEventId(t.getStartedEventId());
1✔
743
    res.setTimeoutType(timeoutType(t.getTimeoutType()));
1✔
744
    res.setBaseRunId(t.getBaseRunId());
1✔
745
    res.setNewRunId(t.getNewRunId());
1✔
746
    res.setForkEventVersion(t.getForkEventVersion());
1✔
747
    res.setReason(t.getReason());
1✔
748
    res.setCause(decisionTaskTimedOutCause(t.getCause()));
1✔
749
    return res;
1✔
750
  }
751

752
  static ExternalWorkflowExecutionCancelRequestedEventAttributes
753
      externalWorkflowExecutionCancelRequestedEventAttributes(
754
          com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes t) {
755
    if (t == null
1✔
756
        || t
757
            == com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes
758
                .getDefaultInstance()) {
1✔
759
      return null;
1✔
760
    }
761
    ExternalWorkflowExecutionCancelRequestedEventAttributes res =
1✔
762
        new ExternalWorkflowExecutionCancelRequestedEventAttributes();
763
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
764
    res.setDomain(t.getDomain());
1✔
765
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
766
    return res;
1✔
767
  }
768

769
  static ExternalWorkflowExecutionSignaledEventAttributes
770
      externalWorkflowExecutionSignaledEventAttributes(
771
          com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes t) {
772
    if (t == null
1✔
773
        || t
774
            == com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes
775
                .getDefaultInstance()) {
1✔
776
      return null;
1✔
777
    }
778
    ExternalWorkflowExecutionSignaledEventAttributes res =
1✔
779
        new ExternalWorkflowExecutionSignaledEventAttributes();
780
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
781
    res.setDomain(t.getDomain());
1✔
782
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
783
    res.setControl(byteStringToArray(t.getControl()));
1✔
784
    return res;
1✔
785
  }
786

787
  static MarkerRecordedEventAttributes markerRecordedEventAttributes(
788
      com.uber.cadence.api.v1.MarkerRecordedEventAttributes t) {
789
    if (t == null
1✔
790
        || t == com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) {
1✔
791
      return null;
1✔
792
    }
793
    MarkerRecordedEventAttributes res = new MarkerRecordedEventAttributes();
1✔
794
    res.setMarkerName(t.getMarkerName());
1✔
795
    res.setDetails(payload(t.getDetails()));
1✔
796
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
797
    res.setHeader(header(t.getHeader()));
1✔
798
    return res;
1✔
799
  }
800

801
  static RequestCancelActivityTaskFailedEventAttributes
802
      requestCancelActivityTaskFailedEventAttributes(
803
          com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes t) {
804
    if (t == null
1✔
805
        || t
806
            == com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes
807
                .getDefaultInstance()) {
1✔
808
      return null;
1✔
809
    }
810
    RequestCancelActivityTaskFailedEventAttributes res =
1✔
811
        new RequestCancelActivityTaskFailedEventAttributes();
812
    res.setActivityId(t.getActivityId());
1✔
813
    res.setCause(t.getCause());
1✔
814
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
815
    return res;
1✔
816
  }
817

818
  static RequestCancelExternalWorkflowExecutionFailedEventAttributes
819
      requestCancelExternalWorkflowExecutionFailedEventAttributes(
820
          com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes t) {
821
    if (t == null
1✔
822
        || t
823
            == com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes
824
                .getDefaultInstance()) {
1✔
825
      return null;
1✔
826
    }
827
    RequestCancelExternalWorkflowExecutionFailedEventAttributes res =
1✔
828
        new RequestCancelExternalWorkflowExecutionFailedEventAttributes();
829
    res.setCause(cancelExternalWorkflowExecutionFailedCause(t.getCause()));
1✔
830
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
831
    res.setDomain(t.getDomain());
1✔
832
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
833
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
834
    res.setControl(byteStringToArray(t.getControl()));
1✔
835
    return res;
1✔
836
  }
837

838
  static RequestCancelExternalWorkflowExecutionInitiatedEventAttributes
839
      requestCancelExternalWorkflowExecutionInitiatedEventAttributes(
840
          com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes
841
              t) {
842
    if (t == null
1✔
843
        || t
844
            == com.uber.cadence.api.v1
845
                .RequestCancelExternalWorkflowExecutionInitiatedEventAttributes
846
                .getDefaultInstance()) {
1✔
847
      return null;
1✔
848
    }
849
    RequestCancelExternalWorkflowExecutionInitiatedEventAttributes res =
1✔
850
        new RequestCancelExternalWorkflowExecutionInitiatedEventAttributes();
851
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
852
    res.setDomain(t.getDomain());
1✔
853
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
854
    res.setControl(byteStringToArray(t.getControl()));
1✔
855
    res.setChildWorkflowOnly(t.getChildWorkflowOnly());
1✔
856
    return res;
1✔
857
  }
858

859
  static SignalExternalWorkflowExecutionFailedEventAttributes
860
      signalExternalWorkflowExecutionFailedEventAttributes(
861
          com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes t) {
862
    if (t == null
1✔
863
        || t
864
            == com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes
865
                .getDefaultInstance()) {
1✔
866
      return null;
1✔
867
    }
868
    SignalExternalWorkflowExecutionFailedEventAttributes res =
1✔
869
        new SignalExternalWorkflowExecutionFailedEventAttributes();
870
    res.setCause(signalExternalWorkflowExecutionFailedCause(t.getCause()));
1✔
871
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
872
    res.setDomain(t.getDomain());
1✔
873
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
874
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
875
    res.setControl(byteStringToArray(t.getControl()));
1✔
876
    return res;
1✔
877
  }
878

879
  static SignalExternalWorkflowExecutionInitiatedEventAttributes
880
      signalExternalWorkflowExecutionInitiatedEventAttributes(
881
          com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes t) {
882
    if (t == null
1✔
883
        || t
884
            == com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes
885
                .getDefaultInstance()) {
1✔
886
      return null;
1✔
887
    }
888
    SignalExternalWorkflowExecutionInitiatedEventAttributes res =
1✔
889
        new SignalExternalWorkflowExecutionInitiatedEventAttributes();
890
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
891
    res.setDomain(t.getDomain());
1✔
892
    res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution()));
1✔
893
    res.setSignalName(t.getSignalName());
1✔
894
    res.setInput(payload(t.getInput()));
1✔
895
    res.setControl(byteStringToArray(t.getControl()));
1✔
896
    res.setChildWorkflowOnly(t.getChildWorkflowOnly());
1✔
897
    return res;
1✔
898
  }
899

900
  static StartChildWorkflowExecutionFailedEventAttributes
901
      startChildWorkflowExecutionFailedEventAttributes(
902
          com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes t) {
903
    if (t == null
1✔
904
        || t
905
            == com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes
906
                .getDefaultInstance()) {
1✔
907
      return null;
1✔
908
    }
909
    StartChildWorkflowExecutionFailedEventAttributes res =
1✔
910
        new StartChildWorkflowExecutionFailedEventAttributes();
911
    res.setDomain(t.getDomain());
1✔
912
    res.setWorkflowId(t.getWorkflowId());
1✔
913
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
914
    res.setCause(childWorkflowExecutionFailedCause(t.getCause()));
1✔
915
    res.setControl(byteStringToArray(t.getControl()));
1✔
916
    res.setInitiatedEventId(t.getInitiatedEventId());
1✔
917
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
918
    return res;
1✔
919
  }
920

921
  static StartChildWorkflowExecutionInitiatedEventAttributes
922
      startChildWorkflowExecutionInitiatedEventAttributes(
923
          com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes t) {
924
    if (t == null
1✔
925
        || t
926
            == com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes
927
                .getDefaultInstance()) {
1✔
928
      return null;
1✔
929
    }
930
    StartChildWorkflowExecutionInitiatedEventAttributes res =
1✔
931
        new StartChildWorkflowExecutionInitiatedEventAttributes();
932
    res.setDomain(t.getDomain());
1✔
933
    res.setWorkflowId(t.getWorkflowId());
1✔
934
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
935
    res.setTaskList(taskList(t.getTaskList()));
1✔
936
    res.setInput(payload(t.getInput()));
1✔
937
    res.setExecutionStartToCloseTimeoutSeconds(
1✔
938
        durationToSeconds(t.getExecutionStartToCloseTimeout()));
1✔
939
    res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout()));
1✔
940
    res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy()));
1✔
941
    res.setControl(byteStringToArray(t.getControl()));
1✔
942
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
943
    res.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy()));
1✔
944
    res.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
1✔
945
    res.setCronSchedule(t.getCronSchedule());
1✔
946
    res.setHeader(header(t.getHeader()));
1✔
947
    res.setMemo(memo(t.getMemo()));
1✔
948
    res.setSearchAttributes(searchAttributes(t.getSearchAttributes()));
1✔
949
    res.setDelayStartSeconds(durationToSeconds(t.getDelayStart()));
1✔
950
    return res;
1✔
951
  }
952

953
  static TimerCanceledEventAttributes timerCanceledEventAttributes(
954
      com.uber.cadence.api.v1.TimerCanceledEventAttributes t) {
955
    if (t == null
1✔
956
        || t == com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) {
1✔
957
      return null;
1✔
958
    }
959
    TimerCanceledEventAttributes res = new TimerCanceledEventAttributes();
1✔
960
    res.setTimerId(t.getTimerId());
1✔
961
    res.setStartedEventId(t.getStartedEventId());
1✔
962
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
963
    res.setIdentity(t.getIdentity());
1✔
964
    return res;
1✔
965
  }
966

967
  static TimerFiredEventAttributes timerFiredEventAttributes(
968
      com.uber.cadence.api.v1.TimerFiredEventAttributes t) {
969
    if (t == null || t == com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) {
1✔
970
      return null;
1✔
971
    }
972
    TimerFiredEventAttributes res = new TimerFiredEventAttributes();
1✔
973
    res.setTimerId(t.getTimerId());
1✔
974
    res.setStartedEventId(t.getStartedEventId());
1✔
975
    return res;
1✔
976
  }
977

978
  static TimerStartedEventAttributes timerStartedEventAttributes(
979
      com.uber.cadence.api.v1.TimerStartedEventAttributes t) {
980
    if (t == null
1✔
981
        || t == com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) {
1✔
982
      return null;
1✔
983
    }
984
    TimerStartedEventAttributes res = new TimerStartedEventAttributes();
1✔
985
    res.setTimerId(t.getTimerId());
1✔
986
    res.setStartToFireTimeoutSeconds(durationToSeconds(t.getStartToFireTimeout()));
1✔
987
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
988
    return res;
1✔
989
  }
990

991
  static UpsertWorkflowSearchAttributesEventAttributes
992
      upsertWorkflowSearchAttributesEventAttributes(
993
          com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes t) {
994
    if (t == null
1✔
995
        || t
996
            == com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes
997
                .getDefaultInstance()) {
1✔
998
      return null;
1✔
999
    }
1000
    UpsertWorkflowSearchAttributesEventAttributes res =
1✔
1001
        new UpsertWorkflowSearchAttributesEventAttributes();
1002
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
1003
    res.setSearchAttributes(searchAttributes(t.getSearchAttributes()));
1✔
1004
    return res;
1✔
1005
  }
1006

1007
  static WorkflowExecutionCancelRequestedEventAttributes
1008
      workflowExecutionCancelRequestedEventAttributes(
1009
          com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes t) {
1010
    if (t == null
1✔
1011
        || t
1012
            == com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes
1013
                .getDefaultInstance()) {
1✔
1014
      return null;
1✔
1015
    }
1016
    WorkflowExecutionCancelRequestedEventAttributes res =
1✔
1017
        new WorkflowExecutionCancelRequestedEventAttributes();
1018
    res.setCause(t.getCause());
1✔
1019
    res.setExternalInitiatedEventId(externalInitiatedId(t.getExternalExecutionInfo()));
1✔
1020
    res.setExternalWorkflowExecution(externalWorkflowExecution(t.getExternalExecutionInfo()));
1✔
1021
    res.setIdentity(t.getIdentity());
1✔
1022
    return res;
1✔
1023
  }
1024

1025
  static WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes(
1026
      com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes t) {
1027
    if (t == null
1✔
1028
        || t
1029
            == com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes
1030
                .getDefaultInstance()) {
1✔
1031
      return null;
1✔
1032
    }
1033
    WorkflowExecutionCanceledEventAttributes res = new WorkflowExecutionCanceledEventAttributes();
1✔
1034
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
1035
    res.setDetails(payload(t.getDetails()));
1✔
1036
    return res;
1✔
1037
  }
1038

1039
  static WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes(
1040
      com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes t) {
1041
    if (t == null
1✔
1042
        || t
1043
            == com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes
1044
                .getDefaultInstance()) {
1✔
1045
      return null;
1✔
1046
    }
1047
    WorkflowExecutionCompletedEventAttributes res = new WorkflowExecutionCompletedEventAttributes();
1✔
1048
    res.setResult(payload(t.getResult()));
1✔
1049
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
1050
    return res;
1✔
1051
  }
1052

1053
  static WorkflowExecutionContinuedAsNewEventAttributes
1054
      workflowExecutionContinuedAsNewEventAttributes(
1055
          com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes t) {
1056
    if (t == null
1✔
1057
        || t
1058
            == com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes
1059
                .getDefaultInstance()) {
1✔
1060
      return null;
1✔
1061
    }
1062
    WorkflowExecutionContinuedAsNewEventAttributes res =
1✔
1063
        new WorkflowExecutionContinuedAsNewEventAttributes();
1064
    res.setNewExecutionRunId(t.getNewExecutionRunId());
1✔
1065
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
1066
    res.setTaskList(taskList(t.getTaskList()));
1✔
1067
    res.setInput(payload(t.getInput()));
1✔
1068
    res.setExecutionStartToCloseTimeoutSeconds(
1✔
1069
        durationToSeconds(t.getExecutionStartToCloseTimeout()));
1✔
1070
    res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout()));
1✔
1071
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
1072
    res.setBackoffStartIntervalInSeconds(durationToSeconds(t.getBackoffStartInterval()));
1✔
1073
    res.setInitiator(continueAsNewInitiator(t.getInitiator()));
1✔
1074
    res.setFailureReason(failureReason(t.getFailure()));
1✔
1075
    res.setFailureDetails(failureDetails(t.getFailure()));
1✔
1076
    res.setLastCompletionResult(payload(t.getLastCompletionResult()));
1✔
1077
    res.setHeader(header(t.getHeader()));
1✔
1078
    res.setMemo(memo(t.getMemo()));
1✔
1079
    res.setSearchAttributes(searchAttributes(t.getSearchAttributes()));
1✔
1080
    return res;
1✔
1081
  }
1082

1083
  static WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes(
1084
      com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes t) {
1085
    if (t == null
1✔
1086
        || t
1087
            == com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes
1088
                .getDefaultInstance()) {
1✔
1089
      return null;
1✔
1090
    }
1091
    WorkflowExecutionFailedEventAttributes res = new WorkflowExecutionFailedEventAttributes();
1✔
1092
    res.setReason(failureReason(t.getFailure()));
1✔
1093
    res.setDetails(failureDetails(t.getFailure()));
1✔
1094
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
1✔
1095
    return res;
1✔
1096
  }
1097

1098
  static WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes(
1099
      com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes t) {
1100
    if (t == null
1✔
1101
        || t
1102
            == com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes
1103
                .getDefaultInstance()) {
1✔
1104
      return null;
1✔
1105
    }
1106
    WorkflowExecutionSignaledEventAttributes res = new WorkflowExecutionSignaledEventAttributes();
1✔
1107
    res.setSignalName(t.getSignalName());
1✔
1108
    res.setInput(payload(t.getInput()));
1✔
1109
    res.setIdentity(t.getIdentity());
1✔
1110
    return res;
1✔
1111
  }
1112

1113
  static WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes(
1114
      com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes t) {
1115
    if (t == null
1✔
1116
        || t
1117
            == com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes
1118
                .getDefaultInstance()) {
1✔
1119
      return null;
1✔
1120
    }
1121
    WorkflowExecutionStartedEventAttributes res = new WorkflowExecutionStartedEventAttributes();
1✔
1122
    res.setWorkflowType(workflowType(t.getWorkflowType()));
1✔
1123
    res.setParentWorkflowDomain(parentDomainName(t.getParentExecutionInfo()));
1✔
1124
    res.setParentWorkflowExecution(parentWorkflowExecution(t.getParentExecutionInfo()));
1✔
1125
    res.setParentInitiatedEventId(parentInitiatedId(t.getParentExecutionInfo()));
1✔
1126
    res.setTaskList(taskList(t.getTaskList()));
1✔
1127
    res.setInput(payload(t.getInput()));
1✔
1128
    res.setExecutionStartToCloseTimeoutSeconds(
1✔
1129
        durationToSeconds(t.getExecutionStartToCloseTimeout()));
1✔
1130
    res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout()));
1✔
1131
    res.setContinuedExecutionRunId(t.getContinuedExecutionRunId());
1✔
1132
    res.setInitiator(continueAsNewInitiator(t.getInitiator()));
1✔
1133
    res.setContinuedFailureReason(failureReason(t.getContinuedFailure()));
1✔
1134
    res.setContinuedFailureDetails(failureDetails(t.getContinuedFailure()));
1✔
1135
    res.setLastCompletionResult(payload(t.getLastCompletionResult()));
1✔
1136
    res.setOriginalExecutionRunId(t.getOriginalExecutionRunId());
1✔
1137
    res.setIdentity(t.getIdentity());
1✔
1138
    res.setFirstExecutionRunId(t.getFirstExecutionRunId());
1✔
1139
    res.setRetryPolicy(retryPolicy(t.getRetryPolicy()));
1✔
1140
    res.setAttempt(t.getAttempt());
1✔
1141
    res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime()));
1✔
1142
    res.setCronSchedule(t.getCronSchedule());
1✔
1143
    res.setFirstDecisionTaskBackoffSeconds(durationToSeconds(t.getFirstDecisionTaskBackoff()));
1✔
1144
    res.setMemo(memo(t.getMemo()));
1✔
1145
    res.setSearchAttributes(searchAttributes(t.getSearchAttributes()));
1✔
1146
    res.setPrevAutoResetPoints(resetPoints(t.getPrevAutoResetPoints()));
1✔
1147
    res.setHeader(header(t.getHeader()));
1✔
1148
    return res;
1✔
1149
  }
1150

1151
  static WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes(
1152
      com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes t) {
1153
    if (t == null
1✔
1154
        || t
1155
            == com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes
1156
                .getDefaultInstance()) {
1✔
1157
      return null;
1✔
1158
    }
1159
    WorkflowExecutionTerminatedEventAttributes res =
1✔
1160
        new WorkflowExecutionTerminatedEventAttributes();
1161
    res.setReason(t.getReason());
1✔
1162
    res.setDetails(payload(t.getDetails()));
1✔
1163
    res.setIdentity(t.getIdentity());
1✔
1164
    return res;
1✔
1165
  }
1166

1167
  static WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes(
1168
      com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes t) {
1169
    if (t == null
1✔
1170
        || t
1171
            == com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes
1172
                .getDefaultInstance()) {
1✔
1173
      return null;
1✔
1174
    }
1175
    WorkflowExecutionTimedOutEventAttributes res = new WorkflowExecutionTimedOutEventAttributes();
1✔
1176
    res.setTimeoutType(timeoutType(t.getTimeoutType()));
1✔
1177
    return res;
1✔
1178
  }
1179
}
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