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

uber / cadence-java-client / 1941

25 Aug 2023 11:48PM UTC coverage: 60.221% (-0.1%) from 60.369%
1941

push

buildkite

web-flow
release 3.10.0 (#849)

11330 of 18814 relevant lines covered (60.22%)

0.6 hits per line

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

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

18
package com.uber.cadence.workflow;
19

20
import com.uber.cadence.WorkflowExecution;
21
import com.uber.cadence.WorkflowExecutionStartedEventAttributes;
22
import com.uber.cadence.WorkflowType;
23
import com.uber.cadence.activity.ActivityOptions;
24
import com.uber.cadence.activity.LocalActivityOptions;
25
import com.uber.cadence.internal.sync.SyncWorkflowDefinition;
26
import com.uber.cadence.internal.worker.WorkflowExecutionException;
27
import com.uber.cadence.workflow.Functions.Func;
28
import java.lang.reflect.Type;
29
import java.time.Duration;
30
import java.util.*;
31
import java.util.concurrent.CancellationException;
32
import java.util.function.BiPredicate;
33
import java.util.function.Supplier;
34

35
public interface WorkflowInterceptor {
36

37
  public final class WorkflowExecuteInput {
38
    private final WorkflowExecutionStartedEventAttributes workflowEventStart;
39
    private final WorkflowType workflowType;
40
    private final byte[] input;
41

42
    public WorkflowExecuteInput(WorkflowExecutionStartedEventAttributes workflowEventStart) {
1✔
43
      this.workflowEventStart = workflowEventStart;
1✔
44
      this.workflowType = workflowEventStart.workflowType;
1✔
45
      this.input = workflowEventStart.getInput();
1✔
46
    }
1✔
47

48
    public WorkflowType getWorkflowType() {
49
      return workflowType;
1✔
50
    }
51

52
    public byte[] getInput() {
53
      return input;
1✔
54
    }
55

56
    public WorkflowExecutionStartedEventAttributes getWorkflowExecutionStartedEventAttributes() {
57
      return workflowEventStart;
×
58
    }
59
  }
60

61
  final class WorkflowResult<R> {
62

63
    private final Promise<R> result;
64
    private final Promise<WorkflowExecution> workflowExecution;
65

66
    public WorkflowResult(Promise<R> result, Promise<WorkflowExecution> workflowExecution) {
1✔
67
      this.result = result;
1✔
68
      this.workflowExecution = workflowExecution;
1✔
69
    }
1✔
70

71
    public Promise<R> getResult() {
72
      return result;
1✔
73
    }
74

75
    public Promise<WorkflowExecution> getWorkflowExecution() {
76
      return workflowExecution;
1✔
77
    }
78
  }
79

80
  // to match behavior in go client: interceptor executeWorkflow method
81
  byte[] executeWorkflow(SyncWorkflowDefinition workflowDefinition, WorkflowExecuteInput input)
82
      throws CancellationException, WorkflowExecutionException;
83

84
  <R> Promise<R> executeActivity(
85
      String activityName,
86
      Class<R> resultClass,
87
      Type resultType,
88
      Object[] args,
89
      ActivityOptions options);
90

91
  <R> Promise<R> executeLocalActivity(
92
      String activityName,
93
      Class<R> resultClass,
94
      Type resultType,
95
      Object[] args,
96
      LocalActivityOptions options);
97

98
  <R> WorkflowResult<R> executeChildWorkflow(
99
      String workflowType,
100
      Class<R> resultClass,
101
      Type resultType,
102
      Object[] args,
103
      ChildWorkflowOptions options);
104

105
  Random newRandom();
106

107
  Promise<Void> signalExternalWorkflow(
108
      WorkflowExecution execution, String signalName, Object[] args);
109

110
  Promise<Void> signalExternalWorkflow(
111
      String domain, WorkflowExecution execution, String signalName, Object[] args);
112

113
  Promise<Void> cancelWorkflow(WorkflowExecution execution);
114

115
  void sleep(Duration duration);
116

117
  boolean await(Duration timeout, String reason, Supplier<Boolean> unblockCondition);
118

119
  void await(String reason, Supplier<Boolean> unblockCondition);
120

121
  Promise<Void> newTimer(Duration duration);
122

123
  <R> R sideEffect(Class<R> resultClass, Type resultType, Func<R> func);
124

125
  <R> R mutableSideEffect(
126
      String id, Class<R> resultClass, Type resultType, BiPredicate<R, R> updated, Func<R> func);
127

128
  int getVersion(String changeID, int minSupported, int maxSupported);
129

130
  void continueAsNew(
131
      Optional<String> workflowType, Optional<ContinueAsNewOptions> options, Object[] args);
132

133
  void registerQuery(String queryType, Type[] argTypes, Functions.Func1<Object[], Object> callback);
134

135
  UUID randomUUID();
136

137
  void upsertSearchAttributes(Map<String, Object> searchAttributes);
138
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc