|
| 1 | +/* |
| 2 | + * Copyright 2010-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | + * You may not use this file except in compliance with the License. |
| 6 | + * A copy of the License is located at |
| 7 | + * |
| 8 | + * http://aws.amazon.com/apache2.0 |
| 9 | + * |
| 10 | + * or in the "license" file accompanying this file. This file is distributed |
| 11 | + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | + * express or implied. See the License for the specific language governing |
| 13 | + * permissions and limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | +package com.amazonaws.services.kinesisvideoarchivedmedia.model; |
| 17 | + |
| 18 | +import java.io.Serializable; |
| 19 | + |
| 20 | +/** |
| 21 | + * <p> |
| 22 | + * Describes the timestamp range and timestamp origin of a range of fragments. |
| 23 | + * </p> |
| 24 | + * <p> |
| 25 | + * Fragments that have duplicate producer timestamps are deduplicated. This |
| 26 | + * means that if producers are producing a stream of fragments with producer |
| 27 | + * timestamps that are approximately equal to the true clock time, the clip will |
| 28 | + * contain all of the fragments within the requested timestamp range. If some |
| 29 | + * fragments are ingested within the same time range and very different points |
| 30 | + * in time, only the oldest ingested collection of fragments are returned. |
| 31 | + * </p> |
| 32 | + */ |
| 33 | +public class ClipFragmentSelector implements Serializable { |
| 34 | + /** |
| 35 | + * <p> |
| 36 | + * The origin of the timestamps to use (Server or Producer). |
| 37 | + * </p> |
| 38 | + * <p> |
| 39 | + * <b>Constraints:</b><br/> |
| 40 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 41 | + */ |
| 42 | + private String fragmentSelectorType; |
| 43 | + |
| 44 | + /** |
| 45 | + * <p> |
| 46 | + * The range of timestamps to return. |
| 47 | + * </p> |
| 48 | + */ |
| 49 | + private ClipTimestampRange timestampRange; |
| 50 | + |
| 51 | + /** |
| 52 | + * <p> |
| 53 | + * The origin of the timestamps to use (Server or Producer). |
| 54 | + * </p> |
| 55 | + * <p> |
| 56 | + * <b>Constraints:</b><br/> |
| 57 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 58 | + * |
| 59 | + * @return <p> |
| 60 | + * The origin of the timestamps to use (Server or Producer). |
| 61 | + * </p> |
| 62 | + * @see ClipFragmentSelectorType |
| 63 | + */ |
| 64 | + public String getFragmentSelectorType() { |
| 65 | + return fragmentSelectorType; |
| 66 | + } |
| 67 | + |
| 68 | + /** |
| 69 | + * <p> |
| 70 | + * The origin of the timestamps to use (Server or Producer). |
| 71 | + * </p> |
| 72 | + * <p> |
| 73 | + * <b>Constraints:</b><br/> |
| 74 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 75 | + * |
| 76 | + * @param fragmentSelectorType <p> |
| 77 | + * The origin of the timestamps to use (Server or Producer). |
| 78 | + * </p> |
| 79 | + * @see ClipFragmentSelectorType |
| 80 | + */ |
| 81 | + public void setFragmentSelectorType(String fragmentSelectorType) { |
| 82 | + this.fragmentSelectorType = fragmentSelectorType; |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * <p> |
| 87 | + * The origin of the timestamps to use (Server or Producer). |
| 88 | + * </p> |
| 89 | + * <p> |
| 90 | + * Returns a reference to this object so that method calls can be chained |
| 91 | + * together. |
| 92 | + * <p> |
| 93 | + * <b>Constraints:</b><br/> |
| 94 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 95 | + * |
| 96 | + * @param fragmentSelectorType <p> |
| 97 | + * The origin of the timestamps to use (Server or Producer). |
| 98 | + * </p> |
| 99 | + * @return A reference to this updated object so that method calls can be |
| 100 | + * chained together. |
| 101 | + * @see ClipFragmentSelectorType |
| 102 | + */ |
| 103 | + public ClipFragmentSelector withFragmentSelectorType(String fragmentSelectorType) { |
| 104 | + this.fragmentSelectorType = fragmentSelectorType; |
| 105 | + return this; |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * <p> |
| 110 | + * The origin of the timestamps to use (Server or Producer). |
| 111 | + * </p> |
| 112 | + * <p> |
| 113 | + * <b>Constraints:</b><br/> |
| 114 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 115 | + * |
| 116 | + * @param fragmentSelectorType <p> |
| 117 | + * The origin of the timestamps to use (Server or Producer). |
| 118 | + * </p> |
| 119 | + * @see ClipFragmentSelectorType |
| 120 | + */ |
| 121 | + public void setFragmentSelectorType(ClipFragmentSelectorType fragmentSelectorType) { |
| 122 | + this.fragmentSelectorType = fragmentSelectorType.toString(); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * <p> |
| 127 | + * The origin of the timestamps to use (Server or Producer). |
| 128 | + * </p> |
| 129 | + * <p> |
| 130 | + * Returns a reference to this object so that method calls can be chained |
| 131 | + * together. |
| 132 | + * <p> |
| 133 | + * <b>Constraints:</b><br/> |
| 134 | + * <b>Allowed Values: </b>PRODUCER_TIMESTAMP, SERVER_TIMESTAMP |
| 135 | + * |
| 136 | + * @param fragmentSelectorType <p> |
| 137 | + * The origin of the timestamps to use (Server or Producer). |
| 138 | + * </p> |
| 139 | + * @return A reference to this updated object so that method calls can be |
| 140 | + * chained together. |
| 141 | + * @see ClipFragmentSelectorType |
| 142 | + */ |
| 143 | + public ClipFragmentSelector withFragmentSelectorType( |
| 144 | + ClipFragmentSelectorType fragmentSelectorType) { |
| 145 | + this.fragmentSelectorType = fragmentSelectorType.toString(); |
| 146 | + return this; |
| 147 | + } |
| 148 | + |
| 149 | + /** |
| 150 | + * <p> |
| 151 | + * The range of timestamps to return. |
| 152 | + * </p> |
| 153 | + * |
| 154 | + * @return <p> |
| 155 | + * The range of timestamps to return. |
| 156 | + * </p> |
| 157 | + */ |
| 158 | + public ClipTimestampRange getTimestampRange() { |
| 159 | + return timestampRange; |
| 160 | + } |
| 161 | + |
| 162 | + /** |
| 163 | + * <p> |
| 164 | + * The range of timestamps to return. |
| 165 | + * </p> |
| 166 | + * |
| 167 | + * @param timestampRange <p> |
| 168 | + * The range of timestamps to return. |
| 169 | + * </p> |
| 170 | + */ |
| 171 | + public void setTimestampRange(ClipTimestampRange timestampRange) { |
| 172 | + this.timestampRange = timestampRange; |
| 173 | + } |
| 174 | + |
| 175 | + /** |
| 176 | + * <p> |
| 177 | + * The range of timestamps to return. |
| 178 | + * </p> |
| 179 | + * <p> |
| 180 | + * Returns a reference to this object so that method calls can be chained |
| 181 | + * together. |
| 182 | + * |
| 183 | + * @param timestampRange <p> |
| 184 | + * The range of timestamps to return. |
| 185 | + * </p> |
| 186 | + * @return A reference to this updated object so that method calls can be |
| 187 | + * chained together. |
| 188 | + */ |
| 189 | + public ClipFragmentSelector withTimestampRange(ClipTimestampRange timestampRange) { |
| 190 | + this.timestampRange = timestampRange; |
| 191 | + return this; |
| 192 | + } |
| 193 | + |
| 194 | + /** |
| 195 | + * Returns a string representation of this object; useful for testing and |
| 196 | + * debugging. |
| 197 | + * |
| 198 | + * @return A string representation of this object. |
| 199 | + * @see java.lang.Object#toString() |
| 200 | + */ |
| 201 | + @Override |
| 202 | + public String toString() { |
| 203 | + StringBuilder sb = new StringBuilder(); |
| 204 | + sb.append("{"); |
| 205 | + if (getFragmentSelectorType() != null) |
| 206 | + sb.append("FragmentSelectorType: " + getFragmentSelectorType() + ","); |
| 207 | + if (getTimestampRange() != null) |
| 208 | + sb.append("TimestampRange: " + getTimestampRange()); |
| 209 | + sb.append("}"); |
| 210 | + return sb.toString(); |
| 211 | + } |
| 212 | + |
| 213 | + @Override |
| 214 | + public int hashCode() { |
| 215 | + final int prime = 31; |
| 216 | + int hashCode = 1; |
| 217 | + |
| 218 | + hashCode = prime * hashCode |
| 219 | + + ((getFragmentSelectorType() == null) ? 0 : getFragmentSelectorType().hashCode()); |
| 220 | + hashCode = prime * hashCode |
| 221 | + + ((getTimestampRange() == null) ? 0 : getTimestampRange().hashCode()); |
| 222 | + return hashCode; |
| 223 | + } |
| 224 | + |
| 225 | + @Override |
| 226 | + public boolean equals(Object obj) { |
| 227 | + if (this == obj) |
| 228 | + return true; |
| 229 | + if (obj == null) |
| 230 | + return false; |
| 231 | + |
| 232 | + if (obj instanceof ClipFragmentSelector == false) |
| 233 | + return false; |
| 234 | + ClipFragmentSelector other = (ClipFragmentSelector) obj; |
| 235 | + |
| 236 | + if (other.getFragmentSelectorType() == null ^ this.getFragmentSelectorType() == null) |
| 237 | + return false; |
| 238 | + if (other.getFragmentSelectorType() != null |
| 239 | + && other.getFragmentSelectorType().equals(this.getFragmentSelectorType()) == false) |
| 240 | + return false; |
| 241 | + if (other.getTimestampRange() == null ^ this.getTimestampRange() == null) |
| 242 | + return false; |
| 243 | + if (other.getTimestampRange() != null |
| 244 | + && other.getTimestampRange().equals(this.getTimestampRange()) == false) |
| 245 | + return false; |
| 246 | + return true; |
| 247 | + } |
| 248 | +} |
0 commit comments