forked from opentiny/tiny-engine-backend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlockParam.java
More file actions
164 lines (130 loc) · 5.73 KB
/
BlockParam.java
File metadata and controls
164 lines (130 loc) · 5.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* Copyright (c) 2023 - present TinyEngine Authors.
* Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
package com.tinyengine.it.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tinyengine.it.common.base.BaseEntity;
import com.tinyengine.it.common.handler.ListTypeHandler;
import com.tinyengine.it.common.handler.MapTypeHandler;
import com.tinyengine.it.model.entity.BlockHistory;
import com.tinyengine.it.model.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* <p>
* 区块param
* </p>
* This class serves as a parameter object for block creation and updates,
* working in conjunction with {@link BlockDto}. While BlockDto represents
* the full block data model, BlockParam is specifically designed for
* handling input parameters during block operations.
* @author lu-yg
* @since 2024-01-27
*/
@Data
public class BlockParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@Schema(name = "label", description = "区块显示名称,严格大小写格式")
private String label;
@Schema(name = "name", description = "区块名称")
@JsonProperty("name_cn")
private String name;
@Schema(name = "framework", description = "技术栈")
private String framework;
@TableField(typeHandler = JacksonTypeHandler.class)
@Schema(name = "assets", description = "构建资源")
private Map<String, Object> assets;
@JsonProperty("last_build_info")
@TableField(typeHandler = JacksonTypeHandler.class)
@Schema(name = "lastBuildInfo", description = "最新一次构建信息")
private Map<String, Object> lastBuildInfo;
@TableField(typeHandler = JacksonTypeHandler.class)
@Schema(name = "content", description = "区块内容")
private Map<String, Object> content;
@Schema(name = "description", description = "描述")
private String description;
@Schema(name = "tags", description = "标签")
@TableField(typeHandler = ListTypeHandler.class)
private List<String> tags;
@Schema(name = "latestHistoryId", description = "当前历史记录表ID")
@JsonProperty("current_history")
private BlockHistory latestHistoryId;
@Schema(name = "screenshot", description = "截屏")
private String screenshot;
@Schema(name = "path", description = "区块路径")
private String path;
@Schema(name = "latestVersion", description = "当前历史记录表最新版本")
@JsonProperty("version")
private String latestVersion;
@Schema(name = "occupierId", description = "当前锁定人id")
private String occupierId;
@Schema(name = "isOfficial", description = "是否是官方")
@JsonProperty("is_official")
private Boolean isOfficial;
@Schema(name = "isDefault", description = "是否是默认")
@JsonProperty("is_default")
private Boolean isDefault;
@Schema(name = "tinyReserved", description = "是否是tiny专有")
@JsonProperty("tiny_reserved")
private Boolean isTinyReserved;
@Schema(name = "npmName", description = "npm包名")
@JsonProperty("npm_name")
private String npmName;
@Schema(name = "public", description = "公开状态:0,1,2")
@JsonProperty("public")
private Integer publicStatus;
@Schema(name = "i18n", description = "国际化")
@TableField(typeHandler = MapTypeHandler.class)
private Map<String, Map<String, String>> i18n;
@Schema(name = "appId", description = "创建区块时所在appId")
@JsonProperty("created_app")
private Integer appId;
@Schema(name = "contentBlocks", description = "*设计预留字段用途*")
@JsonProperty("content_blocks")
private String contentBlocks;
@Schema(name = "platformId", description = "设计器ID")
@JsonProperty("platform_id")
private Integer platformId;
@JsonProperty("occupier")
@Schema(name = "occupierBy", description = "当前锁定人")
private User occupier;
@TableField(exist = false)
@JsonProperty("public_scope_tenants")
private List<Object> publicScopeTenants = new ArrayList<>();
@TableField(exist = false)
@Schema(name = "groups", type = " List<BlockGroup>", description = "区块分组")
private List<Integer> groups = new ArrayList<>();
@TableField(exist = false)
@Schema(name = "histories", type = " List<BlockHistory>", description = "区块历史")
private List<BlockHistory> histories = new ArrayList<>();
@TableField(exist = false)
@JsonProperty("histories_length")
private Integer historiesLength = 0;
@TableField(exist = false)
@JsonProperty("is_published")
private Boolean isPublished;
@TableField(exist = false)
@JsonProperty("current_version")
private String currentVersion;
@JsonProperty("public")
public Integer getPublic() {
if (this.publicStatus != null && !Arrays.asList(0, 1, 2).contains(this.publicStatus)) {
throw new IllegalStateException("Invalid public status value: " + this.publicStatus);
}
return this.publicStatus;
}
}