• 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/ScheduleOptions.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 java.util.List;
24
import java.util.Map;
25

26
/** Options for creating a schedule. */
27
public final class ScheduleOptions {
28
  public static ScheduleOptions.Builder newBuilder() {
29
    return new ScheduleOptions.Builder();
×
30
  }
31

32
  public static ScheduleOptions.Builder newBuilder(ScheduleOptions options) {
33
    return new ScheduleOptions.Builder(options);
×
34
  }
35

36
  public static final class Builder {
37
    private boolean triggerImmediately;
38
    private List<ScheduleBackfill> backfills;
39
    private Map<String, Object> memo;
40
    private Map<String, ?> searchAttributes;
41

42
    private Builder() {}
43

44
    private Builder(ScheduleOptions options) {
×
45
      if (options == null) {
×
46
        return;
×
47
      }
48
      this.triggerImmediately = options.triggerImmediately;
×
49
      this.backfills = options.backfills;
×
50
      this.memo = options.memo;
×
51
      this.searchAttributes = options.searchAttributes;
×
52
    }
×
53

54
    /** Set if the schedule will be triggered immediately upon creation. */
55
    public Builder setTriggerImmediately(boolean triggerImmediately) {
56
      this.triggerImmediately = triggerImmediately;
×
57
      return this;
×
58
    }
59

60
    /** Set the time periods to take actions on as if that time passed right now. */
61
    public Builder setBackfills(List<ScheduleBackfill> backfills) {
62
      this.backfills = backfills;
×
63
      return this;
×
64
    }
65

66
    /** Set the memo for the schedule. Values for the memo cannot be null. */
67
    public Builder setMemo(Map<String, Object> memo) {
68
      this.memo = memo;
×
69
      return this;
×
70
    }
71

72
    /** Set the search attributes for the schedule. */
73
    public Builder setSearchAttributes(Map<String, ?> searchAttributes) {
74
      this.searchAttributes = searchAttributes;
×
75
      return this;
×
76
    }
77

78
    public ScheduleOptions build() {
79
      return new ScheduleOptions(triggerImmediately, backfills, memo, searchAttributes);
×
80
    }
81
  }
82

83
  private final boolean triggerImmediately;
84
  private final List<ScheduleBackfill> backfills;
85
  private final Map<String, Object> memo;
86
  private final Map<String, ?> searchAttributes;
87

88
  private ScheduleOptions(
89
      boolean triggerImmediately,
90
      List<ScheduleBackfill> backfills,
91
      Map<String, Object> memo,
92
      Map<String, ?> searchAttributes) {
×
93
    this.triggerImmediately = triggerImmediately;
×
94
    this.backfills = backfills;
×
95
    this.memo = memo;
×
96
    this.searchAttributes = searchAttributes;
×
97
  }
×
98

99
  /**
100
   * Get if the schedule will be triggered immediately upon creation.
101
   *
102
   * @return True if the schedule will trigger on creation
103
   */
104
  public boolean isTriggerImmediately() {
105
    return triggerImmediately;
×
106
  }
107

108
  /**
109
   * Get the time periods to take actions on as if that time passed right now.
110
   *
111
   * @return backfill requests
112
   */
113
  public List<ScheduleBackfill> getBackfills() {
114
    return backfills;
×
115
  }
116

117
  /**
118
   * Get the memo for the schedule. Values for the memo cannot be null.
119
   *
120
   * @return memos for the schedule
121
   */
122
  public Map<String, Object> getMemo() {
123
    return memo;
×
124
  }
125

126
  /**
127
   * Get the search attributes for the schedule.
128
   *
129
   * @return search attributes for the schedule
130
   */
131
  public Map<String, ?> getSearchAttributes() {
132
    return searchAttributes;
×
133
  }
134
}
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