From 4d3ae31974647c5d6dd71e1a442663ea788979f9 Mon Sep 17 00:00:00 2001 From: Dhruva Chandra Date: Sat, 15 Apr 2023 11:59:37 +0530 Subject: [PATCH] Added the @Column(length=2048) for special fields (#882) --- .../org/dromara/hertzbeat/common/entity/alerter/Alert.java | 2 ++ .../hertzbeat/common/entity/alerter/AlertDefine.java | 6 ++++-- .../hertzbeat/common/entity/manager/NoticeReceiver.java | 6 ++++++ .../dromara/hertzbeat/common/entity/manager/NoticeRule.java | 1 + .../org/dromara/hertzbeat/common/entity/manager/Param.java | 2 +- .../hertzbeat/common/entity/manager/ParamDefine.java | 3 ++- .../org/dromara/hertzbeat/common/entity/manager/Tag.java | 2 +- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/Alert.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/Alert.java index 69ab7b07a85..8fe92296bd9 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/Alert.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/Alert.java @@ -86,6 +86,7 @@ public class Alert { example = "linux_192.134.32.1: 534543534 cpu usage high", accessMode = READ_WRITE) @Length(max = 2048) + @Column(length = 2048) private String content; @Schema(title = "Alarm status: 0-normal alarm (to be processed) 1-threshold triggered but not reached the number of alarms 2-recovered alarm 3-processed", @@ -119,6 +120,7 @@ public class Alert { @Schema(description = "告警信息标签(monitorId:xxx,monitorName:xxx)", example = "{key1:value1}", accessMode = READ_WRITE) @Convert(converter = JsonMapAttributeConverter.class) @SuppressWarnings("JpaAttributeTypeInspection") + @Column(length = 2048) private Map tags; @Schema(title = "此条记录创建者", example = "tom", accessMode = READ_ONLY) diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/AlertDefine.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/AlertDefine.java index 8271fe9ce72..e3e0b8bb87f 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/AlertDefine.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/alerter/AlertDefine.java @@ -79,7 +79,8 @@ public class AlertDefine { private boolean preset; @Schema(title = "告警阈值触发条件表达式", example = "usage>90", accessMode = READ_WRITE) - @Length(max = 1024) + @Length(max = 2048) + @Column(length = 2048) private String expr; @Schema(title = "告警级别 0:高-emergency-紧急告警-红色 1:中-critical-严重告警-橙色 2:低-warning-警告告警-黄色", @@ -98,7 +99,8 @@ public class AlertDefine { @Schema(title = "告警通知内容模版", example = "linux {monitor_name}: {monitor_id} cpu usage high", accessMode = READ_WRITE) - @Length(max = 1024) + @Length(max = 2048) + @Column(length = 2048) private String template; @Schema(title = "此条记录创建者", example = "tom", accessMode = READ_ONLY) diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeReceiver.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeReceiver.java index 2a3f5ddb38a..b7a31b48800 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeReceiver.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeReceiver.java @@ -90,18 +90,21 @@ public class NoticeReceiver { description = "URL地址 : 通知方式为webhook有效", example = "https://www.tancloud.cn", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String hookUrl; @Schema(title = "openId : The notification method is valid for WeChat official account, enterprise WeChat robot or FlyBook robot", description = "openId : 通知方式为微信公众号,企业微信机器人或飞书机器人有效", example = "343432", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String wechatId; @Schema(title = "Access token : The notification method is valid for DingTalk robot", description = "访问token : 通知方式为钉钉机器人有效", example = "34823984635647", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String accessToken; @Schema(title = "Telegram bot token : The notification method is valid for Telegram Bot", @@ -118,6 +121,7 @@ public class NoticeReceiver { description = "URL地址 : 通知方式为Slack有效", example = "https://hooks.slack.com/services/XXXX/XXXX/XXXX", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String slackWebHookUrl; @Schema(title = "Enterprise weChat message: The notification method is valid for Enterprise WeChat app message", @@ -139,12 +143,14 @@ public class NoticeReceiver { description = "Discord 频道id: 通知方式为Discord有效", example = "1065303416030642266", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String discordChannelId; @Schema(title = "Discord bot token: The notification method is valid for Discord", description = "Discord 机器人Token: 通知方式为Discord有效", example = "MTA2NTMwMzU0ODY4Mzg4MjUzNw.xxxxx.xxxxxxx", accessMode = READ_WRITE) @Length(max = 300) + @Column(length = 300) private String discordBotToken; @Schema(title = "The creator of this record", description = "此条记录创建者", example = "tom", diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeRule.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeRule.java index a688018fdee..ba297846be9 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeRule.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/NoticeRule.java @@ -99,6 +99,7 @@ public class NoticeRule { @Schema(description = "告警信息标签(monitorId:xxx,monitorName:xxx)", example = "{name: key1, value: value1}", accessMode = READ_WRITE) @Convert(converter = JsonTagListAttributeConverter.class) + @Column(length = 2048) private List tags; @Schema(title = "星期几,多选,全选或空则为每天 7:周日 1:周一 2:周二 3:周三 4:周四 5:周五 6:周六", example = "[0,1]", accessMode = READ_WRITE) diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/Param.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/Param.java index 12edc134318..b53c3f7cc3a 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/Param.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/Param.java @@ -85,7 +85,7 @@ public class Param { */ @Schema(title = "参数值", example = "8080", accessMode = READ_WRITE) @Length(max = 8126) - @Column(name = "`value`") + @Column(name = "`value`", length = 8126) private String value; /** diff --git a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/ParamDefine.java b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/ParamDefine.java index 7e12b879a51..468ef5d255e 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/ParamDefine.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/entity/manager/ParamDefine.java @@ -78,6 +78,7 @@ public class ParamDefine { @Schema(description = "参数字段显示国际化名称", example = "{zh-CN: '端口'}", accessMode = READ_WRITE) @Convert(converter = JsonMapAttributeConverter.class) @SuppressWarnings("JpaAttributeTypeInspection") + @Column(length = 2048) private Map name; /** @@ -142,7 +143,7 @@ public class ParamDefine { * value-真正值 */ @Schema(description = "当type为radio单选框,checkbox复选框时,option表示可选项值列表", example = "{key1,value1}", accessMode = READ_WRITE) - @Column(name = "param_options") + @Column(name = "param_options", length = 2048) @Convert(converter = JsonOptionListAttributeConverter.class) private List