499 lines
13 KiB
Java
499 lines
13 KiB
Java
package com.muse.dto;
|
||
|
||
import java.net.URI;
|
||
import java.util.Objects;
|
||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||
import com.fasterxml.jackson.annotation.JsonValue;
|
||
import com.muse.dto.FieldDeprecationInfo;
|
||
import com.muse.dto.MetaFieldVisibility;
|
||
import java.util.ArrayList;
|
||
import java.util.Arrays;
|
||
import java.util.List;
|
||
import org.springframework.lang.Nullable;
|
||
import java.io.Serializable;
|
||
import java.time.OffsetDateTime;
|
||
import jakarta.validation.Valid;
|
||
import jakarta.validation.constraints.*;
|
||
import io.swagger.v3.oas.annotations.media.Schema;
|
||
|
||
|
||
import java.util.*;
|
||
import jakarta.annotation.Generated;
|
||
|
||
/**
|
||
* MetaField
|
||
*/
|
||
|
||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T16:47:40.290595+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0")
|
||
public class MetaField implements Serializable {
|
||
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
private String fieldKey;
|
||
|
||
private String displayName;
|
||
|
||
/**
|
||
* 字段类型
|
||
*/
|
||
public enum FieldTypeEnum {
|
||
STRING("string"),
|
||
|
||
TEXT("text"),
|
||
|
||
NUMBER("number"),
|
||
|
||
BOOLEAN("boolean"),
|
||
|
||
DATE("date"),
|
||
|
||
ENUM("enum"),
|
||
|
||
RELATION("relation"),
|
||
|
||
JSON("json");
|
||
|
||
private final String value;
|
||
|
||
FieldTypeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static FieldTypeEnum fromValue(String value) {
|
||
for (FieldTypeEnum b : FieldTypeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private FieldTypeEnum fieldType;
|
||
|
||
/**
|
||
* 作用域
|
||
*/
|
||
public enum ScopeEnum {
|
||
GLOBAL("global"),
|
||
|
||
TENANT("tenant"),
|
||
|
||
USER("user"),
|
||
|
||
WORK("work");
|
||
|
||
private final String value;
|
||
|
||
ScopeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static ScopeEnum fromValue(String value) {
|
||
for (ScopeEnum b : ScopeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private @Nullable ScopeEnum scope;
|
||
|
||
private @Nullable Object defaultValue = null;
|
||
|
||
private Boolean required = false;
|
||
|
||
@Valid
|
||
private List<String> enumValues = new ArrayList<>();
|
||
|
||
private @Nullable Object validationRules;
|
||
|
||
private @Nullable MetaFieldVisibility visibility;
|
||
|
||
private Boolean deprecated = false;
|
||
|
||
private @Nullable FieldDeprecationInfo deprecatedInfo;
|
||
|
||
private @Nullable String inheritedFrom;
|
||
|
||
private Boolean protectionNodeBound = false;
|
||
|
||
public MetaField() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* Constructor with only required parameters
|
||
*/
|
||
public MetaField(String fieldKey, String displayName, FieldTypeEnum fieldType) {
|
||
this.fieldKey = fieldKey;
|
||
this.displayName = displayName;
|
||
this.fieldType = fieldType;
|
||
}
|
||
|
||
public MetaField fieldKey(String fieldKey) {
|
||
this.fieldKey = fieldKey;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 字段业务标识(英文)
|
||
* @return fieldKey
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "fieldKey", description = "字段业务标识(英文)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("fieldKey")
|
||
public String getFieldKey() {
|
||
return fieldKey;
|
||
}
|
||
|
||
@JsonProperty("fieldKey")
|
||
public void setFieldKey(String fieldKey) {
|
||
this.fieldKey = fieldKey;
|
||
}
|
||
|
||
public MetaField displayName(String displayName) {
|
||
this.displayName = displayName;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 显示名称
|
||
* @return displayName
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "displayName", description = "显示名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("displayName")
|
||
public String getDisplayName() {
|
||
return displayName;
|
||
}
|
||
|
||
@JsonProperty("displayName")
|
||
public void setDisplayName(String displayName) {
|
||
this.displayName = displayName;
|
||
}
|
||
|
||
public MetaField fieldType(FieldTypeEnum fieldType) {
|
||
this.fieldType = fieldType;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 字段类型
|
||
* @return fieldType
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "fieldType", description = "字段类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("fieldType")
|
||
public FieldTypeEnum getFieldType() {
|
||
return fieldType;
|
||
}
|
||
|
||
@JsonProperty("fieldType")
|
||
public void setFieldType(FieldTypeEnum fieldType) {
|
||
this.fieldType = fieldType;
|
||
}
|
||
|
||
public MetaField scope(@Nullable ScopeEnum scope) {
|
||
this.scope = scope;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 作用域
|
||
* @return scope
|
||
*/
|
||
|
||
@Schema(name = "scope", description = "作用域", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("scope")
|
||
public @Nullable ScopeEnum getScope() {
|
||
return scope;
|
||
}
|
||
|
||
@JsonProperty("scope")
|
||
public void setScope(@Nullable ScopeEnum scope) {
|
||
this.scope = scope;
|
||
}
|
||
|
||
public MetaField defaultValue(@Nullable Object defaultValue) {
|
||
this.defaultValue = defaultValue;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 默认值
|
||
* @return defaultValue
|
||
*/
|
||
|
||
@Schema(name = "defaultValue", description = "默认值", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("defaultValue")
|
||
public @Nullable Object getDefaultValue() {
|
||
return defaultValue;
|
||
}
|
||
|
||
@JsonProperty("defaultValue")
|
||
public void setDefaultValue(@Nullable Object defaultValue) {
|
||
this.defaultValue = defaultValue;
|
||
}
|
||
|
||
public MetaField required(Boolean required) {
|
||
this.required = required;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 是否必填
|
||
* @return required
|
||
*/
|
||
|
||
@Schema(name = "required", description = "是否必填", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("required")
|
||
public Boolean getRequired() {
|
||
return required;
|
||
}
|
||
|
||
@JsonProperty("required")
|
||
public void setRequired(Boolean required) {
|
||
this.required = required;
|
||
}
|
||
|
||
public MetaField enumValues(List<String> enumValues) {
|
||
this.enumValues = enumValues;
|
||
return this;
|
||
}
|
||
|
||
public MetaField addEnumValuesItem(String enumValuesItem) {
|
||
if (this.enumValues == null) {
|
||
this.enumValues = new ArrayList<>();
|
||
}
|
||
this.enumValues.add(enumValuesItem);
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* fieldType=enum 时的可选值
|
||
* @return enumValues
|
||
*/
|
||
|
||
@Schema(name = "enumValues", description = "fieldType=enum 时的可选值", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("enumValues")
|
||
public List<String> getEnumValues() {
|
||
return enumValues;
|
||
}
|
||
|
||
@JsonProperty("enumValues")
|
||
public void setEnumValues(List<String> enumValues) {
|
||
this.enumValues = enumValues;
|
||
}
|
||
|
||
public MetaField validationRules(@Nullable Object validationRules) {
|
||
this.validationRules = validationRules;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 校验规则(min/max/pattern 等)
|
||
* @return validationRules
|
||
*/
|
||
|
||
@Schema(name = "validationRules", description = "校验规则(min/max/pattern 等)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("validationRules")
|
||
public @Nullable Object getValidationRules() {
|
||
return validationRules;
|
||
}
|
||
|
||
@JsonProperty("validationRules")
|
||
public void setValidationRules(@Nullable Object validationRules) {
|
||
this.validationRules = validationRules;
|
||
}
|
||
|
||
public MetaField visibility(@Nullable MetaFieldVisibility visibility) {
|
||
this.visibility = visibility;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* Get visibility
|
||
* @return visibility
|
||
*/
|
||
@Valid
|
||
@Schema(name = "visibility", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("visibility")
|
||
public @Nullable MetaFieldVisibility getVisibility() {
|
||
return visibility;
|
||
}
|
||
|
||
@JsonProperty("visibility")
|
||
public void setVisibility(@Nullable MetaFieldVisibility visibility) {
|
||
this.visibility = visibility;
|
||
}
|
||
|
||
public MetaField deprecated(Boolean deprecated) {
|
||
this.deprecated = deprecated;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 字段是否已废弃
|
||
* @return deprecated
|
||
*/
|
||
|
||
@Schema(name = "deprecated", description = "字段是否已废弃", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("deprecated")
|
||
public Boolean getDeprecated() {
|
||
return deprecated;
|
||
}
|
||
|
||
@JsonProperty("deprecated")
|
||
public void setDeprecated(Boolean deprecated) {
|
||
this.deprecated = deprecated;
|
||
}
|
||
|
||
public MetaField deprecatedInfo(@Nullable FieldDeprecationInfo deprecatedInfo) {
|
||
this.deprecatedInfo = deprecatedInfo;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* Get deprecatedInfo
|
||
* @return deprecatedInfo
|
||
*/
|
||
@Valid
|
||
@Schema(name = "deprecatedInfo", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("deprecatedInfo")
|
||
public @Nullable FieldDeprecationInfo getDeprecatedInfo() {
|
||
return deprecatedInfo;
|
||
}
|
||
|
||
@JsonProperty("deprecatedInfo")
|
||
public void setDeprecatedInfo(@Nullable FieldDeprecationInfo deprecatedInfo) {
|
||
this.deprecatedInfo = deprecatedInfo;
|
||
}
|
||
|
||
public MetaField inheritedFrom(@Nullable String inheritedFrom) {
|
||
this.inheritedFrom = inheritedFrom;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 字段继承来源 schemaKey(若为继承字段)
|
||
* @return inheritedFrom
|
||
*/
|
||
|
||
@Schema(name = "inheritedFrom", description = "字段继承来源 schemaKey(若为继承字段)", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("inheritedFrom")
|
||
public @Nullable String getInheritedFrom() {
|
||
return inheritedFrom;
|
||
}
|
||
|
||
@JsonProperty("inheritedFrom")
|
||
public void setInheritedFrom(@Nullable String inheritedFrom) {
|
||
this.inheritedFrom = inheritedFrom;
|
||
}
|
||
|
||
public MetaField protectionNodeBound(Boolean protectionNodeBound) {
|
||
this.protectionNodeBound = protectionNodeBound;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 该字段是否绑定保护节点边界
|
||
* @return protectionNodeBound
|
||
*/
|
||
|
||
@Schema(name = "protectionNodeBound", description = "该字段是否绑定保护节点边界", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("protectionNodeBound")
|
||
public Boolean getProtectionNodeBound() {
|
||
return protectionNodeBound;
|
||
}
|
||
|
||
@JsonProperty("protectionNodeBound")
|
||
public void setProtectionNodeBound(Boolean protectionNodeBound) {
|
||
this.protectionNodeBound = protectionNodeBound;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object o) {
|
||
if (this == o) {
|
||
return true;
|
||
}
|
||
if (o == null || getClass() != o.getClass()) {
|
||
return false;
|
||
}
|
||
MetaField metaField = (MetaField) o;
|
||
return Objects.equals(this.fieldKey, metaField.fieldKey) &&
|
||
Objects.equals(this.displayName, metaField.displayName) &&
|
||
Objects.equals(this.fieldType, metaField.fieldType) &&
|
||
Objects.equals(this.scope, metaField.scope) &&
|
||
Objects.equals(this.defaultValue, metaField.defaultValue) &&
|
||
Objects.equals(this.required, metaField.required) &&
|
||
Objects.equals(this.enumValues, metaField.enumValues) &&
|
||
Objects.equals(this.validationRules, metaField.validationRules) &&
|
||
Objects.equals(this.visibility, metaField.visibility) &&
|
||
Objects.equals(this.deprecated, metaField.deprecated) &&
|
||
Objects.equals(this.deprecatedInfo, metaField.deprecatedInfo) &&
|
||
Objects.equals(this.inheritedFrom, metaField.inheritedFrom) &&
|
||
Objects.equals(this.protectionNodeBound, metaField.protectionNodeBound);
|
||
}
|
||
|
||
@Override
|
||
public int hashCode() {
|
||
return Objects.hash(fieldKey, displayName, fieldType, scope, defaultValue, required, enumValues, validationRules, visibility, deprecated, deprecatedInfo, inheritedFrom, protectionNodeBound);
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.append("class MetaField {\n");
|
||
sb.append(" fieldKey: ").append(toIndentedString(fieldKey)).append("\n");
|
||
sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n");
|
||
sb.append(" fieldType: ").append(toIndentedString(fieldType)).append("\n");
|
||
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
|
||
sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n");
|
||
sb.append(" required: ").append(toIndentedString(required)).append("\n");
|
||
sb.append(" enumValues: ").append(toIndentedString(enumValues)).append("\n");
|
||
sb.append(" validationRules: ").append(toIndentedString(validationRules)).append("\n");
|
||
sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n");
|
||
sb.append(" deprecated: ").append(toIndentedString(deprecated)).append("\n");
|
||
sb.append(" deprecatedInfo: ").append(toIndentedString(deprecatedInfo)).append("\n");
|
||
sb.append(" inheritedFrom: ").append(toIndentedString(inheritedFrom)).append("\n");
|
||
sb.append(" protectionNodeBound: ").append(toIndentedString(protectionNodeBound)).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(@Nullable Object o) {
|
||
return o == null ? "null" : o.toString().replace("\n", "\n ");
|
||
}
|
||
}
|
||
|