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

uber / cadence-java-client / 2409

03 Jul 2024 08:33PM CUT coverage: 61.467% (-0.05%) from 61.518%
2409

push

buildkite

web-flow
Avoid consuming ByteBuffers (#913)

A ByteBuffer is a pointer to a byte[] with a starting position, a current position, and a limit. Any function that reads from its contents updates the current position. Both TracingPropagator and WorkflowUtils copy the entirety of its contents, and in doing so they mutate the current position. WorkflowUtils resets it afterwards but this still isn't thread-safe as another thread may be trying to read it.

By duplicating the ByteBuffer (copying only the metadata, not the actual contents) we avoid modifying it. It doesn't seem likely that there's real impact in either of these cases beyond unit tests, where these ByteBuffers stick around in the workflow history and are repeatedly serialized/deserialized. Modifying them during serialization can create test flakiness as that can trigger exceptions.

2 of 2 new or added lines in 2 files covered. (100.0%)

10 existing lines in 4 files now uncovered.

11972 of 19477 relevant lines covered (61.47%)

0.61 hits per line

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

0.0
/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) {
140
    if (t == null || t == com.uber.cadence.api.v1.History.getDefaultInstance()) {
×
141
      return null;
×
142
    }
143
    History history = new History();
×
144
    history.setEvents(historyEventArray(t.getEventsList()));
×
145
    return history;
×
146
  }
147

148
  static List<HistoryEvent> historyEventArray(List<com.uber.cadence.api.v1.HistoryEvent> t) {
149
    if (t == null) {
×
150
      return null;
×
151
    }
152
    List<HistoryEvent> v = new ArrayList<>();
×
153
    for (int i = 0; i < t.size(); i++) {
×
154
      v.add(historyEvent(t.get(i)));
×
155
    }
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()) {
×
161
      return null;
×
162
    }
163
    HistoryEvent event = new HistoryEvent();
×
164
    event.setEventId(e.getEventId());
×
165
    event.setTimestamp(timeToUnixNano(e.getEventTime()));
×
166
    event.setVersion(e.getVersion());
×
167
    event.setTaskId(e.getTaskId());
×
168

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

953
  static TimerCanceledEventAttributes timerCanceledEventAttributes(
954
      com.uber.cadence.api.v1.TimerCanceledEventAttributes t) {
955
    if (t == null
×
956
        || t == com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) {
×
957
      return null;
×
958
    }
959
    TimerCanceledEventAttributes res = new TimerCanceledEventAttributes();
×
960
    res.setTimerId(t.getTimerId());
×
961
    res.setStartedEventId(t.getStartedEventId());
×
962
    res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId());
×
963
    res.setIdentity(t.getIdentity());
×
964
    return res;
×
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()) {
×
970
      return null;
×
971
    }
972
    TimerFiredEventAttributes res = new TimerFiredEventAttributes();
×
973
    res.setTimerId(t.getTimerId());
×
974
    res.setStartedEventId(t.getStartedEventId());
×
975
    return res;
×
976
  }
977

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

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

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

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

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

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

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

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

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

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

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