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

temporalio / sdk-java / #185

28 Aug 2023 02:02PM CUT coverage: 77.642% (-0.04%) from 77.685%
#185

push

github-actions

web-flow
Reconcile typed search attributes with schedules (#1848)

Reconcile typed search attributes with schedules

30 of 30 new or added lines in 6 files covered. (100.0%)

18579 of 23929 relevant lines covered (77.64%)

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 io.temporal.common.SearchAttributes;
24
import java.util.List;
25
import java.util.Map;
26

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

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

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

44
    private Builder() {}
45

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

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

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

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

75
    /**
76
     * Set the search attributes for the schedule.
77
     *
78
     * @deprecated use {@link ScheduleOptions.Builder#setTypedSearchAttributes} instead.
79
     */
80
    public Builder setSearchAttributes(Map<String, ?> searchAttributes) {
81
      this.searchAttributes = searchAttributes;
×
82
      return this;
×
83
    }
84

85
    /** Set the search attributes for the schedule. */
86
    public Builder setTypedSearchAttributes(SearchAttributes searchAttributes) {
87
      this.typedSearchAttributes = searchAttributes;
×
88
      return this;
×
89
    }
90

91
    public ScheduleOptions build() {
92
      return new ScheduleOptions(
×
93
          triggerImmediately, backfills, memo, searchAttributes, typedSearchAttributes);
94
    }
95
  }
96

97
  private final boolean triggerImmediately;
98
  private final List<ScheduleBackfill> backfills;
99
  private final Map<String, Object> memo;
100
  private final Map<String, ?> searchAttributes;
101
  private final SearchAttributes typedSearchAttributes;
102

103
  private ScheduleOptions(
104
      boolean triggerImmediately,
105
      List<ScheduleBackfill> backfills,
106
      Map<String, Object> memo,
107
      Map<String, ?> searchAttributes,
108
      SearchAttributes typedSearchAttributes) {
×
109
    this.triggerImmediately = triggerImmediately;
×
110
    this.backfills = backfills;
×
111
    this.memo = memo;
×
112
    this.searchAttributes = searchAttributes;
×
113
    this.typedSearchAttributes = typedSearchAttributes;
×
114
  }
×
115

116
  /**
117
   * Get if the schedule will be triggered immediately upon creation.
118
   *
119
   * @return True if the schedule will trigger on creation
120
   */
121
  public boolean isTriggerImmediately() {
122
    return triggerImmediately;
×
123
  }
124

125
  /**
126
   * Get the time periods to take actions on as if that time passed right now.
127
   *
128
   * @return backfill requests
129
   */
130
  public List<ScheduleBackfill> getBackfills() {
131
    return backfills;
×
132
  }
133

134
  /**
135
   * Get the memo for the schedule. Values for the memo cannot be null.
136
   *
137
   * @return memos for the schedule
138
   */
139
  public Map<String, Object> getMemo() {
140
    return memo;
×
141
  }
142

143
  /**
144
   * Get the search attributes for the schedule.
145
   *
146
   * @return search attributes for the schedule
147
   * @deprecated use {@link ScheduleOptions#getTypedSearchAttributes()} instead.
148
   */
149
  public Map<String, ?> getSearchAttributes() {
150
    return searchAttributes;
×
151
  }
152

153
  /**
154
   * Get the search attributes for the schedule.
155
   *
156
   * @return search attributes for the schedule
157
   */
158
  public SearchAttributes getTypedSearchAttributes() {
159
    return typedSearchAttributes;
×
160
  }
161
}
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