|
| 1 | +/** |
| 2 | + * Copyright © 2026-2026 ThingsBoard, Inc. |
| 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 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.thingsboard.client.model; |
| 17 | + |
| 18 | +import java.net.URLEncoder; |
| 19 | +import java.nio.charset.StandardCharsets; |
| 20 | +import java.util.StringJoiner; |
| 21 | +import java.util.Objects; |
| 22 | +import java.util.Map; |
| 23 | +import java.util.HashMap; |
| 24 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 25 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 26 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 27 | +import com.fasterxml.jackson.annotation.JsonTypeName; |
| 28 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 29 | +import java.util.ArrayList; |
| 30 | +import java.util.Arrays; |
| 31 | +import java.util.HashMap; |
| 32 | +import java.util.List; |
| 33 | +import java.util.Map; |
| 34 | +import org.thingsboard.client.model.AttributeExportData; |
| 35 | +import org.thingsboard.client.model.CalculatedField; |
| 36 | +import org.thingsboard.client.model.EntityRelation; |
| 37 | +import org.thingsboard.client.model.EntityType; |
| 38 | +import org.thingsboard.client.model.ExportableEntity; |
| 39 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 40 | + |
| 41 | + |
| 42 | +import org.thingsboard.client.ApiClient; |
| 43 | +/** |
| 44 | + * AiModelExportData |
| 45 | + */ |
| 46 | +@JsonPropertyOrder({ |
| 47 | + AiModelExportData.JSON_PROPERTY_ENTITY_TYPE, |
| 48 | + AiModelExportData.JSON_PROPERTY_ENTITY, |
| 49 | + AiModelExportData.JSON_PROPERTY_RELATIONS, |
| 50 | + AiModelExportData.JSON_PROPERTY_ATTRIBUTES, |
| 51 | + AiModelExportData.JSON_PROPERTY_CALCULATED_FIELDS |
| 52 | +}) |
| 53 | +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") |
| 54 | +public class AiModelExportData { |
| 55 | + public static final String JSON_PROPERTY_ENTITY_TYPE = "entityType"; |
| 56 | + @javax.annotation.Nonnull |
| 57 | + private EntityType entityType; |
| 58 | + |
| 59 | + public static final String JSON_PROPERTY_ENTITY = "entity"; |
| 60 | + @javax.annotation.Nullable |
| 61 | + private ExportableEntity entity; |
| 62 | + |
| 63 | + public static final String JSON_PROPERTY_RELATIONS = "relations"; |
| 64 | + @javax.annotation.Nullable |
| 65 | + private List<EntityRelation> relations = new ArrayList<>(); |
| 66 | + |
| 67 | + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; |
| 68 | + @javax.annotation.Nullable |
| 69 | + private Map<String, List<AttributeExportData>> attributes = new HashMap<>(); |
| 70 | + |
| 71 | + public static final String JSON_PROPERTY_CALCULATED_FIELDS = "calculatedFields"; |
| 72 | + @javax.annotation.Nullable |
| 73 | + private List<CalculatedField> calculatedFields = new ArrayList<>(); |
| 74 | + |
| 75 | + public AiModelExportData() { |
| 76 | + } |
| 77 | + |
| 78 | + public AiModelExportData entityType(@javax.annotation.Nonnull EntityType entityType) { |
| 79 | + this.entityType = entityType; |
| 80 | + return this; |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Get entityType |
| 85 | + * @return entityType |
| 86 | + */ |
| 87 | + @javax.annotation.Nonnull |
| 88 | + @JsonProperty(value = JSON_PROPERTY_ENTITY_TYPE, required = true) |
| 89 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 90 | + public EntityType getEntityType() { |
| 91 | + return entityType; |
| 92 | + } |
| 93 | + |
| 94 | + |
| 95 | + @JsonProperty(value = JSON_PROPERTY_ENTITY_TYPE, required = true) |
| 96 | + @JsonInclude(value = JsonInclude.Include.ALWAYS) |
| 97 | + public void setEntityType(@javax.annotation.Nonnull EntityType entityType) { |
| 98 | + this.entityType = entityType; |
| 99 | + } |
| 100 | + |
| 101 | + |
| 102 | + public AiModelExportData entity(@javax.annotation.Nullable ExportableEntity entity) { |
| 103 | + this.entity = entity; |
| 104 | + return this; |
| 105 | + } |
| 106 | + |
| 107 | + /** |
| 108 | + * Get entity |
| 109 | + * @return entity |
| 110 | + */ |
| 111 | + @javax.annotation.Nullable |
| 112 | + @JsonProperty(value = JSON_PROPERTY_ENTITY, required = false) |
| 113 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 114 | + public ExportableEntity getEntity() { |
| 115 | + return entity; |
| 116 | + } |
| 117 | + |
| 118 | + |
| 119 | + @JsonProperty(value = JSON_PROPERTY_ENTITY, required = false) |
| 120 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 121 | + public void setEntity(@javax.annotation.Nullable ExportableEntity entity) { |
| 122 | + this.entity = entity; |
| 123 | + } |
| 124 | + |
| 125 | + |
| 126 | + public AiModelExportData relations(@javax.annotation.Nullable List<EntityRelation> relations) { |
| 127 | + this.relations = relations; |
| 128 | + return this; |
| 129 | + } |
| 130 | + |
| 131 | + public AiModelExportData addRelationsItem(EntityRelation relationsItem) { |
| 132 | + if (this.relations == null) { |
| 133 | + this.relations = new ArrayList<>(); |
| 134 | + } |
| 135 | + this.relations.add(relationsItem); |
| 136 | + return this; |
| 137 | + } |
| 138 | + |
| 139 | + /** |
| 140 | + * Get relations |
| 141 | + * @return relations |
| 142 | + */ |
| 143 | + @javax.annotation.Nullable |
| 144 | + @JsonProperty(value = JSON_PROPERTY_RELATIONS, required = false) |
| 145 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 146 | + public List<EntityRelation> getRelations() { |
| 147 | + return relations; |
| 148 | + } |
| 149 | + |
| 150 | + |
| 151 | + @JsonProperty(value = JSON_PROPERTY_RELATIONS, required = false) |
| 152 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 153 | + public void setRelations(@javax.annotation.Nullable List<EntityRelation> relations) { |
| 154 | + this.relations = relations; |
| 155 | + } |
| 156 | + |
| 157 | + |
| 158 | + public AiModelExportData attributes(@javax.annotation.Nullable Map<String, List<AttributeExportData>> attributes) { |
| 159 | + this.attributes = attributes; |
| 160 | + return this; |
| 161 | + } |
| 162 | + |
| 163 | + public AiModelExportData putAttributesItem(String key, List<AttributeExportData> attributesItem) { |
| 164 | + if (this.attributes == null) { |
| 165 | + this.attributes = new HashMap<>(); |
| 166 | + } |
| 167 | + this.attributes.put(key, attributesItem); |
| 168 | + return this; |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * Map of attributes where key is the scope of attributes and value is the list of attributes for that scope |
| 173 | + * @return attributes |
| 174 | + */ |
| 175 | + @javax.annotation.Nullable |
| 176 | + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) |
| 177 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 178 | + public Map<String, List<AttributeExportData>> getAttributes() { |
| 179 | + return attributes; |
| 180 | + } |
| 181 | + |
| 182 | + |
| 183 | + @JsonProperty(value = JSON_PROPERTY_ATTRIBUTES, required = false) |
| 184 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 185 | + public void setAttributes(@javax.annotation.Nullable Map<String, List<AttributeExportData>> attributes) { |
| 186 | + this.attributes = attributes; |
| 187 | + } |
| 188 | + |
| 189 | + |
| 190 | + public AiModelExportData calculatedFields(@javax.annotation.Nullable List<CalculatedField> calculatedFields) { |
| 191 | + this.calculatedFields = calculatedFields; |
| 192 | + return this; |
| 193 | + } |
| 194 | + |
| 195 | + public AiModelExportData addCalculatedFieldsItem(CalculatedField calculatedFieldsItem) { |
| 196 | + if (this.calculatedFields == null) { |
| 197 | + this.calculatedFields = new ArrayList<>(); |
| 198 | + } |
| 199 | + this.calculatedFields.add(calculatedFieldsItem); |
| 200 | + return this; |
| 201 | + } |
| 202 | + |
| 203 | + /** |
| 204 | + * Get calculatedFields |
| 205 | + * @return calculatedFields |
| 206 | + */ |
| 207 | + @javax.annotation.Nullable |
| 208 | + @JsonProperty(value = JSON_PROPERTY_CALCULATED_FIELDS, required = false) |
| 209 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 210 | + public List<CalculatedField> getCalculatedFields() { |
| 211 | + return calculatedFields; |
| 212 | + } |
| 213 | + |
| 214 | + |
| 215 | + @JsonProperty(value = JSON_PROPERTY_CALCULATED_FIELDS, required = false) |
| 216 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 217 | + public void setCalculatedFields(@javax.annotation.Nullable List<CalculatedField> calculatedFields) { |
| 218 | + this.calculatedFields = calculatedFields; |
| 219 | + } |
| 220 | + |
| 221 | + |
| 222 | + /** |
| 223 | + * Return true if this AiModelExportData object is equal to o. |
| 224 | + */ |
| 225 | + @Override |
| 226 | + public boolean equals(Object o) { |
| 227 | + if (this == o) { |
| 228 | + return true; |
| 229 | + } |
| 230 | + if (o == null || getClass() != o.getClass()) { |
| 231 | + return false; |
| 232 | + } |
| 233 | + AiModelExportData aiModelExportData = (AiModelExportData) o; |
| 234 | + return Objects.equals(this.entityType, aiModelExportData.entityType) && |
| 235 | + Objects.equals(this.entity, aiModelExportData.entity) && |
| 236 | + Objects.equals(this.relations, aiModelExportData.relations) && |
| 237 | + Objects.equals(this.attributes, aiModelExportData.attributes) && |
| 238 | + Objects.equals(this.calculatedFields, aiModelExportData.calculatedFields); |
| 239 | + } |
| 240 | + |
| 241 | + @Override |
| 242 | + public int hashCode() { |
| 243 | + return Objects.hash(entityType, entity, relations, attributes, calculatedFields); |
| 244 | + } |
| 245 | + |
| 246 | + @Override |
| 247 | + public String toString() { |
| 248 | + StringBuilder sb = new StringBuilder(); |
| 249 | + sb.append("class AiModelExportData {\n"); |
| 250 | + sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); |
| 251 | + sb.append(" entity: ").append(toIndentedString(entity)).append("\n"); |
| 252 | + sb.append(" relations: ").append(toIndentedString(relations)).append("\n"); |
| 253 | + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); |
| 254 | + sb.append(" calculatedFields: ").append(toIndentedString(calculatedFields)).append("\n"); |
| 255 | + sb.append("}"); |
| 256 | + return sb.toString(); |
| 257 | + } |
| 258 | + |
| 259 | + /** |
| 260 | + * Convert the given object to string with each line indented by 4 spaces |
| 261 | + * (except the first line). |
| 262 | + */ |
| 263 | + private String toIndentedString(Object o) { |
| 264 | + if (o == null) { |
| 265 | + return "null"; |
| 266 | + } |
| 267 | + return o.toString().replace("\n", "\n "); |
| 268 | + } |
| 269 | + |
| 270 | + /** |
| 271 | + * Convert the instance into URL query string. |
| 272 | + * |
| 273 | + * @return URL query string |
| 274 | + */ |
| 275 | + public String toUrlQueryString() { |
| 276 | + return toUrlQueryString(null); |
| 277 | + } |
| 278 | + |
| 279 | + /** |
| 280 | + * Convert the instance into URL query string. |
| 281 | + * |
| 282 | + * @param prefix prefix of the query string |
| 283 | + * @return URL query string |
| 284 | + */ |
| 285 | + public String toUrlQueryString(String prefix) { |
| 286 | + String suffix = ""; |
| 287 | + String containerSuffix = ""; |
| 288 | + String containerPrefix = ""; |
| 289 | + if (prefix == null) { |
| 290 | + // style=form, explode=true, e.g. /pet?name=cat&type=manx |
| 291 | + prefix = ""; |
| 292 | + } else { |
| 293 | + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx |
| 294 | + prefix = prefix + "["; |
| 295 | + suffix = "]"; |
| 296 | + containerSuffix = "]"; |
| 297 | + containerPrefix = "["; |
| 298 | + } |
| 299 | + |
| 300 | + StringJoiner joiner = new StringJoiner("&"); |
| 301 | + |
| 302 | + // add `entityType` to the URL query string |
| 303 | + if (getEntityType() != null) { |
| 304 | + joiner.add(String.format(java.util.Locale.ROOT, "%sentityType%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEntityType())))); |
| 305 | + } |
| 306 | + |
| 307 | + // add `entity` to the URL query string |
| 308 | + if (getEntity() != null) { |
| 309 | + joiner.add(getEntity().toUrlQueryString(prefix + "entity" + suffix)); |
| 310 | + } |
| 311 | + |
| 312 | + // add `relations` to the URL query string |
| 313 | + if (getRelations() != null) { |
| 314 | + for (int i = 0; i < getRelations().size(); i++) { |
| 315 | + if (getRelations().get(i) != null) { |
| 316 | + joiner.add(getRelations().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%srelations%s%s", prefix, suffix, |
| 317 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); |
| 318 | + } |
| 319 | + } |
| 320 | + } |
| 321 | + |
| 322 | + // add `attributes` to the URL query string |
| 323 | + if (getAttributes() != null) { |
| 324 | + for (String _key : getAttributes().keySet()) { |
| 325 | + joiner.add(String.format(java.util.Locale.ROOT, "%sattributes%s%s=%s", prefix, suffix, |
| 326 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix), |
| 327 | + getAttributes().get(_key), ApiClient.urlEncode(ApiClient.valueToString(getAttributes().get(_key))))); |
| 328 | + } |
| 329 | + } |
| 330 | + |
| 331 | + // add `calculatedFields` to the URL query string |
| 332 | + if (getCalculatedFields() != null) { |
| 333 | + for (int i = 0; i < getCalculatedFields().size(); i++) { |
| 334 | + if (getCalculatedFields().get(i) != null) { |
| 335 | + joiner.add(getCalculatedFields().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%scalculatedFields%s%s", prefix, suffix, |
| 336 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); |
| 337 | + } |
| 338 | + } |
| 339 | + } |
| 340 | + |
| 341 | + return joiner.toString(); |
| 342 | + } |
| 343 | +} |
| 344 | + |
0 commit comments