From 56b6097b47d783918b67fd0d887f48d2eefe6fdc Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 18 Jan 2021 04:02:02 -0600 Subject: [PATCH] [Feature][JsonSplit] ProcessDefinition Entity (#4477) * modify ProcessDefinition and add ProcessDefinitionLog * processDefinitionJson * code style * code style * code style --- .../dao/entity/ProcessDefinition.java | 86 ++-- .../dao/entity/ProcessDefinitionLog.java | 434 ++++++++++++++++++ 2 files changed, 492 insertions(+), 28 deletions(-) create mode 100644 dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java index 56f6cfe905..ee8cc9851e 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java @@ -48,6 +48,11 @@ public class ProcessDefinition { @TableId(value = "id", type = IdType.AUTO) private int id; + /** + * code + */ + private Long code; + /** * name */ @@ -65,11 +70,18 @@ public class ProcessDefinition { /** * project id + * TODO: delete */ private int projectId; + /** + * project code + */ + private Long projectCode; + /** * definition json string + * TODO: delete */ private String processDefinitionJson; @@ -136,6 +148,7 @@ public class ProcessDefinition { /** * connects array for web + * TODO: delete */ private String connects; @@ -388,35 +401,52 @@ public class ProcessDefinition { this.modifyBy = modifyBy; } + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public Long getProjectCode() { + return projectCode; + } + + public void setProjectCode(Long projectCode) { + this.projectCode = projectCode; + } + @Override public String toString() { - return "ProcessDefinition{" + - "id=" + id + - ", name='" + name + '\'' + - ", version=" + version + - ", releaseState=" + releaseState + - ", projectId=" + projectId + - ", processDefinitionJson='" + processDefinitionJson + '\'' + - ", description='" + description + '\'' + - ", globalParams='" + globalParams + '\'' + - ", globalParamList=" + globalParamList + - ", globalParamMap=" + globalParamMap + - ", createTime=" + createTime + - ", updateTime=" + updateTime + - ", flag=" + flag + - ", userId=" + userId + - ", userName='" + userName + '\'' + - ", projectName='" + projectName + '\'' + - ", locations='" + locations + '\'' + - ", connects='" + connects + '\'' + - ", receivers='" + receivers + '\'' + - ", receiversCc='" + receiversCc + '\'' + - ", scheduleReleaseState=" + scheduleReleaseState + - ", timeout=" + timeout + - ", tenantId=" + tenantId + - ", modifyBy='" + modifyBy + '\'' + - ", resourceIds='" + resourceIds + '\'' + - '}'; + return "ProcessDefinition{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", version=" + version + + ", releaseState=" + releaseState + + ", projectId=" + projectId + + ", projectCode=" + projectCode + + ", processDefinitionJson='" + processDefinitionJson + '\'' + + ", description='" + description + '\'' + + ", globalParams='" + globalParams + '\'' + + ", globalParamList=" + globalParamList + + ", globalParamMap=" + globalParamMap + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + ", flag=" + flag + + ", userId=" + userId + + ", userName='" + userName + '\'' + + ", projectName='" + projectName + '\'' + + ", locations='" + locations + '\'' + + ", connects='" + connects + '\'' + + ", receivers='" + receivers + '\'' + + ", receiversCc='" + receiversCc + '\'' + + ", scheduleReleaseState=" + scheduleReleaseState + + ", timeout=" + timeout + + ", tenantId=" + tenantId + + ", modifyBy='" + modifyBy + '\'' + + ", resourceIds='" + resourceIds + '\'' + + '}'; } - } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java new file mode 100644 index 0000000000..02d03ce1e9 --- /dev/null +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinitionLog.java @@ -0,0 +1,434 @@ +/* + * 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.apache.dolphinscheduler.dao.entity; + +import org.apache.dolphinscheduler.common.enums.Flag; +import org.apache.dolphinscheduler.common.enums.ReleaseState; +import org.apache.dolphinscheduler.common.process.Property; +import org.apache.dolphinscheduler.common.utils.JSONUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.fasterxml.jackson.annotation.JsonFormat; + + +/** + * process definition log + */ +@TableName("t_ds_process_definition_log") +public class ProcessDefinitionLog { + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private int id; + + /** + * code + */ + private Long code; + + /** + * name + */ + private String name; + + /** + * version + */ + private long version; + + /** + * release state : online/offline + */ + private ReleaseState releaseState; + + /** + * project code + */ + private Long projectCode; + + /** + * description + */ + private String description; + + /** + * user defined parameters + */ + private String globalParams; + + /** + * user defined parameter list + */ + @TableField(exist = false) + private List globalParamList; + + /** + * user define parameter map + */ + @TableField(exist = false) + private Map globalParamMap; + + /** + * create time + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + + /** + * update time + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; + + /** + * process is valid: yes/no + */ + private Flag flag; + + /** + * process user id + */ + private int userId; + + /** + * user name + */ + @TableField(exist = false) + private String userName; + + /** + * project name + */ + @TableField(exist = false) + private String projectName; + + /** + * locations array for web + */ + private String locations; + + /** + * receivers + */ + private String receivers; + + /** + * receivers cc + */ + private String receiversCc; + + /** + * schedule release state : online/offline + */ + @TableField(exist = false) + private ReleaseState scheduleReleaseState; + + /** + * process warning time out. unit: minute + */ + private int timeout; + + /** + * tenant id + */ + private int tenantId; + + /** + * modify user name + */ + private String modifyBy; + + /** + * resource ids + */ + private String resourceIds; + + /** + * operator + */ + private int operator; + + /** + * operateTime + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date operateTime; + + public int getOperator() { + return operator; + } + + public void setOperator(int operator) { + this.operator = operator; + } + + public Date getOperateTime() { + return operateTime; + } + + public void setOperateTime(Date operateTime) { + this.operateTime = operateTime; + } + + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public Long getProjectCode() { + return projectCode; + } + + public void setProjectCode(Long projectCode) { + this.projectCode = projectCode; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public long getVersion() { + return version; + } + + public void setVersion(long version) { + this.version = version; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ReleaseState getReleaseState() { + return releaseState; + } + + public void setReleaseState(ReleaseState releaseState) { + this.releaseState = releaseState; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Flag getFlag() { + return flag; + } + + public void setFlag(Flag flag) { + this.flag = flag; + } + + public int getUserId() { + return userId; + } + + public void setUserId(int userId) { + this.userId = userId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public String getGlobalParams() { + return globalParams; + } + + public void setGlobalParams(String globalParams) { + if (globalParams == null) { + this.globalParamList = new ArrayList<>(); + } else { + this.globalParamList = JSONUtils.toList(globalParams, Property.class); + } + this.globalParams = globalParams; + } + + public List getGlobalParamList() { + return globalParamList; + } + + public void setGlobalParamList(List globalParamList) { + this.globalParams = JSONUtils.toJsonString(globalParamList); + this.globalParamList = globalParamList; + } + + public Map getGlobalParamMap() { + if (globalParamMap == null && StringUtils.isNotEmpty(globalParams)) { + List propList = JSONUtils.toList(globalParams, Property.class); + globalParamMap = propList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); + } + + return globalParamMap; + } + + public void setGlobalParamMap(Map globalParamMap) { + this.globalParamMap = globalParamMap; + } + + public String getLocations() { + return locations; + } + + public void setLocations(String locations) { + this.locations = locations; + } + + public String getReceivers() { + return receivers; + } + + public void setReceivers(String receivers) { + this.receivers = receivers; + } + + public String getReceiversCc() { + return receiversCc; + } + + public void setReceiversCc(String receiversCc) { + this.receiversCc = receiversCc; + } + + public ReleaseState getScheduleReleaseState() { + return scheduleReleaseState; + } + + public void setScheduleReleaseState(ReleaseState scheduleReleaseState) { + this.scheduleReleaseState = scheduleReleaseState; + } + + public String getResourceIds() { + return resourceIds; + } + + public void setResourceIds(String resourceIds) { + this.resourceIds = resourceIds; + } + + public int getTimeout() { + return timeout; + } + + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getModifyBy() { + return modifyBy; + } + + public void setModifyBy(String modifyBy) { + this.modifyBy = modifyBy; + } + + @Override + public String toString() { + return "ProcessDefinitionLog{" + + "id=" + id + + ", code=" + code + + ", name='" + name + '\'' + + ", version=" + version + + ", releaseState=" + releaseState + + ", projectCode=" + projectCode + + ", description='" + description + '\'' + + ", globalParams='" + globalParams + '\'' + + ", globalParamList=" + globalParamList + + ", globalParamMap=" + globalParamMap + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + ", flag=" + flag + + ", userId=" + userId + + ", userName='" + userName + '\'' + + ", projectName='" + projectName + '\'' + + ", locations='" + locations + '\'' + + ", receivers='" + receivers + '\'' + + ", receiversCc='" + receiversCc + '\'' + + ", scheduleReleaseState=" + scheduleReleaseState + + ", timeout=" + timeout + + ", tenantId=" + tenantId + + ", modifyBy='" + modifyBy + '\'' + + ", resourceIds='" + resourceIds + '\'' + + ", operator=" + operator + + ", operateTime=" + operateTime + + '}'; + } +}