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

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

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

60
  /**
61
   * Get the ID of the schedule.
62
   *
63
   * @return schedule ID
64
   */
65
  public @Nonnull String getId() {
66
    return id;
×
67
  }
68

69
  /**
70
   * Get information about the schedule.
71
   *
72
   * @return schedule info
73
   */
74
  public @Nonnull ScheduleInfo getInfo() {
75
    return info;
×
76
  }
77

78
  /**
79
   * Gets the schedule details.
80
   *
81
   * @return schedule details
82
   */
83
  public @Nonnull Schedule getSchedule() {
84
    return schedule;
×
85
  }
86

87
  /**
88
   * Gets the search attributes on the schedule.
89
   *
90
   * @return search attributes
91
   * @deprecated use {@link ScheduleDescription#getTypedSearchAttributes} instead.
92
   */
93
  @Nonnull
94
  public Map<String, List<?>> getSearchAttributes() {
95
    return searchAttributes;
×
96
  }
97

98
  /**
99
   * Gets the search attributes on the schedule.
100
   *
101
   * @return search attributes
102
   */
103
  @Nonnull
104
  public SearchAttributes getTypedSearchAttributes() {
105
    return typedSearchAttributes;
×
106
  }
107

108
  @Nullable
109
  public <T> Object getMemo(String key, Class<T> valueClass) {
110
    return getMemo(key, valueClass, valueClass);
×
111
  }
112

113
  @Nullable
114
  public <T> T getMemo(String key, Class<T> valueClass, Type genericType) {
115
    Payload memoPayload = this.memo.get(key);
×
116
    if (memo == null) {
×
117
      return null;
×
118
    }
119
    return dataConverter.fromPayload(memoPayload, valueClass, genericType);
×
120
  }
121

122
  @Override
123
  public boolean equals(Object o) {
124
    if (this == o) return true;
×
125
    if (o == null || getClass() != o.getClass()) return false;
×
126
    ScheduleDescription that = (ScheduleDescription) o;
×
127
    return Objects.equals(id, that.id)
×
128
        && Objects.equals(info, that.info)
×
129
        && Objects.equals(schedule, that.schedule)
×
130
        && Objects.equals(searchAttributes, that.searchAttributes)
×
131
        && Objects.equals(typedSearchAttributes, that.typedSearchAttributes)
×
132
        && Objects.equals(memo, that.memo);
×
133
  }
134

135
  @Override
136
  public int hashCode() {
137
    return Objects.hash(id, info, schedule, searchAttributes, typedSearchAttributes, memo);
×
138
  }
139

140
  @Override
141
  public String toString() {
142
    return "ScheduleDescription{"
×
143
        + "id='"
144
        + id
145
        + '\''
146
        + ", info="
147
        + info
148
        + ", schedule="
149
        + schedule
150
        + ", searchAttributes="
151
        + searchAttributes
152
        + ", typedSearchAttributes="
153
        + typedSearchAttributes
154
        + ", memo="
155
        + memo
156
        + '}';
157
  }
158
}
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