Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,36 @@ public AiModelExportData relations(@Nullable List<EntityRelation> relations) {
return this;
}

@Override
public AiModelExportData addRelationsItem(EntityRelation relationsItem) {
super.addRelationsItem(relationsItem);
return this;
}

@Override
public AiModelExportData attributes(@Nullable Map<String, List<AttributeExportData>> attributes) {
this.setAttributes(attributes);
return this;
}

@Override
public AiModelExportData putAttributesItem(String key, List<AttributeExportData> attributesItem) {
super.putAttributesItem(key, attributesItem);
return this;
}

@Override
public AiModelExportData calculatedFields(@Nullable List<CalculatedField> calculatedFields) {
this.setCalculatedFields(calculatedFields);
return this;
}

@Override
public AiModelExportData addCalculatedFieldsItem(CalculatedField calculatedFieldsItem) {
super.addCalculatedFieldsItem(calculatedFieldsItem);
return this;
}

/**
* Return true if this AiModelExportData object is equal to o.
*/
Expand Down
218 changes: 108 additions & 110 deletions ce/src/main/java/org/thingsboard/client/model/AliasEntityId.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,128 +15,159 @@
*/
package org.thingsboard.client.model;

import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Arrays;
import java.util.UUID;
import org.thingsboard.client.model.AliasEntityType;
import org.thingsboard.client.model.EntityType;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.thingsboard.client.ApiClient;

import javax.annotation.Nullable;
import java.util.Objects;
import java.util.StringJoiner;
import java.util.UUID;

import org.thingsboard.client.ApiClient;
/**
* AliasEntityId
* Entity ID used by entity filters: either an entity of a given {@link EntityType}, or an alias
* ({@link AliasEntityType}) that the server resolves for the current user.
* <p>
* Hand-written: it replaces the generated model (see generate-client.sh). The server writes both
* kinds in one {@code entityType} field, e.g. {@code {"entityType": "DEVICE", "id": "..."}} or
* {@code {"entityType": "CURRENT_USER"}}, so the spec documents {@code entityType} as a string.
* This class keeps the typed accessors of earlier client versions on top of that field.
*/
@JsonPropertyOrder({
AliasEntityId.JSON_PROPERTY_ALIAS_ENTITY_TYPE,
AliasEntityId.JSON_PROPERTY_ENTITY_TYPE,
AliasEntityId.JSON_PROPERTY_ID
})
@Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.NONE,
isGetterVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.NONE)
public class AliasEntityId {
public static final String JSON_PROPERTY_ALIAS_ENTITY_TYPE = "aliasEntityType";
@Nullable
private AliasEntityType aliasEntityType;

public static final String JSON_PROPERTY_ENTITY_TYPE = "entityType";
@Nonnull
private EntityType entityType;
@JsonProperty(value = JSON_PROPERTY_ENTITY_TYPE, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
private String entityType;

/**
* @deprecated The server never writes {@code aliasEntityType}; an alias is sent in {@code entityType}.
*/
@Deprecated
public static final String JSON_PROPERTY_ALIAS_ENTITY_TYPE = "aliasEntityType";

public static final String JSON_PROPERTY_ID = "id";
@Nonnull
// Omitted when null: the server rejects "id": null for an alias.
@JsonProperty(value = JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.NON_NULL)
private UUID id;

public AliasEntityId() {
public AliasEntityId() {
}

public AliasEntityId aliasEntityType(@Nullable AliasEntityType aliasEntityType) {
this.aliasEntityType = aliasEntityType;
/**
* Sets the entity type of an entity ID; {@link #id(UUID)} is required with it.
*/
public AliasEntityId entityType(@Nullable EntityType entityType) {
setEntityType(entityType);
return this;
}

/**
* Get aliasEntityType
* @return aliasEntityType
* @return the entity type, or {@code null} if this is an alias
*/
@Nullable
@JsonProperty(value = JSON_PROPERTY_ALIAS_ENTITY_TYPE, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public AliasEntityType getAliasEntityType() {
return aliasEntityType;
public EntityType getEntityType() {
if (entityType != null) {
for (EntityType type : EntityType.values()) {
if (type.getValue().equals(entityType)) {
return type;
}
}
}
return null;
}


@JsonProperty(value = JSON_PROPERTY_ALIAS_ENTITY_TYPE, required = false)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setAliasEntityType(@Nullable AliasEntityType aliasEntityType) {
this.aliasEntityType = aliasEntityType;
/**
* Sets the entity type of an entity ID. {@code null} clears the value only if it is an entity type,
* so it does not clear an alias (e.g. when properties are copied one by one).
*/
public void setEntityType(@Nullable EntityType entityType) {
if (entityType != null) {
this.entityType = entityType.getValue();
} else if (getEntityType() != null) {
this.entityType = null;
}
}


public AliasEntityId entityType(@Nonnull EntityType entityType) {
this.entityType = entityType;
/**
* Sets an alias that the server resolves for the current user; the ID is optional.
*/
public AliasEntityId aliasEntityType(@Nullable AliasEntityType aliasEntityType) {
setAliasEntityType(aliasEntityType);
return this;
}

/**
* Get entityType
* @return entityType
* @return the alias, or {@code null} if this is an entity ID
*/
@Nonnull
@JsonProperty(value = JSON_PROPERTY_ENTITY_TYPE, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public EntityType getEntityType() {
return entityType;
@Nullable
public AliasEntityType getAliasEntityType() {
if (entityType != null) {
for (AliasEntityType type : AliasEntityType.values()) {
if (type.getValue().equals(entityType)) {
return type;
}
}
}
return null;
}

/**
* Sets an alias. {@code null} clears the value only if it is an alias, so it does not clear
* an entity type (e.g. when properties are copied one by one).
*/
public void setAliasEntityType(@Nullable AliasEntityType aliasEntityType) {
if (aliasEntityType != null) {
this.entityType = aliasEntityType.getValue();
} else if (getAliasEntityType() != null) {
this.entityType = null;
}
}

@JsonProperty(value = JSON_PROPERTY_ENTITY_TYPE, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setEntityType(@Nonnull EntityType entityType) {
/**
* Sets the raw {@code entityType} value: an {@link EntityType} or {@link AliasEntityType} name.
*/
public AliasEntityId entityTypeValue(@Nullable String entityType) {
this.entityType = entityType;
return this;
}

/**
* @return the raw {@code entityType} value as the server sent it
*/
@Nullable
public String getEntityTypeValue() {
return entityType;
}

public AliasEntityId id(@Nonnull UUID id) {
public AliasEntityId id(@Nullable UUID id) {
this.id = id;
return this;
}

/**
* ID of the entity, time-based UUID v1
* ID of the entity, time-based UUID v1; required for an entity ID, optional for an alias.
* @return id
*/
@Nonnull
@JsonProperty(value = JSON_PROPERTY_ID, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@Nullable
public UUID getId() {
return id;
}


@JsonProperty(value = JSON_PROPERTY_ID, required = true)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setId(@Nonnull UUID id) {
public void setId(@Nullable UUID id) {
this.id = id;
}


/**
* Return true if this AliasEntityId object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -146,36 +177,21 @@ public boolean equals(Object o) {
return false;
}
AliasEntityId aliasEntityId = (AliasEntityId) o;
return Objects.equals(this.aliasEntityType, aliasEntityId.aliasEntityType) &&
Objects.equals(this.entityType, aliasEntityId.entityType) &&
return Objects.equals(this.entityType, aliasEntityId.entityType) &&
Objects.equals(this.id, aliasEntityId.id);
}

@Override
public int hashCode() {
return Objects.hash(aliasEntityType, entityType, id);
return Objects.hash(entityType, id);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AliasEntityId {\n");
sb.append(" aliasEntityType: ").append(toIndentedString(aliasEntityType)).append("\n");
sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
return "class AliasEntityId {\n" +
" entityType: " + entityType + "\n" +
" id: " + id + "\n" +
"}";
}

/**
Expand All @@ -195,37 +211,19 @@ public String toUrlQueryString() {
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}

StringJoiner joiner = new StringJoiner("&");

// add `aliasEntityType` to the URL query string
if (getAliasEntityType() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%saliasEntityType%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getAliasEntityType()))));
if (entityType != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sentityType%s=%s", prefix, suffix, ApiClient.urlEncode(entityType)));
}

// add `entityType` to the URL query string
if (getEntityType() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sentityType%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getEntityType()))));
if (id != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(id))));
}

// add `id` to the URL query string
if (getId() != null) {
joiner.add(String.format(java.util.Locale.ROOT, "%sid%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getId()))));
}

return joiner.toString();
}
}

18 changes: 18 additions & 0 deletions ce/src/main/java/org/thingsboard/client/model/AssetExportData.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,36 @@ public AssetExportData relations(@Nullable List<EntityRelation> relations) {
return this;
}

@Override
public AssetExportData addRelationsItem(EntityRelation relationsItem) {
super.addRelationsItem(relationsItem);
return this;
}

@Override
public AssetExportData attributes(@Nullable Map<String, List<AttributeExportData>> attributes) {
this.setAttributes(attributes);
return this;
}

@Override
public AssetExportData putAttributesItem(String key, List<AttributeExportData> attributesItem) {
super.putAttributesItem(key, attributesItem);
return this;
}

@Override
public AssetExportData calculatedFields(@Nullable List<CalculatedField> calculatedFields) {
this.setCalculatedFields(calculatedFields);
return this;
}

@Override
public AssetExportData addCalculatedFieldsItem(CalculatedField calculatedFieldsItem) {
super.addCalculatedFieldsItem(calculatedFieldsItem);
return this;
}

/**
* Return true if this AssetExportData object is equal to o.
*/
Expand Down
Loading
Loading