From ed26da52bfaba7a77e71f2ac248ce7caca67fe31 Mon Sep 17 00:00:00 2001 From: tschoemaker Date: Fri, 17 May 2024 21:30:59 +0200 Subject: [PATCH] refactor: data clumps --- .../linkis/common/utils/JobHistoryInfo.java | 215 ++++++++++++++++++ .../monitor/jobhistory/entity/JobHistory.java | 104 +++------ .../linkis/jobhistory/entity/JobHistory.java | 159 +++++-------- 3 files changed, 313 insertions(+), 165 deletions(-) create mode 100644 linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/JobHistoryInfo.java diff --git a/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/JobHistoryInfo.java b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/JobHistoryInfo.java new file mode 100644 index 0000000000..2e72ea9949 --- /dev/null +++ b/linkis-commons/linkis-common/src/main/java/org/apache/linkis/common/utils/JobHistoryInfo.java @@ -0,0 +1,215 @@ +/* + * 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.linkis.common.utils; + +import java.util.Date; + +public class JobHistoryInfo { + private String jobReqId; + private String submitUser; + private String executeUser; + private String source; + private String labels; + private String params; + private String progress; + private String status; + private String logPath; + private Integer errorCode; + private String errorDesc; + private Date createdTime; + private Date updatedTime; + private String instances; + private String metrics; + private String engineType; + private String executionCode; + + public String getJobReqId() { + return jobReqId; + } + + public void setJobReqId(String jobReqId) { + this.jobReqId = jobReqId; + } + + public String getSubmitUser() { + return submitUser; + } + + public void setSubmitUser(String submitUser) { + this.submitUser = submitUser; + } + + public String getExecuteUser() { + return executeUser; + } + + public void setExecuteUser(String executeUser) { + this.executeUser = executeUser; + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getLabels() { + return labels; + } + + public void setLabels(String labels) { + this.labels = labels; + } + + public String getParams() { + return params; + } + + public void setParams(String params) { + this.params = params; + } + + public String getProgress() { + return progress; + } + + public void setProgress(String progress) { + this.progress = progress; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getLogPath() { + return logPath; + } + + public void setLogPath(String logPath) { + this.logPath = logPath; + } + + public Integer getErrorCode() { + return errorCode; + } + + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + public String getErrorDesc() { + return errorDesc; + } + + public void setErrorDesc(String errorDesc) { + this.errorDesc = errorDesc; + } + + public Date getCreatedTime() { + return createdTime; + } + + public void setCreatedTime(Date createdTime) { + this.createdTime = createdTime; + } + + public Date getUpdatedTime() { + return updatedTime; + } + + public void setUpdatedTime(Date updatedTime) { + this.updatedTime = updatedTime; + } + + public String getInstances() { + return instances; + } + + public void setInstances(String instances) { + this.instances = instances; + } + + public String getMetrics() { + return metrics; + } + + public void setMetrics(String metrics) { + this.metrics = metrics; + } + + public String getEngineType() { + return engineType; + } + + public void setEngineType(String engineType) { + this.engineType = engineType; + } + + public String getExecutionCode() { + return executionCode; + } + + public void setExecutionCode(String executionCode) { + this.executionCode = executionCode; + } + + public JobHistoryInfo( + String jobReqId, + String submitUser, + String executeUser, + String source, + String labels, + String params, + String progress, + String status, + String logPath, + Integer errorCode, + String errorDesc, + Date createdTime, + Date updatedTime, + String instances, + String metrics, + String engineType, + String executionCode) { + this.jobReqId = jobReqId; + this.submitUser = submitUser; + this.executeUser = executeUser; + this.source = source; + this.labels = labels; + this.params = params; + this.progress = progress; + this.status = status; + this.logPath = logPath; + this.errorCode = errorCode; + this.errorDesc = errorDesc; + this.createdTime = createdTime; + this.updatedTime = updatedTime; + this.instances = instances; + this.metrics = metrics; + this.engineType = engineType; + this.executionCode = executionCode; + } + + public JobHistoryInfo() {} +} diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/jobhistory/entity/JobHistory.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/jobhistory/entity/JobHistory.java index e2499d328d..b227ebf373 100644 --- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/jobhistory/entity/JobHistory.java +++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/jobhistory/entity/JobHistory.java @@ -17,6 +17,7 @@ package org.apache.linkis.monitor.jobhistory.entity; +import org.apache.linkis.common.utils.JobHistoryInfo; import org.apache.linkis.monitor.jobhistory.QueryUtils; import java.util.Date; @@ -25,42 +26,9 @@ public class JobHistory { private Long id; - private String jobReqId; - - private String submitUser; - - private String executeUser; - - private String source; - - private String labels; - - private String params; - - private String progress; - - private String status; - - private String logPath; - - private Integer errorCode; - - private String errorDesc; - - private Date createdTime; - - private Date updatedTime; - private String updateTimeMills; - private String instances; - - private String metrics; - - private String engineType; - - private String executionCode; - + private JobHistoryInfo jobHistoryInfo = new JobHistoryInfo(); private String observeInfo; public Long getId() { @@ -72,139 +40,139 @@ public void setId(Long id) { } public String getJobReqId() { - return jobReqId; + return jobHistoryInfo.getJobReqId(); } public void setJobReqId(String jobReqId) { - this.jobReqId = jobReqId; + jobHistoryInfo.setJobReqId(jobReqId); } public String getSubmitUser() { - return submitUser; + return jobHistoryInfo.getSubmitUser(); } public void setSubmitUser(String submitUser) { - this.submitUser = submitUser; + jobHistoryInfo.setSubmitUser(submitUser); } public String getExecuteUser() { - return executeUser; + return jobHistoryInfo.getExecuteUser(); } public void setExecuteUser(String executeUser) { - this.executeUser = executeUser; + jobHistoryInfo.setExecuteUser(executeUser); } public String getSource() { - return source; + return jobHistoryInfo.getSource(); } public void setSource(String source) { - this.source = source; + jobHistoryInfo.setSource(source); } public String getLabels() { - return labels; + return jobHistoryInfo.getLabels(); } public void setLabels(String labels) { - this.labels = labels; + jobHistoryInfo.setLabels(labels); } public String getParams() { - return params; + return jobHistoryInfo.getParams(); } public void setParams(String params) { - this.params = params; + jobHistoryInfo.setParams(params); } public String getProgress() { - return progress; + return jobHistoryInfo.getProgress(); } public void setProgress(String progress) { - this.progress = progress; + jobHistoryInfo.setProgress(progress); } public String getStatus() { - return status; + return jobHistoryInfo.getStatus(); } public void setStatus(String status) { - this.status = status; + jobHistoryInfo.setStatus(status); } public String getLogPath() { - return logPath; + return jobHistoryInfo.getLogPath(); } public void setLogPath(String logPath) { - this.logPath = logPath; + jobHistoryInfo.setLogPath(logPath); } public Integer getErrorCode() { - return errorCode; + return jobHistoryInfo.getErrorCode(); } public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; + jobHistoryInfo.setErrorCode(errorCode); } public String getErrorDesc() { - return errorDesc; + return jobHistoryInfo.getErrorDesc(); } public void setErrorDesc(String errorDesc) { - this.errorDesc = errorDesc; + jobHistoryInfo.setErrorDesc(errorDesc); } public Date getCreatedTime() { - return createdTime; + return jobHistoryInfo.getCreatedTime(); } public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + jobHistoryInfo.setCreatedTime(createdTime); } public Date getUpdatedTime() { - return updatedTime; + return jobHistoryInfo.getUpdatedTime(); } public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + jobHistoryInfo.setUpdatedTime(updatedTime); } public String getInstances() { - return instances; + return jobHistoryInfo.getInstances(); } public void setInstances(String instances) { - this.instances = instances; + jobHistoryInfo.setInstances(instances); } public String getMetrics() { - return metrics; + return jobHistoryInfo.getMetrics(); } public void setMetrics(String metrics) { - this.metrics = metrics; + jobHistoryInfo.setMetrics(metrics); } public String getEngineType() { - return engineType; + return jobHistoryInfo.getEngineType(); } public void setEngineType(String engineType) { - this.engineType = engineType; + jobHistoryInfo.setEngineType(engineType); } public String getExecutionCode() { - return executionCode; + return jobHistoryInfo.getExecutionCode(); } public void setExecutionCode(String executionCode) { - this.executionCode = executionCode; + jobHistoryInfo.setExecutionCode(executionCode); } public String getUpdateTimeMills() { diff --git a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/entity/JobHistory.java b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/entity/JobHistory.java index 6aa661a2d7..f7cadbb996 100644 --- a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/entity/JobHistory.java +++ b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/entity/JobHistory.java @@ -17,6 +17,7 @@ package org.apache.linkis.jobhistory.entity; +import org.apache.linkis.common.utils.JobHistoryInfo; import org.apache.linkis.jobhistory.util.QueryUtils; import java.util.Date; @@ -24,52 +25,8 @@ public class JobHistory { private Long id; - - /* - ExecID - */ - private String jobReqId; - - private String submitUser; - - private String executeUser; - - private String source; - - private String labels; - - private String params; - - private String progress; - - private String status; - - private String logPath; - - private Integer errorCode; - - private String errorDesc; - - private Date createdTime; - - private Date updatedTime; - - private String updateTimeMills; - - private String instances; - - private String metrics; - - private String engineType; - - /* - Original execution code - */ - private String executionCode; - - /** result location */ + private JobHistoryInfo jobHistoryInfo = new JobHistoryInfo(); private String resultLocation; - private String observeInfo; public Long getId() { @@ -80,172 +37,180 @@ public void setId(Long id) { this.id = id; } + public JobHistoryInfo getJobHistoryInfo() { + return jobHistoryInfo; + } + + public void setJobHistoryInfo(JobHistoryInfo jobHistoryInfo) { + this.jobHistoryInfo = jobHistoryInfo; + } + + public String getResultLocation() { + return resultLocation; + } + + public void setResultLocation(String resultLocation) { + this.resultLocation = resultLocation; + } + + public String getObserveInfo() { + return observeInfo; + } + + public void setObserveInfo(String observeInfo) { + this.observeInfo = observeInfo; + } + public String getJobReqId() { - return jobReqId; + return jobHistoryInfo.getJobReqId(); } public void setJobReqId(String jobReqId) { - this.jobReqId = jobReqId; + jobHistoryInfo.setJobReqId(jobReqId); } public String getSubmitUser() { - return submitUser; + return jobHistoryInfo.getSubmitUser(); } public void setSubmitUser(String submitUser) { - this.submitUser = submitUser; + jobHistoryInfo.setSubmitUser(submitUser); } public String getExecuteUser() { - return executeUser; + return jobHistoryInfo.getExecuteUser(); } public void setExecuteUser(String executeUser) { - this.executeUser = executeUser; + jobHistoryInfo.setExecuteUser(executeUser); } public String getSource() { - return source; + return jobHistoryInfo.getSource(); } public void setSource(String source) { - this.source = source; + jobHistoryInfo.setSource(source); } public String getLabels() { - return labels; + return jobHistoryInfo.getLabels(); } public void setLabels(String labels) { - this.labels = labels; + jobHistoryInfo.setLabels(labels); } public String getParams() { - return params; + return jobHistoryInfo.getParams(); } public void setParams(String params) { - this.params = params; + jobHistoryInfo.setParams(params); } public String getProgress() { - return progress; + return jobHistoryInfo.getProgress(); } public void setProgress(String progress) { - this.progress = progress; + jobHistoryInfo.setProgress(progress); } public String getStatus() { - return status; + return jobHistoryInfo.getStatus(); } public void setStatus(String status) { - this.status = status; + jobHistoryInfo.setStatus(status); } public String getLogPath() { - return logPath; + return jobHistoryInfo.getLogPath(); } public void setLogPath(String logPath) { - this.logPath = logPath; + jobHistoryInfo.setLogPath(logPath); } public Integer getErrorCode() { - return errorCode; + return jobHistoryInfo.getErrorCode(); } public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; + jobHistoryInfo.setErrorCode(errorCode); } public String getErrorDesc() { - return errorDesc; + return jobHistoryInfo.getErrorDesc(); } public void setErrorDesc(String errorDesc) { - this.errorDesc = errorDesc; + jobHistoryInfo.setErrorDesc(errorDesc); } public Date getCreatedTime() { - return createdTime; + return jobHistoryInfo.getCreatedTime(); } public void setCreatedTime(Date createdTime) { - this.createdTime = createdTime; + jobHistoryInfo.setCreatedTime(createdTime); } public Date getUpdatedTime() { - return updatedTime; + return jobHistoryInfo.getUpdatedTime(); } public void setUpdatedTime(Date updatedTime) { - this.updatedTime = updatedTime; + jobHistoryInfo.setUpdatedTime(updatedTime); } public String getInstances() { - return instances; + return jobHistoryInfo.getInstances(); } public void setInstances(String instances) { - this.instances = instances; + jobHistoryInfo.setInstances(instances); } public String getMetrics() { - return metrics; + return jobHistoryInfo.getMetrics(); } public void setMetrics(String metrics) { - this.metrics = metrics; + jobHistoryInfo.setMetrics(metrics); } public String getEngineType() { - return engineType; + return jobHistoryInfo.getEngineType(); } public void setEngineType(String engineType) { - this.engineType = engineType; + jobHistoryInfo.setEngineType(engineType); } public String getExecutionCode() { - return executionCode; + return jobHistoryInfo.getExecutionCode(); } public void setExecutionCode(String executionCode) { - this.executionCode = executionCode; + jobHistoryInfo.setExecutionCode(executionCode); } public String getUpdateTimeMills() { return QueryUtils.dateToString(getUpdatedTime()); } - public String getResultLocation() { - return resultLocation; - } - - public void setResultLocation(String resultLocation) { - this.resultLocation = resultLocation; - } - - public String getObserveInfo() { - return observeInfo; - } - - public void setObserveInfo(String observeInfo) { - this.observeInfo = observeInfo; - } - @Override public String toString() { return "JobHistory{" + "id=" + id + ", jobReqId='" - + jobReqId + + jobHistoryInfo.getJobReqId() + '\'' + ", labels='" - + labels + + jobHistoryInfo.getLabels() + '\'' + '}'; }