Skip to content

Commit

Permalink
[Fix][Server] Add check if the name has been changed when editing the…
Browse files Browse the repository at this point in the history
… job name (#234)
  • Loading branch information
xxzuo authored Sep 27, 2023
1 parent 9dcba56 commit 89ba78e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public long update(JobUpdate jobUpdate) {
if (job == null) {
throw new DataVinesServerException(Status.JOB_NOT_EXIST_ERROR, jobUpdate.getId());
}

String originJobName = job.getName();
if (jobUpdate.getIsErrorDataOutputToDataSource()!= null && jobUpdate.getIsErrorDataOutputToDataSource()) {
DataSource dataSource = dataSourceService.getDataSourceById(job.getDataSourceId());
if (dataSource != null) {
Expand All @@ -207,7 +207,8 @@ public long update(JobUpdate jobUpdate) {
}else {
job.setName(jobUpdate.getJobName());
}
if (getByKeyAttribute(job)) {
// add check if the name has changed
if (getByKeyAttribute(job) && !org.apache.commons.lang3.StringUtils.equals(originJobName, job.getName())) {
throw new DataVinesServerException(Status.JOB_EXIST_ERROR, job.getName());
}
job.setUpdateBy(ContextHolder.getUserId());
Expand Down

0 comments on commit 89ba78e

Please sign in to comment.