• 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/ScheduleDescription.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.api.common.v1.Payload;
24
import io.temporal.common.converter.DataConverter;
25
import java.lang.reflect.Type;
26
import java.util.List;
27
import java.util.Map;
28
import java.util.Objects;
29
import javax.annotation.Nonnull;
30
import javax.annotation.Nullable;
31

32
/** Description of a schedule. */
33
public final class ScheduleDescription {
34
  private final String id;
35
  private final ScheduleInfo info;
36
  private final Schedule schedule;
37
  private final Map<String, List<?>> searchAttributes;
38
  private final Map<String, Payload> memo;
39
  private final DataConverter dataConverter;
40

41
  public ScheduleDescription(
42
      String id,
43
      ScheduleInfo info,
44
      Schedule schedule,
45
      Map<String, List<?>> searchAttributes,
46
      Map<String, Payload> memo,
47
      DataConverter dataConverter) {
×
48
    this.id = id;
×
49
    this.info = info;
×
50
    this.schedule = schedule;
×
51
    this.searchAttributes = searchAttributes;
×
52
    this.memo = memo;
×
53
    this.dataConverter = dataConverter;
×
54
  }
×
55

56
  /**
57
   * Get the ID of the schedule.
58
   *
59
   * @return schedule ID
60
   */
61
  public @Nonnull String getId() {
62
    return id;
×
63
  }
64

65
  /**
66
   * Get information about the schedule.
67
   *
68
   * @return schedule info
69
   */
70
  public @Nonnull ScheduleInfo getInfo() {
71
    return info;
×
72
  }
73

74
  /**
75
   * Gets the schedule details.
76
   *
77
   * @return schedule details
78
   */
79
  public @Nonnull Schedule getSchedule() {
80
    return schedule;
×
81
  }
82

83
  /**
84
   * Gets the search attributes on the schedule.
85
   *
86
   * @return search attributes
87
   */
88
  @Nonnull
89
  public Map<String, List<?>> getSearchAttributes() {
90
    return searchAttributes;
×
91
  }
92

93
  @Nullable
94
  public <T> Object getMemo(String key, Class<T> valueClass) {
95
    return getMemo(key, valueClass, valueClass);
×
96
  }
97

98
  @Nullable
99
  public <T> T getMemo(String key, Class<T> valueClass, Type genericType) {
100
    Payload memoPayload = this.memo.get(key);
×
101
    if (memo == null) {
×
102
      return null;
×
103
    }
104
    return dataConverter.fromPayload(memoPayload, valueClass, genericType);
×
105
  }
106

107
  @Override
108
  public boolean equals(Object o) {
109
    if (this == o) return true;
×
110
    if (o == null || getClass() != o.getClass()) return false;
×
111
    ScheduleDescription that = (ScheduleDescription) o;
×
112
    return Objects.equals(id, that.id)
×
113
        && Objects.equals(info, that.info)
×
114
        && Objects.equals(schedule, that.schedule)
×
115
        && Objects.equals(searchAttributes, that.searchAttributes)
×
116
        && Objects.equals(memo, that.memo);
×
117
  }
118

119
  @Override
120
  public int hashCode() {
121
    return Objects.hash(id, info, schedule, searchAttributes, memo);
×
122
  }
123

124
  @Override
125
  public String toString() {
126
    return "ScheduleDescription{"
×
127
        + "id='"
128
        + id
129
        + '\''
130
        + ", info="
131
        + info
132
        + ", schedule="
133
        + schedule
134
        + ", searchAttributes="
135
        + searchAttributes
136
        + ", memo="
137
        + memo
138
        + '}';
139
  }
140
}
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