diff --git a/build.gradle b/build.gradle index faf60a464..88fc64e85 100644 --- a/build.gradle +++ b/build.gradle @@ -74,6 +74,11 @@ dependencies { compile group: 'com.google.api.grpc', name: 'proto-google-common-protos', version: '2.10.0' compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.21.9' compile group: 'com.google.oauth-client', name: 'google-oauth-client', version: '1.35.0' + compile group: 'org.projectlombok', name: 'lombok', version: '1.18.30' + compileOnly 'org.projectlombok:lombok:1.18.30' + annotationProcessor 'org.projectlombok:lombok:1.18.30' + testCompileOnly 'org.projectlombok:lombok:1.18.30' + testAnnotationProcessor 'org.projectlombok:lombok:1.18.30' implementation 'io.grpc:grpc-netty-shaded:1.54.2' implementation 'io.grpc:grpc-protobuf:1.54.2' diff --git a/src/main/java/com/uber/cadence/entities/ActivityLocalDispatchInfo.java b/src/main/java/com/uber/cadence/entities/ActivityLocalDispatchInfo.java new file mode 100644 index 000000000..82defc90b --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityLocalDispatchInfo.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityLocalDispatchInfo { + private String activityId; + private Long scheduledTimestamp; + private Long startedTimestamp; + private Long scheduledTimestampOfThisAttempt; + private byte[] taskToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java new file mode 100644 index 000000000..d761024c9 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskCancelRequestedEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskCancelRequestedEventAttributes { + private String activityId; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java new file mode 100644 index 000000000..72e872964 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskCanceledEventAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskCanceledEventAttributes { + private byte[] details; + private Long scheduledEventId; + private Long startedEventId; + private Long latestCancelRequestedEventId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java new file mode 100644 index 000000000..6036584b8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskCompletedEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskCompletedEventAttributes { + private byte[] result; + private Long scheduledEventId; + private Long startedEventId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..5d2dc06e6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskFailedEventAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskFailedEventAttributes { + private String reason; + private byte[] details; + private Long scheduledEventId; + private Long startedEventId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java new file mode 100644 index 000000000..3e9f95f8e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskScheduledEventAttributes.java @@ -0,0 +1,34 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskScheduledEventAttributes { + private ActivityType activityType; + private String activityId; + private String domain; + private TaskList taskList; + private byte[] input; + private Integer scheduleToCloseTimeoutSeconds; + private Integer scheduleToStartTimeoutSeconds; + private Integer startToCloseTimeoutSeconds; + private Integer heartbeatTimeoutSeconds; + private Long decisionTaskCompletedEventId; + private RetryPolicy retryPolicy; + private Header header; + private String requestLocalDispatch; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java new file mode 100644 index 000000000..6e858a220 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskStartedEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskStartedEventAttributes { + private Long scheduledEventId; + private String identity; + private String requestId; + private Integer attempt; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java b/src/main/java/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..60fc2d3e1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityTaskTimedOutEventAttributes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityTaskTimedOutEventAttributes { + private byte[] details; + private Long scheduledEventId; + private Long startedEventId; + private TimeoutType timeoutType; + private String lastHeartbeatDetails; + private String lastFailureReason; + private byte[] lastFailureDetails; +} diff --git a/src/main/java/com/uber/cadence/entities/ActivityType.java b/src/main/java/com/uber/cadence/entities/ActivityType.java new file mode 100644 index 000000000..3be9ff9a0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ActivityType.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ActivityType { + private String name; +} diff --git a/src/main/java/com/uber/cadence/entities/ArchivalStatus.java b/src/main/java/com/uber/cadence/entities/ArchivalStatus.java new file mode 100644 index 000000000..f7d49655c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ArchivalStatus.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** ArchivalStatus represents the status of archival for a domain. */ +public enum ArchivalStatus { + /** Archival is disabled. */ + DISABLED, + + /** Archival is enabled. */ + ENABLED +} diff --git a/src/main/java/com/uber/cadence/entities/AsyncWorkflowConfiguration.java b/src/main/java/com/uber/cadence/entities/AsyncWorkflowConfiguration.java new file mode 100644 index 000000000..507b30312 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/AsyncWorkflowConfiguration.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class AsyncWorkflowConfiguration { + private boolean enabled; + private Integer prefetchTaskListSize; + private Integer maxConcurrentTaskExecutionSize; +} diff --git a/src/main/java/com/uber/cadence/entities/BadBinaries.java b/src/main/java/com/uber/cadence/entities/BadBinaries.java new file mode 100644 index 000000000..17b974c2f --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/BadBinaries.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class BadBinaries { + private Map binaries; +} diff --git a/src/main/java/com/uber/cadence/entities/BadBinaryInfo.java b/src/main/java/com/uber/cadence/entities/BadBinaryInfo.java new file mode 100644 index 000000000..9bd0bf76d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/BadBinaryInfo.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class BadBinaryInfo { + private String reason; + private String operator; + private Long createdTimeNano; +} diff --git a/src/main/java/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java b/src/main/java/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..f3d45b516 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CancelExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum CancelExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, + WORKFLOW_ALREADY_CANCELED, + WORKFLOW_ALREADY_TERMINATED, + WORKFLOW_ALREADY_TIMED_OUT, + WORKFLOW_ALREADY_FAILED, + WORKFLOW_ALREADY_CONTINUED_AS_NEW +} diff --git a/src/main/java/com/uber/cadence/entities/CancelTimerDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/CancelTimerDecisionAttributes.java new file mode 100644 index 000000000..e3d62dae3 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CancelTimerDecisionAttributes.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CancelTimerDecisionAttributes { + private String timerId; +} diff --git a/src/main/java/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java new file mode 100644 index 000000000..2e3d080cb --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CancelTimerFailedEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CancelTimerFailedEventAttributes { + private String timerId; + private String cause; + private Long decisionTaskCompletedEventId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..3aef61034 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CancelWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CancelWorkflowExecutionDecisionAttributes { + private byte[] details; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildPolicy.java b/src/main/java/com/uber/cadence/entities/ChildPolicy.java new file mode 100644 index 000000000..54de5d405 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildPolicy.java @@ -0,0 +1,21 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum ChildPolicy { + TERMINATE, + REQUEST_CANCEL, + ABANDON +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..87b9fa388 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionCanceledEventAttributes { + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..2d0f2513d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionCompletedEventAttributes { + private byte[] result; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..5af4b82f5 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedCause.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum ChildWorkflowExecutionFailedCause { + WORKFLOW_TYPE_DOES_NOT_EXIST, + WORKFLOW_ALREADY_RUNNING, + WORKFLOW_ALREADY_COMPLETED, + WORKFLOW_ALREADY_CANCELED, + WORKFLOW_ALREADY_TERMINATED, + WORKFLOW_ALREADY_TIMED_OUT, + WORKFLOW_ALREADY_FAILED, + WORKFLOW_ALREADY_CONTINUED_AS_NEW, + WORKFLOW_ALREADY_STARTED +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..41c5950bf --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..3a2831781 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionStartedEventAttributes { + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Header header; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..ef0b616d1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionTerminatedEventAttributes { + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..c9ba5387c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ChildWorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ChildWorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; + private String domain; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long initiatedEventId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/ClusterInfo.java b/src/main/java/com/uber/cadence/entities/ClusterInfo.java new file mode 100644 index 000000000..4d6956bbb --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ClusterInfo.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ClusterInfo { + private SupportedClientVersions supportedClientVersions; +} diff --git a/src/main/java/com/uber/cadence/entities/ClusterReplicationConfiguration.java b/src/main/java/com/uber/cadence/entities/ClusterReplicationConfiguration.java new file mode 100644 index 000000000..56d50afee --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ClusterReplicationConfiguration.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ClusterReplicationConfiguration { + private String clusterName; +} diff --git a/src/main/java/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..954379d49 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CompleteWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CompleteWorkflowExecutionDecisionAttributes { + private byte[] result; +} diff --git a/src/main/java/com/uber/cadence/entities/ContinueAsNewInitiator.java b/src/main/java/com/uber/cadence/entities/ContinueAsNewInitiator.java new file mode 100644 index 000000000..729ed1955 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ContinueAsNewInitiator.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** ContinueAsNewInitiator represents the initiator of a continue-as-new workflow execution. */ +public enum ContinueAsNewInitiator { + Decider, + RetryPolicy, + CronSchedule +} diff --git a/src/main/java/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..65a5d78fa --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ContinueAsNewWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,36 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ContinueAsNewWorkflowExecutionDecisionAttributes { + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private Integer executionStartToCloseTimeoutSeconds; + private Integer taskStartToCloseTimeoutSeconds; + private Integer backoffStartIntervalInSeconds; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private RetryPolicy retryPolicy; + private String cronSchedule; +} diff --git a/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java b/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java new file mode 100644 index 000000000..2521af358 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CountWorkflowExecutionsRequest { + private String domain; + private String query; +} diff --git a/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java b/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java new file mode 100644 index 000000000..c331b347b --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/CountWorkflowExecutionsResponse.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class CountWorkflowExecutionsResponse { + private Long count; +} diff --git a/src/main/java/com/uber/cadence/entities/DataBlob.java b/src/main/java/com/uber/cadence/entities/DataBlob.java new file mode 100644 index 000000000..9b428feb8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DataBlob.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DataBlob { + private byte[] data; + private EncodingType encodingType; +} diff --git a/src/main/java/com/uber/cadence/entities/Decision.java b/src/main/java/com/uber/cadence/entities/Decision.java new file mode 100644 index 000000000..e2bb4fd42 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/Decision.java @@ -0,0 +1,40 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class Decision { + private DecisionType decisionType; + private ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes; + private RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes; + private StartTimerDecisionAttributes startTimerDecisionAttributes; + private CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes; + private FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes; + private CancelTimerDecisionAttributes cancelTimerDecisionAttributes; + private CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes; + private RequestCancelExternalWorkflowExecutionDecisionAttributes + requestCancelExternalWorkflowExecutionDecisionAttributes; + private RecordMarkerDecisionAttributes recordMarkerDecisionAttributes; + private ContinueAsNewWorkflowExecutionDecisionAttributes + continueAsNewWorkflowExecutionDecisionAttributes; + private StartChildWorkflowExecutionDecisionAttributes + startChildWorkflowExecutionDecisionAttributes; + private SignalExternalWorkflowExecutionDecisionAttributes + signalExternalWorkflowExecutionDecisionAttributes; + private UpsertWorkflowSearchAttributesDecisionAttributes + upsertWorkflowSearchAttributesDecisionAttributes; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java b/src/main/java/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java new file mode 100644 index 000000000..1042da28c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskCompletedEventAttributes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class DecisionTaskCompletedEventAttributes { + private Long scheduledEventId; + private Long startedEventId; + private List decisions; + private byte[] executionContext; + private String identity; + private String binaryChecksum; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskFailedCause.java b/src/main/java/com/uber/cadence/entities/DecisionTaskFailedCause.java new file mode 100644 index 000000000..d21d9d0ac --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskFailedCause.java @@ -0,0 +1,41 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum DecisionTaskFailedCause { + UNHANDLED_DECISION, + BAD_SCHEDULE_ACTIVITY_ATTRIBUTES, + BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES, + BAD_START_TIMER_ATTRIBUTES, + BAD_CANCEL_TIMER_ATTRIBUTES, + BAD_RECORD_MARKER_ATTRIBUTES, + BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_CONTINUE_AS_NEW_ATTRIBUTES, + START_TIMER_DUPLICATE_ID, + RESET_STICKY_TASKLIST, + WORKFLOW_WORKER_UNHANDLED_FAILURE, + BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES, + BAD_START_CHILD_EXECUTION_ATTRIBUTES, + FORCE_CLOSE_DECISION, + FAILOVER_CLOSE_DECISION, + BAD_SIGNAL_INPUT_SIZE, + RESET_WORKFLOW, + BAD_BINARY, + SCHEDULE_ACTIVITY_DUPLICATE_ID, + BAD_SEARCH_ATTRIBUTES; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java new file mode 100644 index 000000000..199758545 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskFailedEventAttributes.java @@ -0,0 +1,31 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DecisionTaskFailedEventAttributes { + private Long scheduledEventId; + private Long startedEventId; + private DecisionTaskFailedCause cause; + private byte[] details; + private String identity; + private String reason; + private String baseRunId; + private String newRunId; + private Long forkEventVersion; + private String binaryChecksum; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java b/src/main/java/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java new file mode 100644 index 000000000..4eab3af9f --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskScheduledEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DecisionTaskScheduledEventAttributes { + private TaskList taskList; + private Integer startToCloseTimeoutSeconds; + private Integer attempt; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java b/src/main/java/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java new file mode 100644 index 000000000..381591f84 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskStartedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DecisionTaskStartedEventAttributes { + private Long scheduledEventId; + private String identity; + private String requestId; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutCause.java b/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutCause.java new file mode 100644 index 000000000..99bb300e6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutCause.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum DecisionTaskTimedOutCause { + TIMEOUT, + RESET +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java b/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java new file mode 100644 index 000000000..ac62574e8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionTaskTimedOutEventAttributes.java @@ -0,0 +1,29 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DecisionTaskTimedOutEventAttributes { + private Long scheduledEventId; + private Long startedEventId; + private TimeoutType timeoutType; + private String baseRunId; + private String newRunId; + private Long forkEventVersion; + private String reason; + private DecisionTaskTimedOutCause cause; +} diff --git a/src/main/java/com/uber/cadence/entities/DecisionType.java b/src/main/java/com/uber/cadence/entities/DecisionType.java new file mode 100644 index 000000000..761815c31 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DecisionType.java @@ -0,0 +1,57 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** DecisionType represents the type of decision that can be made in a workflow. */ +public enum DecisionType { + /** Schedule an activity task. */ + ScheduleActivityTask, + + /** Request cancellation of an activity task. */ + RequestCancelActivityTask, + + /** Start a timer. */ + StartTimer, + + /** Complete the workflow execution. */ + CompleteWorkflowExecution, + + /** Fail the workflow execution. */ + FailWorkflowExecution, + + /** Cancel a timer. */ + CancelTimer, + + /** Cancel the workflow execution. */ + CancelWorkflowExecution, + + /** Request cancellation of an external workflow execution. */ + RequestCancelExternalWorkflowExecution, + + /** Record a marker in the workflow history. */ + RecordMarker, + + /** Continue the workflow execution as new. */ + ContinueAsNewWorkflowExecution, + + /** Start a child workflow execution. */ + StartChildWorkflowExecution, + + /** Signal an external workflow execution. */ + SignalExternalWorkflowExecution, + + /** Upsert workflow search attributes. */ + UpsertWorkflowSearchAttributes +} diff --git a/src/main/java/com/uber/cadence/entities/DeprecateDomainRequest.java b/src/main/java/com/uber/cadence/entities/DeprecateDomainRequest.java new file mode 100644 index 000000000..e84844bcd --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DeprecateDomainRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DeprecateDomainRequest { + private String name; + private String securityToken; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeDomainRequest.java b/src/main/java/com/uber/cadence/entities/DescribeDomainRequest.java new file mode 100644 index 000000000..307397780 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeDomainRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DescribeDomainRequest { + private String name; + private String uuid; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeDomainResponse.java b/src/main/java/com/uber/cadence/entities/DescribeDomainResponse.java new file mode 100644 index 000000000..fcd6f8548 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeDomainResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DescribeDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private Long failoverVersion; + private Boolean isGlobalDomain; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeTaskListRequest.java b/src/main/java/com/uber/cadence/entities/DescribeTaskListRequest.java new file mode 100644 index 000000000..ff3bda196 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeTaskListRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DescribeTaskListRequest { + private String domain; + private TaskList taskList; + private TaskListType taskListType; + private boolean includeTaskListStatus; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeTaskListResponse.java b/src/main/java/com/uber/cadence/entities/DescribeTaskListResponse.java new file mode 100644 index 000000000..96d297392 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeTaskListResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class DescribeTaskListResponse { + private List pollers; + private TaskListStatus taskListStatus; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java new file mode 100644 index 000000000..3013b84e4 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DescribeWorkflowExecutionRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java b/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java new file mode 100644 index 000000000..4a18e045e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DescribeWorkflowExecutionResponse.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class DescribeWorkflowExecutionResponse { + private WorkflowExecutionConfiguration executionConfiguration; + private WorkflowExecutionInfo workflowExecutionInfo; + private List pendingActivities; + private List pendingChildren; + private PendingDecisionInfo pendingDecision; +} diff --git a/src/main/java/com/uber/cadence/entities/DomainConfiguration.java b/src/main/java/com/uber/cadence/entities/DomainConfiguration.java new file mode 100644 index 000000000..73228f0b6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DomainConfiguration.java @@ -0,0 +1,30 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class DomainConfiguration { + private Integer workflowExecutionRetentionPeriodInDays; + private Boolean emitMetric; + private IsolationGroupConfiguration isolationGroups; + private AsyncWorkflowConfiguration asyncWorkflowConfiguration; + private BadBinaries badBinaries; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; +} diff --git a/src/main/java/com/uber/cadence/entities/DomainInfo.java b/src/main/java/com/uber/cadence/entities/DomainInfo.java new file mode 100644 index 000000000..167c4cfaa --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DomainInfo.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class DomainInfo { + private String name; + private DomainStatus status; + private String description; + private String ownerEmail; + private Map data; + private String uuid; +} diff --git a/src/main/java/com/uber/cadence/entities/DomainReplicationConfiguration.java b/src/main/java/com/uber/cadence/entities/DomainReplicationConfiguration.java new file mode 100644 index 000000000..d9ba89fa4 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DomainReplicationConfiguration.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class DomainReplicationConfiguration { + private String activeClusterName; + private List clusters; +} diff --git a/src/main/java/com/uber/cadence/entities/DomainStatus.java b/src/main/java/com/uber/cadence/entities/DomainStatus.java new file mode 100644 index 000000000..8a22173c1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/DomainStatus.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** DomainStatus represents the status of a domain. */ +public enum DomainStatus { + /** Domain is registered and active. */ + REGISTERED, + + /** Domain is deprecated. */ + DEPRECATED, + + /** Domain is deleted. */ + DELETED +} diff --git a/src/main/java/com/uber/cadence/entities/EncodingType.java b/src/main/java/com/uber/cadence/entities/EncodingType.java new file mode 100644 index 000000000..b0d6b2068 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/EncodingType.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum EncodingType { + ThriftRW, + JSON +} diff --git a/src/main/java/com/uber/cadence/entities/EventType.java b/src/main/java/com/uber/cadence/entities/EventType.java new file mode 100644 index 000000000..5f671f092 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/EventType.java @@ -0,0 +1,61 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** EventType represents the type of event in a workflow history. */ +public enum EventType { + WorkflowExecutionStarted, + WorkflowExecutionCompleted, + WorkflowExecutionFailed, + WorkflowExecutionTimedOut, + DecisionTaskScheduled, + DecisionTaskStarted, + DecisionTaskCompleted, + DecisionTaskTimedOut, + DecisionTaskFailed, + ActivityTaskScheduled, + ActivityTaskStarted, + ActivityTaskCompleted, + ActivityTaskFailed, + ActivityTaskTimedOut, + ActivityTaskCancelRequested, + RequestCancelActivityTaskFailed, + ActivityTaskCanceled, + TimerStarted, + TimerFired, + CancelTimerFailed, + TimerCanceled, + WorkflowExecutionCancelRequested, + WorkflowExecutionCanceled, + RequestCancelExternalWorkflowExecutionInitiated, + RequestCancelExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionCancelRequested, + MarkerRecorded, + WorkflowExecutionSignaled, + WorkflowExecutionTerminated, + WorkflowExecutionContinuedAsNew, + StartChildWorkflowExecutionInitiated, + StartChildWorkflowExecutionFailed, + ChildWorkflowExecutionStarted, + ChildWorkflowExecutionCompleted, + ChildWorkflowExecutionFailed, + ChildWorkflowExecutionCanceled, + ChildWorkflowExecutionTimedOut, + ChildWorkflowExecutionTerminated, + SignalExternalWorkflowExecutionInitiated, + SignalExternalWorkflowExecutionFailed, + ExternalWorkflowExecutionSignaled, + UpsertWorkflowSearchAttributes +} diff --git a/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java b/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..7249d5d7c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ExternalWorkflowExecutionCancelRequestedEventAttributes { + private Long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; +} diff --git a/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java b/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..3f3879eff --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ExternalWorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ExternalWorkflowExecutionSignaledEventAttributes { + private Long initiatedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..ebb57dfca --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/FailWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class FailWorkflowExecutionDecisionAttributes { + private String reason; + private byte[] details; +} diff --git a/src/main/java/com/uber/cadence/entities/FailoverInfo.java b/src/main/java/com/uber/cadence/entities/FailoverInfo.java new file mode 100644 index 000000000..63f856a33 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/FailoverInfo.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class FailoverInfo { + private Long failoverVersion; + private Long failoverStartTimestamp; + private Long failoverExpireTimestamp; + private Integer completedShardCount; + private List pendingShards; +} diff --git a/src/main/java/com/uber/cadence/entities/GetSearchAttributesResponse.java b/src/main/java/com/uber/cadence/entities/GetSearchAttributesResponse.java new file mode 100644 index 000000000..a3428a350 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/GetSearchAttributesResponse.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class GetSearchAttributesResponse { + private Map keys; +} diff --git a/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainRequest.java b/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainRequest.java new file mode 100644 index 000000000..57f878b4d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainRequest.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class GetTaskListsByDomainRequest { + private String domainName; +} diff --git a/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainResponse.java b/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainResponse.java new file mode 100644 index 000000000..5970b3801 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/GetTaskListsByDomainResponse.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +/** + * GetTaskListsByDomainResponse contains the list of all task lists for a domain. It includes both + * decision task lists and activity task lists. + */ +@Data +public class GetTaskListsByDomainResponse { + private Map decisionTaskListMap; + private Map activityTaskListMap; +} diff --git a/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java b/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java new file mode 100644 index 000000000..8cf326a16 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryRequest.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class GetWorkflowExecutionHistoryRequest { + private String domain; + private WorkflowExecution execution; + private int maximumPageSize; + private boolean waitForNewEvent; + private HistoryEventFilterType HistoryEventFilterType; + private boolean skipArchival; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java b/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java new file mode 100644 index 000000000..6d988433a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/GetWorkflowExecutionHistoryResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class GetWorkflowExecutionHistoryResponse { + private History history; + private List rawHistory; + private byte[] nextPageToken; + private boolean archived; +} diff --git a/src/main/java/com/uber/cadence/entities/Header.java b/src/main/java/com/uber/cadence/entities/Header.java new file mode 100644 index 000000000..79f1d15af --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/Header.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.nio.ByteBuffer; +import java.util.Map; +import lombok.Data; + +@Data +public class Header { + private Map fields; +} diff --git a/src/main/java/com/uber/cadence/entities/History.java b/src/main/java/com/uber/cadence/entities/History.java new file mode 100644 index 000000000..ccb3e9e2d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/History.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class History { + private List events; +} diff --git a/src/main/java/com/uber/cadence/entities/HistoryBranch.java b/src/main/java/com/uber/cadence/entities/HistoryBranch.java new file mode 100644 index 000000000..74b9f53b2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/HistoryBranch.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class HistoryBranch { + private String treeId; + private String branchId; + private List ranges; +} diff --git a/src/main/java/com/uber/cadence/entities/HistoryBranchRange.java b/src/main/java/com/uber/cadence/entities/HistoryBranchRange.java new file mode 100644 index 000000000..f92fd686b --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/HistoryBranchRange.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class HistoryBranchRange { + private Long beginNodeId; + private Long endNodeId; +} diff --git a/src/main/java/com/uber/cadence/entities/HistoryEvent.java b/src/main/java/com/uber/cadence/entities/HistoryEvent.java new file mode 100644 index 000000000..4776f24d2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/HistoryEvent.java @@ -0,0 +1,84 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class HistoryEvent { + private Long eventId; + private Long timestamp; + private EventType eventType; + private Long version; + private Long taskId; + private WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes; + private WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes; + private WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes; + private WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes; + private DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes; + private DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes; + private DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes; + private DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes; + private DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes; + private ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes; + private ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes; + private ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes; + private ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes; + private ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes; + private TimerStartedEventAttributes timerStartedEventAttributes; + private TimerFiredEventAttributes timerFiredEventAttributes; + private ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes; + private RequestCancelActivityTaskFailedEventAttributes + requestCancelActivityTaskFailedEventAttributes; + private ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes; + private TimerCanceledEventAttributes timerCanceledEventAttributes; + private CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes; + private MarkerRecordedEventAttributes markerRecordedEventAttributes; + private WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes; + private WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes; + private WorkflowExecutionCancelRequestedEventAttributes + workflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes; + private RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + requestCancelExternalWorkflowExecutionInitiatedEventAttributes; + private RequestCancelExternalWorkflowExecutionFailedEventAttributes + requestCancelExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionCancelRequestedEventAttributes + externalWorkflowExecutionCancelRequestedEventAttributes; + private WorkflowExecutionContinuedAsNewEventAttributes + workflowExecutionContinuedAsNewEventAttributes; + private StartChildWorkflowExecutionInitiatedEventAttributes + startChildWorkflowExecutionInitiatedEventAttributes; + private StartChildWorkflowExecutionFailedEventAttributes + startChildWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes; + private ChildWorkflowExecutionCompletedEventAttributes + childWorkflowExecutionCompletedEventAttributes; + private ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes; + private ChildWorkflowExecutionCanceledEventAttributes + childWorkflowExecutionCanceledEventAttributes; + private ChildWorkflowExecutionTimedOutEventAttributes + childWorkflowExecutionTimedOutEventAttributes; + private ChildWorkflowExecutionTerminatedEventAttributes + childWorkflowExecutionTerminatedEventAttributes; + private SignalExternalWorkflowExecutionInitiatedEventAttributes + signalExternalWorkflowExecutionInitiatedEventAttributes; + private SignalExternalWorkflowExecutionFailedEventAttributes + signalExternalWorkflowExecutionFailedEventAttributes; + private ExternalWorkflowExecutionSignaledEventAttributes + externalWorkflowExecutionSignaledEventAttributes; + private UpsertWorkflowSearchAttributesEventAttributes + upsertWorkflowSearchAttributesEventAttributes; +} diff --git a/src/main/java/com/uber/cadence/entities/HistoryEventFilterType.java b/src/main/java/com/uber/cadence/entities/HistoryEventFilterType.java new file mode 100644 index 000000000..9147fb7ee --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/HistoryEventFilterType.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum HistoryEventFilterType { + ALL_EVENT, + CLOSE_EVENT +} diff --git a/src/main/java/com/uber/cadence/entities/IndexedValueType.java b/src/main/java/com/uber/cadence/entities/IndexedValueType.java new file mode 100644 index 000000000..147c9b12d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/IndexedValueType.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum IndexedValueType { + STRING, + KEYWORD, + INT, + DOUBLE, + BOOL, + DATETIME, + KEYWORD_LIST +} diff --git a/src/main/java/com/uber/cadence/entities/IsolationGroupConfiguration.java b/src/main/java/com/uber/cadence/entities/IsolationGroupConfiguration.java new file mode 100644 index 000000000..e3be6e275 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/IsolationGroupConfiguration.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class IsolationGroupConfiguration { + private List partitions; +} diff --git a/src/main/java/com/uber/cadence/entities/IsolationGroupPartition.java b/src/main/java/com/uber/cadence/entities/IsolationGroupPartition.java new file mode 100644 index 000000000..a29e15e17 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/IsolationGroupPartition.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class IsolationGroupPartition { + private String name; + private Integer percentage; +} diff --git a/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java b/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..fbb4995c8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListArchivedWorkflowExecutionsRequest { + private String domain; + private Integer pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java b/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..ccaab574a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListArchivedWorkflowExecutionsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListArchivedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java b/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java new file mode 100644 index 000000000..ea8221f8c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsRequest.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListClosedWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; + private WorkflowExecutionCloseStatus statusFilter; + private byte[] nextPageToken; + private StartTimeFilter startTimeFilter; +} diff --git a/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java b/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java new file mode 100644 index 000000000..ae1a2e236 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListClosedWorkflowExecutionsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListClosedWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ListDomainsRequest.java b/src/main/java/com/uber/cadence/entities/ListDomainsRequest.java new file mode 100644 index 000000000..8e0a46a6c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListDomainsRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListDomainsRequest { + private int pageSize; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ListDomainsResponse.java b/src/main/java/com/uber/cadence/entities/ListDomainsResponse.java new file mode 100644 index 000000000..59a9b6599 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListDomainsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListDomainsResponse { + private List domains; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java b/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java new file mode 100644 index 000000000..ff26d3778 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListOpenWorkflowExecutionsRequest { + private String domain; + private int maximumPageSize; + private WorkflowExecutionFilter executionFilter; + private WorkflowTypeFilter typeFilter; + private byte[] nextPageToken; + private StartTimeFilter startTimeFilter; +} diff --git a/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java b/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java new file mode 100644 index 000000000..2dd52bb65 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListOpenWorkflowExecutionsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListOpenWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsRequest.java b/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsRequest.java new file mode 100644 index 000000000..e914e288e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListTaskListPartitionsRequest { + private String domain; + private TaskList taskList; +} diff --git a/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsResponse.java b/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsResponse.java new file mode 100644 index 000000000..53aecbe47 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListTaskListPartitionsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListTaskListPartitionsResponse { + private List activityTaskListPartitions; + private List decisionTaskListPartitions; +} diff --git a/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java b/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java new file mode 100644 index 000000000..032dd020e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ListWorkflowExecutionsRequest { + private String domain; + private int pageSize; + private byte[] nextPageToken; + private String query; +} diff --git a/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java b/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java new file mode 100644 index 000000000..6e7d3e62d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ListWorkflowExecutionsResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ListWorkflowExecutionsResponse { + private List executions; + private byte[] nextPageToken; +} diff --git a/src/main/java/com/uber/cadence/entities/MarkerRecordedEventAttributes.java b/src/main/java/com/uber/cadence/entities/MarkerRecordedEventAttributes.java new file mode 100644 index 000000000..0eeaf50f2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/MarkerRecordedEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class MarkerRecordedEventAttributes { + private String markerName; + private byte[] details; + private Long decisionTaskCompletedEventId; + private Header header; +} diff --git a/src/main/java/com/uber/cadence/entities/Memo.java b/src/main/java/com/uber/cadence/entities/Memo.java new file mode 100644 index 000000000..cee55a8ca --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/Memo.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.nio.ByteBuffer; +import java.util.Map; +import lombok.Data; + +@Data +public class Memo { + private Map fields; +} diff --git a/src/main/java/com/uber/cadence/entities/ParentClosePolicy.java b/src/main/java/com/uber/cadence/entities/ParentClosePolicy.java new file mode 100644 index 000000000..3817b3d27 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ParentClosePolicy.java @@ -0,0 +1,30 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** + * ParentClosePolicy represents the policy for handling child workflows when the parent workflow is + * closed. + */ +public enum ParentClosePolicy { + /** Abandon the child workflow when parent is closed. */ + ABANDON, + + /** Request cancellation of the child workflow when parent is closed. */ + REQUEST_CANCEL, + + /** Terminate the child workflow when parent is closed. */ + TERMINATE +} diff --git a/src/main/java/com/uber/cadence/entities/PendingActivityInfo.java b/src/main/java/com/uber/cadence/entities/PendingActivityInfo.java new file mode 100644 index 000000000..978de297e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PendingActivityInfo.java @@ -0,0 +1,35 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PendingActivityInfo { + private String activityID; + private ActivityType activityType; + private PendingActivityState state; + private byte[] heartbeatDetails; + private Long lastHeartbeatTimestamp; + private Long lastStartedTimestamp; + private int attempt; + private int maximumAttempts; + private Long scheduledTimestamp; + private Long expirationTimestamp; + private String lastFailureReason; + private String lastWorkerIdentity; + private byte[] lastFailureDetails; + private String startedWorkerIdentity; +} diff --git a/src/main/java/com/uber/cadence/entities/PendingActivityState.java b/src/main/java/com/uber/cadence/entities/PendingActivityState.java new file mode 100644 index 000000000..166041e61 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PendingActivityState.java @@ -0,0 +1,21 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum PendingActivityState { + SCHEDULED, + STARTED, + CANCEL_REQUESTED +} diff --git a/src/main/java/com/uber/cadence/entities/PendingChildExecutionInfo.java b/src/main/java/com/uber/cadence/entities/PendingChildExecutionInfo.java new file mode 100644 index 000000000..af4f12846 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PendingChildExecutionInfo.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PendingChildExecutionInfo { + private String domain; + private String workflowID; + private String runID; + private String workflowTypName; + private Long initiatedID; + private ParentClosePolicy parentClosePolicy; +} diff --git a/src/main/java/com/uber/cadence/entities/PendingDecisionInfo.java b/src/main/java/com/uber/cadence/entities/PendingDecisionInfo.java new file mode 100644 index 000000000..0fd22fde8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PendingDecisionInfo.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PendingDecisionInfo { + private PendingDecisionState state; + private Long scheduledTimestamp; + private Long startedTimestamp; + private Integer attempt; + private Long originalScheduledTimestamp; +} diff --git a/src/main/java/com/uber/cadence/entities/PendingDecisionState.java b/src/main/java/com/uber/cadence/entities/PendingDecisionState.java new file mode 100644 index 000000000..cbec1e8cb --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PendingDecisionState.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum PendingDecisionState { + SCHEDULED, + STARTED +} diff --git a/src/main/java/com/uber/cadence/entities/PollForActivityTaskRequest.java b/src/main/java/com/uber/cadence/entities/PollForActivityTaskRequest.java new file mode 100644 index 000000000..7b91c9ba0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PollForActivityTaskRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PollForActivityTaskRequest { + private String domain; + private TaskList taskList; + private TaskListMetadata taskListMetadata; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/PollForActivityTaskResponse.java b/src/main/java/com/uber/cadence/entities/PollForActivityTaskResponse.java new file mode 100644 index 000000000..0352a07b8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PollForActivityTaskResponse.java @@ -0,0 +1,37 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PollForActivityTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private String activityId; + private ActivityType activityType; + private byte[] input; + private Long scheduledTimestamp; + private Long startedTimestamp; + private int scheduleToCloseTimeoutSeconds; + private int startToCloseTimeoutSeconds; + private int heartbeatTimeoutSeconds; + private int attempt; + private Long scheduledTimestampOfThisAttempt; + private byte[] heartbeatDetails; + private WorkflowType workflowType; + private String workflowDomain; + private Header header; +} diff --git a/src/main/java/com/uber/cadence/entities/PollForDecisionTaskRequest.java b/src/main/java/com/uber/cadence/entities/PollForDecisionTaskRequest.java new file mode 100644 index 000000000..02722bcec --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PollForDecisionTaskRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PollForDecisionTaskRequest { + private String domain; + private TaskList taskList; + private String binaryChecksum; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/PollForDecisionTaskResponse.java b/src/main/java/com/uber/cadence/entities/PollForDecisionTaskResponse.java new file mode 100644 index 000000000..d21599c1e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PollForDecisionTaskResponse.java @@ -0,0 +1,37 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class PollForDecisionTaskResponse { + private byte[] taskToken; + private WorkflowExecution workflowExecution; + private WorkflowType workflowType; + private Long previousStartedEventId; + private Long startedEventId; + private Long attempt; + private Long backlogCountHint; + private History history; + private byte[] nextPageToken; + private WorkflowQuery query; + private TaskList workflowExecutionTaskList; + private Long scheduledTimestamp; + private Long startedTimestamp; + private Map queries; + private Long nextEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/PollerInfo.java b/src/main/java/com/uber/cadence/entities/PollerInfo.java new file mode 100644 index 000000000..a2e85b45e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/PollerInfo.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class PollerInfo { + private Long lastAccessTime; + private String identity; + private double ratePerSecond; +} diff --git a/src/main/java/com/uber/cadence/entities/QueryConsistencyLevel.java b/src/main/java/com/uber/cadence/entities/QueryConsistencyLevel.java new file mode 100644 index 000000000..66ad43594 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryConsistencyLevel.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum QueryConsistencyLevel { + EVENTUAL, + STRONG +} diff --git a/src/main/java/com/uber/cadence/entities/QueryRejectCondition.java b/src/main/java/com/uber/cadence/entities/QueryRejectCondition.java new file mode 100644 index 000000000..fba808c0e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryRejectCondition.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum QueryRejectCondition { + NOT_OPEN, + NOT_COMPLETED_CLEANLY +} diff --git a/src/main/java/com/uber/cadence/entities/QueryRejected.java b/src/main/java/com/uber/cadence/entities/QueryRejected.java new file mode 100644 index 000000000..f565f000c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryRejected.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class QueryRejected { + private WorkflowExecutionCloseStatus closeStatus; +} diff --git a/src/main/java/com/uber/cadence/entities/QueryResultType.java b/src/main/java/com/uber/cadence/entities/QueryResultType.java new file mode 100644 index 000000000..927faf0aa --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryResultType.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum QueryResultType { + ANSWERED, + FAILED +} diff --git a/src/main/java/com/uber/cadence/entities/QueryTaskCompletedType.java b/src/main/java/com/uber/cadence/entities/QueryTaskCompletedType.java new file mode 100644 index 000000000..941a01c1a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryTaskCompletedType.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** QueryTaskCompletedType represents the type of completion for a query task. */ +public enum QueryTaskCompletedType { + /** Query task completed successfully. */ + COMPLETED, + + /** Query task failed. */ + FAILED, + + /** Query task was rejected. */ + REJECTED +} diff --git a/src/main/java/com/uber/cadence/entities/QueryWorkflowRequest.java b/src/main/java/com/uber/cadence/entities/QueryWorkflowRequest.java new file mode 100644 index 000000000..2295a06ef --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryWorkflowRequest.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class QueryWorkflowRequest { + private String domain; + private WorkflowExecution execution; + private WorkflowQuery query; + private QueryRejectCondition queryRejectCondition; + private QueryConsistencyLevel queryConsistencyLevel; +} diff --git a/src/main/java/com/uber/cadence/entities/QueryWorkflowResponse.java b/src/main/java/com/uber/cadence/entities/QueryWorkflowResponse.java new file mode 100644 index 000000000..3a2d265a6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/QueryWorkflowResponse.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class QueryWorkflowResponse { + private byte[] queryResult; + private QueryRejected queryRejected; +} diff --git a/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java new file mode 100644 index 000000000..ec41ff0d1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatByIDRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RecordActivityTaskHeartbeatByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java new file mode 100644 index 000000000..1b0e936a6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatRequest.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RecordActivityTaskHeartbeatRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java new file mode 100644 index 000000000..dba1fc543 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RecordActivityTaskHeartbeatResponse.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RecordActivityTaskHeartbeatResponse { + private boolean cancelRequested; +} diff --git a/src/main/java/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java new file mode 100644 index 000000000..263f8c5b0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RecordMarkerDecisionAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RecordMarkerDecisionAttributes { + private String markerName; + private byte[] details; + private Header header; +} diff --git a/src/main/java/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java b/src/main/java/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java new file mode 100644 index 000000000..67b5bc53a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RefreshWorkflowTasksRequest.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +/** RefreshWorkflowTasksRequest is used to refresh all tasks of a workflow. */ +@Data +public class RefreshWorkflowTasksRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/main/java/com/uber/cadence/entities/RegisterDomainRequest.java b/src/main/java/com/uber/cadence/entities/RegisterDomainRequest.java new file mode 100644 index 000000000..70c566efe --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RegisterDomainRequest.java @@ -0,0 +1,36 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import java.util.Map; +import lombok.Data; + +@Data +public class RegisterDomainRequest { + private String name; + private String description; + private String ownerEmail; + private int workflowExecutionRetentionPeriodInDays; + private List clusters; + private String activeClusterName; + private Map data; + private String securityToken; + private boolean isGlobalDomain; + private ArchivalStatus historyArchivalStatus; + private String historyArchivalURI; + private ArchivalStatus visibilityArchivalStatus; + private String visibilityArchivalURI; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..e20301efe --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskDecisionAttributes.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelActivityTaskDecisionAttributes { + private String activityId; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java new file mode 100644 index 000000000..a6eda71c2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelActivityTaskFailedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelActivityTaskFailedEventAttributes { + private String activityId; + private String cause; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..50392bbd0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelExternalWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private String runId; + private boolean childWorkflowOnly; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..f4d5261a3 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelExternalWorkflowExecutionFailedEventAttributes { + private Long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private Long initiatedEventId; + private CancelExternalWorkflowExecutionFailedCause cause; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..bbf5220b2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelExternalWorkflowExecutionInitiatedEventAttributes { + private Long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private boolean childWorkflowOnly; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java new file mode 100644 index 000000000..ff9eadb0f --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RequestCancelWorkflowExecutionRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RequestCancelWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String requestId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/ResetPointInfo.java b/src/main/java/com/uber/cadence/entities/ResetPointInfo.java new file mode 100644 index 000000000..79d5571b8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetPointInfo.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ResetPointInfo { + private String binaryChecksum; + private String runId; + private Long firstDecisionCompletedId; + private Long createdTimeNano; + private Long expiringTimeNano; + private boolean resettable; +} diff --git a/src/main/java/com/uber/cadence/entities/ResetPoints.java b/src/main/java/com/uber/cadence/entities/ResetPoints.java new file mode 100644 index 000000000..9029b76c0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetPoints.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class ResetPoints { + private List points; +} diff --git a/src/main/java/com/uber/cadence/entities/ResetStickyTaskListRequest.java b/src/main/java/com/uber/cadence/entities/ResetStickyTaskListRequest.java new file mode 100644 index 000000000..2ee4a3077 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetStickyTaskListRequest.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ResetStickyTaskListRequest { + private String domain; + private WorkflowExecution execution; +} diff --git a/src/main/java/com/uber/cadence/entities/ResetStickyTaskListResponse.java b/src/main/java/com/uber/cadence/entities/ResetStickyTaskListResponse.java new file mode 100644 index 000000000..1aa7d1ef8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetStickyTaskListResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +/** + * ResetStickyTaskListResponse is the response for resetting a sticky task list. This is a simple + * acknowledgment response that indicates the reset operation was successful. + */ +@Data +public class ResetStickyTaskListResponse { + // Empty response as it's just an acknowledgment +} diff --git a/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java new file mode 100644 index 000000000..ac7967f4d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ResetWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private Long decisionFinishEventId; + private String requestId; + private boolean skipSignalReapply; +} diff --git a/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java b/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java new file mode 100644 index 000000000..16e997bad --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ResetWorkflowExecutionResponse.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ResetWorkflowExecutionResponse { + private String runId; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java new file mode 100644 index 000000000..7c2c11d95 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledByIDRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskCanceledByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java new file mode 100644 index 000000000..529375289 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCanceledRequest.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskCanceledRequest { + private byte[] taskToken; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java new file mode 100644 index 000000000..b122116ab --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedByIDRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskCompletedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private byte[] result; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java new file mode 100644 index 000000000..cd417bd49 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskCompletedRequest.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskCompletedRequest { + private byte[] taskToken; + private byte[] result; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java new file mode 100644 index 000000000..f30f913f1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedByIDRequest.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskFailedByIDRequest { + private String domain; + private String workflowID; + private String runID; + private String activityID; + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java b/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java new file mode 100644 index 000000000..cb41aa627 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondActivityTaskFailedRequest.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondActivityTaskFailedRequest { + private byte[] taskToken; + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java new file mode 100644 index 000000000..ddc28dc21 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedRequest.java @@ -0,0 +1,32 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import java.util.Map; +import lombok.Data; + +@Data +public class RespondDecisionTaskCompletedRequest { + private byte[] taskToken; + private List decisions; + private StickyExecutionAttributes stickyAttributes; + private boolean returnNewDecisionTask; + private boolean forceCreateNewDecisionTask; + private Map queryResults; + private byte[] executionContext; + private String binaryChecksum; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java new file mode 100644 index 000000000..c3b213bc5 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskCompletedResponse.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class RespondDecisionTaskCompletedResponse { + private PollForDecisionTaskResponse decisionTask; + private Map activitiesToDispatchLocally; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java new file mode 100644 index 000000000..487c3b36e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondDecisionTaskFailedRequest.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondDecisionTaskFailedRequest { + private byte[] taskToken; + private DecisionTaskFailedCause cause; + private byte[] details; + private String binaryChecksum; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java b/src/main/java/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java new file mode 100644 index 000000000..57efd1075 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RespondQueryTaskCompletedRequest.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class RespondQueryTaskCompletedRequest { + private byte[] taskToken; + private QueryTaskCompletedType completedType; + private byte[] queryResult; + private String errorMessage; + private WorkerVersionInfo workerVersionInfo; +} diff --git a/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java new file mode 100644 index 000000000..0f35052e0 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionRequest.java @@ -0,0 +1,29 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +/** + * RestartWorkflowExecutionRequest is used to restart a previous workflow. If the workflow is + * currently running it will terminate and restart. + */ +@Data +public class RestartWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java b/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java new file mode 100644 index 000000000..bac6360ea --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RestartWorkflowExecutionResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +/** + * RestartWorkflowExecutionResponse is the response for restarting a workflow execution. This is a + * simple acknowledgment response that indicates the restart operation was successful. + */ +@Data +public class RestartWorkflowExecutionResponse { + private String runId; +} diff --git a/src/main/java/com/uber/cadence/entities/RetryPolicy.java b/src/main/java/com/uber/cadence/entities/RetryPolicy.java new file mode 100644 index 000000000..9606fe111 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/RetryPolicy.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class RetryPolicy { + private int initialIntervalInSeconds; + private double backoffCoefficient; + private int maximumIntervalInSeconds; + private int maximumAttempts; + private int expirationIntervalInSeconds; + private List nonRetriableErrorReasons; +} diff --git a/src/main/java/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java new file mode 100644 index 000000000..1a0ba48f2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/ScheduleActivityTaskDecisionAttributes.java @@ -0,0 +1,33 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class ScheduleActivityTaskDecisionAttributes { + private ActivityType activityType; + private String activityId; + private String domain; + private TaskList taskList; + private byte[] input; + private Integer scheduleToCloseTimeoutSeconds; + private Integer scheduleToStartTimeoutSeconds; + private Integer startToCloseTimeoutSeconds; + private Integer heartbeatTimeoutSeconds; + private RetryPolicy retryPolicy; + private Header header; + private boolean requestLocalDispatch; +} diff --git a/src/main/java/com/uber/cadence/entities/SearchAttributes.java b/src/main/java/com/uber/cadence/entities/SearchAttributes.java new file mode 100644 index 000000000..cdacce375 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SearchAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.nio.ByteBuffer; +import java.util.Map; +import lombok.Data; + +@Data +public class SearchAttributes { + private Map indexedFields; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..050e207ba --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalExternalWorkflowExecutionDecisionAttributes { + private String domain; + private WorkflowExecution execution; + private String signalName; + private byte[] input; + private boolean childWorkflowOnly; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java new file mode 100644 index 000000000..ce451b568 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedCause.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum SignalExternalWorkflowExecutionFailedCause { + UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION, + WORKFLOW_ALREADY_COMPLETED, + WORKFLOW_ALREADY_CANCELED, + WORKFLOW_ALREADY_TERMINATED, + WORKFLOW_ALREADY_TIMED_OUT, + WORKFLOW_ALREADY_FAILED, + WORKFLOW_ALREADY_CONTINUED_AS_NEW +} diff --git a/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..963deb709 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalExternalWorkflowExecutionFailedEventAttributes { + private Long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private Long initiatedEventId; + private SignalExternalWorkflowExecutionFailedCause cause; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..9b9424149 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalExternalWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalExternalWorkflowExecutionInitiatedEventAttributes { + private Long decisionTaskCompletedEventId; + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private byte[] control; + private boolean childWorkflowOnly; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..35f28ac41 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalWithStartWorkflowExecutionAsyncRequest { + private SignalWithStartWorkflowExecutionRequest request; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..b3513b976 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalWithStartWorkflowExecutionAsyncResponse {} diff --git a/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java new file mode 100644 index 000000000..3f87e0161 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalWithStartWorkflowExecutionRequest.java @@ -0,0 +1,40 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalWithStartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String requestId; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private RetryPolicy retryPolicy; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private String cronSchedule; + private int delayStartSeconds; + private String identity; + private String signalName; + private byte[] signalInput; + private byte[] control; +} diff --git a/src/main/java/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java new file mode 100644 index 000000000..6d3e6f411 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SignalWorkflowExecutionRequest.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SignalWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String signalName; + private byte[] input; + private String requestId; + private byte[] control; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java new file mode 100644 index 000000000..761a6b41d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionDecisionAttributes.java @@ -0,0 +1,36 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartChildWorkflowExecutionDecisionAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private Integer executionStartToCloseTimeoutSeconds; + private Integer taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private RetryPolicy retryPolicy; + private byte[] control; + private String cronSchedule; +} diff --git a/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..b5e6df144 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,28 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartChildWorkflowExecutionFailedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private ChildWorkflowExecutionFailedCause cause; + private byte[] control; + private Long initiatedEventId; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.java b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.java new file mode 100644 index 000000000..25a75e33f --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartChildWorkflowExecutionInitiatedEventAttributes.java @@ -0,0 +1,39 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartChildWorkflowExecutionInitiatedEventAttributes { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private Integer executionStartToCloseTimeoutSeconds; + private Integer taskStartToCloseTimeoutSeconds; + private ParentClosePolicy parentClosePolicy; + private byte[] control; + private Long decisionTaskCompletedEventId; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; + private String cronSchedule; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; + private Integer delayStartSeconds; + private Integer jitterStartSeconds; +} diff --git a/src/main/java/com/uber/cadence/entities/StartTimeFilter.java b/src/main/java/com/uber/cadence/entities/StartTimeFilter.java new file mode 100644 index 000000000..286fd88dd --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartTimeFilter.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartTimeFilter { + private Long earliestTime; + private Long latestTime; +} diff --git a/src/main/java/com/uber/cadence/entities/StartTimerDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/StartTimerDecisionAttributes.java new file mode 100644 index 000000000..ec3eecfe1 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartTimerDecisionAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartTimerDecisionAttributes { + private String timerId; + private Long startToFireTimeoutSeconds; +} diff --git a/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java new file mode 100644 index 000000000..8a62b4430 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncRequest.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartWorkflowExecutionAsyncRequest { + private StartWorkflowExecutionRequest request; +} diff --git a/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java new file mode 100644 index 000000000..b0f200dbb --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionAsyncResponse.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartWorkflowExecutionAsyncResponse {} diff --git a/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionRequest.java new file mode 100644 index 000000000..1a9d1c659 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionRequest.java @@ -0,0 +1,37 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartWorkflowExecutionRequest { + private String domain; + private String workflowId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private String requestId; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private Memo memo; + private SearchAttributes searchAttributes; + private Header header; + private int delayStartSeconds; + private RetryPolicy retryPolicy; + private String cronSchedule; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionResponse.java b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionResponse.java new file mode 100644 index 000000000..758c88ac9 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StartWorkflowExecutionResponse.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StartWorkflowExecutionResponse { + private String runId; +} diff --git a/src/main/java/com/uber/cadence/entities/StatusFilter.java b/src/main/java/com/uber/cadence/entities/StatusFilter.java new file mode 100644 index 000000000..becf76b07 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StatusFilter.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StatusFilter { + private WorkflowExecutionCloseStatus status; +} diff --git a/src/main/java/com/uber/cadence/entities/StickyExecutionAttributes.java b/src/main/java/com/uber/cadence/entities/StickyExecutionAttributes.java new file mode 100644 index 000000000..04ae03fdf --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/StickyExecutionAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class StickyExecutionAttributes { + private TaskList workerTaskList; + private Integer scheduleToStartTimeoutSeconds; +} diff --git a/src/main/java/com/uber/cadence/entities/SupportedClientVersions.java b/src/main/java/com/uber/cadence/entities/SupportedClientVersions.java new file mode 100644 index 000000000..bb0d3bf0e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/SupportedClientVersions.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class SupportedClientVersions { + private String goSdk; + private String javaSdk; + private String cli; + private String ui; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskIDBlock.java b/src/main/java/com/uber/cadence/entities/TaskIDBlock.java new file mode 100644 index 000000000..98d4b4c5a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskIDBlock.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TaskIDBlock { + private Long startID; + private Long endID; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskList.java b/src/main/java/com/uber/cadence/entities/TaskList.java new file mode 100644 index 000000000..f47790edc --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskList.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TaskList { + private String name; + private TaskListKind kind; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskListKind.java b/src/main/java/com/uber/cadence/entities/TaskListKind.java new file mode 100644 index 000000000..a5d74dbd3 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskListKind.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum TaskListKind { + NORMAL, + STICKY +} diff --git a/src/main/java/com/uber/cadence/entities/TaskListMetadata.java b/src/main/java/com/uber/cadence/entities/TaskListMetadata.java new file mode 100644 index 000000000..89dcd8754 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskListMetadata.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TaskListMetadata { + private double maxTasksPerSecond; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskListPartitionMetadata.java b/src/main/java/com/uber/cadence/entities/TaskListPartitionMetadata.java new file mode 100644 index 000000000..3edd9fd8c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskListPartitionMetadata.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TaskListPartitionMetadata { + private String key; + private String ownerHostName; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskListStatus.java b/src/main/java/com/uber/cadence/entities/TaskListStatus.java new file mode 100644 index 000000000..631f6aee3 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskListStatus.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TaskListStatus { + private Long backlogCountHint; + private Long readLevel; + private Long ackLevel; + private double ratePerSecond; + private TaskIDBlock taskIDBlock; +} diff --git a/src/main/java/com/uber/cadence/entities/TaskListType.java b/src/main/java/com/uber/cadence/entities/TaskListType.java new file mode 100644 index 000000000..36ae57afc --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TaskListType.java @@ -0,0 +1,20 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum TaskListType { + Decision, + Activity +} diff --git a/src/main/java/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java b/src/main/java/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java new file mode 100644 index 000000000..28f7f67c6 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TerminateWorkflowExecutionRequest.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TerminateWorkflowExecutionRequest { + private String domain; + private WorkflowExecution workflowExecution; + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/TimeoutType.java b/src/main/java/com/uber/cadence/entities/TimeoutType.java new file mode 100644 index 000000000..7b5748f1d --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TimeoutType.java @@ -0,0 +1,30 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** TimeoutType represents the type of timeout in a workflow. */ +public enum TimeoutType { + /** Timeout from start to close. */ + START_TO_CLOSE, + + /** Timeout from schedule to start. */ + SCHEDULE_TO_START, + + /** Timeout from schedule to close. */ + SCHEDULE_TO_CLOSE, + + /** Timeout for heartbeat. */ + HEARTBEAT +} diff --git a/src/main/java/com/uber/cadence/entities/TimerCanceledEventAttributes.java b/src/main/java/com/uber/cadence/entities/TimerCanceledEventAttributes.java new file mode 100644 index 000000000..85fd04e28 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TimerCanceledEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TimerCanceledEventAttributes { + private String timerId; + private Long startedEventId; + private Long decisionTaskCompletedEventId; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/TimerFiredEventAttributes.java b/src/main/java/com/uber/cadence/entities/TimerFiredEventAttributes.java new file mode 100644 index 000000000..7e8235cb2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TimerFiredEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TimerFiredEventAttributes { + private String timerId; + private Long startedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/TimerStartedEventAttributes.java b/src/main/java/com/uber/cadence/entities/TimerStartedEventAttributes.java new file mode 100644 index 000000000..8f70a1796 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/TimerStartedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class TimerStartedEventAttributes { + private String timerId; + private int startToFireTimeoutSeconds; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/UpdateDomainInfo.java b/src/main/java/com/uber/cadence/entities/UpdateDomainInfo.java new file mode 100644 index 000000000..e0c27af03 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/UpdateDomainInfo.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class UpdateDomainInfo { + private String description; + private String ownerEmail; + private Map data; +} diff --git a/src/main/java/com/uber/cadence/entities/UpdateDomainRequest.java b/src/main/java/com/uber/cadence/entities/UpdateDomainRequest.java new file mode 100644 index 000000000..d700ce6df --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/UpdateDomainRequest.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class UpdateDomainRequest { + private String name; + private String securityToken; + private UpdateDomainInfo updatedInfo; + private DomainConfiguration configuration; + private String deleteBadBinary; + private int failoverTimeoutInSeconds; +} diff --git a/src/main/java/com/uber/cadence/entities/UpdateDomainResponse.java b/src/main/java/com/uber/cadence/entities/UpdateDomainResponse.java new file mode 100644 index 000000000..7415d0cbb --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/UpdateDomainResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class UpdateDomainResponse { + private DomainInfo domainInfo; + private DomainConfiguration configuration; + private DomainReplicationConfiguration replicationConfiguration; + private Long failoverVersion; + private Boolean isGlobalDomain; +} diff --git a/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java b/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java new file mode 100644 index 000000000..a2d2e2445 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesDecisionAttributes.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class UpsertWorkflowSearchAttributesDecisionAttributes { + private SearchAttributes searchAttributes; +} diff --git a/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java b/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java new file mode 100644 index 000000000..85021fc2a --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/UpsertWorkflowSearchAttributesEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class UpsertWorkflowSearchAttributesEventAttributes { + private Long decisionTaskCompletedEventId; + private SearchAttributes searchAttributes; +} diff --git a/src/main/java/com/uber/cadence/entities/VersionHistory.java b/src/main/java/com/uber/cadence/entities/VersionHistory.java new file mode 100644 index 000000000..ef00d0ea7 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/VersionHistory.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.List; +import lombok.Data; + +@Data +public class VersionHistory { + private byte[] branchToken; + private List items; +} diff --git a/src/main/java/com/uber/cadence/entities/VersionHistoryItem.java b/src/main/java/com/uber/cadence/entities/VersionHistoryItem.java new file mode 100644 index 000000000..b849c23fa --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/VersionHistoryItem.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class VersionHistoryItem { + private Long eventId; + private Long version; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkerVersionInfo.java b/src/main/java/com/uber/cadence/entities/WorkerVersionInfo.java new file mode 100644 index 000000000..199585225 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkerVersionInfo.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkerVersionInfo { + private String impl; + private String featureVersion; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecution.java b/src/main/java/com/uber/cadence/entities/WorkflowExecution.java new file mode 100644 index 000000000..b847aa733 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecution.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecution { + private String workflowId; + private String runId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java new file mode 100644 index 000000000..f9c6c41fe --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCancelRequestedEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionCancelRequestedEventAttributes { + private String cause; + private Long externalInitiatedEventId; + private WorkflowExecution externalWorkflowExecution; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java new file mode 100644 index 000000000..19ea3cd09 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCanceledEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionCanceledEventAttributes { + private Long decisionTaskCompletedEventId; + private byte[] details; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java new file mode 100644 index 000000000..b7b3fb433 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCloseStatus.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +/** WorkflowExecutionCloseStatus represents the status of a workflow execution when it is closed. */ +public enum WorkflowExecutionCloseStatus { + COMPLETED, + FAILED, + CANCELED, + TERMINATED, + CONTINUED_AS_NEW, + TIMED_OUT +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java new file mode 100644 index 000000000..2600fc7aa --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionCompletedEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionCompletedEventAttributes { + private byte[] result; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionConfiguration.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionConfiguration.java new file mode 100644 index 000000000..33db634bd --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionConfiguration.java @@ -0,0 +1,27 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionConfiguration { + private TaskList taskList; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private ChildPolicy childPolicy; + private WorkflowIdReusePolicy workflowIdReusePolicy; + private RetryPolicy retryPolicy; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java new file mode 100644 index 000000000..0a8b13fb5 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionContinuedAsNewEventAttributes.java @@ -0,0 +1,36 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionContinuedAsNewEventAttributes { + private String newExecutionRunId; + private WorkflowType workflowType; + private TaskList taskList; + private byte[] input; + private Integer executionStartToCloseTimeoutSeconds; + private Integer taskStartToCloseTimeoutSeconds; + private Long decisionTaskCompletedEventId; + private Integer backoffStartIntervalInSeconds; + private ContinueAsNewInitiator initiator; + private String failureReason; + private byte[] failureDetails; + private byte[] lastCompletionResult; + private Header header; + private Memo memo; + private SearchAttributes searchAttributes; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java new file mode 100644 index 000000000..3f84078ee --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionFailedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionFailedEventAttributes { + private String reason; + private byte[] details; + private Long decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionFilter.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionFilter.java new file mode 100644 index 000000000..f3a58d812 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionFilter.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionFilter { + private String workflowId; + private String runId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionInfo.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionInfo.java new file mode 100644 index 000000000..af68b9354 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionInfo.java @@ -0,0 +1,36 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionInfo { + private WorkflowExecution execution; + private WorkflowType type; + private Long startTime; + private Long closeTime; + private WorkflowExecutionCloseStatus closeStatus; + private Long historyLength; + private String parentDomainName; + private String parentDomainId; + private WorkflowExecution parentExecution; + private Long executionTime; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints autoResetPoints; + private String taskList; + private Boolean isCron; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java new file mode 100644 index 000000000..de6fe64fc --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionSignaledEventAttributes.java @@ -0,0 +1,25 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionSignaledEventAttributes { + private String signalName; + private byte[] input; + private String identity; + private String requestId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java new file mode 100644 index 000000000..266ee6b2e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionStartedEventAttributes.java @@ -0,0 +1,50 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import java.util.Map; +import lombok.Data; + +@Data +public class WorkflowExecutionStartedEventAttributes { + private WorkflowType workflowType; + private String parentWorkflowDomain; + private WorkflowExecution parentWorkflowExecution; + private Long parentInitiatedEventId; + private TaskList taskList; + private byte[] input; + private int executionStartToCloseTimeoutSeconds; + private int taskStartToCloseTimeoutSeconds; + private String continuedExecutionRunId; + private ContinueAsNewInitiator initiator; + private String continuedFailureReason; + private byte[] continuedFailureDetails; + private byte[] lastCompletionResult; + private String originalExecutionRunId; + private String identity; + private String firstExecutionRunId; + private Long firstScheduledTimeNano; + private RetryPolicy retryPolicy; + private int attempt; + private Long expirationTimestamp; + private String cronSchedule; + private int firstDecisionTaskBackoffSeconds; + private Memo memo; + private SearchAttributes searchAttributes; + private ResetPoints prevAutoResetPoints; + private Header header; + private Map partitionConfig; + private String requestId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java new file mode 100644 index 000000000..a1e57d91b --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionTerminatedEventAttributes.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionTerminatedEventAttributes { + private String reason; + private byte[] details; + private String identity; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java b/src/main/java/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java new file mode 100644 index 000000000..d954d4cee --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowExecutionTimedOutEventAttributes.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowExecutionTimedOutEventAttributes { + private TimeoutType timeoutType; + private Integer decisionTaskCompletedEventId; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowIdReusePolicy.java b/src/main/java/com/uber/cadence/entities/WorkflowIdReusePolicy.java new file mode 100644 index 000000000..54ea2f5e2 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowIdReusePolicy.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +public enum WorkflowIdReusePolicy { + AllowDuplicateFailedOnly, + AllowDuplicate, + RejectDuplicate, + TerminateIfRunning; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowQuery.java b/src/main/java/com/uber/cadence/entities/WorkflowQuery.java new file mode 100644 index 000000000..31bccea52 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowQuery.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowQuery { + private String queryType; + private byte[] queryArgs; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowQueryResult.java b/src/main/java/com/uber/cadence/entities/WorkflowQueryResult.java new file mode 100644 index 000000000..90c4c550c --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowQueryResult.java @@ -0,0 +1,24 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowQueryResult { + private QueryResultType resultType; + private byte[] answer; + private String errorMessage; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowType.java b/src/main/java/com/uber/cadence/entities/WorkflowType.java new file mode 100644 index 000000000..5df89275e --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowType.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowType { + private String name; +} diff --git a/src/main/java/com/uber/cadence/entities/WorkflowTypeFilter.java b/src/main/java/com/uber/cadence/entities/WorkflowTypeFilter.java new file mode 100644 index 000000000..6812461f8 --- /dev/null +++ b/src/main/java/com/uber/cadence/entities/WorkflowTypeFilter.java @@ -0,0 +1,22 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.entities; + +import lombok.Data; + +@Data +public class WorkflowTypeFilter { + private String name; +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java new file mode 100644 index 000000000..71ca1b14f --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/DecisionMapper.java @@ -0,0 +1,274 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.continueAsNewInitiator; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.longToInt; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failure; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowRunPair; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; + +import com.uber.cadence.api.v1.CancelTimerDecisionAttributes; +import com.uber.cadence.api.v1.CancelWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.CompleteWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.ContinueAsNewWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.Decision; +import com.uber.cadence.api.v1.Decision.Builder; +import com.uber.cadence.api.v1.FailWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.RecordMarkerDecisionAttributes; +import com.uber.cadence.api.v1.RequestCancelActivityTaskDecisionAttributes; +import com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.ScheduleActivityTaskDecisionAttributes; +import com.uber.cadence.api.v1.SignalExternalWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.StartChildWorkflowExecutionDecisionAttributes; +import com.uber.cadence.api.v1.StartTimerDecisionAttributes; +import com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesDecisionAttributes; +import java.util.ArrayList; +import java.util.List; + +class DecisionMapper { + static List decisionArray(List t) { + if (t == null) { + return null; + } + + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(decision(t.get(i))); + } + return v; + } + + static Decision decision(com.uber.cadence.entities.Decision d) { + if (d == null) { + return null; + } + Builder decision = Decision.newBuilder(); + switch (d.getDecisionType()) { + case ScheduleActivityTask: + { + com.uber.cadence.entities.ScheduleActivityTaskDecisionAttributes attr = + d.getScheduleActivityTaskDecisionAttributes(); + ScheduleActivityTaskDecisionAttributes.Builder builder = + ScheduleActivityTaskDecisionAttributes.newBuilder() + .setActivityId(attr.getActivityId()) + .setActivityType(activityType(attr.getActivityType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setScheduleToCloseTimeout( + secondsToDuration(attr.getScheduleToCloseTimeoutSeconds())) + .setScheduleToStartTimeout( + secondsToDuration(attr.getScheduleToStartTimeoutSeconds())) + .setStartToCloseTimeout(secondsToDuration(attr.getStartToCloseTimeoutSeconds())) + .setHeartbeatTimeout(secondsToDuration(attr.getHeartbeatTimeoutSeconds())) + .setHeader(header(attr.getHeader())) + .setRequestLocalDispatch(attr.isRequestLocalDispatch()); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getDomain() != null) { + builder.setDomain(attr.getDomain()); + } + decision.setScheduleActivityTaskDecisionAttributes(builder); + } + break; + case RequestCancelActivityTask: + { + com.uber.cadence.entities.RequestCancelActivityTaskDecisionAttributes attr = + d.getRequestCancelActivityTaskDecisionAttributes(); + decision.setRequestCancelActivityTaskDecisionAttributes( + RequestCancelActivityTaskDecisionAttributes.newBuilder() + .setActivityId(attr.getActivityId())); + } + break; + case StartTimer: + { + com.uber.cadence.entities.StartTimerDecisionAttributes attr = + d.getStartTimerDecisionAttributes(); + decision.setStartTimerDecisionAttributes( + StartTimerDecisionAttributes.newBuilder() + .setTimerId(attr.getTimerId()) + .setStartToFireTimeout( + secondsToDuration(longToInt(attr.getStartToFireTimeoutSeconds())))); + } + break; + case CompleteWorkflowExecution: + { + com.uber.cadence.entities.CompleteWorkflowExecutionDecisionAttributes attr = + d.getCompleteWorkflowExecutionDecisionAttributes(); + decision.setCompleteWorkflowExecutionDecisionAttributes( + CompleteWorkflowExecutionDecisionAttributes.newBuilder() + .setResult(payload(attr.getResult()))); + } + break; + case FailWorkflowExecution: + { + com.uber.cadence.entities.FailWorkflowExecutionDecisionAttributes attr = + d.getFailWorkflowExecutionDecisionAttributes(); + decision.setFailWorkflowExecutionDecisionAttributes( + FailWorkflowExecutionDecisionAttributes.newBuilder() + .setFailure(failure(attr.getReason(), attr.getDetails()))); + } + break; + case CancelTimer: + { + com.uber.cadence.entities.CancelTimerDecisionAttributes attr = + d.getCancelTimerDecisionAttributes(); + decision.setCancelTimerDecisionAttributes( + CancelTimerDecisionAttributes.newBuilder().setTimerId(attr.getTimerId())); + } + break; + case CancelWorkflowExecution: + { + com.uber.cadence.entities.CancelWorkflowExecutionDecisionAttributes attr = + d.getCancelWorkflowExecutionDecisionAttributes(); + decision.setCancelWorkflowExecutionDecisionAttributes( + CancelWorkflowExecutionDecisionAttributes.newBuilder() + .setDetails(payload(attr.getDetails()))); + } + break; + case RequestCancelExternalWorkflowExecution: + { + com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionDecisionAttributes attr = + d.getRequestCancelExternalWorkflowExecutionDecisionAttributes(); + RequestCancelExternalWorkflowExecutionDecisionAttributes.Builder builder = + RequestCancelExternalWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowExecution(workflowRunPair(attr.getWorkflowId(), attr.getRunId())) + .setChildWorkflowOnly(attr.isChildWorkflowOnly()); + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + decision.setRequestCancelExternalWorkflowExecutionDecisionAttributes(builder); + } + break; + case ContinueAsNewWorkflowExecution: + { + com.uber.cadence.entities.ContinueAsNewWorkflowExecutionDecisionAttributes attr = + d.getContinueAsNewWorkflowExecutionDecisionAttributes(); + ContinueAsNewWorkflowExecutionDecisionAttributes.Builder builder = + ContinueAsNewWorkflowExecutionDecisionAttributes.newBuilder() + .setWorkflowType(workflowType(attr.getWorkflowType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(attr.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout( + secondsToDuration(attr.getTaskStartToCloseTimeoutSeconds())) + .setBackoffStartInterval( + secondsToDuration(attr.getBackoffStartIntervalInSeconds())) + .setInitiator(continueAsNewInitiator(attr.getInitiator())) + .setFailure(failure(attr.getFailureReason(), attr.getFailureDetails())) + .setLastCompletionResult(payload(attr.getLastCompletionResult())) + .setHeader(header(attr.getHeader())) + .setMemo(memo(attr.getMemo())) + .setSearchAttributes(searchAttributes(attr.getSearchAttributes())); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getCronSchedule() != null) { + builder.setCronSchedule(attr.getCronSchedule()); + } + decision.setContinueAsNewWorkflowExecutionDecisionAttributes(builder); + } + break; + case StartChildWorkflowExecution: + { + com.uber.cadence.entities.StartChildWorkflowExecutionDecisionAttributes attr = + d.getStartChildWorkflowExecutionDecisionAttributes(); + StartChildWorkflowExecutionDecisionAttributes.Builder builder = + StartChildWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowId(attr.getWorkflowId()) + .setWorkflowType(workflowType(attr.getWorkflowType())) + .setTaskList(taskList(attr.getTaskList())) + .setInput(payload(attr.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(attr.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout( + secondsToDuration(attr.getTaskStartToCloseTimeoutSeconds())) + .setParentClosePolicy(parentClosePolicy(attr.getParentClosePolicy())) + .setWorkflowIdReusePolicy(workflowIdReusePolicy(attr.getWorkflowIdReusePolicy())) + .setHeader(header(attr.getHeader())) + .setMemo(memo(attr.getMemo())) + .setSearchAttributes(searchAttributes(attr.getSearchAttributes())); + if (attr.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(attr.getRetryPolicy())); + } + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + if (attr.getCronSchedule() != null) { + builder.setCronSchedule(attr.getCronSchedule()); + } + decision.setStartChildWorkflowExecutionDecisionAttributes(builder); + } + break; + case SignalExternalWorkflowExecution: + { + com.uber.cadence.entities.SignalExternalWorkflowExecutionDecisionAttributes attr = + d.getSignalExternalWorkflowExecutionDecisionAttributes(); + SignalExternalWorkflowExecutionDecisionAttributes.Builder builder = + SignalExternalWorkflowExecutionDecisionAttributes.newBuilder() + .setDomain(attr.getDomain()) + .setWorkflowExecution(workflowExecution(attr.getExecution())) + .setSignalName(attr.getSignalName()) + .setInput(payload(attr.getInput())) + .setChildWorkflowOnly(attr.isChildWorkflowOnly()); + if (attr.getControl() != null) { + builder.setControl(arrayToByteString(attr.getControl())); + } + decision.setSignalExternalWorkflowExecutionDecisionAttributes(builder); + } + break; + case UpsertWorkflowSearchAttributes: + { + com.uber.cadence.entities.UpsertWorkflowSearchAttributesDecisionAttributes attr = + d.getUpsertWorkflowSearchAttributesDecisionAttributes(); + decision.setUpsertWorkflowSearchAttributesDecisionAttributes( + UpsertWorkflowSearchAttributesDecisionAttributes.newBuilder() + .setSearchAttributes(searchAttributes(attr.getSearchAttributes()))); + } + break; + case RecordMarker: + { + com.uber.cadence.entities.RecordMarkerDecisionAttributes attr = + d.getRecordMarkerDecisionAttributes(); + decision.setRecordMarkerDecisionAttributes( + RecordMarkerDecisionAttributes.newBuilder() + .setMarkerName(attr.getMarkerName()) + .setDetails(payload(attr.getDetails())) + .setHeader(header(attr.getHeader()))); + } + break; + default: + throw new IllegalArgumentException("unknown decision type"); + } + return decision.build(); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java new file mode 100644 index 000000000..9970aa889 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/EnumMapper.java @@ -0,0 +1,599 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_BINARY; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_INVALID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION; +import static com.uber.cadence.api.v1.DecisionTaskFailedCause.DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_ANSWERED; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_FAILED; +import static com.uber.cadence.api.v1.QueryResultType.QUERY_RESULT_TYPE_INVALID; + +import com.uber.cadence.api.v1.*; + +public final class EnumMapper { + + private EnumMapper() {} + + public static TaskListKind taskListKind(com.uber.cadence.entities.TaskListKind t) { + if (t == null) { + return TaskListKind.TASK_LIST_KIND_INVALID; + } + switch (t) { + case NORMAL: + return TaskListKind.TASK_LIST_KIND_NORMAL; + case STICKY: + return TaskListKind.TASK_LIST_KIND_STICKY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static TaskListType taskListType(com.uber.cadence.entities.TaskListType t) { + if (t == null) { + return TaskListType.TASK_LIST_TYPE_INVALID; + } + switch (t) { + case Decision: + return TaskListType.TASK_LIST_TYPE_DECISION; + case Activity: + return TaskListType.TASK_LIST_TYPE_ACTIVITY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static EventFilterType eventFilterType( + com.uber.cadence.entities.HistoryEventFilterType t) { + if (t == null) { + return EventFilterType.EVENT_FILTER_TYPE_INVALID; + } + switch (t) { + case ALL_EVENT: + return EventFilterType.EVENT_FILTER_TYPE_ALL_EVENT; + case CLOSE_EVENT: + return EventFilterType.EVENT_FILTER_TYPE_CLOSE_EVENT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryRejectCondition queryRejectCondition( + com.uber.cadence.entities.QueryRejectCondition t) { + if (t == null) { + return QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID; + } + switch (t) { + case NOT_OPEN: + return QueryRejectCondition.QUERY_REJECT_CONDITION_NOT_OPEN; + case NOT_COMPLETED_CLEANLY: + return QueryRejectCondition.QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryConsistencyLevel queryConsistencyLevel( + com.uber.cadence.entities.QueryConsistencyLevel t) { + if (t == null) { + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_INVALID; + } + switch (t) { + case EVENTUAL: + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_EVENTUAL; + case STRONG: + return QueryConsistencyLevel.QUERY_CONSISTENCY_LEVEL_STRONG; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ContinueAsNewInitiator continueAsNewInitiator( + com.uber.cadence.entities.ContinueAsNewInitiator t) { + if (t == null) { + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_INVALID; + } + switch (t) { + case Decider: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_DECIDER; + case RetryPolicy: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY; + case CronSchedule: + return ContinueAsNewInitiator.CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static WorkflowIdReusePolicy workflowIdReusePolicy( + com.uber.cadence.entities.WorkflowIdReusePolicy t) { + if (t == null) { + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_INVALID; + } + switch (t) { + case AllowDuplicateFailedOnly: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY; + case AllowDuplicate: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE; + case RejectDuplicate: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE; + case TerminateIfRunning: + return WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryResultType queryResultType(com.uber.cadence.entities.QueryResultType t) { + if (t == null) { + return QUERY_RESULT_TYPE_INVALID; + } + switch (t) { + case ANSWERED: + return QUERY_RESULT_TYPE_ANSWERED; + case FAILED: + return QUERY_RESULT_TYPE_FAILED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ArchivalStatus archivalStatus(com.uber.cadence.entities.ArchivalStatus t) { + if (t == null) { + return ArchivalStatus.ARCHIVAL_STATUS_INVALID; + } + switch (t) { + case DISABLED: + return ArchivalStatus.ARCHIVAL_STATUS_DISABLED; + case ENABLED: + return ArchivalStatus.ARCHIVAL_STATUS_ENABLED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static ParentClosePolicy parentClosePolicy(com.uber.cadence.entities.ParentClosePolicy t) { + if (t == null) { + return ParentClosePolicy.PARENT_CLOSE_POLICY_INVALID; + } + switch (t) { + case ABANDON: + return ParentClosePolicy.PARENT_CLOSE_POLICY_ABANDON; + case REQUEST_CANCEL: + return ParentClosePolicy.PARENT_CLOSE_POLICY_REQUEST_CANCEL; + case TERMINATE: + return ParentClosePolicy.PARENT_CLOSE_POLICY_TERMINATE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static DecisionTaskFailedCause decisionTaskFailedCause( + com.uber.cadence.entities.DecisionTaskFailedCause t) { + if (t == null) { + return DECISION_TASK_FAILED_CAUSE_INVALID; + } + switch (t) { + case UNHANDLED_DECISION: + return DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION; + case BAD_SCHEDULE_ACTIVITY_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; + case BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; + case BAD_START_TIMER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES; + case BAD_CANCEL_TIMER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES; + case BAD_RECORD_MARKER_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES; + case BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_CONTINUE_AS_NEW_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES; + case START_TIMER_DUPLICATE_ID: + return DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID; + case RESET_STICKY_TASKLIST: + return DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST; + case WORKFLOW_WORKER_UNHANDLED_FAILURE: + return DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE; + case BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case BAD_START_CHILD_EXECUTION_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES; + case FORCE_CLOSE_DECISION: + return DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION; + case FAILOVER_CLOSE_DECISION: + return DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION; + case BAD_SIGNAL_INPUT_SIZE: + return DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE; + case RESET_WORKFLOW: + return DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW; + case BAD_BINARY: + return DECISION_TASK_FAILED_CAUSE_BAD_BINARY; + case SCHEDULE_ACTIVITY_DUPLICATE_ID: + return DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID; + case BAD_SEARCH_ATTRIBUTES: + return DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static WorkflowExecutionCloseStatus workflowExecutionCloseStatus( + com.uber.cadence.entities.WorkflowExecutionCloseStatus t) { + if (t == null) { + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID; + } + switch (t) { + case COMPLETED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED; + case FAILED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED; + case CANCELED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED; + case TERMINATED: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED; + case CONTINUED_AS_NEW: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW; + case TIMED_OUT: + return WorkflowExecutionCloseStatus.WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static QueryResultType queryTaskCompletedType( + com.uber.cadence.entities.QueryTaskCompletedType t) { + if (t == null) { + return QUERY_RESULT_TYPE_INVALID; + } + switch (t) { + case COMPLETED: + return QUERY_RESULT_TYPE_ANSWERED; + case FAILED: + return QUERY_RESULT_TYPE_FAILED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.TaskListKind taskListKind(TaskListKind t) { + switch (t) { + case TASK_LIST_KIND_INVALID: + return null; + case TASK_LIST_KIND_NORMAL: + return com.uber.cadence.entities.TaskListKind.NORMAL; + case TASK_LIST_KIND_STICKY: + return com.uber.cadence.entities.TaskListKind.STICKY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.QueryRejectCondition queryRejectCondition( + QueryRejectCondition t) { + if (t == QueryRejectCondition.QUERY_REJECT_CONDITION_INVALID) { + return null; + } + switch (t) { + case QUERY_REJECT_CONDITION_NOT_OPEN: + return com.uber.cadence.entities.QueryRejectCondition.NOT_OPEN; + case QUERY_REJECT_CONDITION_NOT_COMPLETED_CLEANLY: + return com.uber.cadence.entities.QueryRejectCondition.NOT_COMPLETED_CLEANLY; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.ContinueAsNewInitiator continueAsNewInitiator( + ContinueAsNewInitiator t) { + switch (t) { + case CONTINUE_AS_NEW_INITIATOR_INVALID: + return null; + case CONTINUE_AS_NEW_INITIATOR_DECIDER: + return com.uber.cadence.entities.ContinueAsNewInitiator.Decider; + case CONTINUE_AS_NEW_INITIATOR_RETRY_POLICY: + return com.uber.cadence.entities.ContinueAsNewInitiator.RetryPolicy; + case CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE: + return com.uber.cadence.entities.ContinueAsNewInitiator.CronSchedule; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.WorkflowIdReusePolicy workflowIdReusePolicy( + WorkflowIdReusePolicy t) { + switch (t) { + case WORKFLOW_ID_REUSE_POLICY_INVALID: + return null; + case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: + return com.uber.cadence.entities.WorkflowIdReusePolicy.AllowDuplicateFailedOnly; + case WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: + return com.uber.cadence.entities.WorkflowIdReusePolicy.AllowDuplicate; + case WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: + return com.uber.cadence.entities.WorkflowIdReusePolicy.RejectDuplicate; + case WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: + return com.uber.cadence.entities.WorkflowIdReusePolicy.TerminateIfRunning; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.ArchivalStatus archivalStatus(ArchivalStatus t) { + switch (t) { + case ARCHIVAL_STATUS_INVALID: + return null; + case ARCHIVAL_STATUS_DISABLED: + return com.uber.cadence.entities.ArchivalStatus.DISABLED; + case ARCHIVAL_STATUS_ENABLED: + return com.uber.cadence.entities.ArchivalStatus.ENABLED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.ParentClosePolicy parentClosePolicy(ParentClosePolicy t) { + switch (t) { + case PARENT_CLOSE_POLICY_INVALID: + return null; + case PARENT_CLOSE_POLICY_ABANDON: + return com.uber.cadence.entities.ParentClosePolicy.ABANDON; + case PARENT_CLOSE_POLICY_REQUEST_CANCEL: + return com.uber.cadence.entities.ParentClosePolicy.REQUEST_CANCEL; + case PARENT_CLOSE_POLICY_TERMINATE: + return com.uber.cadence.entities.ParentClosePolicy.TERMINATE; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.DecisionTaskFailedCause decisionTaskFailedCause( + DecisionTaskFailedCause t) { + switch (t) { + case DECISION_TASK_FAILED_CAUSE_INVALID: + return null; + case DECISION_TASK_FAILED_CAUSE_UNHANDLED_DECISION: + return com.uber.cadence.entities.DecisionTaskFailedCause.UNHANDLED_DECISION; + case DECISION_TASK_FAILED_CAUSE_BAD_SCHEDULE_ACTIVITY_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_SCHEDULE_ACTIVITY_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_START_TIMER_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_START_TIMER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_TIMER_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_CANCEL_TIMER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_RECORD_MARKER_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_RECORD_MARKER_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_CONTINUE_AS_NEW_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_CONTINUE_AS_NEW_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_START_TIMER_DUPLICATE_ID: + return com.uber.cadence.entities.DecisionTaskFailedCause.START_TIMER_DUPLICATE_ID; + case DECISION_TASK_FAILED_CAUSE_RESET_STICKY_TASK_LIST: + return com.uber.cadence.entities.DecisionTaskFailedCause.RESET_STICKY_TASKLIST; + case DECISION_TASK_FAILED_CAUSE_WORKFLOW_WORKER_UNHANDLED_FAILURE: + return com.uber.cadence.entities.DecisionTaskFailedCause.WORKFLOW_WORKER_UNHANDLED_FAILURE; + case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_BAD_START_CHILD_EXECUTION_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause + .BAD_START_CHILD_EXECUTION_ATTRIBUTES; + case DECISION_TASK_FAILED_CAUSE_FORCE_CLOSE_DECISION: + return com.uber.cadence.entities.DecisionTaskFailedCause.FORCE_CLOSE_DECISION; + case DECISION_TASK_FAILED_CAUSE_FAILOVER_CLOSE_DECISION: + return com.uber.cadence.entities.DecisionTaskFailedCause.FAILOVER_CLOSE_DECISION; + case DECISION_TASK_FAILED_CAUSE_BAD_SIGNAL_INPUT_SIZE: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_SIGNAL_INPUT_SIZE; + case DECISION_TASK_FAILED_CAUSE_RESET_WORKFLOW: + return com.uber.cadence.entities.DecisionTaskFailedCause.RESET_WORKFLOW; + case DECISION_TASK_FAILED_CAUSE_BAD_BINARY: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_BINARY; + case DECISION_TASK_FAILED_CAUSE_SCHEDULE_ACTIVITY_DUPLICATE_ID: + return com.uber.cadence.entities.DecisionTaskFailedCause.SCHEDULE_ACTIVITY_DUPLICATE_ID; + case DECISION_TASK_FAILED_CAUSE_BAD_SEARCH_ATTRIBUTES: + return com.uber.cadence.entities.DecisionTaskFailedCause.BAD_SEARCH_ATTRIBUTES; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.WorkflowExecutionCloseStatus workflowExecutionCloseStatus( + WorkflowExecutionCloseStatus t) { + switch (t) { + case WORKFLOW_EXECUTION_CLOSE_STATUS_INVALID: + return null; + case WORKFLOW_EXECUTION_CLOSE_STATUS_COMPLETED: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.COMPLETED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_FAILED: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.FAILED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_CANCELED: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.CANCELED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_TERMINATED: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.TERMINATED; + case WORKFLOW_EXECUTION_CLOSE_STATUS_CONTINUED_AS_NEW: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.CONTINUED_AS_NEW; + case WORKFLOW_EXECUTION_CLOSE_STATUS_TIMED_OUT: + return com.uber.cadence.entities.WorkflowExecutionCloseStatus.TIMED_OUT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.DomainStatus domainStatus(DomainStatus t) { + switch (t) { + case DOMAIN_STATUS_INVALID: + return null; + case DOMAIN_STATUS_REGISTERED: + return com.uber.cadence.entities.DomainStatus.REGISTERED; + case DOMAIN_STATUS_DEPRECATED: + return com.uber.cadence.entities.DomainStatus.DEPRECATED; + case DOMAIN_STATUS_DELETED: + return com.uber.cadence.entities.DomainStatus.DELETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.PendingActivityState pendingActivityState( + PendingActivityState t) { + switch (t) { + case PENDING_ACTIVITY_STATE_INVALID: + return null; + case PENDING_ACTIVITY_STATE_SCHEDULED: + return com.uber.cadence.entities.PendingActivityState.SCHEDULED; + case PENDING_ACTIVITY_STATE_STARTED: + return com.uber.cadence.entities.PendingActivityState.STARTED; + case PENDING_ACTIVITY_STATE_CANCEL_REQUESTED: + return com.uber.cadence.entities.PendingActivityState.CANCEL_REQUESTED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.PendingDecisionState pendingDecisionState( + PendingDecisionState t) { + switch (t) { + case PENDING_DECISION_STATE_INVALID: + return null; + case PENDING_DECISION_STATE_SCHEDULED: + return com.uber.cadence.entities.PendingDecisionState.SCHEDULED; + case PENDING_DECISION_STATE_STARTED: + return com.uber.cadence.entities.PendingDecisionState.STARTED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.IndexedValueType indexedValueType(IndexedValueType t) { + switch (t) { + case INDEXED_VALUE_TYPE_INVALID: + throw new IllegalArgumentException("received IndexedValueType_INDEXED_VALUE_TYPE_INVALID"); + case INDEXED_VALUE_TYPE_STRING: + return com.uber.cadence.entities.IndexedValueType.STRING; + case INDEXED_VALUE_TYPE_KEYWORD: + return com.uber.cadence.entities.IndexedValueType.KEYWORD; + case INDEXED_VALUE_TYPE_INT: + return com.uber.cadence.entities.IndexedValueType.INT; + case INDEXED_VALUE_TYPE_DOUBLE: + return com.uber.cadence.entities.IndexedValueType.DOUBLE; + case INDEXED_VALUE_TYPE_BOOL: + return com.uber.cadence.entities.IndexedValueType.BOOL; + case INDEXED_VALUE_TYPE_DATETIME: + return com.uber.cadence.entities.IndexedValueType.DATETIME; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.EncodingType encodingType(EncodingType t) { + switch (t) { + case ENCODING_TYPE_INVALID: + return null; + case ENCODING_TYPE_THRIFTRW: + return com.uber.cadence.entities.EncodingType.ThriftRW; + case ENCODING_TYPE_JSON: + return com.uber.cadence.entities.EncodingType.JSON; + case ENCODING_TYPE_PROTO3: + throw new UnsupportedOperationException(); + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.TimeoutType timeoutType(TimeoutType t) { + switch (t) { + case TIMEOUT_TYPE_INVALID: + return null; + case TIMEOUT_TYPE_START_TO_CLOSE: + return com.uber.cadence.entities.TimeoutType.START_TO_CLOSE; + case TIMEOUT_TYPE_SCHEDULE_TO_START: + return com.uber.cadence.entities.TimeoutType.SCHEDULE_TO_START; + case TIMEOUT_TYPE_SCHEDULE_TO_CLOSE: + return com.uber.cadence.entities.TimeoutType.SCHEDULE_TO_CLOSE; + case TIMEOUT_TYPE_HEARTBEAT: + return com.uber.cadence.entities.TimeoutType.HEARTBEAT; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.DecisionTaskTimedOutCause decisionTaskTimedOutCause( + DecisionTaskTimedOutCause t) { + switch (t) { + case DECISION_TASK_TIMED_OUT_CAUSE_INVALID: + return null; + case DECISION_TASK_TIMED_OUT_CAUSE_TIMEOUT: + return com.uber.cadence.entities.DecisionTaskTimedOutCause.TIMEOUT; + case DECISION_TASK_TIMED_OUT_CAUSE_RESET: + return com.uber.cadence.entities.DecisionTaskTimedOutCause.RESET; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.CancelExternalWorkflowExecutionFailedCause + cancelExternalWorkflowExecutionFailedCause(CancelExternalWorkflowExecutionFailedCause t) { + switch (t) { + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: + return com.uber.cadence.entities.CancelExternalWorkflowExecutionFailedCause + .UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; + case CANCEL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: + return com.uber.cadence.entities.CancelExternalWorkflowExecutionFailedCause + .WORKFLOW_ALREADY_COMPLETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedCause + signalExternalWorkflowExecutionFailedCause(SignalExternalWorkflowExecutionFailedCause t) { + switch (t) { + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION: + return com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedCause + .UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION; + case SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_COMPLETED: + return com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedCause + .WORKFLOW_ALREADY_COMPLETED; + } + throw new IllegalArgumentException("unexpected enum value"); + } + + public static com.uber.cadence.entities.ChildWorkflowExecutionFailedCause + childWorkflowExecutionFailedCause(ChildWorkflowExecutionFailedCause t) { + switch (t) { + case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_INVALID: + return null; + case CHILD_WORKFLOW_EXECUTION_FAILED_CAUSE_WORKFLOW_ALREADY_RUNNING: + return com.uber.cadence.entities.ChildWorkflowExecutionFailedCause.WORKFLOW_ALREADY_RUNNING; + } + throw new IllegalArgumentException("unexpected enum value"); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java new file mode 100644 index 000000000..3832daaf7 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ErrorMapper.java @@ -0,0 +1,109 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.internal.compatibility.proto.mappers; + +import com.google.protobuf.Any; +import com.google.protobuf.InvalidProtocolBufferException; +import com.google.rpc.Status; +import com.uber.cadence.serviceclient.exceptions.AccessDeniedError; +import com.uber.cadence.serviceclient.exceptions.CancellationAlreadyRequestedError; +import com.uber.cadence.serviceclient.exceptions.ClientVersionNotSupportedError; +import com.uber.cadence.serviceclient.exceptions.DomainAlreadyExistsError; +import com.uber.cadence.serviceclient.exceptions.DomainNotActiveError; +import com.uber.cadence.serviceclient.exceptions.EntityNotExistsError; +import com.uber.cadence.serviceclient.exceptions.FeatureNotEnabledError; +import com.uber.cadence.serviceclient.exceptions.InternalDataInconsistencyError; +import com.uber.cadence.serviceclient.exceptions.InternalServiceError; +import com.uber.cadence.serviceclient.exceptions.LimitExceededError; +import com.uber.cadence.serviceclient.exceptions.ServiceBusyError; +import com.uber.cadence.serviceclient.exceptions.ServiceClientError; +import com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyStartedError; +import io.grpc.StatusRuntimeException; +import io.grpc.protobuf.StatusProto; + +public class ErrorMapper { + public static ServiceClientError Error(StatusRuntimeException e) { + + Status status = StatusProto.fromThrowable(e); + if (status == null) { + return new ServiceClientError("empty status", e); + } + + Any detail = Any.getDefaultInstance(); + if (status.getDetailsCount() > 0) { + detail = status.getDetails(0); + } + + try { + switch (e.getStatus().getCode()) { + case PERMISSION_DENIED: + return new AccessDeniedError(e); + case INTERNAL: + return new InternalServiceError(e); + case NOT_FOUND: + if (detail.is(com.uber.cadence.api.v1.WorkflowExecutionAlreadyCompletedError.class)) { + return new WorkflowExecutionAlreadyCompletedError(e); + } else { + return new EntityNotExistsError(e); + } + case ALREADY_EXISTS: + if (detail.is(com.uber.cadence.api.v1.CancellationAlreadyRequestedError.class)) { + return new CancellationAlreadyRequestedError(e); + } else if (detail.is(com.uber.cadence.api.v1.DomainAlreadyExistsError.class)) { + return new DomainAlreadyExistsError(e); + } else if (detail.is( + com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError.class)) { + com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError error = + detail.unpack(com.uber.cadence.api.v1.WorkflowExecutionAlreadyStartedError.class); + return new WorkflowExecutionAlreadyStartedError( + error.getStartRequestId(), error.getRunId()); + } + case DATA_LOSS: + return new InternalDataInconsistencyError(e); + case FAILED_PRECONDITION: + if (detail.is(com.uber.cadence.api.v1.ClientVersionNotSupportedError.class)) { + com.uber.cadence.api.v1.ClientVersionNotSupportedError error = + detail.unpack(com.uber.cadence.api.v1.ClientVersionNotSupportedError.class); + return new ClientVersionNotSupportedError( + error.getFeatureVersion(), error.getClientImpl(), error.getSupportedVersions()); + } else if (detail.is(com.uber.cadence.api.v1.FeatureNotEnabledError.class)) { + com.uber.cadence.api.v1.FeatureNotEnabledError error = + detail.unpack(com.uber.cadence.api.v1.FeatureNotEnabledError.class); + return new FeatureNotEnabledError(error.getFeatureFlag()); + } else if (detail.is(com.uber.cadence.api.v1.DomainNotActiveError.class)) { + com.uber.cadence.api.v1.DomainNotActiveError error = + detail.unpack(com.uber.cadence.api.v1.DomainNotActiveError.class); + return new DomainNotActiveError( + error.getDomain(), error.getCurrentCluster(), error.getActiveCluster()); + } + case RESOURCE_EXHAUSTED: + if (detail.is(com.uber.cadence.api.v1.LimitExceededError.class)) { + return new LimitExceededError(e); + } else { + return new ServiceBusyError(e); + } + case UNKNOWN: + default: + return new ServiceClientError(e); + } + } catch (InvalidProtocolBufferException ex) { + return new ServiceClientError(ex); + } + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java new file mode 100644 index 000000000..8128fbc66 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/Helpers.java @@ -0,0 +1,99 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import com.google.common.base.MoreObjects; +import com.google.common.base.Strings; +import com.google.protobuf.ByteString; +import com.google.protobuf.DoubleValue; +import com.google.protobuf.Duration; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Int64Value; +import com.google.protobuf.Timestamp; +import com.google.protobuf.util.Durations; +import com.google.protobuf.util.Timestamps; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +class Helpers { + + static DoubleValue fromDoubleValue(double v) { + return DoubleValue.newBuilder().setValue(v).build(); + } + + static Timestamp unixNanoToTime(long t) { + return Timestamps.fromNanos(t); + } + + static Duration secondsToDuration(int d) { + return Duration.newBuilder().setSeconds(d).build(); + } + + static int longToInt(long v) { + return (int) v; + } + + static FieldMask newFieldMask(List fields) { + return FieldMask.newBuilder().addAllPaths(fields).build(); + } + + static Duration daysToDuration(int days) { + return Durations.fromDays(days); + } + + static Map nullToEmpty(Map t) { + return MoreObjects.firstNonNull(t, Collections.emptyMap()); + } + + static String nullToEmpty(String t) { + return Strings.nullToEmpty(t); + } + + static boolean nullToEmpty(boolean t) { + return MoreObjects.firstNonNull(t, false); + } + + static ByteString arrayToByteString(byte[] t) { + if (t == null) { + return null; + } + return ByteString.copyFrom(t); + } + + static long toInt64Value(Int64Value v) { + return v.getValue(); + } + + static long timeToUnixNano(Timestamp t) { + return Timestamps.toNanos(t); + } + + static int durationToDays(Duration d) { + return (int) Durations.toDays(d); + } + + static int durationToSeconds(Duration d) { + return (int) Durations.toSeconds(d); + } + + static byte[] byteStringToArray(ByteString t) { + if (t == null || t.size() == 0) { + return null; + } + return t.toByteArray(); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java new file mode 100644 index 000000000..e0f27e1a3 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/HistoryMapper.java @@ -0,0 +1,1140 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.entities.EventType.*; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.cancelExternalWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.childWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.continueAsNewInitiator; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskTimedOutCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.signalExternalWorkflowExecutionFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.timeoutType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.externalInitiatedId; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.externalWorkflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failureDetails; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failureReason; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentDomainName; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentInitiatedId; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.parentWorkflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.resetPoints; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; + +import java.util.ArrayList; +import java.util.List; + +class HistoryMapper { + + static com.uber.cadence.entities.History history(com.uber.cadence.api.v1.History t) { + if (t == null || t == com.uber.cadence.api.v1.History.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.History history = new com.uber.cadence.entities.History(); + history.setEvents(historyEventArray(t.getEventsList())); + return history; + } + + static List historyEventArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(historyEvent(t.get(i))); + } + return v; + } + + static com.uber.cadence.entities.HistoryEvent historyEvent( + com.uber.cadence.api.v1.HistoryEvent e) { + if (e == null || e == com.uber.cadence.api.v1.HistoryEvent.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.HistoryEvent event = new com.uber.cadence.entities.HistoryEvent(); + event.setEventId(e.getEventId()); + event.setTimestamp(timeToUnixNano(e.getEventTime())); + event.setVersion(e.getVersion()); + event.setTaskId(e.getTaskId()); + + if (e.getWorkflowExecutionStartedEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionStarted); + event.setWorkflowExecutionStartedEventAttributes( + workflowExecutionStartedEventAttributes(e.getWorkflowExecutionStartedEventAttributes())); + } else if (e.getWorkflowExecutionCompletedEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionCompleted); + event.setWorkflowExecutionCompletedEventAttributes( + workflowExecutionCompletedEventAttributes( + e.getWorkflowExecutionCompletedEventAttributes())); + } else if (e.getWorkflowExecutionFailedEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionFailed); + event.setWorkflowExecutionFailedEventAttributes( + workflowExecutionFailedEventAttributes(e.getWorkflowExecutionFailedEventAttributes())); + } else if (e.getWorkflowExecutionTimedOutEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionTimedOut); + event.setWorkflowExecutionTimedOutEventAttributes( + workflowExecutionTimedOutEventAttributes( + e.getWorkflowExecutionTimedOutEventAttributes())); + } else if (e.getDecisionTaskScheduledEventAttributes() + != com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) { + event.setEventType(DecisionTaskScheduled); + event.setDecisionTaskScheduledEventAttributes( + decisionTaskScheduledEventAttributes(e.getDecisionTaskScheduledEventAttributes())); + } else if (e.getDecisionTaskStartedEventAttributes() + != com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) { + event.setEventType(DecisionTaskStarted); + event.setDecisionTaskStartedEventAttributes( + decisionTaskStartedEventAttributes(e.getDecisionTaskStartedEventAttributes())); + } else if (e.getDecisionTaskCompletedEventAttributes() + != com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) { + event.setEventType(DecisionTaskCompleted); + event.setDecisionTaskCompletedEventAttributes( + decisionTaskCompletedEventAttributes(e.getDecisionTaskCompletedEventAttributes())); + } else if (e.getDecisionTaskTimedOutEventAttributes() + != com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) { + event.setEventType(DecisionTaskTimedOut); + event.setDecisionTaskTimedOutEventAttributes( + decisionTaskTimedOutEventAttributes(e.getDecisionTaskTimedOutEventAttributes())); + } else if (e.getDecisionTaskFailedEventAttributes() + != com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) { + event.setEventType(DecisionTaskFailed); + event.setDecisionTaskFailedEventAttributes( + decisionTaskFailedEventAttributes(e.getDecisionTaskFailedEventAttributes())); + } else if (e.getActivityTaskScheduledEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskScheduled); + event.setActivityTaskScheduledEventAttributes( + activityTaskScheduledEventAttributes(e.getActivityTaskScheduledEventAttributes())); + } else if (e.getActivityTaskStartedEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskStarted); + event.setActivityTaskStartedEventAttributes( + activityTaskStartedEventAttributes(e.getActivityTaskStartedEventAttributes())); + } else if (e.getActivityTaskCompletedEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskCompleted); + event.setActivityTaskCompletedEventAttributes( + activityTaskCompletedEventAttributes(e.getActivityTaskCompletedEventAttributes())); + } else if (e.getActivityTaskFailedEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskFailed); + event.setActivityTaskFailedEventAttributes( + activityTaskFailedEventAttributes(e.getActivityTaskFailedEventAttributes())); + } else if (e.getActivityTaskTimedOutEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskTimedOut); + event.setActivityTaskTimedOutEventAttributes( + activityTaskTimedOutEventAttributes(e.getActivityTaskTimedOutEventAttributes())); + } else if (e.getTimerStartedEventAttributes() + != com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) { + event.setEventType(TimerStarted); + event.setTimerStartedEventAttributes( + timerStartedEventAttributes(e.getTimerStartedEventAttributes())); + } else if (e.getTimerFiredEventAttributes() + != com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) { + event.setEventType(TimerFired); + event.setTimerFiredEventAttributes( + timerFiredEventAttributes(e.getTimerFiredEventAttributes())); + } else if (e.getActivityTaskCancelRequestedEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes + .getDefaultInstance()) { + event.setEventType(ActivityTaskCancelRequested); + event.setActivityTaskCancelRequestedEventAttributes( + activityTaskCancelRequestedEventAttributes( + e.getActivityTaskCancelRequestedEventAttributes())); + } else if (e.getRequestCancelActivityTaskFailedEventAttributes() + != com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes + .getDefaultInstance()) { + event.setEventType(RequestCancelActivityTaskFailed); + event.setRequestCancelActivityTaskFailedEventAttributes( + requestCancelActivityTaskFailedEventAttributes( + e.getRequestCancelActivityTaskFailedEventAttributes())); + } else if (e.getActivityTaskCanceledEventAttributes() + != com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) { + event.setEventType(ActivityTaskCanceled); + event.setActivityTaskCanceledEventAttributes( + activityTaskCanceledEventAttributes(e.getActivityTaskCanceledEventAttributes())); + } else if (e.getTimerCanceledEventAttributes() + != com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) { + event.setEventType(TimerCanceled); + event.setTimerCanceledEventAttributes( + timerCanceledEventAttributes(e.getTimerCanceledEventAttributes())); + } else if (e.getCancelTimerFailedEventAttributes() + != com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) { + event.setEventType(CancelTimerFailed); + event.setCancelTimerFailedEventAttributes( + cancelTimerFailedEventAttributes(e.getCancelTimerFailedEventAttributes())); + } else if (e.getMarkerRecordedEventAttributes() + != com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) { + event.setEventType(MarkerRecorded); + event.setMarkerRecordedEventAttributes( + markerRecordedEventAttributes(e.getMarkerRecordedEventAttributes())); + } else if (e.getWorkflowExecutionSignaledEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionSignaled); + event.setWorkflowExecutionSignaledEventAttributes( + workflowExecutionSignaledEventAttributes( + e.getWorkflowExecutionSignaledEventAttributes())); + } else if (e.getWorkflowExecutionTerminatedEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes + .getDefaultInstance()) { + event.setEventType(WorkflowExecutionTerminated); + event.setWorkflowExecutionTerminatedEventAttributes( + workflowExecutionTerminatedEventAttributes( + e.getWorkflowExecutionTerminatedEventAttributes())); + } else if (e.getWorkflowExecutionCancelRequestedEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes + .getDefaultInstance()) { + event.setEventType(WorkflowExecutionCancelRequested); + event.setWorkflowExecutionCancelRequestedEventAttributes( + workflowExecutionCancelRequestedEventAttributes( + e.getWorkflowExecutionCancelRequestedEventAttributes())); + } else if (e.getWorkflowExecutionCanceledEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes.getDefaultInstance()) { + event.setEventType(WorkflowExecutionCanceled); + event.setWorkflowExecutionCanceledEventAttributes( + workflowExecutionCanceledEventAttributes( + e.getWorkflowExecutionCanceledEventAttributes())); + } else if (e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes() + != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + event.setEventType(RequestCancelExternalWorkflowExecutionInitiated); + event.setRequestCancelExternalWorkflowExecutionInitiatedEventAttributes( + requestCancelExternalWorkflowExecutionInitiatedEventAttributes( + e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes())); + } else if (e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes() + != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + event.setEventType(RequestCancelExternalWorkflowExecutionFailed); + event.setRequestCancelExternalWorkflowExecutionFailedEventAttributes( + requestCancelExternalWorkflowExecutionFailedEventAttributes( + e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes())); + } else if (e.getExternalWorkflowExecutionCancelRequestedEventAttributes() + != com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes + .getDefaultInstance()) { + event.setEventType(ExternalWorkflowExecutionCancelRequested); + event.setExternalWorkflowExecutionCancelRequestedEventAttributes( + externalWorkflowExecutionCancelRequestedEventAttributes( + e.getExternalWorkflowExecutionCancelRequestedEventAttributes())); + } else if (e.getWorkflowExecutionContinuedAsNewEventAttributes() + != com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes + .getDefaultInstance()) { + event.setEventType(WorkflowExecutionContinuedAsNew); + event.setWorkflowExecutionContinuedAsNewEventAttributes( + workflowExecutionContinuedAsNewEventAttributes( + e.getWorkflowExecutionContinuedAsNewEventAttributes())); + } else if (e.getStartChildWorkflowExecutionInitiatedEventAttributes() + != com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + event.setEventType(StartChildWorkflowExecutionInitiated); + event.setStartChildWorkflowExecutionInitiatedEventAttributes( + startChildWorkflowExecutionInitiatedEventAttributes( + e.getStartChildWorkflowExecutionInitiatedEventAttributes())); + } else if (e.getStartChildWorkflowExecutionFailedEventAttributes() + != com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + event.setEventType(StartChildWorkflowExecutionFailed); + event.setStartChildWorkflowExecutionFailedEventAttributes( + startChildWorkflowExecutionFailedEventAttributes( + e.getStartChildWorkflowExecutionFailedEventAttributes())); + } else if (e.getChildWorkflowExecutionStartedEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionStarted); + event.setChildWorkflowExecutionStartedEventAttributes( + childWorkflowExecutionStartedEventAttributes( + e.getChildWorkflowExecutionStartedEventAttributes())); + } else if (e.getChildWorkflowExecutionCompletedEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionCompleted); + event.setChildWorkflowExecutionCompletedEventAttributes( + childWorkflowExecutionCompletedEventAttributes( + e.getChildWorkflowExecutionCompletedEventAttributes())); + } else if (e.getChildWorkflowExecutionFailedEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionFailed); + event.setChildWorkflowExecutionFailedEventAttributes( + childWorkflowExecutionFailedEventAttributes( + e.getChildWorkflowExecutionFailedEventAttributes())); + } else if (e.getChildWorkflowExecutionCanceledEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionCanceled); + event.setChildWorkflowExecutionCanceledEventAttributes( + childWorkflowExecutionCanceledEventAttributes( + e.getChildWorkflowExecutionCanceledEventAttributes())); + } else if (e.getChildWorkflowExecutionTimedOutEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionTimedOut); + event.setChildWorkflowExecutionTimedOutEventAttributes( + childWorkflowExecutionTimedOutEventAttributes( + e.getChildWorkflowExecutionTimedOutEventAttributes())); + } else if (e.getChildWorkflowExecutionTerminatedEventAttributes() + != com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes + .getDefaultInstance()) { + event.setEventType(ChildWorkflowExecutionTerminated); + event.setChildWorkflowExecutionTerminatedEventAttributes( + childWorkflowExecutionTerminatedEventAttributes( + e.getChildWorkflowExecutionTerminatedEventAttributes())); + } else if (e.getSignalExternalWorkflowExecutionInitiatedEventAttributes() + != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + event.setEventType(SignalExternalWorkflowExecutionInitiated); + event.setSignalExternalWorkflowExecutionInitiatedEventAttributes( + signalExternalWorkflowExecutionInitiatedEventAttributes( + e.getSignalExternalWorkflowExecutionInitiatedEventAttributes())); + } else if (e.getSignalExternalWorkflowExecutionFailedEventAttributes() + != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + event.setEventType(SignalExternalWorkflowExecutionFailed); + event.setSignalExternalWorkflowExecutionFailedEventAttributes( + signalExternalWorkflowExecutionFailedEventAttributes( + e.getSignalExternalWorkflowExecutionFailedEventAttributes())); + } else if (e.getExternalWorkflowExecutionSignaledEventAttributes() + != com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes + .getDefaultInstance()) { + event.setEventType(ExternalWorkflowExecutionSignaled); + event.setExternalWorkflowExecutionSignaledEventAttributes( + externalWorkflowExecutionSignaledEventAttributes( + e.getExternalWorkflowExecutionSignaledEventAttributes())); + } else if (e.getUpsertWorkflowSearchAttributesEventAttributes() + != com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes + .getDefaultInstance()) { + event.setEventType(UpsertWorkflowSearchAttributes); + event.setUpsertWorkflowSearchAttributesEventAttributes( + upsertWorkflowSearchAttributesEventAttributes( + e.getUpsertWorkflowSearchAttributesEventAttributes())); + } else { + throw new IllegalArgumentException("unknown event type"); + } + return event; + } + + static com.uber.cadence.entities.ActivityTaskCancelRequestedEventAttributes + activityTaskCancelRequestedEventAttributes( + com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskCancelRequestedEventAttributes res = + new com.uber.cadence.entities.ActivityTaskCancelRequestedEventAttributes(); + res.setActivityId(t.getActivityId()); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.ActivityTaskCanceledEventAttributes + activityTaskCanceledEventAttributes( + com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskCanceledEventAttributes res = + new com.uber.cadence.entities.ActivityTaskCanceledEventAttributes(); + res.setDetails(payload(t.getDetails())); + res.setLatestCancelRequestedEventId(t.getLatestCancelRequestedEventId()); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.ActivityTaskCompletedEventAttributes + activityTaskCompletedEventAttributes( + com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskCompletedEventAttributes res = + new com.uber.cadence.entities.ActivityTaskCompletedEventAttributes(); + res.setResult(payload(t.getResult())); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.ActivityTaskFailedEventAttributes + activityTaskFailedEventAttributes( + com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskFailedEventAttributes res = + new com.uber.cadence.entities.ActivityTaskFailedEventAttributes(); + res.setReason(failureReason(t.getFailure())); + res.setDetails(failureDetails(t.getFailure())); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.ActivityTaskScheduledEventAttributes + activityTaskScheduledEventAttributes( + com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskScheduledEventAttributes res = + new com.uber.cadence.entities.ActivityTaskScheduledEventAttributes(); + res.setActivityId(t.getActivityId()); + res.setActivityType(activityType(t.getActivityType())); + res.setDomain(t.getDomain()); + res.setTaskList(taskList(t.getTaskList())); + res.setInput(payload(t.getInput())); + res.setScheduleToCloseTimeoutSeconds(durationToSeconds(t.getScheduleToCloseTimeout())); + res.setScheduleToStartTimeoutSeconds(durationToSeconds(t.getScheduleToStartTimeout())); + res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); + res.setHeartbeatTimeoutSeconds(durationToSeconds(t.getHeartbeatTimeout())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + res.setHeader(header(t.getHeader())); + return res; + } + + static com.uber.cadence.entities.ActivityTaskStartedEventAttributes + activityTaskStartedEventAttributes( + com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskStartedEventAttributes res = + new com.uber.cadence.entities.ActivityTaskStartedEventAttributes(); + res.setScheduledEventId(t.getScheduledEventId()); + res.setIdentity(t.getIdentity()); + res.setRequestId(t.getRequestId()); + res.setAttempt(t.getAttempt()); + res.setLastFailureReason(failureReason(t.getLastFailure())); + res.setLastFailureDetails(failureDetails(t.getLastFailure())); + return res; + } + + static com.uber.cadence.entities.ActivityTaskTimedOutEventAttributes + activityTaskTimedOutEventAttributes( + com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityTaskTimedOutEventAttributes res = + new com.uber.cadence.entities.ActivityTaskTimedOutEventAttributes(); + res.setDetails(payload(t.getDetails())); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setTimeoutType(EnumMapper.timeoutType(t.getTimeoutType())); + res.setLastFailureReason(failureReason(t.getLastFailure())); + res.setLastFailureDetails(failureDetails(t.getLastFailure())); + return res; + } + + static com.uber.cadence.entities.CancelTimerFailedEventAttributes + cancelTimerFailedEventAttributes(com.uber.cadence.api.v1.CancelTimerFailedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.CancelTimerFailedEventAttributes res = + new com.uber.cadence.entities.CancelTimerFailedEventAttributes(); + res.setTimerId(t.getTimerId()); + res.setCause(t.getCause()); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionCanceledEventAttributes + childWorkflowExecutionCanceledEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionCanceledEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionCanceledEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setDetails(payload(t.getDetails())); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionCompletedEventAttributes + childWorkflowExecutionCompletedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionCompletedEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionCompletedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setResult(payload(t.getResult())); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionFailedEventAttributes + childWorkflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionFailedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setReason(failureReason(t.getFailure())); + res.setDetails(failureDetails(t.getFailure())); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionStartedEventAttributes + childWorkflowExecutionStartedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionStartedEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionStartedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setHeader(header(t.getHeader())); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionTerminatedEventAttributes + childWorkflowExecutionTerminatedEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionTerminatedEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionTerminatedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setStartedEventId(t.getStartedEventId()); + return res; + } + + static com.uber.cadence.entities.ChildWorkflowExecutionTimedOutEventAttributes + childWorkflowExecutionTimedOutEventAttributes( + com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ChildWorkflowExecutionTimedOutEventAttributes res = + new com.uber.cadence.entities.ChildWorkflowExecutionTimedOutEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setTimeoutType(EnumMapper.timeoutType(t.getTimeoutType())); + return res; + } + + static com.uber.cadence.entities.DecisionTaskFailedEventAttributes + decisionTaskFailedEventAttributes( + com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DecisionTaskFailedEventAttributes res = + new com.uber.cadence.entities.DecisionTaskFailedEventAttributes(); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setCause(decisionTaskFailedCause(t.getCause())); + res.setReason(failureReason(t.getFailure())); + res.setDetails(failureDetails(t.getFailure())); + res.setIdentity(t.getIdentity()); + res.setBaseRunId(t.getBaseRunId()); + res.setNewRunId(t.getNewRunId()); + res.setForkEventVersion(t.getForkEventVersion()); + res.setBinaryChecksum(t.getBinaryChecksum()); + return res; + } + + static com.uber.cadence.entities.DecisionTaskScheduledEventAttributes + decisionTaskScheduledEventAttributes( + com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DecisionTaskScheduledEventAttributes res = + new com.uber.cadence.entities.DecisionTaskScheduledEventAttributes(); + res.setTaskList(taskList(t.getTaskList())); + res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); + res.setAttempt(t.getAttempt()); + return res; + } + + static com.uber.cadence.entities.DecisionTaskStartedEventAttributes + decisionTaskStartedEventAttributes( + com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DecisionTaskStartedEventAttributes res = + new com.uber.cadence.entities.DecisionTaskStartedEventAttributes(); + res.setScheduledEventId(t.getScheduledEventId()); + res.setIdentity(t.getIdentity()); + res.setRequestId(t.getRequestId()); + return res; + } + + static com.uber.cadence.entities.DecisionTaskCompletedEventAttributes + decisionTaskCompletedEventAttributes( + com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DecisionTaskCompletedEventAttributes res = + new com.uber.cadence.entities.DecisionTaskCompletedEventAttributes(); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setIdentity(t.getIdentity()); + res.setBinaryChecksum(t.getBinaryChecksum()); + res.setExecutionContext(byteStringToArray(t.getExecutionContext())); + return res; + } + + static com.uber.cadence.entities.DecisionTaskTimedOutEventAttributes + decisionTaskTimedOutEventAttributes( + com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DecisionTaskTimedOutEventAttributes res = + new com.uber.cadence.entities.DecisionTaskTimedOutEventAttributes(); + res.setScheduledEventId(t.getScheduledEventId()); + res.setStartedEventId(t.getStartedEventId()); + res.setTimeoutType(timeoutType(t.getTimeoutType())); + res.setBaseRunId(t.getBaseRunId()); + res.setNewRunId(t.getNewRunId()); + res.setForkEventVersion(t.getForkEventVersion()); + res.setReason(t.getReason()); + res.setCause(decisionTaskTimedOutCause(t.getCause())); + return res; + } + + static com.uber.cadence.entities.ExternalWorkflowExecutionCancelRequestedEventAttributes + externalWorkflowExecutionCancelRequestedEventAttributes( + com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ExternalWorkflowExecutionCancelRequestedEventAttributes res = + new com.uber.cadence.entities.ExternalWorkflowExecutionCancelRequestedEventAttributes(); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + return res; + } + + static com.uber.cadence.entities.ExternalWorkflowExecutionSignaledEventAttributes + externalWorkflowExecutionSignaledEventAttributes( + com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ExternalWorkflowExecutionSignaledEventAttributes res = + new com.uber.cadence.entities.ExternalWorkflowExecutionSignaledEventAttributes(); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setControl(byteStringToArray(t.getControl())); + return res; + } + + static com.uber.cadence.entities.MarkerRecordedEventAttributes markerRecordedEventAttributes( + com.uber.cadence.api.v1.MarkerRecordedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.MarkerRecordedEventAttributes res = + new com.uber.cadence.entities.MarkerRecordedEventAttributes(); + res.setMarkerName(t.getMarkerName()); + res.setDetails(payload(t.getDetails())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setHeader(header(t.getHeader())); + return res; + } + + static com.uber.cadence.entities.RequestCancelActivityTaskFailedEventAttributes + requestCancelActivityTaskFailedEventAttributes( + com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.RequestCancelActivityTaskFailedEventAttributes res = + new com.uber.cadence.entities.RequestCancelActivityTaskFailedEventAttributes(); + res.setActivityId(t.getActivityId()); + res.setCause(t.getCause()); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionFailedEventAttributes + requestCancelExternalWorkflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionFailedEventAttributes(); + res.setCause(cancelExternalWorkflowExecutionFailedCause(t.getCause())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setControl(byteStringToArray(t.getControl())); + return res; + } + + static com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + requestCancelExternalWorkflowExecutionInitiatedEventAttributes( + com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + t) { + if (t == null + || t + == com.uber.cadence.api.v1 + .RequestCancelExternalWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.entities + .RequestCancelExternalWorkflowExecutionInitiatedEventAttributes(); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setControl(byteStringToArray(t.getControl())); + res.setChildWorkflowOnly(t.getChildWorkflowOnly()); + return res; + } + + static com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedEventAttributes + signalExternalWorkflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.entities.SignalExternalWorkflowExecutionFailedEventAttributes(); + res.setCause(signalExternalWorkflowExecutionFailedCause(t.getCause())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setControl(byteStringToArray(t.getControl())); + return res; + } + + static com.uber.cadence.entities.SignalExternalWorkflowExecutionInitiatedEventAttributes + signalExternalWorkflowExecutionInitiatedEventAttributes( + com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.SignalExternalWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.entities.SignalExternalWorkflowExecutionInitiatedEventAttributes(); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setDomain(t.getDomain()); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setSignalName(t.getSignalName()); + res.setInput(payload(t.getInput())); + res.setControl(byteStringToArray(t.getControl())); + res.setChildWorkflowOnly(t.getChildWorkflowOnly()); + return res; + } + + static com.uber.cadence.entities.StartChildWorkflowExecutionFailedEventAttributes + startChildWorkflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.StartChildWorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.entities.StartChildWorkflowExecutionFailedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowId(t.getWorkflowId()); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setCause(childWorkflowExecutionFailedCause(t.getCause())); + res.setControl(byteStringToArray(t.getControl())); + res.setInitiatedEventId(t.getInitiatedEventId()); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.StartChildWorkflowExecutionInitiatedEventAttributes + startChildWorkflowExecutionInitiatedEventAttributes( + com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.StartChildWorkflowExecutionInitiatedEventAttributes res = + new com.uber.cadence.entities.StartChildWorkflowExecutionInitiatedEventAttributes(); + res.setDomain(t.getDomain()); + res.setWorkflowId(t.getWorkflowId()); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setTaskList(taskList(t.getTaskList())); + res.setInput(payload(t.getInput())); + res.setExecutionStartToCloseTimeoutSeconds( + durationToSeconds(t.getExecutionStartToCloseTimeout())); + res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); + res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy())); + res.setControl(byteStringToArray(t.getControl())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())); + res.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + res.setCronSchedule(t.getCronSchedule()); + res.setHeader(header(t.getHeader())); + res.setMemo(memo(t.getMemo())); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + res.setDelayStartSeconds(durationToSeconds(t.getDelayStart())); + return res; + } + + static com.uber.cadence.entities.TimerCanceledEventAttributes timerCanceledEventAttributes( + com.uber.cadence.api.v1.TimerCanceledEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TimerCanceledEventAttributes res = + new com.uber.cadence.entities.TimerCanceledEventAttributes(); + res.setTimerId(t.getTimerId()); + res.setStartedEventId(t.getStartedEventId()); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.TimerFiredEventAttributes timerFiredEventAttributes( + com.uber.cadence.api.v1.TimerFiredEventAttributes t) { + if (t == null || t == com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TimerFiredEventAttributes res = + new com.uber.cadence.entities.TimerFiredEventAttributes(); + res.setTimerId(t.getTimerId()); + res.setStartedEventId(t.getStartedEventId()); + return res; + } + + static com.uber.cadence.entities.TimerStartedEventAttributes timerStartedEventAttributes( + com.uber.cadence.api.v1.TimerStartedEventAttributes t) { + if (t == null + || t == com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TimerStartedEventAttributes res = + new com.uber.cadence.entities.TimerStartedEventAttributes(); + res.setTimerId(t.getTimerId()); + res.setStartToFireTimeoutSeconds(durationToSeconds(t.getStartToFireTimeout())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.UpsertWorkflowSearchAttributesEventAttributes + upsertWorkflowSearchAttributesEventAttributes( + com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.UpsertWorkflowSearchAttributesEventAttributes res = + new com.uber.cadence.entities.UpsertWorkflowSearchAttributesEventAttributes(); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionCancelRequestedEventAttributes + workflowExecutionCancelRequestedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionCancelRequestedEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionCancelRequestedEventAttributes(); + res.setCause(t.getCause()); + res.setExternalInitiatedEventId(externalInitiatedId(t.getExternalExecutionInfo())); + res.setExternalWorkflowExecution(externalWorkflowExecution(t.getExternalExecutionInfo())); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionCanceledEventAttributes + workflowExecutionCanceledEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionCanceledEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionCanceledEventAttributes(); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setDetails(payload(t.getDetails())); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionCompletedEventAttributes + workflowExecutionCompletedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionCompletedEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionCompletedEventAttributes(); + res.setResult(payload(t.getResult())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionContinuedAsNewEventAttributes + workflowExecutionContinuedAsNewEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionContinuedAsNewEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionContinuedAsNewEventAttributes(); + res.setNewExecutionRunId(t.getNewExecutionRunId()); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setTaskList(taskList(t.getTaskList())); + res.setInput(payload(t.getInput())); + res.setExecutionStartToCloseTimeoutSeconds( + durationToSeconds(t.getExecutionStartToCloseTimeout())); + res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + res.setBackoffStartIntervalInSeconds(durationToSeconds(t.getBackoffStartInterval())); + res.setInitiator(continueAsNewInitiator(t.getInitiator())); + res.setFailureReason(failureReason(t.getFailure())); + res.setFailureDetails(failureDetails(t.getFailure())); + res.setLastCompletionResult(payload(t.getLastCompletionResult())); + res.setHeader(header(t.getHeader())); + res.setMemo(memo(t.getMemo())); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionFailedEventAttributes + workflowExecutionFailedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionFailedEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionFailedEventAttributes(); + res.setReason(failureReason(t.getFailure())); + res.setDetails(failureDetails(t.getFailure())); + res.setDecisionTaskCompletedEventId(t.getDecisionTaskCompletedEventId()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionSignaledEventAttributes + workflowExecutionSignaledEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionSignaledEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionSignaledEventAttributes(); + res.setSignalName(t.getSignalName()); + res.setInput(payload(t.getInput())); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionStartedEventAttributes + workflowExecutionStartedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionStartedEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionStartedEventAttributes(); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setParentWorkflowDomain(parentDomainName(t.getParentExecutionInfo())); + res.setParentWorkflowExecution(parentWorkflowExecution(t.getParentExecutionInfo())); + res.setParentInitiatedEventId(parentInitiatedId(t.getParentExecutionInfo())); + res.setTaskList(taskList(t.getTaskList())); + res.setInput(payload(t.getInput())); + res.setExecutionStartToCloseTimeoutSeconds( + durationToSeconds(t.getExecutionStartToCloseTimeout())); + res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); + res.setContinuedExecutionRunId(t.getContinuedExecutionRunId()); + res.setInitiator(continueAsNewInitiator(t.getInitiator())); + res.setContinuedFailureReason(failureReason(t.getContinuedFailure())); + res.setContinuedFailureDetails(failureDetails(t.getContinuedFailure())); + res.setLastCompletionResult(payload(t.getLastCompletionResult())); + res.setOriginalExecutionRunId(t.getOriginalExecutionRunId()); + res.setIdentity(t.getIdentity()); + res.setFirstExecutionRunId(t.getFirstExecutionRunId()); + res.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + res.setAttempt(t.getAttempt()); + res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime())); + res.setCronSchedule(t.getCronSchedule()); + res.setFirstDecisionTaskBackoffSeconds(durationToSeconds(t.getFirstDecisionTaskBackoff())); + res.setMemo(memo(t.getMemo())); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + res.setPrevAutoResetPoints(resetPoints(t.getPrevAutoResetPoints())); + res.setHeader(header(t.getHeader())); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionTerminatedEventAttributes + workflowExecutionTerminatedEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionTerminatedEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionTerminatedEventAttributes(); + res.setReason(t.getReason()); + res.setDetails(payload(t.getDetails())); + res.setIdentity(t.getIdentity()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionTimedOutEventAttributes + workflowExecutionTimedOutEventAttributes( + com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes t) { + if (t == null + || t + == com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes + .getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionTimedOutEventAttributes res = + new com.uber.cadence.entities.WorkflowExecutionTimedOutEventAttributes(); + res.setTimeoutType(timeoutType(t.getTimeoutType())); + return res; + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java new file mode 100644 index 000000000..7541ebf2f --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/RequestMapper.java @@ -0,0 +1,971 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.DecisionMapper.decisionArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.decisionTaskFailedCause; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.eventFilterType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryConsistencyLevel; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryRejectCondition; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryTaskCompletedType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.taskListType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowIdReusePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.daysToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.newFieldMask; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.nullToEmpty; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.badBinaries; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.clusterReplicationConfigurationArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.failure; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.memo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.retryPolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.searchAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.startTimeFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.statusFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.stickyExecutionAttributes; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListMetadata; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workerVersionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionFilter; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQuery; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQueryResultMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowTypeFilter; + +import com.uber.cadence.api.v1.CountWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.DeprecateDomainRequest; +import com.uber.cadence.api.v1.DescribeDomainRequest; +import com.uber.cadence.api.v1.DescribeTaskListRequest; +import com.uber.cadence.api.v1.DescribeWorkflowExecutionRequest; +import com.uber.cadence.api.v1.GetTaskListsByDomainRequest; +import com.uber.cadence.api.v1.GetWorkflowExecutionHistoryRequest; +import com.uber.cadence.api.v1.ListArchivedWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListClosedWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListDomainsRequest; +import com.uber.cadence.api.v1.ListOpenWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.ListTaskListPartitionsRequest; +import com.uber.cadence.api.v1.ListWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.PollForActivityTaskRequest; +import com.uber.cadence.api.v1.PollForDecisionTaskRequest; +import com.uber.cadence.api.v1.QueryWorkflowRequest; +import com.uber.cadence.api.v1.RecordActivityTaskHeartbeatByIDRequest; +import com.uber.cadence.api.v1.RecordActivityTaskHeartbeatRequest; +import com.uber.cadence.api.v1.RefreshWorkflowTasksRequest; +import com.uber.cadence.api.v1.RegisterDomainRequest; +import com.uber.cadence.api.v1.RequestCancelWorkflowExecutionRequest; +import com.uber.cadence.api.v1.ResetStickyTaskListRequest; +import com.uber.cadence.api.v1.ResetWorkflowExecutionRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCanceledByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCanceledRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCompletedByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskCompletedRequest; +import com.uber.cadence.api.v1.RespondActivityTaskFailedByIDRequest; +import com.uber.cadence.api.v1.RespondActivityTaskFailedRequest; +import com.uber.cadence.api.v1.RespondDecisionTaskCompletedRequest; +import com.uber.cadence.api.v1.RespondDecisionTaskFailedRequest; +import com.uber.cadence.api.v1.RespondQueryTaskCompletedRequest; +import com.uber.cadence.api.v1.RestartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.ScanWorkflowExecutionsRequest; +import com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionAsyncRequest; +import com.uber.cadence.api.v1.SignalWithStartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.SignalWorkflowExecutionRequest; +import com.uber.cadence.api.v1.StartWorkflowExecutionAsyncRequest; +import com.uber.cadence.api.v1.StartWorkflowExecutionRequest; +import com.uber.cadence.api.v1.TerminateWorkflowExecutionRequest; +import com.uber.cadence.api.v1.UpdateDomainRequest; +import com.uber.cadence.api.v1.UpdateDomainRequest.Builder; +import com.uber.cadence.api.v1.WorkflowQueryResult; +import java.util.ArrayList; +import java.util.List; + +public class RequestMapper { + + private static final String DomainUpdateDescriptionField = "description"; + private static final String DomainUpdateOwnerEmailField = "owner_email"; + private static final String DomainUpdateDataField = "data"; + private static final String DomainUpdateRetentionPeriodField = + "workflow_execution_retention_period"; + + private static final String DomainUpdateBadBinariesField = "bad_binaries"; + private static final String DomainUpdateHistoryArchivalStatusField = "history_archival_status"; + private static final String DomainUpdateHistoryArchivalURIField = "history_archival_uri"; + private static final String DomainUpdateVisibilityArchivalStatusField = + "visibility_archival_status"; + private static final String DomainUpdateVisibilityArchivalURIField = "visibility_archival_uri"; + private static final String DomainUpdateActiveClusterNameField = "active_cluster_name"; + private static final String DomainUpdateClustersField = "clusters"; + private static final String DomainUpdateDeleteBadBinaryField = "delete_bad_binary"; + private static final String DomainUpdateFailoverTimeoutField = "failover_timeout"; + + public static CountWorkflowExecutionsRequest countWorkflowExecutionsRequest( + com.uber.cadence.entities.CountWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + CountWorkflowExecutionsRequest.Builder request = + CountWorkflowExecutionsRequest.newBuilder().setDomain(t.getDomain()); + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static DescribeTaskListRequest describeTaskListRequest( + com.uber.cadence.entities.DescribeTaskListRequest t) { + if (t == null) { + return null; + } + return DescribeTaskListRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .setTaskListType(taskListType(t.getTaskListType())) + .setIncludeTaskListStatus(t.isIncludeTaskListStatus()) + .build(); + } + + public static ListArchivedWorkflowExecutionsRequest listArchivedWorkflowExecutionsRequest( + com.uber.cadence.entities.ListArchivedWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListArchivedWorkflowExecutionsRequest.Builder request = + ListArchivedWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecutionRequest( + com.uber.cadence.entities.RequestCancelWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + RequestCancelWorkflowExecutionRequest.Builder builder = + RequestCancelWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setRequestId(t.getRequestId()); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static ResetStickyTaskListRequest resetStickyTaskListRequest( + com.uber.cadence.entities.ResetStickyTaskListRequest t) { + if (t == null) { + return null; + } + return ResetStickyTaskListRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .build(); + } + + public static ResetWorkflowExecutionRequest resetWorkflowExecutionRequest( + com.uber.cadence.entities.ResetWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return ResetWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setDecisionFinishEventId(t.getDecisionFinishEventId()) + .setRequestId(t.getRequestId()) + .setSkipSignalReapply(t.isSkipSignalReapply()) + .build(); + } + + public static RespondActivityTaskCanceledByIDRequest respondActivityTaskCanceledByIdRequest( + com.uber.cadence.entities.RespondActivityTaskCanceledByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCanceledByIDRequest.Builder builder = + RespondActivityTaskCanceledByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCanceledRequest respondActivityTaskCanceledRequest( + com.uber.cadence.entities.RespondActivityTaskCanceledRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCanceledRequest.Builder builder = + RespondActivityTaskCanceledRequest.newBuilder().setDetails(payload(t.getDetails())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCompletedByIDRequest respondActivityTaskCompletedByIdRequest( + com.uber.cadence.entities.RespondActivityTaskCompletedByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCompletedByIDRequest.Builder builder = + RespondActivityTaskCompletedByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setResult(payload(t.getResult())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskCompletedRequest respondActivityTaskCompletedRequest( + com.uber.cadence.entities.RespondActivityTaskCompletedRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskCompletedRequest.Builder builder = + RespondActivityTaskCompletedRequest.newBuilder().setResult(payload(t.getResult())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskFailedByIDRequest respondActivityTaskFailedByIdRequest( + com.uber.cadence.entities.RespondActivityTaskFailedByIDRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskFailedByIDRequest.Builder builder = + RespondActivityTaskFailedByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setFailure(failure(t.getReason(), t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondActivityTaskFailedRequest respondActivityTaskFailedRequest( + com.uber.cadence.entities.RespondActivityTaskFailedRequest t) { + if (t == null) { + return null; + } + RespondActivityTaskFailedRequest.Builder builder = + RespondActivityTaskFailedRequest.newBuilder() + .setFailure(failure(t.getReason(), t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + return builder.build(); + } + + public static RespondDecisionTaskCompletedRequest respondDecisionTaskCompletedRequest( + com.uber.cadence.entities.RespondDecisionTaskCompletedRequest t) { + if (t == null) { + return null; + } + RespondDecisionTaskCompletedRequest.Builder builder = + RespondDecisionTaskCompletedRequest.newBuilder() + .addAllDecisions(decisionArray(t.getDecisions())) + .setStickyAttributes(stickyExecutionAttributes(t.getStickyAttributes())) + .setReturnNewDecisionTask(t.isReturnNewDecisionTask()) + .setForceCreateNewDecisionTask(t.isForceCreateNewDecisionTask()) + .putAllQueryResults(workflowQueryResultMap(t.getQueryResults())); + if (t.getExecutionContext() != null) { + builder.setExecutionContext(arrayToByteString(t.getExecutionContext())); + } + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondDecisionTaskFailedRequest respondDecisionTaskFailedRequest( + com.uber.cadence.entities.RespondDecisionTaskFailedRequest t) { + if (t == null) { + return null; + } + RespondDecisionTaskFailedRequest.Builder builder = + RespondDecisionTaskFailedRequest.newBuilder() + .setCause(decisionTaskFailedCause(t.getCause())) + .setDetails(payload(t.getDetails())); + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RespondQueryTaskCompletedRequest respondQueryTaskCompletedRequest( + com.uber.cadence.entities.RespondQueryTaskCompletedRequest t) { + if (t == null) { + return null; + } + WorkflowQueryResult.Builder wqBuilder = + WorkflowQueryResult.newBuilder() + .setResultType(queryTaskCompletedType(t.getCompletedType())) + .setAnswer(payload(t.getQueryResult())); + if (t.getErrorMessage() != null) { + wqBuilder.setErrorMessage(t.getErrorMessage()); + } + RespondQueryTaskCompletedRequest.Builder builder = + RespondQueryTaskCompletedRequest.newBuilder() + .setResult(wqBuilder.build()) + .setWorkerVersionInfo(workerVersionInfo(t.getWorkerVersionInfo())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + return builder.build(); + } + + public static ScanWorkflowExecutionsRequest scanWorkflowExecutionsRequest( + com.uber.cadence.entities.ListWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ScanWorkflowExecutionsRequest.Builder request = + ScanWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest( + com.uber.cadence.entities.DescribeWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return DescribeWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .build(); + } + + public static GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequest( + com.uber.cadence.entities.GetWorkflowExecutionHistoryRequest t) { + if (t == null) { + return null; + } + GetWorkflowExecutionHistoryRequest.Builder builder = + GetWorkflowExecutionHistoryRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .setPageSize(t.getMaximumPageSize()) + .setWaitForNewEvent(t.isWaitForNewEvent()) + .setHistoryEventFilterType(eventFilterType(t.getHistoryEventFilterType())) + .setSkipArchival(t.isSkipArchival()); + if (t.getNextPageToken() != null) { + builder.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + return builder.build(); + } + + public static SignalWithStartWorkflowExecutionRequest signalWithStartWorkflowExecutionRequest( + com.uber.cadence.entities.SignalWithStartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionRequest.Builder builder = + StartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowId(t.getWorkflowId()) + .setWorkflowType(workflowType(t.getWorkflowType())) + .setTaskList(taskList(t.getTaskList())) + .setInput(payload(t.getInput())) + .setExecutionStartToCloseTimeout( + secondsToDuration(t.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout(secondsToDuration(t.getTaskStartToCloseTimeoutSeconds())) + .setRequestId(t.getRequestId()) + .setMemo(memo(t.getMemo())) + .setSearchAttributes(searchAttributes(t.getSearchAttributes())) + .setHeader(header(t.getHeader())); + if (t.getRetryPolicy() != null) { + builder.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + } + builder.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())); + if (t.getWorkflowIdReusePolicy() != null) { + builder.setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())); + } + if (t.getCronSchedule() != null) { + builder.setCronSchedule(t.getCronSchedule()); + } + if (t.getDelayStartSeconds() > 0) { + builder.setDelayStart(secondsToDuration(t.getDelayStartSeconds())); + } + + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + SignalWithStartWorkflowExecutionRequest.Builder sb = + SignalWithStartWorkflowExecutionRequest.newBuilder() + .setStartRequest(builder.build()) + .setSignalName(t.getSignalName()) + .setSignalInput(payload(t.getSignalInput())); + if (t.getControl() != null) { + sb.setControl(arrayToByteString(t.getControl())); + } + return sb.build(); + } + + public static SignalWithStartWorkflowExecutionAsyncRequest + signalWithStartWorkflowExecutionAsyncRequest( + com.uber.cadence.entities.SignalWithStartWorkflowExecutionAsyncRequest t) { + if (t == null) { + return null; + } + SignalWithStartWorkflowExecutionAsyncRequest.Builder builder = + SignalWithStartWorkflowExecutionAsyncRequest.newBuilder(); + if (t.getRequest() != null) { + builder.setRequest(signalWithStartWorkflowExecutionRequest(t.getRequest())); + } + return builder.build(); + } + + public static SignalWorkflowExecutionRequest signalWorkflowExecutionRequest( + com.uber.cadence.entities.SignalWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + SignalWorkflowExecutionRequest.Builder builder = + SignalWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setSignalName(t.getSignalName()) + .setSignalInput(payload(t.getInput())) + .setRequestId(t.getRequestId()); + if (t.getControl() != null) { + builder.setControl(arrayToByteString(t.getControl())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static StartWorkflowExecutionRequest startWorkflowExecutionRequest( + com.uber.cadence.entities.StartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionRequest.Builder request = + StartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowId(t.getWorkflowId()) + .setWorkflowType(workflowType(t.getWorkflowType())) + .setTaskList(taskList(t.getTaskList())) + .setInput(payload(t.getInput())) + .setRequestId(t.getRequestId()) + .setExecutionStartToCloseTimeout( + secondsToDuration(t.getExecutionStartToCloseTimeoutSeconds())) + .setTaskStartToCloseTimeout(secondsToDuration(t.getTaskStartToCloseTimeoutSeconds())) + .setWorkflowIdReusePolicy(workflowIdReusePolicy(t.getWorkflowIdReusePolicy())) + .setMemo(memo(t.getMemo())) + .setSearchAttributes(searchAttributes(t.getSearchAttributes())) + .setHeader(header(t.getHeader())) + .setDelayStart(secondsToDuration(t.getDelayStartSeconds())); + if (t.getRetryPolicy() != null) { + request.setRetryPolicy(retryPolicy(t.getRetryPolicy())); + } + if (t.getCronSchedule() != null) { + request.setCronSchedule(t.getCronSchedule()); + } + if (t.getIdentity() != null) { + request.setIdentity(t.getIdentity()); + } + return request.build(); + } + + public static StartWorkflowExecutionAsyncRequest startWorkflowExecutionAsyncRequest( + com.uber.cadence.entities.StartWorkflowExecutionAsyncRequest t) { + if (t == null) { + return null; + } + StartWorkflowExecutionAsyncRequest.Builder builder = + StartWorkflowExecutionAsyncRequest.newBuilder(); + if (t.getRequest() != null) { + builder.setRequest(startWorkflowExecutionRequest(t.getRequest())); + } + return builder.build(); + } + + public static TerminateWorkflowExecutionRequest terminateWorkflowExecutionRequest( + com.uber.cadence.entities.TerminateWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + TerminateWorkflowExecutionRequest.Builder builder = + TerminateWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static DeprecateDomainRequest deprecateDomainRequest( + com.uber.cadence.entities.DeprecateDomainRequest t) { + if (t == null) { + return null; + } + return DeprecateDomainRequest.newBuilder() + .setName(t.getName()) + .setSecurityToken(t.getSecurityToken()) + .build(); + } + + public static DescribeDomainRequest describeDomainRequest( + com.uber.cadence.entities.DescribeDomainRequest t) { + if (t == null) { + return null; + } + if (t.getUuid() != null) { + return DescribeDomainRequest.newBuilder().setId(t.getUuid()).build(); + } + if (t.getName() != null) { + return DescribeDomainRequest.newBuilder().setName(t.getName()).build(); + } + throw new IllegalArgumentException("neither one of field is set for DescribeDomainRequest"); + } + + public static ListDomainsRequest listDomainsRequest( + com.uber.cadence.entities.ListDomainsRequest t) { + if (t == null) { + return null; + } + ListDomainsRequest.Builder request = + ListDomainsRequest.newBuilder().setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + return request.build(); + } + + public static ListTaskListPartitionsRequest listTaskListPartitionsRequest( + com.uber.cadence.entities.ListTaskListPartitionsRequest t) { + if (t == null) { + return null; + } + return ListTaskListPartitionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .build(); + } + + public static ListWorkflowExecutionsRequest listWorkflowExecutionsRequest( + com.uber.cadence.entities.ListWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListWorkflowExecutionsRequest.Builder request = + ListWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getPageSize()); + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getQuery() != null) { + request.setQuery(t.getQuery()); + } + return request.build(); + } + + public static PollForActivityTaskRequest pollForActivityTaskRequest( + com.uber.cadence.entities.PollForActivityTaskRequest t) { + if (t == null) { + return null; + } + PollForActivityTaskRequest.Builder builder = + PollForActivityTaskRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())) + .setTaskListMetadata(taskListMetadata(t.getTaskListMetadata())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static PollForDecisionTaskRequest pollForDecisionTaskRequest( + com.uber.cadence.entities.PollForDecisionTaskRequest t) { + if (t == null) { + return null; + } + PollForDecisionTaskRequest.Builder builder = + PollForDecisionTaskRequest.newBuilder() + .setDomain(t.getDomain()) + .setTaskList(taskList(t.getTaskList())); + if (t.getBinaryChecksum() != null) { + builder.setBinaryChecksum(t.getBinaryChecksum()); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static QueryWorkflowRequest queryWorkflowRequest( + com.uber.cadence.entities.QueryWorkflowRequest t) { + if (t == null) { + return null; + } + return QueryWorkflowRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getExecution())) + .setQuery(workflowQuery(t.getQuery())) + .setQueryRejectCondition(queryRejectCondition(t.getQueryRejectCondition())) + .setQueryConsistencyLevel(queryConsistencyLevel(t.getQueryConsistencyLevel())) + .build(); + } + + public static RecordActivityTaskHeartbeatByIDRequest recordActivityTaskHeartbeatByIdRequest( + com.uber.cadence.entities.RecordActivityTaskHeartbeatByIDRequest t) { + if (t == null) { + return null; + } + RecordActivityTaskHeartbeatByIDRequest.Builder builder = + RecordActivityTaskHeartbeatByIDRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(TypeMapper.workflowRunPair(t.getWorkflowID(), t.getRunID())) + .setActivityId(t.getActivityID()) + .setDetails(payload(t.getDetails())); + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RecordActivityTaskHeartbeatRequest recordActivityTaskHeartbeatRequest( + com.uber.cadence.entities.RecordActivityTaskHeartbeatRequest t) { + if (t == null) { + return null; + } + RecordActivityTaskHeartbeatRequest.Builder builder = + RecordActivityTaskHeartbeatRequest.newBuilder().setDetails(payload(t.getDetails())); + if (t.getTaskToken() != null) { + builder.setTaskToken(arrayToByteString(t.getTaskToken())); + } + if (t.getIdentity() != null) { + builder.setIdentity(t.getIdentity()); + } + return builder.build(); + } + + public static RegisterDomainRequest registerDomainRequest( + com.uber.cadence.entities.RegisterDomainRequest t) { + if (t == null) { + return null; + } + RegisterDomainRequest request = + RegisterDomainRequest.newBuilder() + .setName(t.getName()) + .setDescription(Helpers.nullToEmpty(t.getDescription())) + .setOwnerEmail(Helpers.nullToEmpty(t.getOwnerEmail())) + .setWorkflowExecutionRetentionPeriod( + daysToDuration(t.getWorkflowExecutionRetentionPeriodInDays())) + .addAllClusters(clusterReplicationConfigurationArray(t.getClusters())) + .setActiveClusterName(Helpers.nullToEmpty(t.getActiveClusterName())) + .putAllData(Helpers.nullToEmpty(t.getData())) + .setSecurityToken(Helpers.nullToEmpty(t.getSecurityToken())) + .setIsGlobalDomain(nullToEmpty(t.isGlobalDomain())) + .setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())) + .setHistoryArchivalUri(Helpers.nullToEmpty(t.getHistoryArchivalURI())) + .setVisibilityArchivalStatus(archivalStatus(t.getVisibilityArchivalStatus())) + .setVisibilityArchivalUri(Helpers.nullToEmpty(t.getVisibilityArchivalURI())) + .build(); + return request; + } + + public static RestartWorkflowExecutionRequest restartWorkflowExecutionRequest( + com.uber.cadence.entities.RestartWorkflowExecutionRequest t) { + if (t == null) { + return null; + } + return RestartWorkflowExecutionRequest.newBuilder() + .setDomain(t.getDomain()) + .setWorkflowExecution(workflowExecution(t.getWorkflowExecution())) + .setReason(t.getReason()) + .setIdentity(t.getIdentity()) + .build(); + } + + public static UpdateDomainRequest updateDomainRequest( + com.uber.cadence.entities.UpdateDomainRequest t) { + if (t == null) { + return null; + } + Builder request = + UpdateDomainRequest.newBuilder() + .setName(t.getName()) + .setSecurityToken(t.getSecurityToken()); + + List fields = new ArrayList<>(); + com.uber.cadence.entities.UpdateDomainInfo updatedInfo = t.getUpdatedInfo(); + if (updatedInfo != null) { + if (updatedInfo.getDescription() != null) { + request.setDescription(updatedInfo.getDescription()); + fields.add(DomainUpdateDescriptionField); + } + if (updatedInfo.getOwnerEmail() != null) { + request.setOwnerEmail(updatedInfo.getOwnerEmail()); + fields.add(DomainUpdateOwnerEmailField); + } + if (updatedInfo.getData() != null) { + updatedInfo.setData(updatedInfo.getData()); + fields.add(DomainUpdateDataField); + } + } + com.uber.cadence.entities.DomainConfiguration configuration = t.getConfiguration(); + if (configuration != null) { + if (configuration.getWorkflowExecutionRetentionPeriodInDays() > 0) { + request.setWorkflowExecutionRetentionPeriod( + daysToDuration(configuration.getWorkflowExecutionRetentionPeriodInDays())); + fields.add(DomainUpdateRetentionPeriodField); + } + // if t.EmitMetric != null {} - DEPRECATED + if (configuration.getBadBinaries() != null) { + request.setBadBinaries(badBinaries(configuration.getBadBinaries())); + fields.add(DomainUpdateBadBinariesField); + } + if (configuration.getHistoryArchivalStatus() != null) { + request.setHistoryArchivalStatus(archivalStatus(configuration.getHistoryArchivalStatus())); + fields.add(DomainUpdateHistoryArchivalStatusField); + } + if (configuration.getHistoryArchivalURI() != null) { + request.setHistoryArchivalUri(configuration.getHistoryArchivalURI()); + fields.add(DomainUpdateHistoryArchivalURIField); + } + if (configuration.getVisibilityArchivalStatus() != null) { + request.setVisibilityArchivalStatus( + archivalStatus(configuration.getVisibilityArchivalStatus())); + fields.add(DomainUpdateVisibilityArchivalStatusField); + } + if (configuration.getVisibilityArchivalURI() != null) { + request.setVisibilityArchivalUri(configuration.getVisibilityArchivalURI()); + fields.add(DomainUpdateVisibilityArchivalURIField); + } + } + com.uber.cadence.entities.DomainReplicationConfiguration replicationConfiguration = + new com.uber.cadence.entities.DomainReplicationConfiguration(); + if (replicationConfiguration != null) { + if (replicationConfiguration.getActiveClusterName() != null) { + request.setActiveClusterName(replicationConfiguration.getActiveClusterName()); + fields.add(DomainUpdateActiveClusterNameField); + } + if (replicationConfiguration.getClusters() != null) { + request.addAllClusters( + clusterReplicationConfigurationArray(replicationConfiguration.getClusters())); + fields.add(DomainUpdateClustersField); + } + } + if (t.getDeleteBadBinary() != null) { + request.setDeleteBadBinary(t.getDeleteBadBinary()); + fields.add(DomainUpdateDeleteBadBinaryField); + } + if (t.getFailoverTimeoutInSeconds() > 0) { + request.setFailoverTimeout(secondsToDuration(t.getFailoverTimeoutInSeconds())); + fields.add(DomainUpdateFailoverTimeoutField); + } + + request.setUpdateMask(newFieldMask(fields)); + + return request.build(); + } + + public static ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest( + com.uber.cadence.entities.ListClosedWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListClosedWorkflowExecutionsRequest.Builder request = + ListClosedWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getMaximumPageSize()); + if (t.getExecutionFilter() != null) { + request.setExecutionFilter(workflowExecutionFilter(t.getExecutionFilter())); + } + if (t.getTypeFilter() != null) { + request.setTypeFilter(workflowTypeFilter(t.getTypeFilter())); + } + if (t.getStatusFilter() != null) { + request.setStatusFilter(statusFilter(t.getStatusFilter())); + } + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getStartTimeFilter() != null) { + request.setStartTimeFilter(startTimeFilter(t.getStartTimeFilter())); + } + return request.build(); + } + + public static ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest( + com.uber.cadence.entities.ListOpenWorkflowExecutionsRequest t) { + if (t == null) { + return null; + } + ListOpenWorkflowExecutionsRequest.Builder request = + ListOpenWorkflowExecutionsRequest.newBuilder() + .setDomain(t.getDomain()) + .setPageSize(t.getMaximumPageSize()); + if (t.getExecutionFilter() != null) { + request.setExecutionFilter(workflowExecutionFilter(t.getExecutionFilter())); + } + if (t.getTypeFilter() != null) { + request.setTypeFilter(workflowTypeFilter(t.getTypeFilter())); + } + if (t.getNextPageToken() != null) { + request.setNextPageToken(arrayToByteString(t.getNextPageToken())); + } + if (t.getStartTimeFilter() != null) { + request.setStartTimeFilter(startTimeFilter(t.getStartTimeFilter())); + } + return request.build(); + } + + public static RespondActivityTaskFailedByIDRequest respondActivityTaskFailedByIDRequest( + com.uber.cadence.entities.RespondActivityTaskFailedByIDRequest failRequest) { + if (failRequest == null) { + return null; + } + RespondActivityTaskFailedByIDRequest.Builder request = + RespondActivityTaskFailedByIDRequest.newBuilder() + .setDomain(failRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair(failRequest.getWorkflowID(), failRequest.getRunID())) + .setActivityId(failRequest.getActivityID()) + .setFailure(failure(failRequest.getReason(), failRequest.getDetails())) + .setIdentity(failRequest.getIdentity()); + return request.build(); + } + + public static RespondActivityTaskCompletedByIDRequest respondActivityTaskCompletedByIDRequest( + com.uber.cadence.entities.RespondActivityTaskCompletedByIDRequest completeRequest) { + if (completeRequest == null) { + return null; + } + RespondActivityTaskCompletedByIDRequest.Builder request = + RespondActivityTaskCompletedByIDRequest.newBuilder() + .setDomain(completeRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + completeRequest.getWorkflowID(), completeRequest.getRunID())) + .setActivityId(completeRequest.getActivityID()) + .setResult(payload(completeRequest.getResult())) + .setIdentity(completeRequest.getIdentity()); + return request.build(); + } + + public static RecordActivityTaskHeartbeatByIDRequest recordActivityTaskHeartbeatByIDRequest( + com.uber.cadence.entities.RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) { + if (heartbeatRequest == null) { + return null; + } + RecordActivityTaskHeartbeatByIDRequest.Builder request = + RecordActivityTaskHeartbeatByIDRequest.newBuilder() + .setDomain(heartbeatRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + heartbeatRequest.getWorkflowID(), heartbeatRequest.getRunID())) + .setActivityId(heartbeatRequest.getActivityID()) + .setDetails(payload(heartbeatRequest.getDetails())) + .setIdentity(heartbeatRequest.getIdentity()); + return request.build(); + } + + public static RespondActivityTaskCanceledByIDRequest respondActivityTaskCanceledByIDRequest( + com.uber.cadence.entities.RespondActivityTaskCanceledByIDRequest canceledRequest) { + if (canceledRequest == null) { + return null; + } + RespondActivityTaskCanceledByIDRequest.Builder request = + RespondActivityTaskCanceledByIDRequest.newBuilder() + .setDomain(canceledRequest.getDomain()) + .setWorkflowExecution( + TypeMapper.workflowRunPair( + canceledRequest.getWorkflowID(), canceledRequest.getRunID())) + .setActivityId(canceledRequest.getActivityID()) + .setDetails(payload(canceledRequest.getDetails())) + .setIdentity(canceledRequest.getIdentity()); + return request.build(); + } + + public static GetTaskListsByDomainRequest getTaskListsByDomainRequest( + com.uber.cadence.entities.GetTaskListsByDomainRequest domainRequest) { + if (domainRequest == null) { + return null; + } + GetTaskListsByDomainRequest.Builder request = + GetTaskListsByDomainRequest.newBuilder().setDomain(domainRequest.getDomainName()); + return request.build(); + } + + public static RefreshWorkflowTasksRequest refreshWorkflowTasksRequest( + com.uber.cadence.entities.RefreshWorkflowTasksRequest request) { + if (request == null) { + return null; + } + return RefreshWorkflowTasksRequest.newBuilder().setDomain(request.getDomain()).build(); + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java new file mode 100644 index 000000000..c914975c0 --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/ResponseMapper.java @@ -0,0 +1,527 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.domainStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToDays; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.toInt64Value; +import static com.uber.cadence.internal.compatibility.proto.mappers.HistoryMapper.history; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityLocalDispatchInfoMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.activityType; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.badBinaries; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.clusterReplicationConfigurationArrayFromProto; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.dataBlobArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.describeDomainResponseArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.header; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.indexedValueTypeMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.payload; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingActivityInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingChildExecutionInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pendingDecisionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.pollerInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.queryRejected; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.supportedClientVersions; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskList; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListPartitionMetadataArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.taskListStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecution; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionConfiguration; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionInfo; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowExecutionInfoArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQuery; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowQueryMap; +import static com.uber.cadence.internal.compatibility.proto.mappers.TypeMapper.workflowType; + +import com.uber.cadence.api.v1.*; +import java.util.Map; +import java.util.stream.Collectors; + +public class ResponseMapper { + + public static com.uber.cadence.entities.StartWorkflowExecutionResponse + startWorkflowExecutionResponse(StartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.StartWorkflowExecutionResponse startWorkflowExecutionResponse = + new com.uber.cadence.entities.StartWorkflowExecutionResponse(); + startWorkflowExecutionResponse.setRunId(t.getRunId()); + return startWorkflowExecutionResponse; + } + + public static com.uber.cadence.entities.StartWorkflowExecutionAsyncResponse + startWorkflowExecutionAsyncResponse(StartWorkflowExecutionAsyncResponse t) { + return t == null ? null : new com.uber.cadence.entities.StartWorkflowExecutionAsyncResponse(); + } + + public static com.uber.cadence.entities.DescribeTaskListResponse describeTaskListResponse( + DescribeTaskListResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.DescribeTaskListResponse describeTaskListResponse = + new com.uber.cadence.entities.DescribeTaskListResponse(); + describeTaskListResponse.setPollers(pollerInfoArray(t.getPollersList())); + describeTaskListResponse.setTaskListStatus(taskListStatus(t.getTaskListStatus())); + return describeTaskListResponse; + } + + public static com.uber.cadence.entities.RestartWorkflowExecutionResponse + restartWorkflowExecutionResponse(RestartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.RestartWorkflowExecutionResponse restartWorkflowExecutionResponse = + new com.uber.cadence.entities.RestartWorkflowExecutionResponse(); + restartWorkflowExecutionResponse.setRunId(t.getRunId()); + return restartWorkflowExecutionResponse; + } + + public static com.uber.cadence.entities.DescribeWorkflowExecutionResponse + describeWorkflowExecutionResponse(DescribeWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse = + new com.uber.cadence.entities.DescribeWorkflowExecutionResponse(); + describeWorkflowExecutionResponse.setExecutionConfiguration( + workflowExecutionConfiguration(t.getExecutionConfiguration())); + describeWorkflowExecutionResponse.setWorkflowExecutionInfo( + workflowExecutionInfo(t.getWorkflowExecutionInfo())); + describeWorkflowExecutionResponse.setPendingActivities( + pendingActivityInfoArray(t.getPendingActivitiesList())); + describeWorkflowExecutionResponse.setPendingChildren( + pendingChildExecutionInfoArray(t.getPendingChildrenList())); + describeWorkflowExecutionResponse.setPendingDecision( + pendingDecisionInfo(t.getPendingDecision())); + return describeWorkflowExecutionResponse; + } + + public static com.uber.cadence.entities.ClusterInfo getClusterInfoResponse( + GetClusterInfoResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ClusterInfo clusterInfo = + new com.uber.cadence.entities.ClusterInfo(); + clusterInfo.setSupportedClientVersions(supportedClientVersions(t.getSupportedClientVersions())); + return clusterInfo; + } + + public static com.uber.cadence.entities.GetSearchAttributesResponse getSearchAttributesResponse( + GetSearchAttributesResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.GetSearchAttributesResponse getSearchAttributesResponse = + new com.uber.cadence.entities.GetSearchAttributesResponse(); + getSearchAttributesResponse.setKeys(indexedValueTypeMap(t.getKeysMap())); + return getSearchAttributesResponse; + } + + public static com.uber.cadence.entities.GetWorkflowExecutionHistoryResponse + getWorkflowExecutionHistoryResponse(GetWorkflowExecutionHistoryResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.GetWorkflowExecutionHistoryResponse + getWorkflowExecutionHistoryResponse = + new com.uber.cadence.entities.GetWorkflowExecutionHistoryResponse(); + getWorkflowExecutionHistoryResponse.setHistory(history(t.getHistory())); + getWorkflowExecutionHistoryResponse.setRawHistory(dataBlobArray(t.getRawHistoryList())); + getWorkflowExecutionHistoryResponse.setNextPageToken(byteStringToArray(t.getNextPageToken())); + getWorkflowExecutionHistoryResponse.setArchived(t.getArchived()); + return getWorkflowExecutionHistoryResponse; + } + + public static com.uber.cadence.entities.ListArchivedWorkflowExecutionsResponse + listArchivedWorkflowExecutionsResponse(ListArchivedWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListArchivedWorkflowExecutionsResponse res = + new com.uber.cadence.entities.ListArchivedWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.ListClosedWorkflowExecutionsResponse + listClosedWorkflowExecutionsResponse(ListClosedWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListClosedWorkflowExecutionsResponse res = + new com.uber.cadence.entities.ListClosedWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.ListOpenWorkflowExecutionsResponse + listOpenWorkflowExecutionsResponse(ListOpenWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListOpenWorkflowExecutionsResponse res = + new com.uber.cadence.entities.ListOpenWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.ListTaskListPartitionsResponse + listTaskListPartitionsResponse(ListTaskListPartitionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListTaskListPartitionsResponse res = + new com.uber.cadence.entities.ListTaskListPartitionsResponse(); + res.setActivityTaskListPartitions( + taskListPartitionMetadataArray(t.getActivityTaskListPartitionsList())); + res.setDecisionTaskListPartitions( + taskListPartitionMetadataArray(t.getDecisionTaskListPartitionsList())); + return res; + } + + public static com.uber.cadence.entities.ListWorkflowExecutionsResponse + listWorkflowExecutionsResponse(ListWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListWorkflowExecutionsResponse res = + new com.uber.cadence.entities.ListWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.PollForActivityTaskResponse pollForActivityTaskResponse( + PollForActivityTaskResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.PollForActivityTaskResponse res = + new com.uber.cadence.entities.PollForActivityTaskResponse(); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setActivityId(t.getActivityId()); + res.setActivityType(activityType(t.getActivityType())); + res.setInput(payload(t.getInput())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setScheduleToCloseTimeoutSeconds(durationToSeconds(t.getScheduleToCloseTimeout())); + res.setStartToCloseTimeoutSeconds(durationToSeconds(t.getStartToCloseTimeout())); + res.setHeartbeatTimeoutSeconds(durationToSeconds(t.getHeartbeatTimeout())); + res.setAttempt(t.getAttempt()); + res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); + res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setWorkflowDomain(t.getWorkflowDomain()); + res.setHeader(header(t.getHeader())); + return res; + } + + public static com.uber.cadence.entities.PollForDecisionTaskResponse pollForDecisionTaskResponse( + PollForDecisionTaskResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.PollForDecisionTaskResponse res = + new com.uber.cadence.entities.PollForDecisionTaskResponse(); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + res.setWorkflowExecution(workflowExecution(t.getWorkflowExecution())); + res.setWorkflowType(workflowType(t.getWorkflowType())); + res.setPreviousStartedEventId(toInt64Value(t.getPreviousStartedEventId())); + res.setStartedEventId(t.getStartedEventId()); + res.setAttempt(t.getAttempt()); + res.setBacklogCountHint(t.getBacklogCountHint()); + res.setHistory(history(t.getHistory())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + if (t.getQuery() != WorkflowQuery.getDefaultInstance()) { + res.setQuery(workflowQuery(t.getQuery())); + } + res.setWorkflowExecutionTaskList(taskList(t.getWorkflowExecutionTaskList())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setQueries(workflowQueryMap(t.getQueriesMap())); + res.setNextEventId(t.getNextEventId()); + return res; + } + + public static com.uber.cadence.entities.QueryWorkflowResponse queryWorkflowResponse( + QueryWorkflowResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.QueryWorkflowResponse res = + new com.uber.cadence.entities.QueryWorkflowResponse(); + res.setQueryResult(payload(t.getQueryResult())); + res.setQueryRejected(queryRejected(t.getQueryRejected())); + return res; + } + + public static com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatByIdResponse(RecordActivityTaskHeartbeatByIDResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(t.getCancelRequested()); + return res; + } + + public static com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatResponse(RecordActivityTaskHeartbeatResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(t.getCancelRequested()); + return res; + } + + public static com.uber.cadence.entities.ResetWorkflowExecutionResponse + resetWorkflowExecutionResponse(ResetWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ResetWorkflowExecutionResponse res = + new com.uber.cadence.entities.ResetWorkflowExecutionResponse(); + res.setRunId(t.getRunId()); + return res; + } + + public static com.uber.cadence.entities.RespondDecisionTaskCompletedResponse + respondDecisionTaskCompletedResponse(RespondDecisionTaskCompletedResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.RespondDecisionTaskCompletedResponse res = + new com.uber.cadence.entities.RespondDecisionTaskCompletedResponse(); + res.setDecisionTask(pollForDecisionTaskResponse(t.getDecisionTask())); + res.setActivitiesToDispatchLocally( + activityLocalDispatchInfoMap(t.getActivitiesToDispatchLocallyMap())); + return res; + } + + public static com.uber.cadence.entities.ListWorkflowExecutionsResponse + scanWorkflowExecutionsResponse(ScanWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListWorkflowExecutionsResponse res = + new com.uber.cadence.entities.ListWorkflowExecutionsResponse(); + res.setExecutions(workflowExecutionInfoArray(t.getExecutionsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.CountWorkflowExecutionsResponse + countWorkflowExecutionsResponse(CountWorkflowExecutionsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.CountWorkflowExecutionsResponse res = + new com.uber.cadence.entities.CountWorkflowExecutionsResponse(); + res.setCount(t.getCount()); + return res; + } + + public static com.uber.cadence.entities.DescribeDomainResponse describeDomainResponse( + DescribeDomainResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.DescribeDomainResponse response = + new com.uber.cadence.entities.DescribeDomainResponse(); + com.uber.cadence.entities.DomainInfo domainInfo = new com.uber.cadence.entities.DomainInfo(); + response.setDomainInfo(domainInfo); + + domainInfo.setName(t.getDomain().getName()); + domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); + domainInfo.setDescription(t.getDomain().getDescription()); + domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); + domainInfo.setData(t.getDomain().getDataMap()); + domainInfo.setUuid(t.getDomain().getId()); + + com.uber.cadence.entities.DomainConfiguration domainConfiguration = + new com.uber.cadence.entities.DomainConfiguration(); + response.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus( + archivalStatus(t.getDomain().getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getDomain().getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); + + com.uber.cadence.entities.DomainReplicationConfiguration replicationConfiguration = + new com.uber.cadence.entities.DomainReplicationConfiguration(); + response.setReplicationConfiguration(replicationConfiguration); + + replicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); + replicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getDomain().getClustersList())); + + response.setFailoverVersion(t.getDomain().getFailoverVersion()); + response.setIsGlobalDomain(t.getDomain().getIsGlobalDomain()); + return response; + } + + public static com.uber.cadence.entities.ListDomainsResponse listDomainsResponse( + ListDomainsResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.ListDomainsResponse res = + new com.uber.cadence.entities.ListDomainsResponse(); + res.setDomains(describeDomainResponseArray(t.getDomainsList())); + res.setNextPageToken(byteStringToArray(t.getNextPageToken())); + return res; + } + + public static com.uber.cadence.entities.StartWorkflowExecutionResponse + signalWithStartWorkflowExecutionResponse(SignalWithStartWorkflowExecutionResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.StartWorkflowExecutionResponse startWorkflowExecutionResponse = + new com.uber.cadence.entities.StartWorkflowExecutionResponse(); + startWorkflowExecutionResponse.setRunId(t.getRunId()); + return startWorkflowExecutionResponse; + } + + public static com.uber.cadence.entities.SignalWithStartWorkflowExecutionAsyncResponse + signalWithStartWorkflowExecutionAsyncResponse( + SignalWithStartWorkflowExecutionAsyncResponse t) { + return t == null + ? null + : new com.uber.cadence.entities.SignalWithStartWorkflowExecutionAsyncResponse(); + } + + public static com.uber.cadence.entities.UpdateDomainResponse updateDomainResponse( + UpdateDomainResponse t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.UpdateDomainResponse updateDomainResponse = + new com.uber.cadence.entities.UpdateDomainResponse(); + com.uber.cadence.entities.DomainInfo domainInfo = new com.uber.cadence.entities.DomainInfo(); + updateDomainResponse.setDomainInfo(domainInfo); + + domainInfo.setName(t.getDomain().getName()); + domainInfo.setStatus(domainStatus(t.getDomain().getStatus())); + domainInfo.setDescription(t.getDomain().getDescription()); + domainInfo.setOwnerEmail(t.getDomain().getOwnerEmail()); + domainInfo.setData(t.getDomain().getDataMap()); + domainInfo.setUuid(t.getDomain().getId()); + + com.uber.cadence.entities.DomainConfiguration domainConfiguration = + new com.uber.cadence.entities.DomainConfiguration(); + updateDomainResponse.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getDomain().getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getDomain().getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus( + archivalStatus(t.getDomain().getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getDomain().getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getDomain().getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getDomain().getVisibilityArchivalUri()); + + com.uber.cadence.entities.DomainReplicationConfiguration domainReplicationConfiguration = + new com.uber.cadence.entities.DomainReplicationConfiguration(); + updateDomainResponse.setReplicationConfiguration(domainReplicationConfiguration); + + domainReplicationConfiguration.setActiveClusterName(t.getDomain().getActiveClusterName()); + domainReplicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getDomain().getClustersList())); + updateDomainResponse.setFailoverVersion(t.getDomain().getFailoverVersion()); + updateDomainResponse.setIsGlobalDomain(t.getDomain().getIsGlobalDomain()); + return updateDomainResponse; + } + + public static com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse + recordActivityTaskHeartbeatResponse( + RecordActivityTaskHeartbeatByIDResponse recordActivityTaskHeartbeatByID) { + if (recordActivityTaskHeartbeatByID == null) { + return null; + } + com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse res = + new com.uber.cadence.entities.RecordActivityTaskHeartbeatResponse(); + res.setCancelRequested(recordActivityTaskHeartbeatByID.getCancelRequested()); + return res; + } + + public static com.uber.cadence.entities.ResetStickyTaskListResponse resetStickyTaskListResponse( + ResetStickyTaskListResponse resetStickyTaskList) { + if (resetStickyTaskList == null) { + return null; + } + com.uber.cadence.entities.ResetStickyTaskListResponse res = + new com.uber.cadence.entities.ResetStickyTaskListResponse(); + return res; + } + + public static com.uber.cadence.entities.ClusterInfo clusterInfoResponse( + GetClusterInfoResponse clusterInfo) { + if (clusterInfo == null) { + return null; + } + com.uber.cadence.entities.ClusterInfo res = + new com.uber.cadence.entities.ClusterInfo(); + res.setSupportedClientVersions( + TypeMapper.supportedClientVersions(clusterInfo.getSupportedClientVersions())); + return res; + } + + public static com.uber.cadence.entities.GetTaskListsByDomainResponse getTaskListsByDomainResponse( + GetTaskListsByDomainResponse taskListsByDomain) { + if (taskListsByDomain == null) { + return null; + } + com.uber.cadence.entities.GetTaskListsByDomainResponse res = + new com.uber.cadence.entities.GetTaskListsByDomainResponse(); + + res.setActivityTaskListMap( + taskListsByDomain + .getActivityTaskListMapMap() + .entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, e -> describeTaskListResponse(e.getValue())))); + res.setDecisionTaskListMap( + taskListsByDomain + .getDecisionTaskListMapMap() + .entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, e -> describeTaskListResponse(e.getValue())))); + return res; + } +} diff --git a/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java new file mode 100644 index 000000000..82fca471f --- /dev/null +++ b/src/main/java/com/uber/cadence/internal/compatibility/proto/mappers/TypeMapper.java @@ -0,0 +1,932 @@ +/* + * Modifications Copyright (c) 2017-2021 Uber Technologies Inc. + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.internal.compatibility.proto.mappers; + +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.archivalStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.domainStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.encodingType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.indexedValueType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.parentClosePolicy; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.pendingActivityState; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.pendingDecisionState; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.queryResultType; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.taskListKind; +import static com.uber.cadence.internal.compatibility.proto.mappers.EnumMapper.workflowExecutionCloseStatus; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.arrayToByteString; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.byteStringToArray; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToDays; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.durationToSeconds; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.fromDoubleValue; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.secondsToDuration; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.timeToUnixNano; +import static com.uber.cadence.internal.compatibility.proto.mappers.Helpers.unixNanoToTime; + +import com.google.common.base.Strings; +import com.uber.cadence.api.v1.*; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +class TypeMapper { + + static BadBinaryInfo badBinaryInfo(com.uber.cadence.entities.BadBinaryInfo t) { + if (t == null) { + return null; + } + return BadBinaryInfo.newBuilder() + .setReason(t.getReason()) + .setOperator(t.getOperator()) + .setCreatedTime(unixNanoToTime(t.getCreatedTimeNano())) + .build(); + } + + static Payload payload(byte[] data) { + if (data == null) { + return Payload.newBuilder().build(); + } + return Payload.newBuilder().setData(arrayToByteString(data)).build(); + } + + static Failure failure(String reason, byte[] details) { + if (reason == null) { + return Failure.newBuilder().build(); + } + return Failure.newBuilder().setReason(reason).setDetails(arrayToByteString(details)).build(); + } + + static WorkflowExecution workflowExecution(com.uber.cadence.entities.WorkflowExecution t) { + if (t == null) { + return WorkflowExecution.newBuilder().build(); + } + if (t.getWorkflowId() == null && t.getRunId() == null) { + return WorkflowExecution.newBuilder().build(); + } + WorkflowExecution.Builder builder = + WorkflowExecution.newBuilder().setWorkflowId(t.getWorkflowId()); + if (t.getRunId() != null) { + builder.setRunId(t.getRunId()); + } + return builder.build(); + } + + static WorkflowExecution workflowRunPair(String workflowId, String runId) { + if (Strings.isNullOrEmpty(workflowId) && Strings.isNullOrEmpty(runId)) { + return WorkflowExecution.newBuilder().build(); + } + return WorkflowExecution.newBuilder().setWorkflowId(workflowId).setRunId(runId).build(); + } + + static ActivityType activityType(com.uber.cadence.entities.ActivityType t) { + if (t == null) { + return ActivityType.newBuilder().build(); + } + return ActivityType.newBuilder().setName(t.getName()).build(); + } + + static WorkflowType workflowType(com.uber.cadence.entities.WorkflowType t) { + if (t == null) { + return WorkflowType.newBuilder().build(); + } + return WorkflowType.newBuilder().setName(t.getName()).build(); + } + + static TaskList taskList(com.uber.cadence.entities.TaskList t) { + if (t == null) { + return TaskList.newBuilder().build(); + } + return TaskList.newBuilder().setName(t.getName()).setKind(taskListKind(t.getKind())).build(); + } + + static TaskListMetadata taskListMetadata(com.uber.cadence.entities.TaskListMetadata t) { + if (t == null) { + return TaskListMetadata.newBuilder().build(); + } + return TaskListMetadata.newBuilder() + .setMaxTasksPerSecond(fromDoubleValue(t.getMaxTasksPerSecond())) + .build(); + } + + static RetryPolicy retryPolicy(com.uber.cadence.entities.RetryPolicy t) { + if (t == null) { + return null; + } + RetryPolicy.Builder builder = + RetryPolicy.newBuilder() + .setInitialInterval(secondsToDuration(t.getInitialIntervalInSeconds())) + .setBackoffCoefficient(t.getBackoffCoefficient()) + .setMaximumInterval(secondsToDuration(t.getMaximumIntervalInSeconds())) + .setMaximumAttempts(t.getMaximumAttempts()) + .setExpirationInterval(secondsToDuration(t.getExpirationIntervalInSeconds())); + if (t.getNonRetriableErrorReasons() != null) { + builder.addAllNonRetryableErrorReasons(t.getNonRetriableErrorReasons()); + } + return builder.build(); + } + + static Header header(com.uber.cadence.entities.Header t) { + if (t == null) { + return Header.newBuilder().build(); + } + return Header.newBuilder().putAllFields(payloadByteBufferMap(t.getFields())).build(); + } + + static Memo memo(com.uber.cadence.entities.Memo t) { + if (t == null) { + return Memo.newBuilder().build(); + } + return Memo.newBuilder().putAllFields(payloadByteBufferMap(t.getFields())).build(); + } + + static SearchAttributes searchAttributes(com.uber.cadence.entities.SearchAttributes t) { + if (t == null) { + return SearchAttributes.newBuilder().build(); + } + return SearchAttributes.newBuilder() + .putAllIndexedFields(payloadByteBufferMap(t.getIndexedFields())) + .build(); + } + + static BadBinaries badBinaries(com.uber.cadence.entities.BadBinaries t) { + if (t == null) { + return BadBinaries.newBuilder().build(); + } + return BadBinaries.newBuilder().putAllBinaries(badBinaryInfoMap(t.getBinaries())).build(); + } + + static ClusterReplicationConfiguration clusterReplicationConfiguration( + com.uber.cadence.entities.ClusterReplicationConfiguration t) { + if (t == null) { + return ClusterReplicationConfiguration.newBuilder().build(); + } + return ClusterReplicationConfiguration.newBuilder().setClusterName(t.getClusterName()).build(); + } + + static WorkflowQuery workflowQuery(com.uber.cadence.entities.WorkflowQuery t) { + if (t == null) { + return null; + } + return WorkflowQuery.newBuilder() + .setQueryType(t.getQueryType()) + .setQueryArgs(payload(t.getQueryArgs())) + .build(); + } + + static WorkflowQueryResult workflowQueryResult(com.uber.cadence.entities.WorkflowQueryResult t) { + if (t == null) { + return WorkflowQueryResult.newBuilder().build(); + } + return WorkflowQueryResult.newBuilder() + .setResultType(queryResultType(t.getResultType())) + .setAnswer(payload(t.getAnswer())) + .setErrorMessage(t.getErrorMessage()) + .build(); + } + + static StickyExecutionAttributes stickyExecutionAttributes( + com.uber.cadence.entities.StickyExecutionAttributes t) { + if (t == null) { + return StickyExecutionAttributes.newBuilder().build(); + } + return StickyExecutionAttributes.newBuilder() + .setWorkerTaskList(taskList(t.getWorkerTaskList())) + .setScheduleToStartTimeout(secondsToDuration(t.getScheduleToStartTimeoutSeconds())) + .build(); + } + + static WorkerVersionInfo workerVersionInfo(com.uber.cadence.entities.WorkerVersionInfo t) { + if (t == null) { + return WorkerVersionInfo.newBuilder().build(); + } + return WorkerVersionInfo.newBuilder() + .setImpl(t.getImpl()) + .setFeatureVersion(t.getFeatureVersion()) + .build(); + } + + static StartTimeFilter startTimeFilter(com.uber.cadence.entities.StartTimeFilter t) { + if (t == null) { + return null; + } + return StartTimeFilter.newBuilder() + .setEarliestTime(unixNanoToTime(t.getEarliestTime())) + .setLatestTime(unixNanoToTime(t.getLatestTime())) + .build(); + } + + static WorkflowExecutionFilter workflowExecutionFilter( + com.uber.cadence.entities.WorkflowExecutionFilter t) { + if (t == null) { + return WorkflowExecutionFilter.newBuilder().build(); + } + return WorkflowExecutionFilter.newBuilder() + .setWorkflowId(t.getWorkflowId()) + .setRunId(t.getRunId()) + .build(); + } + + static WorkflowTypeFilter workflowTypeFilter(com.uber.cadence.entities.WorkflowTypeFilter t) { + if (t == null) { + return WorkflowTypeFilter.newBuilder().build(); + } + return WorkflowTypeFilter.newBuilder().setName(t.getName()).build(); + } + + static StatusFilter statusFilter(com.uber.cadence.entities.WorkflowExecutionCloseStatus t) { + if (t == null) { + return null; + } + return StatusFilter.newBuilder().setStatus(workflowExecutionCloseStatus(t)).build(); + } + + static Map payloadByteBufferMap(Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, payload(t.get(key).array())); + } + return v; + } + + static Map badBinaryInfoMap( + Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, badBinaryInfo(t.get(key))); + } + return v; + } + + static List clusterReplicationConfigurationArray( + List t) { + if (t == null) { + return Collections.emptyList(); + } + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(clusterReplicationConfiguration(t.get(i))); + } + return v; + } + + static Map workflowQueryResultMap( + Map t) { + if (t == null) { + return Collections.emptyMap(); + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, workflowQueryResult(t.get(key))); + } + return v; + } + + static byte[] payload(Payload t) { + if (t == null || t == Payload.getDefaultInstance()) { + return null; + } + if (t.getData() == null || t.getData().size() == 0) { + // protoPayload will not generate this case + // however, Data field will be dropped by the encoding if it's empty + // and receiver side will see null for the Data field + // since we already know p is not null, Data field must be an empty byte array + return new byte[0]; + } + return byteStringToArray(t.getData()); + } + + static String failureReason(Failure t) { + if (t == null || t == Failure.getDefaultInstance()) { + return null; + } + return t.getReason(); + } + + static byte[] failureDetails(Failure t) { + if (t == null || t == Failure.getDefaultInstance()) { + return null; + } + return byteStringToArray(t.getDetails()); + } + + static com.uber.cadence.entities.WorkflowExecution workflowExecution(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecution we = + new com.uber.cadence.entities.WorkflowExecution(); + we.setWorkflowId(t.getWorkflowId()); + we.setRunId(t.getRunId()); + return we; + } + + static String workflowId(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + return t.getWorkflowId(); + } + + static String runId(WorkflowExecution t) { + if (t == null || t == WorkflowExecution.getDefaultInstance()) { + return null; + } + return t.getRunId(); + } + + static com.uber.cadence.entities.ActivityType activityType(ActivityType t) { + if (t == null || t == ActivityType.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityType activityType = + new com.uber.cadence.entities.ActivityType(); + activityType.setName(t.getName()); + return activityType; + } + + static com.uber.cadence.entities.WorkflowType workflowType(WorkflowType t) { + if (t == null || t == WorkflowType.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowType wt = new com.uber.cadence.entities.WorkflowType(); + wt.setName(t.getName()); + return wt; + } + + static com.uber.cadence.entities.TaskList taskList(TaskList t) { + if (t == null || t == TaskList.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TaskList taskList = new com.uber.cadence.entities.TaskList(); + taskList.setName(t.getName()); + taskList.setKind(taskListKind(t.getKind())); + return taskList; + } + + static com.uber.cadence.entities.RetryPolicy retryPolicy(RetryPolicy t) { + if (t == null || t == RetryPolicy.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.RetryPolicy res = new com.uber.cadence.entities.RetryPolicy(); + res.setInitialIntervalInSeconds(durationToSeconds(t.getInitialInterval())); + res.setBackoffCoefficient(t.getBackoffCoefficient()); + res.setMaximumIntervalInSeconds(durationToSeconds(t.getMaximumInterval())); + res.setMaximumAttempts(t.getMaximumAttempts()); + res.setNonRetriableErrorReasons(t.getNonRetryableErrorReasonsList()); + res.setExpirationIntervalInSeconds(durationToSeconds(t.getExpirationInterval())); + return res; + } + + static com.uber.cadence.entities.Header header(Header t) { + if (t == null || t == Header.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.Header res = new com.uber.cadence.entities.Header(); + res.setFields(payloadMap(t.getFieldsMap())); + return res; + } + + static com.uber.cadence.entities.Memo memo(Memo t) { + if (t == null || t == Memo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.Memo res = new com.uber.cadence.entities.Memo(); + res.setFields(payloadMap(t.getFieldsMap())); + return res; + } + + static com.uber.cadence.entities.SearchAttributes searchAttributes(SearchAttributes t) { + if (t == null || t.getAllFields().size() == 0 || t == SearchAttributes.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.SearchAttributes res = + new com.uber.cadence.entities.SearchAttributes(); + res.setIndexedFields(payloadMap(t.getIndexedFieldsMap())); + return res; + } + + static com.uber.cadence.entities.BadBinaries badBinaries(BadBinaries t) { + if (t == null || t == BadBinaries.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.BadBinaries badBinaries = new com.uber.cadence.entities.BadBinaries(); + badBinaries.setBinaries(badBinaryInfoMapFromProto(t.getBinariesMap())); + return badBinaries; + } + + static com.uber.cadence.entities.BadBinaryInfo badBinaryInfo(BadBinaryInfo t) { + if (t == null || t == BadBinaryInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.BadBinaryInfo res = new com.uber.cadence.entities.BadBinaryInfo(); + res.setReason(t.getReason()); + res.setOperator(t.getOperator()); + res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); + return res; + } + + static Map badBinaryInfoMapFromProto( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, badBinaryInfo(t.get(key))); + } + return v; + } + + static com.uber.cadence.entities.WorkflowQuery workflowQuery(WorkflowQuery t) { + if (t == null || t == WorkflowQuery.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowQuery res = new com.uber.cadence.entities.WorkflowQuery(); + res.setQueryType(t.getQueryType()); + res.setQueryArgs(payload(t.getQueryArgs())); + return res; + } + + static Map payloadMap(Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, ByteBuffer.wrap(payload(t.get(key)))); + } + return v; + } + + static List + clusterReplicationConfigurationArrayFromProto(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (int i = 0; i < t.size(); i++) { + v.add(clusterReplicationConfiguration(t.get(i))); + } + return v; + } + + static com.uber.cadence.entities.ClusterReplicationConfiguration clusterReplicationConfiguration( + ClusterReplicationConfiguration t) { + if (t == null || t == ClusterReplicationConfiguration.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ClusterReplicationConfiguration res = + new com.uber.cadence.entities.ClusterReplicationConfiguration(); + res.setClusterName(t.getClusterName()); + return res; + } + + static com.uber.cadence.entities.DataBlob dataBlob(DataBlob t) { + if (t == null || t == DataBlob.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DataBlob dataBlob = new com.uber.cadence.entities.DataBlob(); + dataBlob.setEncodingType(encodingType(t.getEncodingType())); + dataBlob.setData(byteStringToArray(t.getData())); + return dataBlob; + } + + static long externalInitiatedId(ExternalExecutionInfo t) { + return t.getInitiatedId(); + } + + static com.uber.cadence.entities.WorkflowExecution externalWorkflowExecution( + ExternalExecutionInfo t) { + if (t == null || t == ExternalExecutionInfo.getDefaultInstance()) { + return null; + } + return workflowExecution(t.getWorkflowExecution()); + } + + static com.uber.cadence.entities.ResetPoints resetPoints(ResetPoints t) { + if (t == null || t == ResetPoints.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ResetPoints res = new com.uber.cadence.entities.ResetPoints(); + res.setPoints(resetPointInfoArray(t.getPointsList())); + return res; + } + + static com.uber.cadence.entities.ResetPointInfo resetPointInfo(ResetPointInfo t) { + if (t == null || t == ResetPointInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ResetPointInfo res = new com.uber.cadence.entities.ResetPointInfo(); + res.setBinaryChecksum(t.getBinaryChecksum()); + res.setRunId(t.getRunId()); + res.setFirstDecisionCompletedId(t.getFirstDecisionCompletedId()); + res.setCreatedTimeNano(timeToUnixNano(t.getCreatedTime())); + res.setExpiringTimeNano(timeToUnixNano(t.getExpiringTime())); + res.setResettable(t.getResettable()); + return res; + } + + static com.uber.cadence.entities.PollerInfo pollerInfo(PollerInfo t) { + if (t == null || t == PollerInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.PollerInfo res = new com.uber.cadence.entities.PollerInfo(); + res.setLastAccessTime(timeToUnixNano(t.getLastAccessTime())); + res.setIdentity(t.getIdentity()); + res.setRatePerSecond(t.getRatePerSecond()); + return res; + } + + static com.uber.cadence.entities.TaskListStatus taskListStatus(TaskListStatus t) { + if (t == null || t == TaskListStatus.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TaskListStatus res = new com.uber.cadence.entities.TaskListStatus(); + res.setBacklogCountHint(t.getBacklogCountHint()); + res.setReadLevel(t.getReadLevel()); + res.setAckLevel(t.getAckLevel()); + res.setRatePerSecond(t.getRatePerSecond()); + res.setTaskIDBlock(taskIdBlock(t.getTaskIdBlock())); + return res; + } + + static com.uber.cadence.entities.TaskIDBlock taskIdBlock(TaskIDBlock t) { + if (t == null || t == TaskIDBlock.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TaskIDBlock res = new com.uber.cadence.entities.TaskIDBlock(); + res.setStartID(t.getStartId()); + res.setEndID(t.getEndId()); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionConfiguration workflowExecutionConfiguration( + WorkflowExecutionConfiguration t) { + if (t == null || t == WorkflowExecutionConfiguration.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionConfiguration res = + new com.uber.cadence.entities.WorkflowExecutionConfiguration(); + res.setTaskList(taskList(t.getTaskList())); + res.setExecutionStartToCloseTimeoutSeconds( + durationToSeconds(t.getExecutionStartToCloseTimeout())); + res.setTaskStartToCloseTimeoutSeconds(durationToSeconds(t.getTaskStartToCloseTimeout())); + return res; + } + + static com.uber.cadence.entities.WorkflowExecutionInfo workflowExecutionInfo( + WorkflowExecutionInfo t) { + if (t == null || t == WorkflowExecutionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.WorkflowExecutionInfo res = + new com.uber.cadence.entities.WorkflowExecutionInfo(); + res.setExecution(workflowExecution(t.getWorkflowExecution())); + res.setType(workflowType(t.getType())); + res.setStartTime(timeToUnixNano(t.getStartTime())); + res.setCloseTime(timeToUnixNano(t.getCloseTime())); + res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); + res.setHistoryLength(t.getHistoryLength()); + res.setParentDomainName(parentDomainName(t.getParentExecutionInfo())); + res.setParentDomainId(parentDomainId(t.getParentExecutionInfo())); + res.setParentExecution(parentWorkflowExecution(t.getParentExecutionInfo())); + res.setExecutionTime(timeToUnixNano(t.getExecutionTime())); + res.setMemo(memo(t.getMemo())); + res.setSearchAttributes(searchAttributes(t.getSearchAttributes())); + res.setAutoResetPoints(resetPoints(t.getAutoResetPoints())); + res.setTaskList(t.getTaskList()); + res.setIsCron(t.getIsCron()); + return res; + } + + static String parentDomainId(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return t.getDomainId(); + } + + static String parentDomainName(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return t.getDomainName(); + } + + static long parentInitiatedId(ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return -1; + } + return t.getInitiatedId(); + } + + static com.uber.cadence.entities.WorkflowExecution parentWorkflowExecution( + ParentExecutionInfo t) { + if (t == null || t == ParentExecutionInfo.getDefaultInstance()) { + return null; + } + return workflowExecution(t.getWorkflowExecution()); + } + + static com.uber.cadence.entities.PendingActivityInfo pendingActivityInfo(PendingActivityInfo t) { + if (t == null || t == PendingActivityInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.PendingActivityInfo res = + new com.uber.cadence.entities.PendingActivityInfo(); + res.setActivityID(t.getActivityId()); + res.setActivityType(activityType(t.getActivityType())); + res.setState(pendingActivityState(t.getState())); + res.setHeartbeatDetails(payload(t.getHeartbeatDetails())); + res.setLastHeartbeatTimestamp(timeToUnixNano(t.getLastHeartbeatTime())); + res.setLastStartedTimestamp(timeToUnixNano(t.getLastStartedTime())); + res.setAttempt(t.getAttempt()); + res.setMaximumAttempts(t.getMaximumAttempts()); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setExpirationTimestamp(timeToUnixNano(t.getExpirationTime())); + res.setLastFailureReason(failureReason(t.getLastFailure())); + res.setLastFailureDetails(failureDetails(t.getLastFailure())); + res.setLastWorkerIdentity(t.getLastWorkerIdentity()); + return res; + } + + static com.uber.cadence.entities.PendingChildExecutionInfo pendingChildExecutionInfo( + PendingChildExecutionInfo t) { + if (t == null || t == PendingChildExecutionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.PendingChildExecutionInfo res = + new com.uber.cadence.entities.PendingChildExecutionInfo(); + res.setWorkflowID(workflowId(t.getWorkflowExecution())); + res.setRunID(runId(t.getWorkflowExecution())); + res.setWorkflowTypName(t.getWorkflowTypeName()); + res.setInitiatedID(t.getInitiatedId()); + res.setParentClosePolicy(parentClosePolicy(t.getParentClosePolicy())); + return res; + } + + static com.uber.cadence.entities.PendingDecisionInfo pendingDecisionInfo(PendingDecisionInfo t) { + if (t == null || t == PendingDecisionInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.PendingDecisionInfo res = + new com.uber.cadence.entities.PendingDecisionInfo(); + res.setState(pendingDecisionState(t.getState())); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setAttempt(t.getAttempt()); + res.setOriginalScheduledTimestamp(timeToUnixNano(t.getOriginalScheduledTime())); + return res; + } + + static com.uber.cadence.entities.ActivityLocalDispatchInfo activityLocalDispatchInfo( + ActivityLocalDispatchInfo t) { + if (t == null || t == ActivityLocalDispatchInfo.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.ActivityLocalDispatchInfo res = + new com.uber.cadence.entities.ActivityLocalDispatchInfo(); + res.setActivityId(t.getActivityId()); + res.setScheduledTimestamp(timeToUnixNano(t.getScheduledTime())); + res.setStartedTimestamp(timeToUnixNano(t.getStartedTime())); + res.setScheduledTimestampOfThisAttempt(timeToUnixNano(t.getScheduledTimeOfThisAttempt())); + res.setTaskToken(byteStringToArray(t.getTaskToken())); + return res; + } + + static com.uber.cadence.entities.SupportedClientVersions supportedClientVersions( + SupportedClientVersions t) { + if (t == null || t == SupportedClientVersions.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.SupportedClientVersions res = + new com.uber.cadence.entities.SupportedClientVersions(); + res.setGoSdk(t.getGoSdk()); + res.setJavaSdk(t.getJavaSdk()); + return res; + } + + static com.uber.cadence.entities.DescribeDomainResponse describeDomainResponseDomain(Domain t) { + if (t == null || t == Domain.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.DescribeDomainResponse res = + new com.uber.cadence.entities.DescribeDomainResponse(); + com.uber.cadence.entities.DomainInfo domainInfo = new com.uber.cadence.entities.DomainInfo(); + res.setDomainInfo(domainInfo); + + domainInfo.setName(t.getName()); + domainInfo.setStatus(domainStatus(t.getStatus())); + domainInfo.setDescription(t.getDescription()); + domainInfo.setOwnerEmail(t.getOwnerEmail()); + domainInfo.setData(t.getDataMap()); + domainInfo.setUuid(t.getId()); + + com.uber.cadence.entities.DomainConfiguration domainConfiguration = + new com.uber.cadence.entities.DomainConfiguration(); + res.setConfiguration(domainConfiguration); + + domainConfiguration.setWorkflowExecutionRetentionPeriodInDays( + durationToDays(t.getWorkflowExecutionRetentionPeriod())); + domainConfiguration.setEmitMetric(true); + domainConfiguration.setBadBinaries(badBinaries(t.getBadBinaries())); + domainConfiguration.setHistoryArchivalStatus(archivalStatus(t.getHistoryArchivalStatus())); + domainConfiguration.setHistoryArchivalURI(t.getHistoryArchivalUri()); + domainConfiguration.setVisibilityArchivalStatus( + archivalStatus(t.getVisibilityArchivalStatus())); + domainConfiguration.setVisibilityArchivalURI(t.getVisibilityArchivalUri()); + + com.uber.cadence.entities.DomainReplicationConfiguration domainReplicationConfiguration = + new com.uber.cadence.entities.DomainReplicationConfiguration(); + res.setReplicationConfiguration(domainReplicationConfiguration); + + domainReplicationConfiguration.setActiveClusterName(t.getActiveClusterName()); + domainReplicationConfiguration.setClusters( + clusterReplicationConfigurationArrayFromProto(t.getClustersList())); + res.setFailoverVersion(t.getFailoverVersion()); + res.setIsGlobalDomain(t.getIsGlobalDomain()); + + return res; + } + + static com.uber.cadence.entities.TaskListMetadata taskListMetadata(TaskListMetadata t) { + if (t == null) { + return null; + } + com.uber.cadence.entities.TaskListMetadata res = + new com.uber.cadence.entities.TaskListMetadata(); + res.setMaxTasksPerSecond(t.getMaxTasksPerSecond().getValue()); + return res; + } + + static com.uber.cadence.entities.TaskListPartitionMetadata taskListPartitionMetadata( + TaskListPartitionMetadata t) { + if (t == null || t == TaskListPartitionMetadata.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.TaskListPartitionMetadata res = + new com.uber.cadence.entities.TaskListPartitionMetadata(); + res.setKey(t.getKey()); + res.setOwnerHostName(t.getOwnerHostName()); + return res; + } + + static com.uber.cadence.entities.QueryRejected queryRejected(QueryRejected t) { + if (t == null || t == QueryRejected.getDefaultInstance()) { + return null; + } + com.uber.cadence.entities.QueryRejected res = new com.uber.cadence.entities.QueryRejected(); + res.setCloseStatus(workflowExecutionCloseStatus(t.getCloseStatus())); + return res; + } + + static List pollerInfoArray(List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PollerInfo pollerInfo : t) { + v.add(pollerInfo(pollerInfo)); + } + return v; + } + + static List resetPointInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (ResetPointInfo resetPointInfo : t) { + v.add(resetPointInfo(resetPointInfo)); + } + return v; + } + + static List pendingActivityInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PendingActivityInfo pendingActivityInfo : t) { + v.add(pendingActivityInfo(pendingActivityInfo)); + } + return v; + } + + static List pendingChildExecutionInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (PendingChildExecutionInfo pendingChildExecutionInfo : t) { + v.add(pendingChildExecutionInfo(pendingChildExecutionInfo)); + } + return v; + } + + static Map indexedValueTypeMap( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, indexedValueType(t.get(key))); + } + return v; + } + + static List dataBlobArray(List t) { + if (t == null || t.size() == 0) { + return null; + } + List v = new ArrayList<>(); + for (DataBlob dataBlob : t) { + v.add(dataBlob(dataBlob)); + } + return v; + } + + static List workflowExecutionInfoArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (WorkflowExecutionInfo workflowExecutionInfo : t) { + v.add(workflowExecutionInfo(workflowExecutionInfo)); + } + return v; + } + + static List describeDomainResponseArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (Domain domain : t) { + v.add(describeDomainResponseDomain(domain)); + } + return v; + } + + static List taskListPartitionMetadataArray( + List t) { + if (t == null) { + return null; + } + List v = new ArrayList<>(); + for (TaskListPartitionMetadata taskListPartitionMetadata : t) { + v.add(taskListPartitionMetadata(taskListPartitionMetadata)); + } + return v; + } + + static Map workflowQueryMap( + Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, workflowQuery(t.get(key))); + } + return v; + } + + static Map + activityLocalDispatchInfoMap(Map t) { + if (t == null) { + return null; + } + Map v = new HashMap<>(); + for (String key : t.keySet()) { + v.put(key, activityLocalDispatchInfo(t.get(key))); + } + return v; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java b/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java new file mode 100644 index 000000000..1727bbe8d --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/AsyncMethodCallback.java @@ -0,0 +1,31 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient; + +public interface AsyncMethodCallback { + /** + * Called when the remote service has completed processing the request and the response has been + * fully received. + * @param response + */ + public void onComplete(T response); + + /** + * Called when there is an unexpected expection. Exception is wrapped in {@link ServiceClientError}. + * + * @param exception + */ + public void onError(Exception exception); +} diff --git a/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceV4.java b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceV4.java new file mode 100644 index 000000000..5b61628a9 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/IWorkflowServiceV4.java @@ -0,0 +1,824 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient; + +import com.uber.cadence.entities.*; +import com.uber.cadence.serviceclient.exceptions.*; +import java.util.concurrent.CompletableFuture; + +public interface IWorkflowServiceV4 extends Iface, AsyncIface { + void close(); + + ClientOptions getOptions(); + + /** + * StartWorkflowExecutionWithTimeout start workflow same as StartWorkflowExecution but with + * timeout + * + * @param startRequest + * @param resultHandler + * @param timeoutInMillis + * @throws ServiceClientError + */ + void StartWorkflowExecutionWithTimeout( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError; + + /** + * StartWorkflowExecutionAsyncWithTimeout start workflow same as StartWorkflowExecutionAsync but + * with timeout + * + * @param startAsyncRequest + * @param resultHandler + * @param timeoutInMillis + * @throws ServiceClientError + */ + void StartWorkflowExecutionAsyncWithTimeout( + StartWorkflowExecutionAsyncRequest startAsyncRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError; + + /** + * GetWorkflowExecutionHistoryWithTimeout get workflow history same as GetWorkflowExecutionHistory + * but with timeout. + * + * @param getRequest + * @param timeoutInMillis + * @return GetWorkflowExecutionHistoryResponse + * @throws ServiceClientError + */ + GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) + throws ServiceClientError; + + /** + * GetWorkflowExecutionHistoryWithTimeout get workflow history asynchronously same as + * GetWorkflowExecutionHistory but with timeout. + * + * @param getRequest + * @param resultHandler + * @param timeoutInMillis + * @throws ServiceClientError + */ + void GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError; + + /** + * SignalWorkflowExecutionWithTimeout signal workflow same as SignalWorkflowExecution but with + * timeout + * + * @param signalRequest + * @param resultHandler + * @param timeoutInMillis + * @throws ServiceClientError + */ + void SignalWorkflowExecutionWithTimeout( + SignalWorkflowExecutionRequest signalRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError; + + /** + * Checks if we have a valid connection to the Cadence cluster, and potentially resets the peer + * list + */ + CompletableFuture isHealthy(); +} + +interface Iface { + + /** + * RegisterDomain creates a new domain which can be used as a container for all resources. Domain + * is a top level entity within Cadence, used as a container for all resources like workflow + * executions, tasklists, etc. Domain acts as a sandbox and provides isolation for all resources + * within the domain. All resources belongs to exactly one domain. + * + * @param registerRequest + */ + public void RegisterDomain(RegisterDomainRequest registerRequest) + throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * DescribeDomain returns the information and configuration for a registered domain. + * + * @param describeRequest + */ + public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ListDomains returns the information and configuration for all domains. + * + * @param listRequest + */ + public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * UpdateDomain is used to update the information and configuration for a registered domain. + * + * @param updateRequest + */ + public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain + * is deprecated it cannot be used to start new workflow executions. Existing workflow executions + * will continue to run on deprecated domains. + * + * @param deprecateRequest + */ + public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * RestartWorkflowExecution restarts a previous workflow If the workflow is currently running it + * will terminate and restart + * + * @param restartRequest + */ + public RestartWorkflowExecutionResponse RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest) + throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, + EntityNotExistsError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * StartWorkflowExecution starts a new long running workflow instance. It will create the instance + * with 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for + * the worker to make the first decision for this instance. It will return + * 'WorkflowExecutionAlreadyStartedError', if an instance already exists with same workflowId. + * + * @param startRequest + */ + public StartWorkflowExecutionResponse StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * StartWorkflowExecutionAsync starts a new long running workflow instance asynchronously. It will + * push a StartWorkflowExecutionRequest to a queue and immediately return a response. The request + * will be processed by a separate consumer eventually. + * + * @param startRequest + */ + public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if + * speficied workflow execution in unknown to the service. + * + * @param getRequest + */ + public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * PollForDecisionTask is called by application worker to process DecisionTask from a specific + * taskList. A DecisionTask is dispatched to callers for active workflow executions, with pending + * decisions. Application is then expected to call 'RespondDecisionTaskCompleted' API when it is + * done processing the DecisionTask. It will also create a 'DecisionTaskStarted' event in the + * history for that session before handing off DecisionTask to application worker. + * + * @param pollRequest + */ + public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed + * as a result of 'PollForDecisionTask' API call. Completing a DecisionTask will result in new + * events for the workflow execution and potentially new ActivityTask being created for + * corresponding decisions. It will also create a DecisionTaskCompleted event in the history for + * that session. Use the 'taskToken' provided as response of PollForDecisionTask API call for + * completing the DecisionTask. The response could contain a new decision task if there is one or + * if the request asking for one. + * + * @param completeRequest + */ + public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in + * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be + * used by client to either clear sticky tasklist or report any panics during DecisionTask + * processing. Cadence will only append first DecisionTaskFailed event to the history of workflow + * execution for consecutive failures. + * + * @param failedRequest + */ + public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * PollForActivityTask is called by application worker to process ActivityTask from a specific + * taskList. ActivityTask is dispatched to callers whenever a ScheduleTask decision is made for a + * workflow execution. Application is expected to call 'RespondActivityTaskCompleted' or + * 'RespondActivityTaskFailed' once it is done processing the task. Application also needs to call + * 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to prevent the task + * from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow + * execution history before the ActivityTask is dispatched to application worker. + * + * @param pollRequest + */ + public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * RecordActivityTaskHeartbeat is called by application worker while it is processing an + * ActivityTask. If worker fails to heartbeat within 'heartbeatTimeoutSeconds' interval for the + * ActivityTask, then it will be marked as timedout and 'ActivityTaskTimedOut' event will be + * written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will fail with + * 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of + * PollForActivityTask API call for heartbeating. + * + * @param heartbeatRequest + */ + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RecordActivityTaskHeartbeatByID is called by application worker while it is processing an + * ActivityTask. If worker fails to heartbeat within 'heartbeatTimeoutSeconds' interval for the + * ActivityTask, then it will be marked as timedout and 'ActivityTaskTimedOut' event will be + * written to the workflow history. Calling 'RecordActivityTaskHeartbeatByID' will fail with + * 'EntityNotExistsError' in such situations. Instead of using 'taskToken' like in + * RecordActivityTaskHeartbeat, use Domain, WorkflowID and ActivityID + * + * @param heartbeatRequest + */ + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskCompleted is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskCompleted' event being written to the + * workflow history and a new DecisionTask created for the workflow so new decisions could be + * made. Use the 'taskToken' provided as response of PollForActivityTask API call for completion. + * It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to activity + * timeout. + * + * @param completeRequest + */ + public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskCompletedByID is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskCompleted' event being written to the + * workflow history and a new DecisionTask created for the workflow so new decisions could be + * made. Similar to RespondActivityTaskCompleted but use Domain, WorkflowID and ActivityID instead + * of 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs are not + * valid anymore due to activity timeout. + * + * @param completeRequest + */ + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskFailed is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskFailed' event being written to the workflow + * history and a new DecisionTask created for the workflow instance so new decisions could be + * made. Use the 'taskToken' provided as response of PollForActivityTask API call for completion. + * It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to activity + * timeout. + * + * @param failRequest + */ + public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskFailedByID is called by application worker when it is done processing an + * ActivityTask. It will result in a new 'ActivityTaskFailed' event being written to the workflow + * history and a new DecisionTask created for the workflow instance so new decisions could be + * made. Similar to RespondActivityTaskFailed but use Domain, WorkflowID and ActivityID instead of + * 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs are not valid + * anymore due to activity timeout. + * + * @param failRequest + */ + public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an + * ActivityTask. It will result in a new 'ActivityTaskCanceled' event being written to the + * workflow history and a new DecisionTask created for the workflow instance so new decisions + * could be made. Use the 'taskToken' provided as response of PollForActivityTask API call for + * completion. It fails with 'EntityNotExistsError' if the taskToken is not valid anymore due to + * activity timeout. + * + * @param canceledRequest + */ + public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RespondActivityTaskCanceledByID is called by application worker when it is successfully + * canceled an ActivityTask. It will result in a new 'ActivityTaskCanceled' event being written to + * the workflow history and a new DecisionTask created for the workflow instance so new decisions + * could be made. Similar to RespondActivityTaskCanceled but use Domain, WorkflowID and ActivityID + * instead of 'taskToken' for completion. It fails with 'EntityNotExistsError' if the these IDs + * are not valid anymore due to activity timeout. + * + * @param canceledRequest + */ + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * RequestCancelWorkflowExecution is called by application worker when it wants to request + * cancellation of a workflow instance. It will result in a new 'WorkflowExecutionCancelRequested' + * event being written to the workflow history and a new DecisionTask created for the workflow + * instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow + * is not valid anymore due to completion or doesn't exist. + * + * @param cancelRequest + */ + public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) + throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, + ServiceBusyError, DomainNotActiveError, LimitExceededError, + ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError; + + /** + * SignalWorkflowExecution is used to send a signal event to running workflow execution. This + * results in WorkflowExecutionSignaled event recorded in the history and a decision task being + * created for the execution. + * + * @param signalRequest + */ + public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError; + + /** + * SignalWithStartWorkflowExecution is used to ensure sending signal to a workflow. If the + * workflow is running, this results in WorkflowExecutionSignaled event being recorded in the + * history and a decision task being created for the execution. If the workflow is not running or + * not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled events being + * recorded in history, and a decision task being created for the execution + * + * @param signalWithStartRequest + */ + public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, + ServiceClientError; + + /** + * SignalWithStartWorkflowExecutionAsync is used to ensure sending signal to a workflow + * asynchronously. It will push a SignalWithStartWorkflowExecutionRequest to a queue and + * immediately return a response. The request will be processed by a separate consumer eventually. + * + * @param signalWithStartRequest + */ + public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ResetWorkflowExecution reset an existing workflow execution to DecisionTaskCompleted + * event(exclusive). And it will immediately terminating the current execution instance. + * + * @param resetRequest + */ + public ResetWorkflowExecutionResponse ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * TerminateWorkflowExecution terminates an existing workflow execution by recording + * WorkflowExecutionTerminated event in the history and immediately terminating the execution + * instance. + * + * @param terminateRequest + */ + public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError; + + /** + * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific + * domain. + * + * @param listRequest + */ + public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific + * domain. + * + * @param listRequest + */ + public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ListWorkflowExecutions is a visibility API to list workflow executions in a specific domain. + * + * @param listRequest + */ + public ListWorkflowExecutionsResponse ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ListArchivedWorkflowExecutions is a visibility API to list archived workflow executions in a + * specific domain. + * + * @param listRequest + */ + public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ScanWorkflowExecutions is a visibility API to list large amount of workflow executions in a + * specific domain without order. + * + * @param listRequest + */ + public ListWorkflowExecutionsResponse ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * CountWorkflowExecutions is a visibility API to count of workflow executions in a specific + * domain. + * + * @param countRequest + */ + public CountWorkflowExecutionsResponse CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * GetSearchAttributes is a visibility API to get all legal keys that could be used in list APIs + */ + public GetSearchAttributesResponse GetSearchAttributes() + throws ServiceBusyError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a + * DecisionTask for query) as a result of 'PollForDecisionTask' API call. Completing a QueryTask + * will unblock the client call to 'QueryWorkflow' API and return the query result to client as a + * response to 'QueryWorkflow' API call. + * + * @param completeRequest + */ + public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * Reset the sticky tasklist related information in mutable state of a given workflow. Things + * cleared are: 1. StickyTaskList 2. StickyScheduleToStartTimeout 3. ClientLibraryVersion 4. + * ClientFeatureVersion 5. ClientImpl + * + * @param resetRequest + */ + public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError; + + /** + * QueryWorkflow returns query result for a specified workflow execution + * + * @param queryRequest + */ + public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) + throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, ServiceClientError; + + /** + * DescribeWorkflowExecution returns information about the specified workflow execution. + * + * @param describeRequest + */ + public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * DescribeTaskList returns information about the target tasklist, right now this API returns the + * pollers which polled this tasklist in last few minutes. + * + * @param request + */ + public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** GetClusterInfo returns information about cadence cluster */ + public ClusterInfo GetClusterInfo() + throws InternalServiceError, ServiceBusyError, ServiceClientError; + + /** + * GetTaskListsByDomain returns the list of all the task lists for a domainName. + * + * @param request + */ + public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError; + + /** + * ReapplyEvents applies stale events to the current workflow and current run + * + * @param request + */ + public ListTaskListPartitionsResponse ListTaskListPartitions( + ListTaskListPartitionsRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ServiceClientError; + + /** + * RefreshWorkflowTasks refreshes all tasks of a workflow + * + * @param request + */ + public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) + throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ServiceClientError; +} + +interface AsyncIface { + + public void RegisterDomain( + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void DescribeDomain( + DescribeDomainRequest describeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListDomains( + ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void UpdateDomain( + UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void DeprecateDomain( + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void PollForDecisionTask( + PollForDecisionTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondDecisionTaskFailed( + RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void PollForActivityTask( + PollForActivityTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskCompleted( + RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskFailed( + RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskFailedByID( + RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskCanceled( + RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RequestCancelWorkflowExecution( + RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void SignalWorkflowExecution( + SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void TerminateWorkflowExecution( + TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void GetSearchAttributes(AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RespondQueryTaskCompleted( + RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ResetStickyTaskList( + ResetStickyTaskListRequest resetRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void QueryWorkflow( + QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void DescribeTaskList( + DescribeTaskListRequest request, AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void GetClusterInfo(AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void GetTaskListsByDomain( + GetTaskListsByDomainRequest request, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void ListTaskListPartitions( + ListTaskListPartitionsRequest request, + AsyncMethodCallback resultHandler) + throws ServiceClientError; + + public void RefreshWorkflowTasks( + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) + throws ServiceClientError; +} diff --git a/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java new file mode 100644 index 000000000..cec90a600 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/WorkflowServiceGrpc.java @@ -0,0 +1,1398 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient; + +import com.google.common.util.concurrent.FutureCallback; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; +import com.uber.cadence.entities.*; +import com.uber.cadence.internal.compatibility.proto.mappers.*; +import com.uber.cadence.internal.compatibility.proto.serviceclient.IGrpcServiceStubs; +import com.uber.cadence.serviceclient.exceptions.BadRequestError; +import com.uber.cadence.serviceclient.exceptions.CancellationAlreadyRequestedError; +import com.uber.cadence.serviceclient.exceptions.ClientVersionNotSupportedError; +import com.uber.cadence.serviceclient.exceptions.DomainAlreadyExistsError; +import com.uber.cadence.serviceclient.exceptions.DomainNotActiveError; +import com.uber.cadence.serviceclient.exceptions.EntityNotExistsError; +import com.uber.cadence.serviceclient.exceptions.InternalServiceError; +import com.uber.cadence.serviceclient.exceptions.LimitExceededError; +import com.uber.cadence.serviceclient.exceptions.QueryFailedError; +import com.uber.cadence.serviceclient.exceptions.ServiceBusyError; +import com.uber.cadence.serviceclient.exceptions.ServiceClientError; +import com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyCompletedError; +import com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyStartedError; +import io.grpc.*; +import java.time.Duration; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +public class WorkflowServiceGrpc implements IWorkflowServiceV4 { + + private final IGrpcServiceStubs grpcServiceStubs; + private final Executor executor = MoreExecutors.directExecutor(); + + WorkflowServiceGrpc(ClientOptions options) { + this.grpcServiceStubs = IGrpcServiceStubs.newInstance(options); + } + + @Override + public void close() { + grpcServiceStubs.shutdown(); + } + + @Override + public ClientOptions getOptions() { + return grpcServiceStubs.getOptions(); + } + + @Override + public CompletableFuture isHealthy() { + CompletableFuture completableFuture = new CompletableFuture<>(); + Futures.addCallback( + grpcServiceStubs + .metaFutureStub() + .health(com.uber.cadence.api.v1.HealthRequest.getDefaultInstance()), + new FutureCallback() { + @Override + public void onSuccess(com.uber.cadence.api.v1.HealthResponse response) { + completableFuture.complete(response.getOk()); + } + + @Override + public void onFailure(Throwable throwable) { + completableFuture.completeExceptionally(toServiceClientException(throwable)); + } + }, + executor); + return completableFuture; + } + + @Override + public void StartWorkflowExecutionWithTimeout( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecutionAsyncWithTimeout( + StartWorkflowExecutionAsyncRequest startAsyncRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startAsyncRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, Long timeoutInMillis) + throws ServiceClientError { + try { + return ResponseMapper.getWorkflowExecutionHistoryResponse( + grpcServiceStubs + .workflowBlockingStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void GetWorkflowExecutionHistoryWithTimeout( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)), + toFutureCallback(resultHandler, ResponseMapper::getWorkflowExecutionHistoryResponse), + executor); + } + + @Override + public void SignalWorkflowExecutionWithTimeout( + SignalWorkflowExecutionRequest signalRequest, + AsyncMethodCallback resultHandler, + Long timeoutInMillis) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .withDeadlineAfter(timeoutInMillis, TimeUnit.MILLISECONDS) + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RegisterDomain(RegisterDomainRequest registerRequest) + throws BadRequestError, DomainAlreadyExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + grpcServiceStubs + .domainBlockingStub() + .registerDomain(RequestMapper.registerDomainRequest(registerRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeDomainResponse DescribeDomain(DescribeDomainRequest describeRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.describeDomainResponse( + grpcServiceStubs + .domainBlockingStub() + .describeDomain(RequestMapper.describeDomainRequest(describeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListDomainsResponse ListDomains(ListDomainsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.listDomainsResponse( + grpcServiceStubs + .domainBlockingStub() + .listDomains(RequestMapper.listDomainsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public UpdateDomainResponse UpdateDomain(UpdateDomainRequest updateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.updateDomainResponse( + grpcServiceStubs + .domainBlockingStub() + .updateDomain(RequestMapper.updateDomainRequest(updateRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void DeprecateDomain(DeprecateDomainRequest deprecateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + ClientVersionNotSupportedError, ServiceClientError { + try { + grpcServiceStubs + .domainBlockingStub() + .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RestartWorkflowExecutionResponse RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest) + throws BadRequestError, ServiceBusyError, DomainNotActiveError, LimitExceededError, + EntityNotExistsError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.restartWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .restartWorkflowExecution( + RequestMapper.restartWorkflowExecutionRequest(restartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionResponse StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.startWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionAsyncResponse StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.startWorkflowExecutionAsyncResponse( + grpcServiceStubs + .workflowBlockingStub() + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.getWorkflowExecutionHistoryResponse( + grpcServiceStubs + .workflowBlockingStub() + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public PollForDecisionTaskResponse PollForDecisionTask(PollForDecisionTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.pollForDecisionTaskResponse( + grpcServiceStubs + .workerBlockingStub() + .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + return ResponseMapper.respondDecisionTaskCompletedResponse( + grpcServiceStubs + .workerBlockingStub() + .respondDecisionTaskCompleted( + RequestMapper.respondDecisionTaskCompletedRequest(completeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondDecisionTaskFailed(RespondDecisionTaskFailedRequest failedRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondDecisionTaskFailed(RequestMapper.respondDecisionTaskFailedRequest(failedRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public PollForActivityTaskResponse PollForActivityTask(PollForActivityTaskRequest pollRequest) + throws BadRequestError, ServiceBusyError, LimitExceededError, EntityNotExistsError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.pollForActivityTaskResponse( + grpcServiceStubs + .workerBlockingStub() + .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + return ResponseMapper.recordActivityTaskHeartbeatResponse( + grpcServiceStubs + .workerBlockingStub() + .recordActivityTaskHeartbeat( + RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + return ResponseMapper.recordActivityTaskHeartbeatResponse( + grpcServiceStubs + .workerBlockingStub() + .recordActivityTaskHeartbeatByID( + RequestMapper.recordActivityTaskHeartbeatByIDRequest(heartbeatRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCompleted(RespondActivityTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCompleted( + RequestMapper.respondActivityTaskCompletedRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCompletedByID( + RequestMapper.respondActivityTaskCompletedByIDRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskFailed(RespondActivityTaskFailedRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskFailedByID(RespondActivityTaskFailedByIDRequest failRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskFailedByID( + RequestMapper.respondActivityTaskFailedByIDRequest(failRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCanceled(RespondActivityTaskCanceledRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCanceled( + RequestMapper.respondActivityTaskCanceledRequest(canceledRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest) + throws BadRequestError, EntityNotExistsError, DomainNotActiveError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondActivityTaskCanceledByID( + RequestMapper.respondActivityTaskCanceledByIDRequest(canceledRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest cancelRequest) + throws BadRequestError, EntityNotExistsError, CancellationAlreadyRequestedError, + ServiceBusyError, DomainNotActiveError, LimitExceededError, + ClientVersionNotSupportedError, WorkflowExecutionAlreadyCompletedError, + ServiceClientError { + try { + grpcServiceStubs + .workflowBlockingStub() + .requestCancelWorkflowExecution( + RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void SignalWorkflowExecution(SignalWorkflowExecutionRequest signalRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError { + try { + grpcServiceStubs + .workflowBlockingStub() + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public StartWorkflowExecutionResponse SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, WorkflowExecutionAlreadyStartedError, ClientVersionNotSupportedError, + ServiceClientError { + try { + return ResponseMapper.signalWithStartWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .signalWithStartWorkflowExecution( + RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public SignalWithStartWorkflowExecutionAsyncResponse SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest) + throws BadRequestError, WorkflowExecutionAlreadyStartedError, ServiceBusyError, + DomainNotActiveError, LimitExceededError, EntityNotExistsError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.signalWithStartWorkflowExecutionAsyncResponse( + grpcServiceStubs + .workflowBlockingStub() + .signalWithStartWorkflowExecutionAsync( + RequestMapper.signalWithStartWorkflowExecutionAsyncRequest( + signalWithStartRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ResetWorkflowExecutionResponse ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.resetWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void TerminateWorkflowExecution(TerminateWorkflowExecutionRequest terminateRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, DomainNotActiveError, + LimitExceededError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError { + try { + grpcServiceStubs + .workflowBlockingStub() + .terminateWorkflowExecution( + RequestMapper.terminateWorkflowExecutionRequest(terminateRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, LimitExceededError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.listOpenWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listOpenWorkflowExecutions( + RequestMapper.listOpenWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.listClosedWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listClosedWorkflowExecutions( + RequestMapper.listClosedWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListWorkflowExecutionsResponse ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.listWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListArchivedWorkflowExecutionsResponse ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.listArchivedWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .listArchivedWorkflowExecutions( + RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListWorkflowExecutionsResponse ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.scanWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public CountWorkflowExecutionsResponse CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest) + throws BadRequestError, EntityNotExistsError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.countWorkflowExecutionsResponse( + grpcServiceStubs + .visibilityBlockingStub() + .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetSearchAttributesResponse GetSearchAttributes() + throws ServiceBusyError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.getSearchAttributesResponse( + grpcServiceStubs + .visibilityBlockingStub() + .getSearchAttributes( + com.uber.cadence.api.v1.GetSearchAttributesRequest.newBuilder().build())); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RespondQueryTaskCompleted(RespondQueryTaskCompletedRequest completeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, ServiceClientError { + try { + grpcServiceStubs + .workerBlockingStub() + .respondQueryTaskCompleted( + RequestMapper.respondQueryTaskCompletedRequest(completeRequest)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ResetStickyTaskListResponse ResetStickyTaskList(ResetStickyTaskListRequest resetRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + DomainNotActiveError, ClientVersionNotSupportedError, + WorkflowExecutionAlreadyCompletedError, ServiceClientError { + try { + return ResponseMapper.resetStickyTaskListResponse( + grpcServiceStubs + .workerBlockingStub() + .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public QueryWorkflowResponse QueryWorkflow(QueryWorkflowRequest queryRequest) + throws BadRequestError, EntityNotExistsError, QueryFailedError, LimitExceededError, + ServiceBusyError, ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.queryWorkflowResponse( + grpcServiceStubs + .workflowBlockingStub() + .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeWorkflowExecutionResponse DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.describeWorkflowExecutionResponse( + grpcServiceStubs + .workflowBlockingStub() + .describeWorkflowExecution( + RequestMapper.describeWorkflowExecutionRequest(describeRequest))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public DescribeTaskListResponse DescribeTaskList(DescribeTaskListRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.describeTaskListResponse( + grpcServiceStubs + .workflowBlockingStub() + .describeTaskList(RequestMapper.describeTaskListRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ClusterInfo GetClusterInfo() + throws InternalServiceError, ServiceBusyError, ServiceClientError { + try { + return ResponseMapper.clusterInfoResponse( + grpcServiceStubs + .workflowBlockingStub() + .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.getDefaultInstance())); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public GetTaskListsByDomainResponse GetTaskListsByDomain(GetTaskListsByDomainRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ClientVersionNotSupportedError, ServiceClientError { + try { + return ResponseMapper.getTaskListsByDomainResponse( + grpcServiceStubs + .workflowBlockingStub() + .getTaskListsByDomain(RequestMapper.getTaskListsByDomainRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public ListTaskListPartitionsResponse ListTaskListPartitions( + ListTaskListPartitionsRequest request) + throws BadRequestError, EntityNotExistsError, LimitExceededError, ServiceBusyError, + ServiceClientError { + try { + return ResponseMapper.listTaskListPartitionsResponse( + grpcServiceStubs + .workflowBlockingStub() + .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request))); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RefreshWorkflowTasks(RefreshWorkflowTasksRequest request) + throws BadRequestError, DomainNotActiveError, ServiceBusyError, EntityNotExistsError, + ServiceClientError { + try { + grpcServiceStubs + .workflowBlockingStub() + .refreshWorkflowTasks(RequestMapper.refreshWorkflowTasksRequest(request)); + } catch (Exception e) { + throw toServiceClientException(e); + } + } + + @Override + public void RegisterDomain( + RegisterDomainRequest registerRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .registerDomain(RequestMapper.registerDomainRequest(registerRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void DescribeDomain( + DescribeDomainRequest describeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .describeDomain(RequestMapper.describeDomainRequest(describeRequest)), + toFutureCallback(resultHandler, ResponseMapper::describeDomainResponse), + executor); + } + + @Override + public void ListDomains( + ListDomainsRequest listRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .listDomains(RequestMapper.listDomainsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listDomainsResponse), + executor); + } + + @Override + public void UpdateDomain( + UpdateDomainRequest updateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .updateDomain(RequestMapper.updateDomainRequest(updateRequest)), + toFutureCallback(resultHandler, ResponseMapper::updateDomainResponse), + executor); + } + + @Override + public void DeprecateDomain( + DeprecateDomainRequest deprecateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .domainFutureStub() + .deprecateDomain(RequestMapper.deprecateDomainRequest(deprecateRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RestartWorkflowExecution( + RestartWorkflowExecutionRequest restartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .restartWorkflowExecution( + RequestMapper.restartWorkflowExecutionRequest(restartRequest)), + toFutureCallback(resultHandler, ResponseMapper::restartWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecution( + StartWorkflowExecutionRequest startRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .startWorkflowExecution(RequestMapper.startWorkflowExecutionRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionResponse), + executor); + } + + @Override + public void StartWorkflowExecutionAsync( + StartWorkflowExecutionAsyncRequest startRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .startWorkflowExecutionAsync( + RequestMapper.startWorkflowExecutionAsyncRequest(startRequest)), + toFutureCallback(resultHandler, ResponseMapper::startWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public void GetWorkflowExecutionHistory( + GetWorkflowExecutionHistoryRequest getRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getWorkflowExecutionHistory( + RequestMapper.getWorkflowExecutionHistoryRequest(getRequest)), + toFutureCallback(resultHandler, ResponseMapper::getWorkflowExecutionHistoryResponse), + executor); + } + + @Override + public void PollForDecisionTask( + PollForDecisionTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .pollForDecisionTask(RequestMapper.pollForDecisionTaskRequest(pollRequest)), + toFutureCallback(resultHandler, ResponseMapper::pollForDecisionTaskResponse), + executor); + } + + @Override + public void RespondDecisionTaskCompleted( + RespondDecisionTaskCompletedRequest completeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondDecisionTaskCompleted( + RequestMapper.respondDecisionTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, ResponseMapper::respondDecisionTaskCompletedResponse), + executor); + } + + @Override + public void RespondDecisionTaskFailed( + RespondDecisionTaskFailedRequest failedRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondDecisionTaskFailed( + RequestMapper.respondDecisionTaskFailedRequest(failedRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void PollForActivityTask( + PollForActivityTaskRequest pollRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .pollForActivityTask(RequestMapper.pollForActivityTaskRequest(pollRequest)), + toFutureCallback(resultHandler, ResponseMapper::pollForActivityTaskResponse), + executor); + } + + @Override + public void RecordActivityTaskHeartbeat( + RecordActivityTaskHeartbeatRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .recordActivityTaskHeartbeat( + RequestMapper.recordActivityTaskHeartbeatRequest(heartbeatRequest)), + toFutureCallback(resultHandler, ResponseMapper::recordActivityTaskHeartbeatResponse), + executor); + } + + @Override + public void RecordActivityTaskHeartbeatByID( + RecordActivityTaskHeartbeatByIDRequest heartbeatRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .recordActivityTaskHeartbeatByID( + RequestMapper.recordActivityTaskHeartbeatByIDRequest(heartbeatRequest)), + toFutureCallback(resultHandler, ResponseMapper::recordActivityTaskHeartbeatResponse), + executor); + } + + @Override + public void RespondActivityTaskCompleted( + RespondActivityTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCompleted( + RequestMapper.respondActivityTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCompletedByID( + RespondActivityTaskCompletedByIDRequest completeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCompletedByID( + RequestMapper.respondActivityTaskCompletedByIDRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskFailed( + RespondActivityTaskFailedRequest failRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskFailed(RequestMapper.respondActivityTaskFailedRequest(failRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskFailedByID( + RespondActivityTaskFailedByIDRequest failRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskFailedByID( + RequestMapper.respondActivityTaskFailedByIDRequest(failRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCanceled( + RespondActivityTaskCanceledRequest canceledRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCanceled( + RequestMapper.respondActivityTaskCanceledRequest(canceledRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RespondActivityTaskCanceledByID( + RespondActivityTaskCanceledByIDRequest canceledRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondActivityTaskCanceledByID( + RequestMapper.respondActivityTaskCanceledByIDRequest(canceledRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void RequestCancelWorkflowExecution( + RequestCancelWorkflowExecutionRequest cancelRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .requestCancelWorkflowExecution( + RequestMapper.requestCancelWorkflowExecutionRequest(cancelRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void SignalWorkflowExecution( + SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void SignalWithStartWorkflowExecution( + SignalWithStartWorkflowExecutionRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWithStartWorkflowExecution( + RequestMapper.signalWithStartWorkflowExecutionRequest(signalWithStartRequest)), + toFutureCallback(resultHandler, ResponseMapper::signalWithStartWorkflowExecutionResponse), + executor); + } + + @Override + public void SignalWithStartWorkflowExecutionAsync( + SignalWithStartWorkflowExecutionAsyncRequest signalWithStartRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .signalWithStartWorkflowExecutionAsync( + RequestMapper.signalWithStartWorkflowExecutionAsyncRequest(signalWithStartRequest)), + toFutureCallback( + resultHandler, ResponseMapper::signalWithStartWorkflowExecutionAsyncResponse), + executor); + } + + @Override + public void ResetWorkflowExecution( + ResetWorkflowExecutionRequest resetRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .resetWorkflowExecution(RequestMapper.resetWorkflowExecutionRequest(resetRequest)), + toFutureCallback(resultHandler, ResponseMapper::resetWorkflowExecutionResponse), + executor); + } + + @Override + public void TerminateWorkflowExecution( + TerminateWorkflowExecutionRequest terminateRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .terminateWorkflowExecution( + RequestMapper.terminateWorkflowExecutionRequest(terminateRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void ListOpenWorkflowExecutions( + ListOpenWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listOpenWorkflowExecutions( + RequestMapper.listOpenWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listOpenWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListClosedWorkflowExecutions( + ListClosedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listClosedWorkflowExecutions( + RequestMapper.listClosedWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listClosedWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listWorkflowExecutions(RequestMapper.listWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listWorkflowExecutionsResponse), + executor); + } + + @Override + public void ListArchivedWorkflowExecutions( + ListArchivedWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .listArchivedWorkflowExecutions( + RequestMapper.listArchivedWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::listArchivedWorkflowExecutionsResponse), + executor); + } + + @Override + public void ScanWorkflowExecutions( + ListWorkflowExecutionsRequest listRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest)), + toFutureCallback(resultHandler, ResponseMapper::scanWorkflowExecutionsResponse), + executor); + } + + @Override + public void CountWorkflowExecutions( + CountWorkflowExecutionsRequest countRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest)), + toFutureCallback(resultHandler, ResponseMapper::countWorkflowExecutionsResponse), + executor); + } + + @Override + public void GetSearchAttributes(AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .visibilityFutureStub() + .getSearchAttributes( + com.uber.cadence.api.v1.GetSearchAttributesRequest.getDefaultInstance()), + toFutureCallback(resultHandler, ResponseMapper::getSearchAttributesResponse), + executor); + } + + @Override + public void RespondQueryTaskCompleted( + RespondQueryTaskCompletedRequest completeRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .respondQueryTaskCompleted( + RequestMapper.respondQueryTaskCompletedRequest(completeRequest)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + @Override + public void ResetStickyTaskList( + ResetStickyTaskListRequest resetRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workerFutureStub() + .resetStickyTaskList(RequestMapper.resetStickyTaskListRequest(resetRequest)), + toFutureCallback(resultHandler, ResponseMapper::resetStickyTaskListResponse), + executor); + } + + @Override + public void QueryWorkflow( + QueryWorkflowRequest queryRequest, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .queryWorkflow(RequestMapper.queryWorkflowRequest(queryRequest)), + toFutureCallback(resultHandler, ResponseMapper::queryWorkflowResponse), + executor); + } + + @Override + public void DescribeWorkflowExecution( + DescribeWorkflowExecutionRequest describeRequest, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .describeWorkflowExecution( + RequestMapper.describeWorkflowExecutionRequest(describeRequest)), + toFutureCallback(resultHandler, ResponseMapper::describeWorkflowExecutionResponse), + executor); + } + + @Override + public void DescribeTaskList( + DescribeTaskListRequest request, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .describeTaskList(RequestMapper.describeTaskListRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::describeTaskListResponse), + executor); + } + + @Override + public void GetClusterInfo(AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getClusterInfo(com.uber.cadence.api.v1.GetClusterInfoRequest.getDefaultInstance()), + toFutureCallback(resultHandler, ResponseMapper::getClusterInfoResponse), + executor); + } + + @Override + public void GetTaskListsByDomain( + GetTaskListsByDomainRequest request, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .getTaskListsByDomain(RequestMapper.getTaskListsByDomainRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::getTaskListsByDomainResponse), + executor); + } + + @Override + public void ListTaskListPartitions( + ListTaskListPartitionsRequest request, + AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .listTaskListPartitions(RequestMapper.listTaskListPartitionsRequest(request)), + toFutureCallback(resultHandler, ResponseMapper::listTaskListPartitionsResponse), + executor); + } + + @Override + public void RefreshWorkflowTasks( + RefreshWorkflowTasksRequest request, AsyncMethodCallback resultHandler) + throws ServiceClientError { + Futures.addCallback( + grpcServiceStubs + .workflowFutureStub() + .refreshWorkflowTasks(RequestMapper.refreshWorkflowTasksRequest(request)), + toFutureCallback(resultHandler, r -> null), + executor); + } + + private ServiceClientError toServiceClientException(Throwable t) { + if (t instanceof ServiceClientError) { + return (ServiceClientError) t; + } else if (t instanceof StatusRuntimeException) { + return ErrorMapper.Error((StatusRuntimeException) t); + } else { + return new ServiceClientError(t); + } + } + + private FutureCallback toFutureCallback( + AsyncMethodCallback resultHandler, Function mapper) { + return new FutureCallback() { + @Override + public void onSuccess(R t) { + resultHandler.onComplete(mapper.apply(t)); + } + + @Override + public void onFailure(Throwable throwable) { + resultHandler.onError(toServiceClientException(throwable)); + } + }; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/AccessDeniedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/AccessDeniedError.java new file mode 100644 index 000000000..242ff889b --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/AccessDeniedError.java @@ -0,0 +1,25 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class AccessDeniedError extends ServiceClientError { + + public AccessDeniedError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/BadRequestError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/BadRequestError.java new file mode 100644 index 000000000..a75e3f6d5 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/BadRequestError.java @@ -0,0 +1,21 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient.exceptions; + +public class BadRequestError extends ServiceClientError { + public BadRequestError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/CancellationAlreadyRequestedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/CancellationAlreadyRequestedError.java new file mode 100644 index 000000000..7e5d94457 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/CancellationAlreadyRequestedError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class CancellationAlreadyRequestedError extends ServiceClientError { + public CancellationAlreadyRequestedError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/ClientVersionNotSupportedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/ClientVersionNotSupportedError.java new file mode 100644 index 000000000..623c70e8f --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/ClientVersionNotSupportedError.java @@ -0,0 +1,43 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class ClientVersionNotSupportedError extends ServiceClientError { + private final String featureVersion; + private final String clientImpl; + private final String supportedVersions; + + public ClientVersionNotSupportedError( + String featureVersion, String clientImpl, String supportedVersions) { + this.featureVersion = featureVersion; + this.clientImpl = clientImpl; + this.supportedVersions = supportedVersions; + } + + public String getFeatureVersion() { + return featureVersion; + } + + public String getClientImpl() { + return clientImpl; + } + + public String getSupportedVersions() { + return supportedVersions; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainAlreadyExistsError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainAlreadyExistsError.java new file mode 100644 index 000000000..d74dac1e6 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainAlreadyExistsError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class DomainAlreadyExistsError extends ServiceClientError { + public DomainAlreadyExistsError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainNotActiveError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainNotActiveError.java new file mode 100644 index 000000000..64a74b233 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/DomainNotActiveError.java @@ -0,0 +1,42 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class DomainNotActiveError extends ServiceClientError { + private final String domain; + private final String currentCluster; + private final String activeCluster; + + public DomainNotActiveError(String domain, String currentCluster, String activeCluster) { + this.domain = domain; + this.currentCluster = currentCluster; + this.activeCluster = activeCluster; + } + + public String getDomain() { + return domain; + } + + public String getCurrentCluster() { + return currentCluster; + } + + public String getActiveCluster() { + return activeCluster; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/EntityNotExistsError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/EntityNotExistsError.java new file mode 100644 index 000000000..0397abbbd --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/EntityNotExistsError.java @@ -0,0 +1,21 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient.exceptions; + +public class EntityNotExistsError extends ServiceClientError { + public EntityNotExistsError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/FeatureNotEnabledError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/FeatureNotEnabledError.java new file mode 100644 index 000000000..607f8632d --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/FeatureNotEnabledError.java @@ -0,0 +1,30 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class FeatureNotEnabledError extends ServiceClientError { + private final String featureFlag; + + public FeatureNotEnabledError(String featureFlag) { + this.featureFlag = featureFlag; + } + + public String getFeatureFlag() { + return featureFlag; + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalDataInconsistencyError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalDataInconsistencyError.java new file mode 100644 index 000000000..5efa9f059 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalDataInconsistencyError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class InternalDataInconsistencyError extends ServiceClientError { + public InternalDataInconsistencyError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalServiceError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalServiceError.java new file mode 100644 index 000000000..0dc375999 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/InternalServiceError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class InternalServiceError extends ServiceClientError { + public InternalServiceError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/LimitExceededError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/LimitExceededError.java new file mode 100644 index 000000000..0d16732ea --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/LimitExceededError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class LimitExceededError extends ServiceClientError { + public LimitExceededError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/QueryFailedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/QueryFailedError.java new file mode 100644 index 000000000..13e83e66c --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/QueryFailedError.java @@ -0,0 +1,23 @@ +/** + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + *

Modifications copyright (C) 2017 Uber Technologies, Inc. + * + *

Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file + * except in compliance with the License. A copy of the License is located at + * + *

http://aws.amazon.com/apache2.0 + * + *

or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient.exceptions; + +public class QueryFailedError extends ServiceClientError { + private static final long serialVersionUID = 1L; + + public QueryFailedError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceBusyError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceBusyError.java new file mode 100644 index 000000000..d742031ef --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceBusyError.java @@ -0,0 +1,24 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +public class ServiceBusyError extends ServiceClientError { + public ServiceBusyError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceClientError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceClientError.java new file mode 100644 index 000000000..ea779ce86 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/ServiceClientError.java @@ -0,0 +1,41 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.serviceclient.exceptions; + +/** + * Base class for all exceptions thrown by the service client. + * + *

This is a catchall for all other errors. + */ +public class ServiceClientError extends RuntimeException { + ServiceClientError() { + super(); + } + + public ServiceClientError(String message) { + super(message); + } + + public ServiceClientError(String message, Throwable cause) { + super(message, cause); + } + + public ServiceClientError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyCompletedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyCompletedError.java new file mode 100644 index 000000000..dfdbf0802 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyCompletedError.java @@ -0,0 +1,23 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient.exceptions; + +public class WorkflowExecutionAlreadyCompletedError extends ServiceClientError { + public WorkflowExecutionAlreadyCompletedError(Throwable cause) { + super(cause); + } +} diff --git a/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyStartedError.java b/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyStartedError.java new file mode 100644 index 000000000..787ddb099 --- /dev/null +++ b/src/main/java/com/uber/cadence/serviceclient/exceptions/WorkflowExecutionAlreadyStartedError.java @@ -0,0 +1,35 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.uber.cadence.serviceclient.exceptions; + +public class WorkflowExecutionAlreadyStartedError extends ServiceClientError { + private final String startRequestId; + private final String runId; + + public WorkflowExecutionAlreadyStartedError(String startRequestId, String runId) { + this.startRequestId = startRequestId; + this.runId = runId; + } + + public String getStartRequestId() { + return startRequestId; + } + + public String getRunId() { + return runId; + } +} diff --git a/src/test/java/com/uber/cadence/internal/compatibility/proto/ErrorMapperTest.java b/src/test/java/com/uber/cadence/internal/compatibility/proto/ErrorMapperTest.java new file mode 100644 index 000000000..81b803de0 --- /dev/null +++ b/src/test/java/com/uber/cadence/internal/compatibility/proto/ErrorMapperTest.java @@ -0,0 +1,161 @@ +/* + * Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Modifications copyright (C) 2017 Uber Technologies, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"). You may not + * use this file except in compliance with the License. A copy of the License is + * located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.uber.cadence.internal.compatibility.proto; + +import static org.junit.Assert.assertEquals; + +import com.google.protobuf.Any; +import com.google.protobuf.Message; +import com.uber.cadence.api.v1.*; +import com.uber.cadence.internal.compatibility.proto.mappers.ErrorMapper; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import io.grpc.protobuf.StatusProto; +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class ErrorMapperTest { + + @Parameterized.Parameter(0) + public Status status; + + @Parameterized.Parameter(1) + public Message detail; + + @Parameterized.Parameter(2) + public Class expectedException; + + @Parameterized.Parameters + public static Collection data() { + Object[][] data = + new Object[][] { + { + Status.PERMISSION_DENIED, + null, + com.uber.cadence.serviceclient.exceptions.AccessDeniedError.class + }, + { + Status.INTERNAL, + null, + com.uber.cadence.serviceclient.exceptions.InternalServiceError.class + }, + { + Status.NOT_FOUND, + null, + com.uber.cadence.serviceclient.exceptions.EntityNotExistsError.class + }, + { + Status.ALREADY_EXISTS, + DomainAlreadyExistsError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.DomainAlreadyExistsError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.FeatureNotEnabledError.class + }, + { + Status.RESOURCE_EXHAUSTED, + LimitExceededError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.LimitExceededError.class + }, + { + Status.UNKNOWN, null, com.uber.cadence.serviceclient.exceptions.ServiceClientError.class + }, + { + Status.NOT_FOUND, + WorkflowExecutionAlreadyCompletedError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyCompletedError.class + }, + { + Status.ALREADY_EXISTS, + WorkflowExecutionAlreadyStartedError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.WorkflowExecutionAlreadyStartedError.class + }, + { + Status.FAILED_PRECONDITION, + DomainNotActiveError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.DomainNotActiveError.class + }, + { + Status.FAILED_PRECONDITION, + ClientVersionNotSupportedError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.ClientVersionNotSupportedError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.FeatureNotEnabledError.class + }, + { + Status.FAILED_PRECONDITION, + DomainNotActiveError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.DomainNotActiveError.class + }, + { + Status.FAILED_PRECONDITION, + ClientVersionNotSupportedError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.ClientVersionNotSupportedError.class + }, + { + Status.FAILED_PRECONDITION, + FeatureNotEnabledError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.FeatureNotEnabledError.class + }, + { + Status.RESOURCE_EXHAUSTED, + LimitExceededError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.LimitExceededError.class + }, + { + Status.DATA_LOSS, + null, + com.uber.cadence.serviceclient.exceptions.InternalDataInconsistencyError.class + }, + { + Status.RESOURCE_EXHAUSTED, + ServiceBusyError.getDefaultInstance(), + com.uber.cadence.serviceclient.exceptions.ServiceBusyError.class + }, + { + Status.INTERNAL, + null, + com.uber.cadence.serviceclient.exceptions.InternalServiceError.class + } + }; + return Arrays.asList(data); + } + + @Test + public void testErrorMapper() { + com.google.rpc.Status.Builder builder = + com.google.rpc.Status.newBuilder().setCode(status.getCode().value()); + + if (detail != null) { + builder.addDetails(Any.pack(detail)); + } + + StatusRuntimeException ex = StatusProto.toStatusRuntimeException(builder.build()); + com.uber.cadence.serviceclient.exceptions.ServiceClientError result = ErrorMapper.Error(ex); + assertEquals(expectedException, result.getClass()); + } +}