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

temporalio / sdk-java / #174

pending completion
#174

push

github-actions

web-flow
Add schedules API (#1776)

Add schedules API

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

18101 of 23284 relevant lines covered (77.74%)

0.78 hits per line

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

0.0
/temporal-sdk/src/main/java/io/temporal/common/interceptors/ScheduleClientCallsInterceptor.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.common.interceptors;
22

23
import io.temporal.api.enums.v1.ScheduleOverlapPolicy;
24
import io.temporal.client.schedules.*;
25
import io.temporal.common.Experimental;
26
import io.temporal.workflow.Functions;
27
import java.util.List;
28
import java.util.stream.Stream;
29

30
/**
31
 * Intercepts calls to the {@link io.temporal.client.schedules.ScheduleClient} and {@link
32
 * io.temporal.client.schedules.ScheduleHandle} related to the lifecycle of a Schedule.
33
 *
34
 * <p>Prefer extending {@link ScheduleClientCallsInterceptorBase} and override only the methods you
35
 * need instead of implementing this interface directly. {@link ScheduleClientCallsInterceptor}
36
 * provides correct default implementations to all the methods of this interface.
37
 */
38
@Experimental
39
public interface ScheduleClientCallsInterceptor {
40

41
  void createSchedule(CreateScheduleInput input);
42

43
  ListScheduleOutput listSchedules(ListSchedulesInput input);
44

45
  void backfillSchedule(BackfillScheduleInput input);
46

47
  void deleteSchedule(DeleteScheduleInput input);
48

49
  DescribeScheduleOutput describeSchedule(DescribeScheduleInput input);
50

51
  void pauseSchedule(PauseScheduleInput input);
52

53
  void triggerSchedule(TriggerScheduleInput input);
54

55
  void unpauseSchedule(UnpauseScheduleInput input);
56

57
  void updateSchedule(UpdateScheduleInput input);
58

59
  class CreateScheduleInput {
60
    private final String Id;
61
    private final Schedule schedule;
62
    private final ScheduleOptions options;
63

64
    public CreateScheduleInput(String id, Schedule schedule, ScheduleOptions options) {
×
65
      Id = id;
×
66
      this.schedule = schedule;
×
67
      this.options = options;
×
68
    }
×
69

70
    public String getId() {
71
      return Id;
×
72
    }
73

74
    public Schedule getSchedule() {
75
      return schedule;
×
76
    }
77

78
    public ScheduleOptions getOptions() {
79
      return options;
×
80
    }
81
  }
82

83
  class ListSchedulesInput {
84
    private final int pageSize;
85

86
    public ListSchedulesInput(int pageSize) {
×
87
      this.pageSize = pageSize;
×
88
    }
×
89

90
    public int getPageSize() {
91
      return pageSize;
×
92
    }
93
  }
94

95
  class ListScheduleOutput {
96
    public Stream<ScheduleListDescription> getStream() {
97
      return stream;
×
98
    }
99

100
    private final Stream<ScheduleListDescription> stream;
101

102
    public ListScheduleOutput(Stream<ScheduleListDescription> stream) {
×
103
      this.stream = stream;
×
104
    }
×
105
  }
106

107
  class BackfillScheduleInput {
108
    private final String scheduleId;
109

110
    public String getScheduleId() {
111
      return scheduleId;
×
112
    }
113

114
    public List<ScheduleBackfill> getBackfills() {
115
      return backfills;
×
116
    }
117

118
    private final List<ScheduleBackfill> backfills;
119

120
    public BackfillScheduleInput(String scheduleId, List<ScheduleBackfill> backfills) {
×
121
      this.scheduleId = scheduleId;
×
122
      this.backfills = backfills;
×
123
    }
×
124
  }
125

126
  class DeleteScheduleInput {
127
    public String getScheduleId() {
128
      return scheduleId;
×
129
    }
130

131
    private final String scheduleId;
132

133
    public DeleteScheduleInput(String scheduleId) {
×
134
      this.scheduleId = scheduleId;
×
135
    }
×
136
  }
137

138
  class DescribeScheduleInput {
139
    public String getScheduleId() {
140
      return scheduleId;
×
141
    }
142

143
    private final String scheduleId;
144

145
    public DescribeScheduleInput(String scheduleId) {
×
146
      this.scheduleId = scheduleId;
×
147
    }
×
148
  }
149

150
  class DescribeScheduleOutput {
151
    private final ScheduleDescription description;
152

153
    public DescribeScheduleOutput(ScheduleDescription description) {
×
154
      this.description = description;
×
155
    }
×
156

157
    public ScheduleDescription getDescription() {
158
      return description;
×
159
    }
160
  }
161

162
  class PauseScheduleInput {
163
    public String getScheduleId() {
164
      return scheduleId;
×
165
    }
166

167
    public String getNote() {
168
      return note;
×
169
    }
170

171
    private final String scheduleId;
172
    private final String note;
173

174
    public PauseScheduleInput(String scheduleId, String note) {
×
175
      this.scheduleId = scheduleId;
×
176
      this.note = note;
×
177
    }
×
178
  }
179

180
  class TriggerScheduleInput {
181
    private final String scheduleId;
182
    private final ScheduleOverlapPolicy overlapPolicy;
183

184
    public String getScheduleId() {
185
      return scheduleId;
×
186
    }
187

188
    public ScheduleOverlapPolicy getOverlapPolicy() {
189
      return overlapPolicy;
×
190
    }
191

192
    public TriggerScheduleInput(String scheduleId, ScheduleOverlapPolicy overlapPolicy) {
×
193
      this.scheduleId = scheduleId;
×
194
      this.overlapPolicy = overlapPolicy;
×
195
    }
×
196
  }
197

198
  class UnpauseScheduleInput {
199
    public String getScheduleId() {
200
      return scheduleId;
×
201
    }
202

203
    public String getNote() {
204
      return note;
×
205
    }
206

207
    private final String scheduleId;
208
    private final String note;
209

210
    public UnpauseScheduleInput(String scheduleId, String note) {
×
211
      this.scheduleId = scheduleId;
×
212
      this.note = note;
×
213
    }
×
214
  }
215

216
  class UpdateScheduleInput {
217
    public ScheduleDescription getDescription() {
218
      return description;
×
219
    }
220

221
    public Functions.Func1<ScheduleUpdateInput, ScheduleUpdate> getUpdater() {
222
      return updater;
×
223
    }
224

225
    private final ScheduleDescription description;
226
    private final Functions.Func1<ScheduleUpdateInput, ScheduleUpdate> updater;
227

228
    public UpdateScheduleInput(
229
        ScheduleDescription description,
230
        Functions.Func1<ScheduleUpdateInput, ScheduleUpdate> updater) {
×
231
      this.description = description;
×
232
      this.updater = updater;
×
233
    }
×
234
  }
235
}
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