zhongjiajie commented on code in PR #11912:
URL: https://github.com/apache/dolphinscheduler/pull/11912#discussion_r976233781
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java:
##########
@@ -270,6 +350,61 @@ public Map<String, Object> updateSchedule(User loginUser,
return result;
}
+ /**
+ * update schedule object V2
+ *
+ * @param loginUser login user
+ * @param scheduleId scheduler id
+ * @param scheduleUpdateRequest the schedule object will be updated
+ * @return Schedule object
+ */
+ @Override
+ @Transactional
+ public Schedule updateSchedulesV2(User loginUser,
+ Integer scheduleId,
+ ScheduleUpdateRequest
scheduleUpdateRequest) {
+ Schedule schedule = scheduleMapper.selectById(scheduleId);
+ if (schedule == null) {
+ throw new ServiceException(Status.SCHEDULE_NOT_EXISTS, scheduleId);
+ }
+ Schedule scheduleUpdate =
scheduleUpdateRequest.mergeIntoSchedule(schedule);
+
+ // check update params
+ this.projectPermCheckByProcess(loginUser,
scheduleUpdate.getProcessDefinitionCode());
+
this.scheduleParamCheck(scheduleUpdateRequest.updateScheduleParam(scheduleUpdate));
+ if (scheduleUpdate.getEnvironmentCode() != null) {
+ Environment environment =
environmentMapper.queryByEnvironmentCode(scheduleUpdate.getEnvironmentCode());
+ if (environment == null) {
+ throw new
ServiceException(Status.QUERY_ENVIRONMENT_BY_CODE_ERROR,
scheduleUpdate.getEnvironmentCode());
+ }
+ }
+
+ int update = scheduleMapper.updateById(scheduleUpdate);
+ if (update <= 0) {
+ throw new ServiceException(Status.UPDATE_SCHEDULE_ERROR);
+ }
+ return scheduleUpdate;
+ }
+
+ /**
+ * get schedule object
+ *
+ * @param loginUser login user
+ * @param scheduleId scheduler id
+ * @return Schedule object
+ */
+ @Override
+ @Transactional
+ public Schedule getSchedules(User loginUser,
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]