status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PropertyUtils.java
return Boolean.parseBoolean(value); } return false; } /** * get property value * * @param key property name * @param defaultValue default value * @return property value */ public static Boolean getBoolean(String key, boolean defaultValue) { String value = properties.getProperty(key.trim()); if(null != value){ return Boolean.parseBoolean(value); } return defaultValue; } /** * get property long value * @param key key * @param defaultVal default value * @return property value */ public static long getLong(String key, long defaultVal) { String val = getString(key); return val == null ? defaultVal : Long.parseLong(val); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
/* * 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.service.quartz; import static org.apache.dolphinscheduler.common.Constants.ORG_POSTGRESQL_DRIVER;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_DATASOURCE; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_ISCLUSTERED; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_TABLEPREFIX; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_JOBSTORE_USEPROPERTIES; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_INSTANCEID; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_INSTANCENAME; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_CLASS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_THREADCOUNT; import static org.apache.dolphinscheduler.common.Constants.ORG_QUARTZ_THREADPOOL_THREADPRIORITY; import static org.apache.dolphinscheduler.common.Constants.PROJECT_ID; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_ACQUIRETRIGGERSWITHINLOCK; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_CLUSTERCHECKININTERVAL; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_DATASOURCE; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_INSTANCEID; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_INSTANCENAME; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_JOB_GROUP_PRIFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_JOB_PRIFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_MISFIRETHRESHOLD; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_PROPERTIES_PATH; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_TABLE_PREFIX; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_THREADCOUNT; import static org.apache.dolphinscheduler.common.Constants.QUARTZ_THREADPRIORITY;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
import static org.apache.dolphinscheduler.common.Constants.SCHEDULE; import static org.apache.dolphinscheduler.common.Constants.SCHEDULE_ID; import static org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME; import static org.apache.dolphinscheduler.common.Constants.STRING_FALSE; import static org.apache.dolphinscheduler.common.Constants.STRING_TRUE; import static org.apache.dolphinscheduler.common.Constants.UNDERLINE; import static org.quartz.CronScheduleBuilder.cronSchedule; import static org.quartz.JobBuilder.newJob; import static org.quartz.TriggerBuilder.newTrigger; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.service.exceptions.ServiceException; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobDetail; import org.quartz.JobKey; import org.quartz.Scheduler; import org.quartz.SchedulerException;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
import org.quartz.TriggerKey; import org.quartz.impl.StdSchedulerFactory; import org.quartz.impl.jdbcjobstore.JobStoreTX; import org.quartz.impl.jdbcjobstore.PostgreSQLDelegate; import org.quartz.impl.jdbcjobstore.StdJDBCDelegate; import org.quartz.impl.matchers.GroupMatcher; import org.quartz.simpl.SimpleThreadPool; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * single Quartz executors instance */ public class QuartzExecutors { /** * logger of QuartzExecutors */ private static final Logger logger = LoggerFactory.getLogger(QuartzExecutors.class); /** * read write lock */ private final ReadWriteLock lock = new ReentrantReadWriteLock(); /** * A Scheduler maintains a registry of org.quartz.JobDetail and Trigger. */ private static Scheduler scheduler; /** * load conf */ private static Configuration conf; private static final class Holder {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
private static final QuartzExecutors instance = new QuartzExecutors(); } private QuartzExecutors() { try { conf = new PropertiesConfiguration(QUARTZ_PROPERTIES_PATH); init(); } catch (ConfigurationException e) { logger.warn("not loaded quartz configuration file, will used default value", e); } } /** * thread safe and performance promote * * @return instance of Quartz Executors */ public static QuartzExecutors getInstance() { return Holder.instance; } /** * init * <p> * Returns a client-usable handle to a Scheduler. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
private void init() { try { StdSchedulerFactory schedulerFactory = new StdSchedulerFactory(); Properties properties = new Properties(); String dataSourceDriverClass = org.apache.dolphinscheduler.dao.utils.PropertyUtils.getString(SPRING_DATASOURCE_DRIVER_CLASS_NAME); if (dataSourceDriverClass.equals(ORG_POSTGRESQL_DRIVER)) { properties.setProperty(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, conf.getString(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, PostgreSQLDelegate.class.getName())); } else { properties.setProperty(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, conf.getString(ORG_QUARTZ_JOBSTORE_DRIVERDELEGATECLASS, StdJDBCDelegate.class.getName())); } properties.setProperty(ORG_QUARTZ_SCHEDULER_INSTANCENAME, conf.getString(ORG_QUARTZ_SCHEDULER_INSTANCENAME, QUARTZ_INSTANCENAME)); properties.setProperty(ORG_QUARTZ_SCHEDULER_INSTANCEID, conf.getString(ORG_QUARTZ_SCHEDULER_INSTANCEID, QUARTZ_INSTANCEID)); properties.setProperty(ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON, conf.getString(ORG_QUARTZ_SCHEDULER_MAKESCHEDULERTHREADDAEMON, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_JOBSTORE_USEPROPERTIES, conf.getString(ORG_QUARTZ_JOBSTORE_USEPROPERTIES, STRING_FALSE)); properties.setProperty(ORG_QUARTZ_THREADPOOL_CLASS, conf.getString(ORG_QUARTZ_THREADPOOL_CLASS, SimpleThreadPool.class.getName())); properties.setProperty(ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS, conf.getString(ORG_QUARTZ_THREADPOOL_MAKETHREADSDAEMONS, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_THREADPOOL_THREADCOUNT, conf.getString(ORG_QUARTZ_THREADPOOL_THREADCOUNT, QUARTZ_THREADCOUNT)); properties.setProperty(ORG_QUARTZ_THREADPOOL_THREADPRIORITY, conf.getString(ORG_QUARTZ_THREADPOOL_THREADPRIORITY, QUARTZ_THREADPRIORITY)); properties.setProperty(ORG_QUARTZ_JOBSTORE_CLASS, conf.getString(ORG_QUARTZ_JOBSTORE_CLASS, JobStoreTX.class.getName())); properties.setProperty(ORG_QUARTZ_JOBSTORE_TABLEPREFIX, conf.getString(ORG_QUARTZ_JOBSTORE_TABLEPREFIX, QUARTZ_TABLE_PREFIX)); properties.setProperty(ORG_QUARTZ_JOBSTORE_ISCLUSTERED, conf.getString(ORG_QUARTZ_JOBSTORE_ISCLUSTERED, STRING_TRUE)); properties.setProperty(ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD, conf.getString(ORG_QUARTZ_JOBSTORE_MISFIRETHRESHOLD, QUARTZ_MISFIRETHRESHOLD)); properties.setProperty(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, conf.getString(ORG_QUARTZ_JOBSTORE_CLUSTERCHECKININTERVAL, QUARTZ_CLUSTERCHECKININTERVAL)); properties.setProperty(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, conf.getString(ORG_QUARTZ_JOBSTORE_ACQUIRETRIGGERSWITHINLOCK, QUARTZ_ACQUIRETRIGGERSWITHINLOCK)); properties.setProperty(ORG_QUARTZ_JOBSTORE_DATASOURCE, conf.getString(ORG_QUARTZ_JOBSTORE_DATASOURCE, QUARTZ_DATASOURCE)); properties.setProperty(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, conf.getString(ORG_QUARTZ_DATASOURCE_MYDS_CONNECTIONPROVIDER_CLASS, DruidConnectionProvider.class.getName())); schedulerFactory.initialize(properties); scheduler = schedulerFactory.getScheduler(); } catch (SchedulerException e) { logger.error(e.getMessage(), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
System.exit(1); } } /** * Whether the scheduler has been started. * * @throws SchedulerException scheduler exception */ public void start() throws SchedulerException { if (!scheduler.isStarted()) { scheduler.start(); logger.info("Quartz service started"); } } /** * stop all scheduled tasks * <p> * Halts the Scheduler's firing of Triggers, * and cleans up all resources associated with the Scheduler. * <p> * The scheduler cannot be re-started. * * @throws SchedulerException scheduler exception */ public void shutdown() throws SchedulerException { if (!scheduler.isShutdown()) { scheduler.shutdown(); logger.info("Quartz service stopped, and halt all tasks"); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
} /** * add task trigger , if this task already exists, return this task with updated trigger * * @param clazz job class name * @param jobName job name * @param jobGroupName job group name * @param startDate job start date * @param endDate job end date * @param cronExpression cron expression * @param jobDataMap job parameters data map */ public void addJob(Class<? extends Job> clazz, String jobName, String jobGroupName, Date startDate, Date endDate, String cronExpression, Map<String, Object> jobDataMap) { lock.writeLock().lock(); try { JobKey jobKey = new JobKey(jobName, jobGroupName); JobDetail jobDetail; if (scheduler.checkExists(jobKey)) { jobDetail = scheduler.getJobDetail(jobKey); if (jobDataMap != null) { jobDetail.getJobDataMap().putAll(jobDataMap); } } else { jobDetail = newJob(clazz).withIdentity(jobKey).build(); if (jobDataMap != null) { jobDetail.getJobDataMap().putAll(jobDataMap); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
scheduler.addJob(jobDetail, false, true); logger.info("Add job, job name: {}, group name: {}", jobName, jobGroupName); } TriggerKey triggerKey = new TriggerKey(jobName, jobGroupName); /** * Instructs the Scheduler that upon a mis-fire * situation, the CronTrigger wants to have it's * next-fire-time updated to the next time in the schedule after the * current time (taking into account any associated Calendar), * but it does not want to be fired now. */ CronTrigger cronTrigger = newTrigger().withIdentity(triggerKey).startAt(startDate).endAt(endDate) .withSchedule(cronSchedule(cronExpression).withMisfireHandlingInstructionDoNothing()) .forJob(jobDetail).build(); if (scheduler.checkExists(triggerKey)) { CronTrigger oldCronTrigger = (CronTrigger) scheduler.getTrigger(triggerKey); String oldCronExpression = oldCronTrigger.getCronExpression(); if (!StringUtils.equalsIgnoreCase(cronExpression, oldCronExpression)) { scheduler.rescheduleJob(triggerKey, cronTrigger); logger.info("reschedule job trigger, triggerName: {}, triggerGroupName: {}, cronExpression: {}, startDate: {}, endDate: {}", jobName, jobGroupName, cronExpression, startDate, endDate); } } else { scheduler.scheduleJob(cronTrigger); logger.info("schedule job trigger, triggerName: {}, triggerGroupName: {}, cronExpression: {}, startDate: {}, endDate: {}", jobName, jobGroupName, cronExpression, startDate, endDate); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
} catch (Exception e) { throw new ServiceException("add job failed", e); } finally { lock.writeLock().unlock(); } } /** * delete job * * @param jobName job name * @param jobGroupName job group name * @return true if the Job was found and deleted. */ public boolean deleteJob(String jobName, String jobGroupName) { lock.writeLock().lock(); try { JobKey jobKey = new JobKey(jobName, jobGroupName); if (scheduler.checkExists(jobKey)) { logger.info("try to delete job, job name: {}, job group name: {},", jobName, jobGroupName); return scheduler.deleteJob(jobKey); } else { return true; } } catch (SchedulerException e) { logger.error("delete job : {} failed", jobName, e); } finally { lock.writeLock().unlock(); } return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
/** * delete all jobs in job group * * @param jobGroupName job group name * @return true if all of the Jobs were found and deleted, false if * one or more were not deleted. */ public boolean deleteAllJobs(String jobGroupName) { lock.writeLock().lock(); try { logger.info("try to delete all jobs in job group: {}", jobGroupName); List<JobKey> jobKeys = new ArrayList<>(); jobKeys.addAll(scheduler.getJobKeys(GroupMatcher.groupEndsWith(jobGroupName))); return scheduler.deleteJobs(jobKeys); } catch (SchedulerException e) { logger.error("delete all jobs in job group: {} failed", jobGroupName, e); } finally { lock.writeLock().unlock(); } return false; } /** * build job name * * @param processId process id * @return job name */ public static String buildJobName(int processId) { StringBuilder sb = new StringBuilder(30); sb.append(QUARTZ_JOB_PRIFIX).append(UNDERLINE).append(processId);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,971
[Improvement][common] Remove redundant PropertyUtils.class
We are flooded with too many PropertyUtils.class, in my opinion, there is no need, therefore, it is best to keep only the common-model.
https://github.com/apache/dolphinscheduler/issues/4971
https://github.com/apache/dolphinscheduler/pull/5020
1cd62b4a5e6d5e8ac3adf8b7e2ffd61a8e87f71b
6216817861c64d9a170686c4c5aa6f3b9b0da110
"2021-03-05T13:58:44Z"
java
"2021-03-17T07:28:07Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
return sb.toString(); } /** * build job group name * * @param projectId project id * @return job group name */ public static String buildJobGroupName(int projectId) { StringBuilder sb = new StringBuilder(30); sb.append(QUARTZ_JOB_GROUP_PRIFIX).append(UNDERLINE).append(projectId); return sb.toString(); } /** * add params to map * * @param projectId project id * @param scheduleId schedule id * @param schedule schedule * @return data map */ public static Map<String, Object> buildDataMap(int projectId, int scheduleId, Schedule schedule) { Map<String, Object> dataMap = new HashMap<>(8); dataMap.put(PROJECT_ID, projectId); dataMap.put(SCHEDULE_ID, scheduleId); dataMap.put(SCHEDULE, JSONUtils.toJsonString(schedule)); return dataMap; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
/* * 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.api.enums; import java.util.Locale; import org.springframework.context.i18n.LocaleContextHolder; /** * status enum // todo #4855 One category one interval */ public enum Status { SUCCESS(0, "success", "成功"), INTERNAL_SERVER_ERROR_ARGS(10000, "Internal Server Error: {0}", "服务端异常: {0}"), REQUEST_PARAMS_NOT_VALID_ERROR(10001, "request parameter {0} is not valid", "请求参数[{0}]无效"), TASK_TIMEOUT_PARAMS_ERROR(10002, "task timeout parameter is not valid", "任务超时参数无效"), USER_NAME_EXIST(10003, "user name already exists", "用户名已存在"), USER_NAME_NULL(10004, "user name is null", "用户名不能为空"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
HDFS_OPERATION_ERROR(10006, "hdfs operation error", "hdfs操作错误"), TASK_INSTANCE_NOT_FOUND(10008, "task instance not found", "任务实例不存在"), OS_TENANT_CODE_EXIST(10009, "os tenant code {0} already exists", "操作系统租户[{0}]已存在"), USER_NOT_EXIST(10010, "user {0} not exists", "用户[{0}]不存在"), ALERT_GROUP_NOT_EXIST(10011, "alarm group not found", "告警组不存在"), ALERT_GROUP_EXIST(10012, "alarm group already exists", "告警组名称已存在"), USER_NAME_PASSWD_ERROR(10013, "user name or password error", "用户名或密码错误"), LOGIN_SESSION_FAILED(10014, "create session failed!", "创建session失败"), DATASOURCE_EXIST(10015, "data source name already exists", "数据源名称已存在"), DATASOURCE_CONNECT_FAILED(10016, "data source connection failed", "建立数据源连接失败"), TENANT_NOT_EXIST(10017, "tenant not exists", "租户不存在"), PROJECT_NOT_FOUNT(10018, "project {0} not found ", "项目[{0}]不存在"), PROJECT_ALREADY_EXISTS(10019, "project {0} already exists", "项目名称[{0}]已存在"), TASK_INSTANCE_NOT_EXISTS(10020, "task instance {0} does not exist", "任务实例[{0}]不存在"), TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE(10021, "task instance {0} is not sub process instance", "任务实例[{0}]不是子流程实例"), SCHEDULE_CRON_NOT_EXISTS(10022, "scheduler crontab {0} does not exist", "调度配置定时表达式[{0}]不存在"), SCHEDULE_CRON_ONLINE_FORBID_UPDATE(10023, "online status does not allow update operations", "调度配置上线状态不允许修改"), SCHEDULE_CRON_CHECK_FAILED(10024, "scheduler crontab expression validation failure: {0}", "调度配置定时表达式验证失败: {0}"), MASTER_NOT_EXISTS(10025, "master does not exist", "无可用master节点"), SCHEDULE_STATUS_UNKNOWN(10026, "unknown status: {0}", "未知状态: {0}"), CREATE_ALERT_GROUP_ERROR(10027, "create alert group error", "创建告警组错误"), QUERY_ALL_ALERTGROUP_ERROR(10028, "query all alertgroup error", "查询告警组错误"), LIST_PAGING_ALERT_GROUP_ERROR(10029, "list paging alert group error", "分页查询告警组错误"), UPDATE_ALERT_GROUP_ERROR(10030, "update alert group error", "更新告警组错误"), DELETE_ALERT_GROUP_ERROR(10031, "delete alert group error", "删除告警组错误"), ALERT_GROUP_GRANT_USER_ERROR(10032, "alert group grant user error", "告警组授权用户错误"), CREATE_DATASOURCE_ERROR(10033, "create datasource error", "创建数据源错误"), UPDATE_DATASOURCE_ERROR(10034, "update datasource error", "更新数据源错误"), QUERY_DATASOURCE_ERROR(10035, "query datasource error", "查询数据源错误"), CONNECT_DATASOURCE_FAILURE(10036, "connect datasource failure", "建立数据源连接失败"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
CONNECTION_TEST_FAILURE(10037, "connection test failure", "测试数据源连接失败"), DELETE_DATA_SOURCE_FAILURE(10038, "delete data source failure", "删除数据源失败"), VERIFY_DATASOURCE_NAME_FAILURE(10039, "verify datasource name failure", "验证数据源名称失败"), UNAUTHORIZED_DATASOURCE(10040, "unauthorized datasource", "未经授权的数据源"), AUTHORIZED_DATA_SOURCE(10041, "authorized data source", "授权数据源失败"), LOGIN_SUCCESS(10042, "login success", "登录成功"), USER_LOGIN_FAILURE(10043, "user login failure", "用户登录失败"), LIST_WORKERS_ERROR(10044, "list workers error", "查询worker列表错误"), LIST_MASTERS_ERROR(10045, "list masters error", "查询master列表错误"), UPDATE_PROJECT_ERROR(10046, "update project error", "更新项目信息错误"), QUERY_PROJECT_DETAILS_BY_ID_ERROR(10047, "query project details by id error", "查询项目详细信息错误"), CREATE_PROJECT_ERROR(10048, "create project error", "创建项目错误"), LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR(10049, "login user query project list paging error", "分页查询项目列表错误"), DELETE_PROJECT_ERROR(10050, "delete project error", "删除项目错误"), QUERY_UNAUTHORIZED_PROJECT_ERROR(10051, "query unauthorized project error", "查询未授权项目错误"), QUERY_AUTHORIZED_PROJECT(10052, "query authorized project", "查询授权项目错误"), QUERY_QUEUE_LIST_ERROR(10053, "query queue list error", "查询队列列表错误"), CREATE_RESOURCE_ERROR(10054, "create resource error", "创建资源错误"), UPDATE_RESOURCE_ERROR(10055, "update resource error", "更新资源错误"), QUERY_RESOURCES_LIST_ERROR(10056, "query resources list error", "查询资源列表错误"), QUERY_RESOURCES_LIST_PAGING(10057, "query resources list paging", "分页查询资源列表错误"), DELETE_RESOURCE_ERROR(10058, "delete resource error", "删除资源错误"), VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR(10059, "verify resource by name and type error", "资源名称或类型验证错误"), VIEW_RESOURCE_FILE_ON_LINE_ERROR(10060, "view resource file online error", "查看资源文件错误"), CREATE_RESOURCE_FILE_ON_LINE_ERROR(10061, "create resource file online error", "创建资源文件错误"), RESOURCE_FILE_IS_EMPTY(10062, "resource file is empty", "资源文件内容不能为空"), EDIT_RESOURCE_FILE_ON_LINE_ERROR(10063, "edit resource file online error", "更新资源文件错误"), DOWNLOAD_RESOURCE_FILE_ERROR(10064, "download resource file error", "下载资源文件错误"), CREATE_UDF_FUNCTION_ERROR(10065, "create udf function error", "创建UDF函数错误"), VIEW_UDF_FUNCTION_ERROR(10066, "view udf function error", "查询UDF函数错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
UPDATE_UDF_FUNCTION_ERROR(10067, "update udf function error", "更新UDF函数错误"), QUERY_UDF_FUNCTION_LIST_PAGING_ERROR(10068, "query udf function list paging error", "分页查询UDF函数列表错误"), QUERY_DATASOURCE_BY_TYPE_ERROR(10069, "query datasource by type error", "查询数据源信息错误"), VERIFY_UDF_FUNCTION_NAME_ERROR(10070, "verify udf function name error", "UDF函数名称验证错误"), DELETE_UDF_FUNCTION_ERROR(10071, "delete udf function error", "删除UDF函数错误"), AUTHORIZED_FILE_RESOURCE_ERROR(10072, "authorized file resource error", "授权资源文件错误"), AUTHORIZE_RESOURCE_TREE(10073, "authorize resource tree display error", "授权资源目录树错误"), UNAUTHORIZED_UDF_FUNCTION_ERROR(10074, "unauthorized udf function error", "查询未授权UDF函数错误"), AUTHORIZED_UDF_FUNCTION_ERROR(10075, "authorized udf function error", "授权UDF函数错误"), CREATE_SCHEDULE_ERROR(10076, "create schedule error", "创建调度配置错误"), UPDATE_SCHEDULE_ERROR(10077, "update schedule error", "更新调度配置错误"), PUBLISH_SCHEDULE_ONLINE_ERROR(10078, "publish schedule online error", "上线调度配置错误"), OFFLINE_SCHEDULE_ERROR(10079, "offline schedule error", "下线调度配置错误"), QUERY_SCHEDULE_LIST_PAGING_ERROR(10080, "query schedule list paging error", "分页查询调度配置列表错误"), QUERY_SCHEDULE_LIST_ERROR(10081, "query schedule list error", "查询调度配置列表错误"), QUERY_TASK_LIST_PAGING_ERROR(10082, "query task list paging error", "分页查询任务列表错误"), QUERY_TASK_RECORD_LIST_PAGING_ERROR(10083, "query task record list paging error", "分页查询任务记录错误"), CREATE_TENANT_ERROR(10084, "create tenant error", "创建租户错误"), QUERY_TENANT_LIST_PAGING_ERROR(10085, "query tenant list paging error", "分页查询租户列表错误"), QUERY_TENANT_LIST_ERROR(10086, "query tenant list error", "查询租户列表错误"), UPDATE_TENANT_ERROR(10087, "update tenant error", "更新租户错误"), DELETE_TENANT_BY_ID_ERROR(10088, "delete tenant by id error", "删除租户错误"), VERIFY_OS_TENANT_CODE_ERROR(10089, "verify os tenant code error", "操作系统租户验证错误"), CREATE_USER_ERROR(10090, "create user error", "创建用户错误"), QUERY_USER_LIST_PAGING_ERROR(10091, "query user list paging error", "分页查询用户列表错误"), UPDATE_USER_ERROR(10092, "update user error", "更新用户错误"), DELETE_USER_BY_ID_ERROR(10093, "delete user by id error", "删除用户错误"), GRANT_PROJECT_ERROR(10094, "grant project error", "授权项目错误"), GRANT_RESOURCE_ERROR(10095, "grant resource error", "授权资源错误"), GRANT_UDF_FUNCTION_ERROR(10096, "grant udf function error", "授权UDF函数错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
GRANT_DATASOURCE_ERROR(10097, "grant datasource error", "授权数据源错误"), GET_USER_INFO_ERROR(10098, "get user info error", "获取用户信息错误"), USER_LIST_ERROR(10099, "user list error", "查询用户列表错误"), VERIFY_USERNAME_ERROR(10100, "verify username error", "用户名验证错误"), UNAUTHORIZED_USER_ERROR(10101, "unauthorized user error", "查询未授权用户错误"), AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"), QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"), DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"), CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"), VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"), UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"), RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"), QUERY_DATAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query datail of process definition error", "查询工作流详细信息错误"), QUERY_PROCESS_DEFINITION_LIST(10110, "query process definition list", "查询工作流列表错误"), ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR(10111, "encapsulation treeview structure error", "查询工作流树形图数据错误"), GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR(10112, "get tasks list by process definition id error", "查询工作流定义节点信息错误"), QUERY_PROCESS_INSTANCE_LIST_PAGING_ERROR(10113, "query process instance list paging error", "分页查询工作流实例列表错误"), QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_ERROR(10114, "query task list by process instance id error", "查询任务实例列表错误"), UPDATE_PROCESS_INSTANCE_ERROR(10115, "update process instance error", "更新工作流实例错误"), QUERY_PROCESS_INSTANCE_BY_ID_ERROR(10116, "query process instance by id error", "查询工作流实例错误"), DELETE_PROCESS_INSTANCE_BY_ID_ERROR(10117, "delete process instance by id error", "删除工作流实例错误"), QUERY_SUB_PROCESS_INSTANCE_DETAIL_INFO_BY_TASK_ID_ERROR(10118, "query sub process instance detail info by task id error", "查询子流程任务实例错误"), QUERY_PARENT_PROCESS_INSTANCE_DETAIL_INFO_BY_SUB_PROCESS_INSTANCE_ID_ERROR(10119, "query parent process instance detail info by sub process instance id error", "查询子流程该工作流实例错误"), QUERY_PROCESS_INSTANCE_ALL_VARIABLES_ERROR(10120, "query process instance all variables error", "查询工作流自定义变量信息错误"), ENCAPSULATION_PROCESS_INSTANCE_GANTT_STRUCTURE_ERROR(10121, "encapsulation process instance gantt structure error", "查询工作流实例甘特图数据错误"), QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR(10122, "query process definition list paging error", "分页查询工作流定义列表错误"), SIGN_OUT_ERROR(10123, "sign out error", "退出错误"), OS_TENANT_CODE_HAS_ALREADY_EXISTS(10124, "os tenant code has already exists", "操作系统租户已存在"), IP_IS_EMPTY(10125, "ip is empty", "IP地址不能为空"), SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE(10126, "schedule release is already {0}", "调度配置上线错误[{0}]"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
CREATE_QUEUE_ERROR(10127, "create queue error", "创建队列错误"), QUEUE_NOT_EXIST(10128, "queue {0} not exists", "队列ID[{0}]不存在"), QUEUE_VALUE_EXIST(10129, "queue value {0} already exists", "队列值[{0}]已存在"), QUEUE_NAME_EXIST(10130, "queue name {0} already exists", "队列名称[{0}]已存在"), UPDATE_QUEUE_ERROR(10131, "update queue error", "更新队列信息错误"), NEED_NOT_UPDATE_QUEUE(10132, "no content changes, no updates are required", "数据未变更,不需要更新队列信息"), VERIFY_QUEUE_ERROR(10133, "verify queue error", "验证队列信息错误"), NAME_NULL(10134, "name must be not null", "名称不能为空"), NAME_EXIST(10135, "name {0} already exists", "名称[{0}]已存在"), SAVE_ERROR(10136, "save error", "保存错误"), DELETE_PROJECT_ERROR_DEFINES_NOT_NULL(10137, "please delete the process definitions in project first!", "请先删除全部工作流定义"), BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR(10117, "batch delete process instance by ids {0} error", "批量删除工作流实例错误"), PREVIEW_SCHEDULE_ERROR(10139, "preview schedule error", "预览调度配置错误"), PARSE_TO_CRON_EXPRESSION_ERROR(10140, "parse cron to cron expression error", "解析调度表达式错误"), SCHEDULE_START_TIME_END_TIME_SAME(10141, "The start time must not be the same as the end", "开始时间不能和结束时间一样"), DELETE_TENANT_BY_ID_FAIL(10142, "delete tenant by id fail, for there are {0} process instances in executing using it", "删除租户失败,有[{0}]个运行中的工作流实例正在使用"), DELETE_TENANT_BY_ID_FAIL_DEFINES(10143, "delete tenant by id fail, for there are {0} process definitions using it", "删除租户失败,有[{0}]个工作流定义正在使用"), DELETE_TENANT_BY_ID_FAIL_USERS(10144, "delete tenant by id fail, for there are {0} users using it", "删除租户失败,有[{0}]个用户正在使用"), DELETE_WORKER_GROUP_BY_ID_FAIL(10145, "delete worker group by id fail, for there are {0} process instances in executing using it", "删除Worker分组失败,有[{0}]个运行中的工作流实例正在使用"), QUERY_WORKER_GROUP_FAIL(10146, "query worker group fail ", "查询worker分组失败"), DELETE_WORKER_GROUP_FAIL(10147, "delete worker group fail ", "删除worker分组失败"), USER_DISABLED(10148, "The current user is disabled", "当前用户已停用"), COPY_PROCESS_DEFINITION_ERROR(10149, "copy process definition from {0} to {1} error : {2}", "从{0}复制工作流到{1}错误 : {2}"), MOVE_PROCESS_DEFINITION_ERROR(10150, "move process definition from {0} to {1} error : {2}", "从{0}移动工作流到{1}错误 : {2}"), SWITCH_PROCESS_DEFINITION_VERSION_ERROR(10151, "Switch process definition version error", "切换工作流版本出错"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR(10152 , "Switch process definition version error: not exists process definition, [process definition id {0}]", "切换工作流版本出错:工作流不存在,[工作流id {0}]"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR(10153 , "Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]", "切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"), QUERY_PROCESS_DEFINITION_VERSIONS_ERROR(10154, "query process definition versions error", "查询工作流历史版本信息出错"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR(10155 , "query process definition versions error: [page number:{0}] < 1 or [page size:{1}] < 1", "查询工作流历史版本出错:[pageNo:{0}] < 1 或 [pageSize:{1}] < 1"), DELETE_PROCESS_DEFINITION_VERSION_ERROR(10156, "delete process definition version error", "删除工作流历史版本出错"), QUERY_USER_CREATED_PROJECT_ERROR(10157, "query user created project error error", "查询用户创建的项目错误"), PROCESS_DEFINITION_IDS_IS_EMPTY(10158, "process definition ids is empty", "工作流IDS不能为空"), BATCH_COPY_PROCESS_DEFINITION_ERROR(10159, "batch copy process definition error", "复制工作流错误"), BATCH_MOVE_PROCESS_DEFINITION_ERROR(10160, "batch move process definition error", "移动工作流错误"), QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"), QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"), DELETE_PROCESS_DEFINITION_BY_ID_FAIL(10163, "delete process definition by id fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"), CHECK_OS_TENANT_CODE_ERROR(10164, "Please enter the English os tenant code", "请输入英文操作系统租户"), FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"), TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"), DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"), PROCESS_DEFINITION_NAME_EXIST(10168, "process definition name {0} already exists", "工作流定义名称[{0}]已存在"), DATASOURCE_DB_TYPE_ILLEGAL(10169, "datasource type illegal", "数据源类型参数不合法"), DATASOURCE_PORT_ILLEGAL(10170, "datasource port illegal", "数据源端口参数不合法"), DATASOURCE_OTHER_PARAMS_ILLEGAL(10171, "datasource other params illegal", "数据源其他参数不合法"), DATASOURCE_NAME_ILLEGAL(10172, "datasource name illegal", "数据源名称不合法"), DATASOURCE_HOST_ILLEGAL(10173, "datasource host illegal", "数据源HOST不合法"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), RESOURCE_NOT_EXIST(20004, "resource not exist", "资源不存在"), RESOURCE_EXIST(20005, "resource already exists", "资源已存在"), RESOURCE_SUFFIX_NOT_SUPPORT_VIEW(20006, "resource suffix do not support online viewing", "资源文件后缀不支持查看"), RESOURCE_SIZE_EXCEED_LIMIT(20007, "upload resource file size exceeds limit", "上传资源文件大小超过限制"), RESOURCE_SUFFIX_FORBID_CHANGE(20008, "resource suffix not allowed to be modified", "资源文件后缀不支持修改"), UDF_RESOURCE_SUFFIX_NOT_JAR(20009, "UDF resource suffix name must be jar", "UDF资源文件后缀名只支持[jar]"), HDFS_COPY_FAIL(20010, "hdfs copy {0} -> {1} fail", "hdfs复制失败:[{0}] -> [{1}]"), RESOURCE_FILE_EXIST(20011, "resource file {0} already exists in hdfs,please delete it or change name!", "资源文件[{0}]在hdfs中已存在,请删除或修改资源名"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
RESOURCE_FILE_NOT_EXIST(20012, "resource file {0} not exists in hdfs!", "资源文件[{0}]在hdfs中不存在"), UDF_RESOURCE_IS_BOUND(20013, "udf resource file is bound by UDF functions:{0}", "udf函数绑定了资源文件[{0}]"), RESOURCE_IS_USED(20014, "resource file is used by process definition", "资源文件被上线的流程定义使用了"), PARENT_RESOURCE_NOT_EXIST(20015, "parent resource not exist", "父资源文件不存在"), RESOURCE_NOT_EXIST_OR_NO_PERMISSION(20016, "resource not exist or no permission,please view the task node and remove error resource", "请检查任务节点并移除无权限或者已删除的资源"), RESOURCE_IS_AUTHORIZED(20017, "resource is authorized to user {0},suffix not allowed to be modified", "资源文件已授权其他用户[{0}],后缀不允许修改"), USER_NO_OPERATION_PERM(30001, "user has no operation privilege", "当前用户没有操作权限"), USER_NO_OPERATION_PROJECT_PERM(30002, "user {0} is not has project {1} permission", "当前用户[{0}]没有[{1}]项目的操作权限"), PROCESS_INSTANCE_NOT_EXIST(50001, "process instance {0} does not exist", "工作流实例[{0}]不存在"), PROCESS_INSTANCE_EXIST(50002, "process instance {0} already exists", "工作流实例[{0}]已存在"), PROCESS_DEFINE_NOT_EXIST(50003, "process definition {0} does not exist", "工作流定义[{0}]不存在"), PROCESS_DEFINE_NOT_RELEASE(50004, "process definition {0} not on line", "工作流定义[{0}]不是上线状态"), PROCESS_INSTANCE_ALREADY_CHANGED(50005, "the status of process instance {0} is already {1}", "工作流实例[{0}]的状态已经是[{1}]"), PROCESS_INSTANCE_STATE_OPERATION_ERROR(50006, "the status of process instance {0} is {1},Cannot perform {2} operation", "工作流实例[{0}]的状态是[{1}],无法执行[{2}]操作"), SUB_PROCESS_INSTANCE_NOT_EXIST(50007, "the task belong to process instance does not exist", "子工作流实例不存在"), PROCESS_DEFINE_NOT_ALLOWED_EDIT(50008, "process definition {0} does not allow edit", "工作流定义[{0}]不允许修改"), PROCESS_INSTANCE_EXECUTING_COMMAND(50009, "process instance {0} is executing the command, please wait ...", "工作流实例[{0}]正在执行命令,请稍等..."), PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE(50010, "process instance {0} is not sub process instance", "工作流实例[{0}]不是子工作流实例"), TASK_INSTANCE_STATE_COUNT_ERROR(50011, "task instance state count error", "查询各状态任务实例数错误"), COUNT_PROCESS_INSTANCE_STATE_ERROR(50012, "count process instance state error", "查询各状态流程实例数错误"), COUNT_PROCESS_DEFINITION_USER_ERROR(50013, "count process definition user error", "查询各用户流程定义数错误"), START_PROCESS_INSTANCE_ERROR(50014, "start process instance error", "运行工作流实例错误"), EXECUTE_PROCESS_INSTANCE_ERROR(50015, "execute process instance error", "操作工作流实例错误"), CHECK_PROCESS_DEFINITION_ERROR(50016, "check process definition error", "工作流定义错误"), QUERY_RECIPIENTS_AND_COPYERS_BY_PROCESS_DEFINITION_ERROR(50017, "query recipients and copyers by process definition error", "查询收件人和抄送人错误"), DATA_IS_NOT_VALID(50017, "data {0} not valid", "数据[{0}]无效"), DATA_IS_NULL(50018, "data {0} is null", "数据[{0}]不能为空"), PROCESS_NODE_HAS_CYCLE(50019, "process node has cycle", "流程节点间存在循环依赖"), PROCESS_NODE_S_PARAMETER_INVALID(50020, "process node {0} parameter invalid", "流程节点[{0}]参数无效"), PROCESS_DEFINE_STATE_ONLINE(50021, "process definition {0} is already on line", "工作流定义[{0}]已上线"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
DELETE_PROCESS_DEFINE_BY_ID_ERROR(50022, "delete process definition by id error", "删除工作流定义错误"), SCHEDULE_CRON_STATE_ONLINE(50023, "the status of schedule {0} is already on line", "调度配置[{0}]已上线"), DELETE_SCHEDULE_CRON_BY_ID_ERROR(50024, "delete schedule by id error", "删除调度配置错误"), BATCH_DELETE_PROCESS_DEFINE_ERROR(50025, "batch delete process definition error", "批量删除工作流定义错误"), BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR(50026, "batch delete process definition by ids {0} error", "批量删除工作流定义[{0}]错误"), TENANT_NOT_SUITABLE(50027, "there is not any tenant suitable, please choose a tenant available.", "没有合适的租户,请选择可用的租户"), EXPORT_PROCESS_DEFINE_BY_ID_ERROR(50028, "export process definition by id error", "导出工作流定义错误"), BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR(50028, "batch export process definition by ids error", "批量导出工作流定义错误"), IMPORT_PROCESS_DEFINE_ERROR(50029, "import process definition error", "导入工作流定义错误"), HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"), /** * for monitor */ QUERY_DATABASE_STATE_ERROR(70001, "query database state error", "查询数据库状态错误"), QUERY_ZOOKEEPER_STATE_ERROR(70002, "query zookeeper state error", "查询zookeeper状态错误"), CREATE_ACCESS_TOKEN_ERROR(70010, "create access token error", "创建访问token错误"), GENERATE_TOKEN_ERROR(70011, "generate token error", "生成token错误"), QUERY_ACCESSTOKEN_LIST_PAGING_ERROR(70012, "query access token list paging error", "分页查询访问token列表错误"), UPDATE_ACCESS_TOKEN_ERROR(70013, "update access token error", "更新访问token错误"), DELETE_ACCESS_TOKEN_ERROR(70014, "delete access token error", "删除访问token错误"), ACCESS_TOKEN_NOT_EXIST(70015, "access token not exist", "访问token不存在"), COMMAND_STATE_COUNT_ERROR(80001, "task instance state count error", "查询各状态任务实例数错误"), NEGTIVE_SIZE_NUMBER_ERROR(80002, "query size number error", "查询size错误"), START_TIME_BIGGER_THAN_END_TIME_ERROR(80003, "start time bigger than end time error", "开始时间在结束时间之后错误"), QUEUE_COUNT_ERROR(90001, "queue count error", "查询队列数据错误"), KERBEROS_STARTUP_STATE(100001, "get kerberos startup state error", "获取kerberos启动状态错误"), //plugin PLUGIN_NOT_A_UI_COMPONENT(110001, "query plugin error, this plugin has no UI component", "查询插件错误,此插件无UI组件"), QUERY_PLUGINS_RESULT_IS_NULL(110002, "query plugins result is null", "查询插件为空"), QUERY_PLUGINS_ERROR(110003, "query plugins error", "查询插件错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
QUERY_PLUGIN_DETAIL_RESULT_IS_NULL(110004, "query plugin detail result is null", "查询插件详情结果为空"), UPDATE_ALERT_PLUGIN_INSTANCE_ERROR(110005, "update alert plugin instance error", "更新告警组和告警组插件实例错误"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR(110006, "delete alert plugin instance error", "删除告警组和告警组插件实例错误"), GET_ALERT_PLUGIN_INSTANCE_ERROR(110007, "get alert plugin instance error", "获取告警组和告警组插件实例错误"), CREATE_ALERT_PLUGIN_INSTANCE_ERROR(110008, "create alert plugin instance error", "创建告警组和告警组插件实例错误"), QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR(110009, "query all alert plugin instance error", "查询所有告警实例失败"), PLUGIN_INSTANCE_ALREADY_EXIT(110010, "plugin instance already exit", "该告警插件实例已存在"), LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR(110011, "query plugin instance page error", "分页查询告警实例失败"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED(110012, "failed to delete the alert instance, there is an alarm group associated with this alert instance", "删除告警实例失败,存在与此告警实例关联的警报组"); private final int code; private final String enMsg; private final String zhMsg; Status(int code, String enMsg, String zhMsg) { this.code = code; this.enMsg = enMsg; this.zhMsg = zhMsg; } public int getCode() { return this.code; } public String getMsg() { if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { return this.zhMsg; } else { return this.enMsg; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
/* * 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.api.service; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.springframework.web.multipart.MultipartFile; import com.fasterxml.jackson.core.JsonProcessingException; /** * process definition service */ public interface ProcessDefinitionService {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
/** * create process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return create result code * @throws JsonProcessingException JsonProcessingException
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
*/ Map<String, Object> createProcessDefinition(User loginUser, String projectName, String name, String processDefinitionJson, String desc, String locations, String connects) throws JsonProcessingException; /** * query process definition list * * @param loginUser login user * @param projectName project name * @return definition list */ Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName); /** * query process definition list paging * * @param loginUser login user * @param projectName project name * @param searchVal search value * @param pageNo page number * @param pageSize page size * @param userId user id * @return process definition page */ Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
String searchVal, Integer pageNo, Integer pageSize, Integer userId); /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return process definition detail */ Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId); /** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processDefinitionName process definition name * @return process definition detail */ Map<String, Object> queryProcessDefinitionByName(User loginUser, String projectName, String processDefinitionName); /** * batch copy process definition * * @param loginUser loginUser
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ Map<String, Object> batchCopyProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId); /** * batch move process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ Map<String, Object> batchMoveProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId); /** * update process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param id process definition id * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* @param connects connects for nodes * @return update result code */ Map<String, Object> updateProcessDefinition(User loginUser, String projectName, int id, String name, String processDefinitionJson, String desc, String locations, String connects); /** * verify process definition name unique * * @param loginUser login user * @param projectName project name * @param name name * @return true if process definition name not exists, otherwise false */ Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name); /** * delete process definition by id * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @return delete result code */ Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
Integer processDefinitionId); /** * release process definition: online / offline * * @param loginUser login user * @param projectName project name * @param id process definition id * @param releaseState release state * @return release result code */ Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, ReleaseState releaseState); /** * batch export process definition by ids * * @param loginUser login user * @param projectName project name * @param processDefinitionIds process definition ids * @param response http servlet response */ void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response); /** * import process definition * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
* @param file process metadata json file * @param currentProjectName current project name * @return import process */ Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName); /** * check the process definition node meets the specifications * * @param processData process data * @param processDefinitionJson process definition json * @return check result code */ Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson); /** * get task node details based on process definition * * @param defineId define id * @return task node list */ Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId); /** * get task node details based on process definition * * @param defineIdList define id list * @return task node list */ Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
/** * query process definition all by project id * * @param projectId project id * @return process definitions in the project */ Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId); /** * Encapsulates the TreeView structure * * @param processId process definition id * @param limit limit * @return tree view json data * @throws Exception exception */ Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception; /** * switch the defined process definition verison * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @param version the version user want to switch * @return switch process definition version result code */ Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName , int processDefinitionId, long version); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID; import org.apache.dolphinscheduler.api.dto.ProcessMeta; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.exportprocess.ProcessAddTaskParam; import org.apache.dolphinscheduler.api.utils.exportprocess.TaskNodeParamFactory; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TaskType; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.process.ProcessDag; import org.apache.dolphinscheduler.common.process.Property; import org.apache.dolphinscheduler.common.process.ResourceInfo; import org.apache.dolphinscheduler.common.task.AbstractParameters; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.StreamUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.common.utils.TaskParametersUtils; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.utils.DagHelper; import org.apache.dolphinscheduler.service.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; import java.io.BufferedOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; /** * process definition service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String PROCESSDEFINITIONID = "processDefinitionId"; private static final String RELEASESTATE = "releaseState"; private static final String TASKS = "tasks"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionVersionService processDefinitionVersionService; @Autowired private ProcessDefinitionMapper processDefineMapper; @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private SchedulerService schedulerService; /** * create process definition * * @param loginUser login user * @param projectName project name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param name process definition name * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return create result code */ @Override public Map<String, Object> createProcessDefinition(User loginUser, String projectName, String name, String processDefinitionJson, String desc, String locations, String connects) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefine = new ProcessDefinition(); Date now = new Date(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if (checkProcessJson.get(Constants.STATUS) != Status.SUCCESS) { return checkProcessJson; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson); processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); List<Property> globalParamsList = processData.getGlobalParams(); if (CollectionUtils.isNotEmpty(globalParamsList)) { Set<Property> globalParamsSet = new HashSet<>(globalParamsList); globalParamsList = new ArrayList<>(globalParamsSet); processDefine.setGlobalParamList(globalParamsList); } processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); processDefineMapper.insert(processDefine); long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine); processDefine.setVersion(version); processDefineMapper.updateVersionByProcessDefinitionId(processDefine.getId(), version); result.put(Constants.DATA_LIST, processDefine.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); return result; } /** * get resource ids * * @param processData process data * @return resource ids */ private String getResourceIds(ProcessData processData) { List<TaskNode> tasks = processData.getTasks(); Set<Integer> resourceIds = new HashSet<>(); StringBuilder sb = new StringBuilder(); if (CollectionUtils.isEmpty(tasks)) { return sb.toString(); } for (TaskNode taskNode : tasks) { String taskParameter = taskNode.getParams(); AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter); if (params == null) { continue; } if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) { Set<Integer> tempSet = params.getResourceFilesList(). stream() .filter(t -> t.getId() != 0) .map(ResourceInfo::getId) .collect(Collectors.toSet()); resourceIds.addAll(tempSet); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} for (int i : resourceIds) { if (sb.length() > 0) { sb.append(","); } sb.append(i); } return sb.toString(); } /** * query process definition list * * @param loginUser login user * @param projectName project name * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, String projectName) { HashMap<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(project.getId()); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * query process definition list paging * * @param loginUser login user * @param projectName project name * @param searchVal search value * @param pageNo page number * @param pageSize page size * @param userId user id * @return process definition page */ @Override public Map<String, Object> queryProcessDefinitionListPaging(User loginUser, String projectName, String searchVal, Integer pageNo, Integer pageSize, Integer userId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefineMapper.queryDefineListPaging( page, searchVal, userId, project.getId(), isAdmin(loginUser)); PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotalCount((int) processDefinitionIPage.getTotal()); pageInfo.setLists(processDefinitionIPage.getRecords()); result.put(Constants.DATA_LIST, pageInfo); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * query datail of process definition * * @param loginUser login user * @param projectName project name * @param processId process definition id * @return process definition detail */ @Override public Map<String, Object> queryProcessDefinitionById(User loginUser, String projectName, Integer processId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); } else { result.put(Constants.DATA_LIST, processDefinition); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryProcessDefinitionByName(User loginUser, String projectName, String processDefinitionName) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(project.getId(),processDefinitionName); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionName); } else { result.put(Constants.DATA_LIST, processDefinition); putMsg(result, Status.SUCCESS); } return result; } /** * update process definition * * @param loginUser login user * @param projectName project name * @param name process definition name * @param id process definition id * @param processDefinitionJson process definition json * @param desc description * @param locations locations for nodes * @param connects connects for nodes * @return update result code */ @Override public Map<String, Object> updateProcessDefinition(User loginUser, String projectName,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
int id, String name, String processDefinitionJson, String desc, String locations, String connects) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); Map<String, Object> checkProcessJson = checkProcessNodeList(processData, processDefinitionJson); if ((checkProcessJson.get(Constants.STATUS) != Status.SUCCESS)) { return checkProcessJson; } ProcessDefinition processDefine = processService.findProcessDefineById(id); if (processDefine == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, id); return result; } if (processDefine.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefine.getName()); return result; } if (!name.equals(processDefine.getName())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition definition = processDefineMapper.verifyByDefineName(project.getId(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } } String oldJson = processDefine.getProcessDefinitionJson(); processDefinitionJson = processService.changeJson(processData,oldJson); Date now = new Date(); processDefine.setId(id); processDefine.setName(name); processDefine.setReleaseState(ReleaseState.OFFLINE); processDefine.setProjectId(project.getId()); processDefine.setProcessDefinitionJson(processDefinitionJson); processDefine.setDescription(desc); processDefine.setLocations(locations); processDefine.setConnects(connects); processDefine.setTimeout(processData.getTimeout()); processDefine.setTenantId(processData.getTenantId()); processDefine.setModifyBy(loginUser.getUserName()); processDefine.setResourceIds(getResourceIds(processData)); List<Property> globalParamsList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(processData.getGlobalParams())) { Set<Property> userDefParamsSet = new HashSet<>(processData.getGlobalParams()); globalParamsList = new ArrayList<>(userDefParamsSet); } processDefine.setGlobalParamList(globalParamsList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefine); processDefine.setVersion(version); if (processDefineMapper.updateById(processDefine) > 0) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefineMapper.queryByDefineId(id)); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectName project name * @param name name * @return true if process definition name not exists, otherwise false */ @Override public Map<String, Object> verifyProcessDefinitionName(User loginUser, String projectName, String name) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition processDefinition = processDefineMapper.verifyByDefineName(project.getId(), name); if (processDefinition == null) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); } return result; } /** * delete process definition by id * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteProcessDefinitionById(User loginUser, String projectName, Integer processDefinitionId) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.selectById(processDefinitionId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionId); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, processDefinitionId); return result; } List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineIdAndStatus(processDefinitionId, Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_ID_FAIL, processInstances.size()); return result; } List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty() && schedules.size() > 1) { logger.warn("scheduler num is {},Greater than 1", schedules.size()); putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); return result; } else if (schedules.size() == 1) { Schedule schedule = schedules.get(0); if (schedule.getReleaseState() == ReleaseState.OFFLINE) { scheduleMapper.deleteById(schedule.getId()); } else if (schedule.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId()); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} } int delete = processDefineMapper.deleteById(processDefinitionId); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_ID_ERROR); } return result; } /** * release process definition: online / offline * * @param loginUser login user * @param projectName project name * @param id process definition id * @param releaseState release state * @return release result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> releaseProcessDefinition(User loginUser, String projectName, int id, ReleaseState releaseState) { HashMap<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultEnum = (Status) checkResult.get(Constants.STATUS); if (resultEnum != Status.SUCCESS) { return checkResult; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefineMapper.selectById(id); switch (releaseState) { case ONLINE: String resourceIds = processDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) { Integer[] resourceIdArray = Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger); try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE); return result; } } processDefinition.setReleaseState(releaseState); processDefineMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(releaseState); processDefineMapper.updateById(processDefinition); List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray( new int[]{processDefinition.getId()} ); for (Schedule schedule : scheduleList) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.info("set schedule offline, project id: {}, schedule id: {}, process definition id: {}", project.getId(), schedule.getId(), id); schedule.setReleaseState(ReleaseState.OFFLINE); scheduleMapper.updateById(schedule); schedulerService.deleteSchedule(project.getId(), schedule.getId()); } break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } putMsg(result, Status.SUCCESS); return result; } /** * batch export process definition by ids */ @Override public void batchExportProcessDefinitionByIds(User loginUser, String projectName, String processDefinitionIds, HttpServletResponse response) { if (StringUtils.isEmpty(processDefinitionIds)) { return; } Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessMeta> processDefinitionList = getProcessDefinitionList(processDefinitionIds); if (CollectionUtils.isNotEmpty(processDefinitionList)) { downloadProcessDefinitionFile(response, processDefinitionList); } } /** * get process definition list by ids */ private List<ProcessMeta> getProcessDefinitionList(String processDefinitionIds) { List<ProcessMeta> processDefinitionList = new ArrayList<>(); String[] processDefinitionIdArray = processDefinitionIds.split(","); for (String strProcessDefinitionId : processDefinitionIdArray) { int processDefinitionId = Integer.parseInt(strProcessDefinitionId); ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); if (null != processDefinition) { processDefinitionList.add(exportProcessMetaData(processDefinitionId, processDefinition)); } } return processDefinitionList; } /** * download the process definition file */ private void downloadProcessDefinitionFile(HttpServletResponse response, List<ProcessMeta> processDefinitionList) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSONUtils.toJsonString(processDefinitionList).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { logger.warn("export process fail", e); } finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("export process buffer not close", e); } } if (null != out) { try { out.close(); } catch (Exception e) { logger.warn("export process output stream not close", e); } } } } /** * get export process metadata string * * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
*/ public String exportProcessMetaDataStr(Integer processDefinitionId, ProcessDefinition processDefinition) { return JSONUtils.toJsonString(exportProcessMetaData(processDefinitionId, processDefinition)); } /** * get export process metadata string * * @param processDefinitionId process definition id * @param processDefinition process definition * @return export process metadata string */ public ProcessMeta exportProcessMetaData(Integer processDefinitionId, ProcessDefinition processDefinition) { String correctProcessDefinitionJson = addExportTaskNodeSpecialParam(processDefinition.getProcessDefinitionJson()); processDefinition.setProcessDefinitionJson(correctProcessDefinitionJson); ProcessMeta exportProcessMeta = new ProcessMeta(); exportProcessMeta.setProjectName(processDefinition.getProjectName()); exportProcessMeta.setProcessDefinitionName(processDefinition.getName()); exportProcessMeta.setProcessDefinitionJson(processDefinition.getProcessDefinitionJson()); exportProcessMeta.setProcessDefinitionDescription(processDefinition.getDescription()); exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations()); exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects()); List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionId(processDefinitionId); if (!schedules.isEmpty()) { Schedule schedule = schedules.get(0); exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString()); exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
exportProcessMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime())); exportProcessMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime())); exportProcessMeta.setScheduleCrontab(schedule.getCrontab()); exportProcessMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy())); exportProcessMeta.setScheduleReleaseState(String.valueOf(ReleaseState.OFFLINE)); exportProcessMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority())); exportProcessMeta.setScheduleWorkerGroupName(schedule.getWorkerGroup()); } return exportProcessMeta; } /** * correct task param which has datasource or dependent * * @param processDefinitionJson processDefinitionJson * @return correct processDefinitionJson */ private String addExportTaskNodeSpecialParam(String processDefinitionJson) { ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson); ArrayNode jsonArray = (ArrayNode) jsonObject.path(TASKS); for (int i = 0; i < jsonArray.size(); i++) { JsonNode taskNode = jsonArray.path(i); if (StringUtils.isNotEmpty(taskNode.path("type").asText())) { String taskType = taskNode.path("type").asText(); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addExportSpecialParam(taskNode); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
jsonObject.set(TASKS, jsonArray); return jsonObject.toString(); } /** * check task if has sub process * * @param taskType task type * @return if task has sub process return true else false */ private boolean checkTaskHasSubProcess(String taskType) { return taskType.equals(TaskType.SUB_PROCESS.name()); } /** * import process definition * * @param loginUser login user * @param file process metadata json file * @param currentProjectName current project name * @return import process */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> importProcessDefinition(User loginUser, MultipartFile file, String currentProjectName) { Map<String, Object> result = new HashMap<>(); String processMetaJson = FileUtils.file2String(file); List<ProcessMeta> processMetaList = JSONUtils.toList(processMetaJson, ProcessMeta.class); if (CollectionUtils.isEmpty(processMetaList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} for (ProcessMeta processMeta : processMetaList) { if (!checkAndImportProcessDefinition(loginUser, currentProjectName, result, processMeta)) { return result; } } return result; } /** * check and import process definition */ private boolean checkAndImportProcessDefinition(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta) { if (!checkImportanceParams(processMeta, result)) { return false; } String processDefinitionName = processMeta.getProcessDefinitionName(); Project targetProject = projectMapper.queryByName(currentProjectName); if (null != targetProject) { processDefinitionName = recursionProcessDefinitionName(targetProject.getId(), processDefinitionName, 1); } Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName); Status status = (Status) checkResult.get(Constants.STATUS); if (Status.SUCCESS.equals(status)) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return false; } Map<String, Object> createProcessResult = getCreateProcessResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject)); if (createProcessResult == null) { return false; } Integer processDefinitionId = Objects.isNull(createProcessResult.get(Constants.DATA_LIST)) ? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString()); return getImportProcessScheduleResult(loginUser, currentProjectName, result, processMeta, processDefinitionName, processDefinitionId); } /** * get create process result */ private Map<String, Object> getCreateProcessResult(User loginUser, String currentProjectName,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, String importProcessParam) { Map<String, Object> createProcessResult = null; try { createProcessResult = createProcessDefinition(loginUser , currentProjectName, processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(), importProcessParam, processMeta.getProcessDefinitionDescription(), processMeta.getProcessDefinitionLocations(), processMeta.getProcessDefinitionConnects()); putMsg(result, Status.SUCCESS); } catch (Exception e) { logger.error("import process meta json data: {}", e.getMessage(), e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); } return createProcessResult; } /** * get import process schedule result */ private boolean getImportProcessScheduleResult(User loginUser, String currentProjectName, Map<String, Object> result, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
int scheduleInsert = importProcessSchedule(loginUser, currentProjectName, processMeta, processDefinitionName, processDefinitionId); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return false; } } return true; } /** * check importance params */ private boolean checkImportanceParams(ProcessMeta processMeta, Map<String, Object> result) { if (StringUtils.isEmpty(processMeta.getProjectName())) { putMsg(result, Status.DATA_IS_NULL, "projectName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionName"); return false; } if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) { putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson"); return false; } return true; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * import process add special task param * * @param loginUser login user * @param processDefinitionJson process definition json * @param targetProject target project * @return import process param */ private String addImportTaskNodeParam(User loginUser, String processDefinitionJson, Project targetProject) { ObjectNode jsonObject = JSONUtils.parseObject(processDefinitionJson); ArrayNode jsonArray = (ArrayNode) jsonObject.get(TASKS); for (int i = 0; i < jsonArray.size(); i++) { JsonNode taskNode = jsonArray.path(i); String taskType = taskNode.path("type").asText(); ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskType); if (null != addTaskParam) { addTaskParam.addImportSpecialParam(taskNode); } } Map<Integer, Integer> subProcessIdMap = new HashMap<>(); List<Object> subProcessList = StreamUtils.asStream(jsonArray.elements()) .filter(elem -> checkTaskHasSubProcess(JSONUtils.parseObject(elem.toString()).path("type").asText())) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, jsonArray, subProcessIdMap); } jsonObject.set(TASKS, jsonArray); return jsonObject.toString();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} /** * import process schedule * * @param loginUser login user * @param currentProjectName current project name * @param processMeta process meta data * @param processDefinitionName process definition name * @param processDefinitionId process definition id * @return insert schedule flag */ public int importProcessSchedule(User loginUser, String currentProjectName, ProcessMeta processMeta, String processDefinitionName, Integer processDefinitionId) { Date now = new Date(); Schedule scheduleObj = new Schedule(); scheduleObj.setProjectName(currentProjectName); scheduleObj.setProcessDefinitionId(processDefinitionId); scheduleObj.setProcessDefinitionName(processDefinitionName); scheduleObj.setCreateTime(now); scheduleObj.setUpdateTime(now); scheduleObj.setUserId(loginUser.getId()); scheduleObj.setUserName(loginUser.getUserName()); scheduleObj.setCrontab(processMeta.getScheduleCrontab()); if (null != processMeta.getScheduleStartTime()) { scheduleObj.setStartTime(DateUtils.stringToDate(processMeta.getScheduleStartTime())); } if (null != processMeta.getScheduleEndTime()) { scheduleObj.setEndTime(DateUtils.stringToDate(processMeta.getScheduleEndTime())); } if (null != processMeta.getScheduleWarningType()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
scheduleObj.setWarningType(WarningType.valueOf(processMeta.getScheduleWarningType())); } if (null != processMeta.getScheduleWarningGroupId()) { scheduleObj.setWarningGroupId(processMeta.getScheduleWarningGroupId()); } if (null != processMeta.getScheduleFailureStrategy()) { scheduleObj.setFailureStrategy(FailureStrategy.valueOf(processMeta.getScheduleFailureStrategy())); } if (null != processMeta.getScheduleReleaseState()) { scheduleObj.setReleaseState(ReleaseState.valueOf(processMeta.getScheduleReleaseState())); } if (null != processMeta.getScheduleProcessInstancePriority()) { scheduleObj.setProcessInstancePriority(Priority.valueOf(processMeta.getScheduleProcessInstancePriority())); } if (null != processMeta.getScheduleWorkerGroupName()) { scheduleObj.setWorkerGroup(processMeta.getScheduleWorkerGroupName()); } return scheduleMapper.insert(scheduleObj); } /** * check import process has sub process * recursion create sub process * * @param loginUser login user * @param targetProject target project * @param jsonArray process task array * @param subProcessIdMap correct sub process id map */ private void importSubProcess(User loginUser, Project targetProject, ArrayNode jsonArray, Map<Integer, Integer> subProcessIdMap) { for (int i = 0; i < jsonArray.size(); i++) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ObjectNode taskNode = (ObjectNode) jsonArray.path(i); String taskType = taskNode.path("type").asText(); if (!checkTaskHasSubProcess(taskType)) { continue; } ObjectNode subParams = (ObjectNode) taskNode.path("params"); Integer subProcessId = subParams.path(PROCESSDEFINITIONID).asInt(); ProcessDefinition subProcess = processDefineMapper.queryByDefineId(subProcessId); if (null == subProcess) { continue; } String subProcessJson = subProcess.getProcessDefinitionJson(); ProcessDefinition currentProjectSubProcess = processDefineMapper.queryByDefineName(targetProject.getId(), subProcess.getName()); if (null == currentProjectSubProcess) { ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcess.getProcessDefinitionJson()).get(TASKS); List<Object> subProcessList = StreamUtils.asStream(subJsonArray.elements()) .filter(item -> checkTaskHasSubProcess(JSONUtils.parseObject(item.toString()).path("type").asText())) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(subProcessList)) { importSubProcess(loginUser, targetProject, subJsonArray, subProcessIdMap); if (!subProcessIdMap.isEmpty()) { for (Map.Entry<Integer, Integer> entry : subProcessIdMap.entrySet()) { String oldSubProcessId = "\"processDefinitionId\":" + entry.getKey(); String newSubProcessId = "\"processDefinitionId\":" + entry.getValue(); subProcessJson = subProcessJson.replaceAll(oldSubProcessId, newSubProcessId); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
subProcessIdMap.clear(); } } Date now = new Date(); ProcessDefinition processDefine = new ProcessDefinition(); processDefine.setName(subProcess.getName()); processDefine.setVersion(subProcess.getVersion()); processDefine.setReleaseState(subProcess.getReleaseState()); processDefine.setProjectId(targetProject.getId()); processDefine.setUserId(loginUser.getId()); processDefine.setProcessDefinitionJson(subProcessJson); processDefine.setDescription(subProcess.getDescription()); processDefine.setLocations(subProcess.getLocations()); processDefine.setConnects(subProcess.getConnects()); processDefine.setTimeout(subProcess.getTimeout()); processDefine.setTenantId(subProcess.getTenantId()); processDefine.setGlobalParams(subProcess.getGlobalParams()); processDefine.setCreateTime(now); processDefine.setUpdateTime(now); processDefine.setFlag(subProcess.getFlag()); processDefine.setWarningGroupId(subProcess.getWarningGroupId()); processDefineMapper.insert(processDefine); logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), processDefine.getName()); ProcessDefinition newSubProcessDefine = processDefineMapper.queryByDefineName(processDefine.getProjectId(), processDefine.getName()); if (null != newSubProcessDefine) { subProcessIdMap.put(subProcessId, newSubProcessDefine.getId()); subParams.put(PROCESSDEFINITIONID, newSubProcessDefine.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
taskNode.set("params", subParams); } } } } /** * check the process definition node meets the specifications * * @param processData process data * @param processDefinitionJson process definition json * @return check result code */ @Override public Map<String, Object> checkProcessNodeList(ProcessData processData, String processDefinitionJson) { Map<String, Object> result = new HashMap<>(); try { if (processData == null) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } List<TaskNode> taskNodes = processData.getTasks(); if (taskNodes == null) { logger.error("process node info is empty"); putMsg(result, Status.DATA_IS_NULL, processDefinitionJson); return result; } if (graphHasCycle(taskNodes)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (TaskNode taskNode : taskNodes) { if (!CheckUtils.checkTaskNodeParameters(taskNode.getParams(), taskNode.getType())) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * get task node details based on process definition * * @param defineId define id * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionId(Integer defineId) { Map<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition processDefinition = processDefineMapper.selectById(defineId); if (processDefinition == null) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineId); return result; } String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); if (null == processData) { logger.error("process data is null"); putMsg(result, Status.DATA_IS_NOT_VALID, processDefinitionJson); return result; } List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); result.put(Constants.DATA_LIST, taskNodeList); putMsg(result, Status.SUCCESS); return result; } /** * get task node details based on process definition * * @param defineIdList define id list * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionIdList(String defineIdList) { Map<String, Object> result = new HashMap<>(); Map<Integer, List<TaskNode>> taskNodeMap = new HashMap<>(); String[] idList = defineIdList.split(",");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<Integer> idIntList = new ArrayList<>(); for (String definitionId : idList) { idIntList.add(Integer.parseInt(definitionId)); } Integer[] idArray = idIntList.toArray(new Integer[0]); List<ProcessDefinition> processDefinitionList = processDefineMapper.queryDefinitionListByIdList(idArray); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.info("process definition not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, defineIdList); return result; } for (ProcessDefinition processDefinition : processDefinitionList) { String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); List<TaskNode> taskNodeList = (processData.getTasks() == null) ? new ArrayList<>() : processData.getTasks(); taskNodeMap.put(processDefinition.getId(), taskNodeList); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project id * * @param projectId project id * @return process definitions in the project */ @Override public Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId) { HashMap<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessDefinition> resourceList = processDefineMapper.queryAllDefinitionList(projectId); result.put(Constants.DATA_LIST, resourceList); putMsg(result, Status.SUCCESS); return result; } /** * Encapsulates the TreeView structure * * @param processId process definition id * @param limit limit * @return tree view json data * @throws Exception exception */ @Override public Map<String, Object> viewTree(Integer processId, Integer limit) throws Exception { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (null == processDefinition) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinition); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = genDagGraph(processDefinition); /** * nodes that is running */ Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>(); /** * nodes that is waiting torun */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); /** * List of process instances */ List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineId(processId, limit); for (ProcessInstance processInstance : processInstanceList) { processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); } if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "", processInstance.getState().toString() , processInstance.getStartTime(), endTime, processInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (Stopper.isRunning()) { Set<String> postNodeList = null; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeName = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); treeViewDto.setName(nodeName); TaskNode taskNode = dag.getNode(nodeName); treeViewDto.setType(taskNode.getType()); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); int subProcessId = 0; /** * if process is sub process, the return sub id, or sub id=0 */ if (taskInstance.getTaskType().equals(TaskType.SUB_PROCESS.name())) { String taskJson = taskInstance.getTaskJson(); taskNode = JSONUtils.parseObject(taskJson, TaskNode.class); subProcessId = Integer.parseInt(JSONUtils.parseObject( taskNode.getParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString() , taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId)); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeName); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeName : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName); if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); } treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeName, treeViewDtoList); } } runningNodeMap.remove(nodeName); } if (waitingRunningNodeMap == null || waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* Generate the DAG Graph based on the process definition id * * @param processDefinition process definition * @return dag graph */ private DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) { String processDefinitionJson = processDefinition.getProcessDefinitionJson(); ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); if (null != processData) { List<TaskNode> taskNodeList = processData.getTasks(); processDefinition.setGlobalParamList(processData.getGlobalParams()); ProcessDag processDag = DagHelper.getProcessDag(taskNodeList); return DagHelper.buildDagGraph(processDag); } return new DAG<>(); } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>(); for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(taskNodeResponse.getName(), taskNodeResponse); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (TaskNode taskNodeResponse : taskNodeResponseList) { taskNodeResponse.getPreTasks(); List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) { if (!graph.addEdge(preTask, taskNodeResponse.getName())) { return true; } } } } return graph.hasCycle(); } private String recursionProcessDefinitionName(Integer projectId, String processDefinitionName, int num) { ProcessDefinition processDefinition = processDefineMapper.queryByDefineName(projectId, processDefinitionName); if (processDefinition != null) { if (num > 1) { String str = processDefinitionName.substring(0, processDefinitionName.length() - 3); processDefinitionName = str + "(" + num + ")"; } else { processDefinitionName = processDefinition.getName() + "(" + num + ")"; } } else { return processDefinitionName; } return recursionProcessDefinitionName(projectId, processDefinitionName, num + 1); } private Map<String, Object> copyProcessDefinition(User loginUser, Integer processId,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Project targetProject) throws JsonProcessingException { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } else { return createProcessDefinition( loginUser, targetProject.getName(), processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp(), processDefinition.getProcessDefinitionJson(), processDefinition.getDescription(), processDefinition.getLocations(), processDefinition.getConnects()); } } /** * batch copy process definition * * @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ @Override public Map<String, Object> batchCopyProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = new HashMap<>(); List<String> failedProcessList = new ArrayList<>(); if (StringUtils.isEmpty(processDefinitionIds)) { putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds); return result; } Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName); if (checkResult != null) { return checkResult; } Project targetProject = projectMapper.queryDetailById(targetProjectId); if (targetProject == null) { putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId); return result; } if (!(targetProject.getName()).equals(projectName)) { Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName()); if (checkTargetProjectResult != null) { return checkTargetProjectResult; } } String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA); doBatchCopyProcessDefinition(loginUser, targetProject, failedProcessList, processDefinitionIdList); checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, true); return result; } /** * batch move process definition *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param loginUser loginUser * @param projectName projectName * @param processDefinitionIds processDefinitionIds * @param targetProjectId targetProjectId */ @Override public Map<String, Object> batchMoveProcessDefinition(User loginUser, String projectName, String processDefinitionIds, int targetProjectId) { Map<String, Object> result = new HashMap<>(); List<String> failedProcessList = new ArrayList<>(); Map<String, Object> checkResult = checkProjectAndAuth(loginUser, projectName); if (checkResult != null) { return checkResult; } if (StringUtils.isEmpty(processDefinitionIds)) { putMsg(result, Status.PROCESS_DEFINITION_IDS_IS_EMPTY, processDefinitionIds); return result; } Project targetProject = projectMapper.queryDetailById(targetProjectId); if (targetProject == null) { putMsg(result, Status.PROJECT_NOT_FOUNT, targetProjectId); return result; } if (!(targetProject.getName()).equals(projectName)) { Map<String, Object> checkTargetProjectResult = checkProjectAndAuth(loginUser, targetProject.getName()); if (checkTargetProjectResult != null) { return checkTargetProjectResult;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} } String[] processDefinitionIdList = processDefinitionIds.split(Constants.COMMA); doBatchMoveProcessDefinition(targetProject, failedProcessList, processDefinitionIdList); checkBatchOperateResult(projectName, targetProject.getName(), result, failedProcessList, false); return result; } /** * switch the defined process definition verison * * @param loginUser login user * @param projectName project name * @param processDefinitionId process definition id * @param version the version user want to switch * @return switch process definition version result code */ @Override public Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName , int processDefinitionId, long version) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(processDefinitionId); if (Objects.isNull(processDefinition)) { putMsg(result
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR , processDefinitionId); return result; } ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService .queryByProcessDefinitionIdAndVersion(processDefinitionId, version); if (Objects.isNull(processDefinitionVersion)) { putMsg(result , Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR , processDefinitionId , version); return result; } processDefinition.setVersion(processDefinitionVersion.getVersion()); processDefinition.setProcessDefinitionJson(processDefinitionVersion.getProcessDefinitionJson()); processDefinition.setDescription(processDefinitionVersion.getDescription()); processDefinition.setLocations(processDefinitionVersion.getLocations()); processDefinition.setConnects(processDefinitionVersion.getConnects()); processDefinition.setTimeout(processDefinitionVersion.getTimeout()); processDefinition.setGlobalParams(processDefinitionVersion.getGlobalParams()); processDefinition.setUpdateTime(new Date()); processDefinition.setWarningGroupId(processDefinitionVersion.getWarningGroupId()); processDefinition.setResourceIds(processDefinitionVersion.getResourceIds()); if (processDefineMapper.updateById(processDefinition) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * do batch move process definition * * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchMoveProcessDefinition(Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) { for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> moveProcessDefinitionResult = moveProcessDefinition(Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(moveProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) moveProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * batch copy process definition * * @param loginUser loginUser * @param targetProject targetProject * @param failedProcessList failedProcessList * @param processDefinitionIdList processDefinitionIdList */ private void doBatchCopyProcessDefinition(User loginUser, Project targetProject, List<String> failedProcessList, String[] processDefinitionIdList) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (String processDefinitionId : processDefinitionIdList) { try { Map<String, Object> copyProcessDefinitionResult = copyProcessDefinition(loginUser, Integer.valueOf(processDefinitionId), targetProject); if (!Status.SUCCESS.equals(copyProcessDefinitionResult.get(Constants.STATUS))) { setFailedProcessList(failedProcessList, processDefinitionId); logger.error((String) copyProcessDefinitionResult.get(Constants.MSG)); } } catch (Exception e) { setFailedProcessList(failedProcessList, processDefinitionId); } } } /** * set failed processList * * @param failedProcessList failedProcessList * @param processDefinitionId processDefinitionId */ private void setFailedProcessList(List<String> failedProcessList, String processDefinitionId) { ProcessDefinition processDefinition = processDefineMapper.queryByDefineId(Integer.valueOf(processDefinitionId)); if (processDefinition != null) { failedProcessList.add(processDefinitionId + "[" + processDefinition.getName() + "]"); } else { failedProcessList.add(processDefinitionId + "[null]"); } } /** * check project and auth *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param loginUser loginUser * @param projectName projectName */ private Map<String, Object> checkProjectAndAuth(User loginUser, String projectName) { Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } return null; } /** * move process definition * * @param processId processId * @param targetProject targetProject * @return move result code */ private Map<String, Object> moveProcessDefinition(Integer processId, Project targetProject) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefineMapper.selectById(processId); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId); return result; } processDefinition.setProjectId(targetProject.getId()); processDefinition.setUpdateTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefineMapper.updateById(processDefinition) > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * check batch operate result * * @param srcProjectName srcProjectName * @param targetProjectName targetProjectName * @param result result * @param failedProcessList failedProcessList * @param isCopy isCopy */ private void checkBatchOperateResult(String srcProjectName, String targetProjectName, Map<String, Object> result, List<String> failedProcessList, boolean isCopy) { if (!failedProcessList.isEmpty()) { if (isCopy) { putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } else { putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectName, targetProjectName, String.join(",", failedProcessList)); } } else { putMsg(result, Status.SUCCESS); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
/* * 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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
* See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionVersionService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionVersionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.ImmutableMap; /** * process definition version service impl */ @Service public class ProcessDefinitionVersionServiceImpl extends BaseServiceImpl implements ProcessDefinitionVersionService { @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
private ProcessDefinitionVersionMapper processDefinitionVersionMapper; @Autowired private ProjectService projectService; @Autowired private ProjectMapper projectMapper; /** * add the newest version of one process definition * * @param processDefinition the process definition that need to record version * @return the newest version number of this process definition */ @Override public long addProcessDefinitionVersion(ProcessDefinition processDefinition) { long version = this.queryMaxVersionByProcessDefinitionId(processDefinition.getId()) + 1; ProcessDefinitionVersion processDefinitionVersion = ProcessDefinitionVersion .newBuilder() .processDefinitionId(processDefinition.getId()) .version(version) .processDefinitionJson(processDefinition.getProcessDefinitionJson()) .description(processDefinition.getDescription()) .locations(processDefinition.getLocations()) .connects(processDefinition.getConnects()) .timeout(processDefinition.getTimeout()) .globalParams(processDefinition.getGlobalParams()) .createTime(processDefinition.getUpdateTime()) .warningGroupId(processDefinition.getWarningGroupId()) .resourceIds(processDefinition.getResourceIds()) .build(); processDefinitionVersionMapper.insert(processDefinitionVersion); return version;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
} /** * query the max version number by the process definition id * * @param processDefinitionId process definition id * @return the max version number of this id */ private long queryMaxVersionByProcessDefinitionId(int processDefinitionId) { Long maxVersion = processDefinitionVersionMapper.queryMaxVersionByProcessDefinitionId(processDefinitionId); if (Objects.isNull(maxVersion)) { return 0L; } else { return maxVersion; } } /** * query the pagination versions info by one certain process definition id * * @param loginUser login user info to check auth * @param projectName process definition project name * @param pageNo page number * @param pageSize page size * @param processDefinitionId process definition id * @return the pagination process definition versions info of the certain process definition */ @Override public Map<String, Object> queryProcessDefinitionVersions(User loginUser, String projectName, int pageNo, int pageSize, int processDefinitionId) { Map<String, Object> result = new HashMap<>(); if (pageNo <= 0 || pageSize <= 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
putMsg(result , Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR , pageNo , pageSize); return result; } Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } PageInfo<ProcessDefinitionVersion> pageInfo = new PageInfo<>(pageNo, pageSize); Page<ProcessDefinitionVersion> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinitionVersion> processDefinitionVersionsPaging = processDefinitionVersionMapper.queryProcessDefinitionVersionsPaging(page, processDefinitionId); List<ProcessDefinitionVersion> processDefinitionVersions = processDefinitionVersionsPaging.getRecords(); pageInfo.setLists(processDefinitionVersions); pageInfo.setTotalCount((int) processDefinitionVersionsPaging.getTotal()); return ImmutableMap.of( Constants.MSG, Status.SUCCESS.getMsg() , Constants.STATUS, Status.SUCCESS , Constants.DATA_LIST, pageInfo); } /** * query one certain process definition version by version number and process definition id * * @param processDefinitionId process definition id * @param version version number * @return the process definition version info
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionVersionServiceImpl.java
*/ @Override public ProcessDefinitionVersion queryByProcessDefinitionIdAndVersion(int processDefinitionId, long version) { return processDefinitionVersionMapper.queryByProcessDefinitionIdAndVersion(processDefinitionId, version); } /** * delete one certain process definition by version number and process definition id * * @param loginUser login user info to check auth * @param projectName process definition project name * @param processDefinitionId process definition id * @param version version number * @return delele result code */ @Override public Map<String, Object> deleteByProcessDefinitionIdAndVersion(User loginUser, String projectName, int processDefinitionId, long version) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { return checkResult; } processDefinitionVersionMapper.deleteByProcessDefinitionIdAndVersion(processDefinitionId, version); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
/* * 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.api.service; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionVersionServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionVersion; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionVersionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; /** * process definition version service test */ @RunWith(MockitoJUnitRunner.class) public class ProcessDefinitionVersionServiceTest { @InjectMocks private ProcessDefinitionVersionServiceImpl processDefinitionVersionService; @Mock private ProcessDefinitionVersionMapper processDefinitionVersionMapper; @Mock private ProjectMapper projectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
@Mock private ProjectServiceImpl projectService; @Test public void testAddProcessDefinitionVersion() { long expectedVersion = 5L; ProcessDefinition processDefinition = getProcessDefinition(); Mockito.when(processDefinitionVersionMapper .queryMaxVersionByProcessDefinitionId(processDefinition.getId())) .thenReturn(expectedVersion); long version = processDefinitionVersionService.addProcessDefinitionVersion(processDefinition); Assert.assertEquals(expectedVersion + 1, version); } @Test @SuppressWarnings("unchecked") public void testQueryProcessDefinitionVersions() { int pageNo = -1; int pageSize = 10; int processDefinitionId = 66; String projectName = "project_test1"; User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> resultMap1 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
, resultMap1.get(Constants.STATUS)); pageNo = 1; pageSize = -1; Map<String, Object> resultMap2 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR , resultMap2.get(Constants.STATUS)); Map<String, Object> res = new HashMap<>(); putMsg(res, Status.PROJECT_NOT_FOUNT); Project project = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)) .thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); pageNo = 1; pageSize = 10; Map<String, Object> resultMap3 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, resultMap3.get(Constants.STATUS)); putMsg(res, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); ProcessDefinitionVersion processDefinitionVersion = getProcessDefinitionVersion(getProcessDefinition()); Mockito.when(processDefinitionVersionMapper .queryProcessDefinitionVersionsPaging(Mockito.any(Page.class), Mockito.eq(processDefinitionId))) .thenReturn(new Page<ProcessDefinitionVersion>() .setRecords(Lists.newArrayList(processDefinitionVersion))); Map<String, Object> resultMap4 = processDefinitionVersionService.queryProcessDefinitionVersions( loginUser , projectName , pageNo , pageSize , processDefinitionId); Assert.assertEquals(Status.SUCCESS, resultMap4.get(Constants.STATUS)); Assert.assertEquals(processDefinitionVersion , ((PageInfo<ProcessDefinitionVersion>) resultMap4.get(Constants.DATA_LIST)) .getLists().get(0)); } @Test public void testQueryByProcessDefinitionIdAndVersion() { ProcessDefinitionVersion expectedProcessDefinitionVersion = getProcessDefinitionVersion(getProcessDefinition()); int processDefinitionId = 66; long version = 10; Mockito.when(processDefinitionVersionMapper.queryByProcessDefinitionIdAndVersion(processDefinitionId, version)) .thenReturn(expectedProcessDefinitionVersion); ProcessDefinitionVersion processDefinitionVersion = processDefinitionVersionService .queryByProcessDefinitionIdAndVersion(processDefinitionId, version); Assert.assertEquals(expectedProcessDefinitionVersion, processDefinitionVersion); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
@Test public void testDeleteByProcessDefinitionIdAndVersion() { String projectName = "project_test1"; int processDefinitionId = 66; long version = 10; Project project = getProject(projectName); Mockito.when(projectMapper.queryByName(projectName)) .thenReturn(project); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(new HashMap<>()); Map<String, Object> resultMap1 = processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion( loginUser , projectName , processDefinitionId , version); Assert.assertEquals(0, resultMap1.size()); Map<String, Object> res = new HashMap<>(); putMsg(res, Status.SUCCESS); Mockito.when(processDefinitionVersionMapper.deleteByProcessDefinitionIdAndVersion(processDefinitionId, version)) .thenReturn(1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectName)) .thenReturn(res); Map<String, Object> resultMap2 = processDefinitionVersionService.deleteByProcessDefinitionIdAndVersion( loginUser , projectName , processDefinitionId
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
, version); Assert.assertEquals(Status.SUCCESS, resultMap2.get(Constants.STATUS)); } /** * get mock processDefinitionVersion by processDefinition * * @return processDefinitionVersion */ private ProcessDefinitionVersion getProcessDefinitionVersion(ProcessDefinition processDefinition) { return ProcessDefinitionVersion .newBuilder() .processDefinitionId(processDefinition.getId()) .version(1) .processDefinitionJson(processDefinition.getProcessDefinitionJson()) .description(processDefinition.getDescription()) .locations(processDefinition.getLocations()) .connects(processDefinition.getConnects()) .timeout(processDefinition.getTimeout()) .globalParams(processDefinition.getGlobalParams()) .createTime(processDefinition.getUpdateTime()) .warningGroupId(processDefinition.getWarningGroupId()) .resourceIds(processDefinition.getResourceIds()) .build(); } /** * get mock processDefinition * * @return ProcessDefinition */ private ProcessDefinition getProcessDefinition() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionVersionServiceTest.java
ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(66); processDefinition.setName("test_pdf"); processDefinition.setProjectId(2); processDefinition.setTenantId(1); processDefinition.setDescription(""); return processDefinition; } /** * get mock Project * * @param projectName projectName * @return Project */ private Project getProject(String projectName) { Project project = new Project(); project.setId(1); project.setName(projectName); project.setUserId(1); return project; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,059
[Improvement][API] Verify that the new workflow definition version is the current version before removing it
**Describe the question** Verify that the new workflow definition version is the current version before removing it 1.A new method to the Delete API verifies that the workflow definition version is in use 2.UI additions prohibit deleting the current version **Which version of DolphinScheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/5059
https://github.com/apache/dolphinscheduler/pull/5060
6216817861c64d9a170686c4c5aa6f3b9b0da110
705715c3130be49a8bab9bc2d181b2ad26d453da
"2021-03-15T12:35:24Z"
java
"2021-03-18T01:37:17Z"
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.java
/* * 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.mapper; import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * process definition mapper interface */ public interface ProcessDefinitionMapper extends BaseMapper<ProcessDefinition> {