|
| 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.JsonIgnoreProperties; |
| 25 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 26 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 27 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 28 | +import com.fasterxml.jackson.annotation.JsonSubTypes; |
| 29 | +import com.fasterxml.jackson.annotation.JsonTypeInfo; |
| 30 | +import com.fasterxml.jackson.annotation.JsonTypeName; |
| 31 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 32 | +import java.util.ArrayList; |
| 33 | +import java.util.Arrays; |
| 34 | +import java.util.HashMap; |
| 35 | +import java.util.List; |
| 36 | +import java.util.Map; |
| 37 | +import org.thingsboard.client.model.AttributeExportData; |
| 38 | +import org.thingsboard.client.model.CalculatedField; |
| 39 | +import org.thingsboard.client.model.EntityExportData; |
| 40 | +import org.thingsboard.client.model.EntityRelation; |
| 41 | +import org.thingsboard.client.model.EntityType; |
| 42 | +import org.thingsboard.client.model.ExportableEntity; |
| 43 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 44 | + |
| 45 | + |
| 46 | +import org.thingsboard.client.JSON; |
| 47 | +import org.thingsboard.client.ApiClient; |
| 48 | +/** |
| 49 | + * AiModelExportData |
| 50 | + */ |
| 51 | +@JsonPropertyOrder({ |
| 52 | +}) |
| 53 | +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") |
| 54 | +@JsonIgnoreProperties( |
| 55 | + value = "entityType", // ignore manually set entityType, it will be automatically generated by Jackson during serialization |
| 56 | + allowSetters = true // allows the entityType to be set during deserialization |
| 57 | +) |
| 58 | +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "entityType", visible = true) |
| 59 | + |
| 60 | +public class AiModelExportData extends EntityExportData { |
| 61 | + public AiModelExportData() { |
| 62 | + } |
| 63 | + |
| 64 | + @Override |
| 65 | + public AiModelExportData entityType(@javax.annotation.Nonnull EntityType entityType) { |
| 66 | + this.setEntityType(entityType); |
| 67 | + return this; |
| 68 | + } |
| 69 | + |
| 70 | + @Override |
| 71 | + public AiModelExportData entity(@javax.annotation.Nullable ExportableEntity entity) { |
| 72 | + this.setEntity(entity); |
| 73 | + return this; |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public AiModelExportData relations(@javax.annotation.Nullable List<EntityRelation> relations) { |
| 78 | + this.setRelations(relations); |
| 79 | + return this; |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public AiModelExportData attributes(@javax.annotation.Nullable Map<String, List<AttributeExportData>> attributes) { |
| 84 | + this.setAttributes(attributes); |
| 85 | + return this; |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public AiModelExportData calculatedFields(@javax.annotation.Nullable List<CalculatedField> calculatedFields) { |
| 90 | + this.setCalculatedFields(calculatedFields); |
| 91 | + return this; |
| 92 | + } |
| 93 | + |
| 94 | + /** |
| 95 | + * Return true if this AiModelExportData object is equal to o. |
| 96 | + */ |
| 97 | + @Override |
| 98 | + public boolean equals(Object o) { |
| 99 | + if (this == o) { |
| 100 | + return true; |
| 101 | + } |
| 102 | + if (o == null || getClass() != o.getClass()) { |
| 103 | + return false; |
| 104 | + } |
| 105 | + return super.equals(o); |
| 106 | + } |
| 107 | + |
| 108 | + @Override |
| 109 | + public int hashCode() { |
| 110 | + return Objects.hash(super.hashCode()); |
| 111 | + } |
| 112 | + |
| 113 | + @Override |
| 114 | + public String toString() { |
| 115 | + StringBuilder sb = new StringBuilder(); |
| 116 | + sb.append("class AiModelExportData {\n"); |
| 117 | + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); |
| 118 | + sb.append("}"); |
| 119 | + return sb.toString(); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * Convert the given object to string with each line indented by 4 spaces |
| 124 | + * (except the first line). |
| 125 | + */ |
| 126 | + private String toIndentedString(Object o) { |
| 127 | + if (o == null) { |
| 128 | + return "null"; |
| 129 | + } |
| 130 | + return o.toString().replace("\n", "\n "); |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * Convert the instance into URL query string. |
| 135 | + * |
| 136 | + * @return URL query string |
| 137 | + */ |
| 138 | + public String toUrlQueryString() { |
| 139 | + return toUrlQueryString(null); |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * Convert the instance into URL query string. |
| 144 | + * |
| 145 | + * @param prefix prefix of the query string |
| 146 | + * @return URL query string |
| 147 | + */ |
| 148 | + public String toUrlQueryString(String prefix) { |
| 149 | + String suffix = ""; |
| 150 | + String containerSuffix = ""; |
| 151 | + String containerPrefix = ""; |
| 152 | + if (prefix == null) { |
| 153 | + // style=form, explode=true, e.g. /pet?name=cat&type=manx |
| 154 | + prefix = ""; |
| 155 | + } else { |
| 156 | + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx |
| 157 | + prefix = prefix + "["; |
| 158 | + suffix = "]"; |
| 159 | + containerSuffix = "]"; |
| 160 | + containerPrefix = "["; |
| 161 | + } |
| 162 | + |
| 163 | + StringJoiner joiner = new StringJoiner("&"); |
| 164 | + |
| 165 | + // add `entityType` to the URL query string |
| 166 | + if (getEntityType() != null) { |
| 167 | + joiner.add(String.format(java.util.Locale.ROOT, "%sentityType%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEntityType())))); |
| 168 | + } |
| 169 | + |
| 170 | + // add `entity` to the URL query string |
| 171 | + if (getEntity() != null) { |
| 172 | + joiner.add(getEntity().toUrlQueryString(prefix + "entity" + suffix)); |
| 173 | + } |
| 174 | + |
| 175 | + // add `relations` to the URL query string |
| 176 | + if (getRelations() != null) { |
| 177 | + for (int i = 0; i < getRelations().size(); i++) { |
| 178 | + if (getRelations().get(i) != null) { |
| 179 | + joiner.add(getRelations().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%srelations%s%s", prefix, suffix, |
| 180 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); |
| 181 | + } |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + // add `attributes` to the URL query string |
| 186 | + if (getAttributes() != null) { |
| 187 | + for (String _key : getAttributes().keySet()) { |
| 188 | + joiner.add(String.format(java.util.Locale.ROOT, "%sattributes%s%s=%s", prefix, suffix, |
| 189 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, _key, containerSuffix), |
| 190 | + getAttributes().get(_key), ApiClient.urlEncode(ApiClient.valueToString(getAttributes().get(_key))))); |
| 191 | + } |
| 192 | + } |
| 193 | + |
| 194 | + // add `calculatedFields` to the URL query string |
| 195 | + if (getCalculatedFields() != null) { |
| 196 | + for (int i = 0; i < getCalculatedFields().size(); i++) { |
| 197 | + if (getCalculatedFields().get(i) != null) { |
| 198 | + joiner.add(getCalculatedFields().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%scalculatedFields%s%s", prefix, suffix, |
| 199 | + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); |
| 200 | + } |
| 201 | + } |
| 202 | + } |
| 203 | + |
| 204 | + return joiner.toString(); |
| 205 | + } |
| 206 | +static { |
| 207 | + // Initialize and register the discriminator mappings. |
| 208 | + Map<String, Class<?>> mappings = new HashMap<String, Class<?>>(); |
| 209 | + mappings.put("AiModelExportData", AiModelExportData.class); |
| 210 | + JSON.registerDiscriminator(AiModelExportData.class, "entityType", mappings); |
| 211 | +} |
| 212 | +} |
| 213 | + |
0 commit comments