• 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/client/schedules/ScheduleHandleImpl.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.client.schedules;
22

23
import com.google.common.base.Preconditions;
24
import io.temporal.api.enums.v1.ScheduleOverlapPolicy;
25
import io.temporal.common.interceptors.ScheduleClientCallsInterceptor;
26
import io.temporal.workflow.Functions;
27
import java.util.List;
28
import java.util.Objects;
29
import javax.annotation.Nonnull;
30

31
class ScheduleHandleImpl implements ScheduleHandle {
32
  private final String Id;
33
  private final ScheduleClientCallsInterceptor interceptor;
34

35
  public ScheduleHandleImpl(ScheduleClientCallsInterceptor interceptor, String Id) {
×
36
    this.interceptor = interceptor;
×
37
    this.Id = Id;
×
38
  }
×
39

40
  @Override
41
  public String getId() {
42
    return this.Id;
×
43
  }
44

45
  @Override
46
  public void backfill(List<ScheduleBackfill> backfills) {
47
    Preconditions.checkState(backfills.size() > 0, "At least one backfill required");
×
48
    interceptor.backfillSchedule(
×
49
        new ScheduleClientCallsInterceptor.BackfillScheduleInput(Id, backfills));
50
  }
×
51

52
  @Override
53
  public void delete() {
54
    interceptor.deleteSchedule(new ScheduleClientCallsInterceptor.DeleteScheduleInput(Id));
×
55
  }
×
56

57
  @Override
58
  public ScheduleDescription describe() {
59
    return interceptor
×
60
        .describeSchedule(new ScheduleClientCallsInterceptor.DescribeScheduleInput(Id))
×
61
        .getDescription();
×
62
  }
63

64
  @Override
65
  public void pause(@Nonnull String note) {
66
    Objects.requireNonNull(note);
×
67
    interceptor.pauseSchedule(
×
68
        new ScheduleClientCallsInterceptor.PauseScheduleInput(
69
            Id, note.isEmpty() ? "Paused via Java SDK" : note));
×
70
  }
×
71

72
  @Override
73
  public void pause() {
74
    pause("");
×
75
  }
×
76

77
  @Override
78
  public void trigger(ScheduleOverlapPolicy overlapPolicy) {
79
    interceptor.triggerSchedule(
×
80
        new ScheduleClientCallsInterceptor.TriggerScheduleInput(Id, overlapPolicy));
81
  }
×
82

83
  @Override
84
  public void trigger() {
85
    interceptor.triggerSchedule(
×
86
        new ScheduleClientCallsInterceptor.TriggerScheduleInput(
87
            Id, ScheduleOverlapPolicy.SCHEDULE_OVERLAP_POLICY_UNSPECIFIED));
88
  }
×
89

90
  @Override
91
  public void unpause(@Nonnull String note) {
92
    Objects.requireNonNull(note);
×
93
    interceptor.unpauseSchedule(
×
94
        new ScheduleClientCallsInterceptor.UnpauseScheduleInput(
95
            Id, note.isEmpty() ? "Unpaused via Java SDK" : note));
×
96
  }
×
97

98
  @Override
99
  public void unpause() {
100
    unpause("");
×
101
  }
×
102

103
  @Override
104
  public void update(Functions.Func1<ScheduleUpdateInput, ScheduleUpdate> updater) {
105
    interceptor.updateSchedule(
×
106
        new ScheduleClientCallsInterceptor.UpdateScheduleInput(this.describe(), updater));
×
107
  }
×
108
}
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