Skip to content

Commit

Permalink
add typehandler
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzm0809 committed Oct 13, 2023
1 parent 29857a5 commit b16ac6c
Show file tree
Hide file tree
Showing 25 changed files with 1,174 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.baomidou.mybatisplus.annotation.TableId;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

Expand Down Expand Up @@ -88,7 +89,7 @@ public static ClusterConfigurationDTO fromBean(ClusterConfiguration bean) {
public ClusterConfiguration toBean() {
ClusterConfiguration clusterConfiguration = new ClusterConfiguration();
BeanUtil.copyProperties(this, clusterConfiguration);
clusterConfiguration.setConfigJson(this.getConfig());
clusterConfiguration.setConfigJson(JSONUtil.toJsonStr(this.getConfig()));
return clusterConfiguration;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class JobDataDto {
@ApiModelProperty(value = "Checkpoints Config Object", notes = "Object representing checkpoints configuration")
private CheckpointConfigInfo checkpointsConfig;

@ApiModelProperty(value = "FlinkJobConfigInfo", notes = "FlinkJobConfigInfo representing job configuration")
@ApiModelProperty(value = "JobConfigInfo", notes = "JobConfigInfo representing job configuration")
private JobConfigInfo config;

@ApiModelProperty(value = "Jar Object", notes = "Object representing the JAR used in the job")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.dinky.data.model.alert.instance.parser;

public class AbstractAlertInstanceConfig {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.dinky.data.model.alert.instance.parser.types;

import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* the full config is:
* <p>
* {"webhook":"https:///111","keyword":"111","secret":"1111","isEnableProxy":true,"isAtAll":false,"proxy":"1121","port":2121,"user":"2121","password":"2121","atMobiles":"2121"}
*/
@Data
@NoArgsConstructor
@ApiModel(value = "DingTalkConfigParser", description = "DingTalk Config Parser")
public class DingTalkConfigParser extends AbstractAlertInstanceConfig implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(
value = "webhook url",
required = true,
dataType = "String",
example = "https://oapi.dingtalk.com/robot/send?access_token=xxx")
@JsonProperty("webhook")
private String webhook;

@ApiModelProperty(value = "keyword", required = true, dataType = "String", example = "111")
@JsonProperty("keyword")
private String keyword;

@ApiModelProperty(value = "secret", required = true, dataType = "String", example = "1111")
@JsonProperty("secret")
private String secret;

@ApiModelProperty(value = "isEnableProxy", required = true, dataType = "Boolean", example = "true")
@JsonProperty("isEnableProxy")
private boolean isEnableProxy;

@ApiModelProperty(value = "isAtAll", required = true, dataType = "Boolean", example = "false")
@JsonProperty("isAtAll")
private boolean isAtAll;

@ApiModelProperty(value = "atMobiles", required = true, dataType = "String", example = "2121")
@JsonProperty("atMobiles")
private String atMobiles;

@ApiModelProperty(value = "proxy ip / host", required = true, dataType = "String", example = "1121")
@JsonProperty("proxy")
private String proxy;

@ApiModelProperty(value = "proxy port", required = true, dataType = "Integer", example = "2121")
@JsonProperty("port")
private int port;

@ApiModelProperty(value = "proxy user", required = true, dataType = "String", example = "2121")
@JsonProperty("user")
private String user;

@ApiModelProperty(value = "proxy password", required = true, dataType = "String", example = "2121")
@JsonProperty("password")
private String password;

@JsonCreator
public DingTalkConfigParser(
@JsonProperty("webhook") String webhook,
@JsonProperty("keyword") String keyword,
@JsonProperty("secret") String secret,
@JsonProperty("isEnableProxy") boolean isEnableProxy,
@JsonProperty("isAtAll") boolean isAtAll,
@JsonProperty("atMobiles") String atMobiles,
@JsonProperty("proxy") String proxy,
@JsonProperty("port") int port,
@JsonProperty("user") String user,
@JsonProperty("password") String password) {
this.webhook = webhook;
this.keyword = keyword;
this.secret = secret;
this.isEnableProxy = isEnableProxy;
this.isAtAll = isAtAll;
this.atMobiles = atMobiles;
this.proxy = proxy;
this.port = port;
this.user = user;
this.password = password;
}

@JsonCreator
public DingTalkConfigParser(
@JsonProperty("webhook") String webhook,
@JsonProperty("keyword") String keyword,
@JsonProperty("secret") String secret,
@JsonProperty("isEnableProxy") boolean isEnableProxy,
@JsonProperty("isAtAll") boolean isAtAll,
@JsonProperty("atMobiles") String atMobiles) {
this.webhook = webhook;
this.keyword = keyword;
this.secret = secret;
this.isEnableProxy = isEnableProxy;
this.isAtAll = isAtAll;
this.atMobiles = atMobiles;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package org.dinky.data.model.alert.instance.parser.types;

import org.dinky.data.model.alert.instance.parser.AbstractAlertInstanceConfig;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* the full config is:
* <p>
* {"serverHost":"121","serverPort":1212,"sender":"212121","receivers":"2121","receiverCcs":"2121","enableSmtpAuth":true,"starttlsEnable":true,"sslEnable":true,"User":"212","Password":"121","smtpSslTrust":"2121"}
*/
@Data
@NoArgsConstructor
@ApiModel(value = "EmailConfigParser", description = "Email Config Parser")
public class EmailConfigParser extends AbstractAlertInstanceConfig implements Serializable {
private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "server Host", required = true, dataType = "String", example = "121")
private String serverHost;

@ApiModelProperty(value = "server Port", required = true, dataType = "Integer", example = "1212")
private Integer serverPort;

@ApiModelProperty(value = "sender", required = true, dataType = "String", example = "212121")
private String sender;

@ApiModelProperty(value = "receivers", required = true, dataType = "String", example = "2121")
private String receivers;

@ApiModelProperty(value = "receiver Ccs", required = true, dataType = "String", example = "2121")
private String receiverCcs;

@ApiModelProperty(value = "enable Smtp Auth", required = true, dataType = "Boolean", example = "true")
private boolean enableSmtpAuth;

@ApiModelProperty(value = "starttls Enable", required = true, dataType = "Boolean", example = "true")
private boolean starttlsEnable;

@ApiModelProperty(value = "ssl Enable", required = true, dataType = "Boolean", example = "true")
private boolean sslEnable;

@ApiModelProperty(value = "User", required = true, dataType = "String", example = "212")
@JsonProperty("User")
private String user;

@ApiModelProperty(value = "Password", required = true, dataType = "String", example = "121")
@JsonProperty("Password")
private String password;

@ApiModelProperty(value = "smtp Ssl Trust", required = true, dataType = "String", example = "2121")
@JsonProperty("smtpSslTrust")
private String smtpSslTrust;

@JsonCreator
public EmailConfigParser(
@JsonProperty("serverHost") String serverHost,
@JsonProperty("serverPort") Integer serverPort,
@JsonProperty("sender") String sender,
@JsonProperty("receivers") String receivers,
@JsonProperty("receiverCcs") String receiverCcs,
@JsonProperty("enableSmtpAuth") boolean enableSmtpAuth,
@JsonProperty("starttlsEnable") boolean starttlsEnable,
@JsonProperty("sslEnable") boolean sslEnable,
@JsonProperty("User") String user,
@JsonProperty("Password") String password,
@JsonProperty("smtpSslTrust") String smtpSslTrust) {
this.serverHost = serverHost;
this.serverPort = serverPort;
this.sender = sender;
this.receivers = receivers;
this.receiverCcs = receiverCcs;
this.enableSmtpAuth = enableSmtpAuth;
this.starttlsEnable = starttlsEnable;
this.sslEnable = sslEnable;
this.user = user;
this.password = password;
this.smtpSslTrust = smtpSslTrust;
}
}
Loading

0 comments on commit b16ac6c

Please sign in to comment.