From 93abae94e49af56c12bb0b45f6b42f9d81322072 Mon Sep 17 00:00:00 2001 From: JinyLeeChina <42576980+JinyLeeChina@users.noreply.github.com> Date: Thu, 29 Jul 2021 16:49:52 +0800 Subject: [PATCH] [Feature][JsonSplit-api] export/import of ProcessDefinition api (#5910) * modify viewTree of ProcessDefiniton * modify ut * modify ut * modify viewTree of ProcessDefiniton * export/import of ProcessDefinition api * fix ut * fix ut * fix codeStyle Co-authored-by: JinyLeeChina <297062848@qq.com> --- .../api/controller/AccessTokenController.java | 30 +- .../api/controller/AlertGroupController.java | 24 +- .../AlertPluginInstanceController.java | 20 +- .../api/controller/BaseController.java | 8 +- .../controller/DataAnalysisController.java | 4 +- .../api/controller/DataSourceController.java | 44 +- .../api/controller/ExecutorController.java | 4 +- .../api/controller/LoggerController.java | 28 +- .../api/controller/LoginController.java | 14 +- .../ProcessDefinitionController.java | 101 ++-- .../controller/ProcessInstanceController.java | 148 +++--- .../api/controller/ProjectController.java | 26 +- .../api/controller/QueueController.java | 32 +- .../api/controller/ResourcesController.java | 186 ++++--- .../api/controller/SchedulerController.java | 50 +- .../controller/TaskDefinitionController.java | 27 +- .../controller/TaskInstanceController.java | 51 +- .../api/controller/TenantController.java | 25 +- .../api/controller/UiPluginController.java | 2 +- .../api/controller/UsersController.java | 150 +++--- .../controller/WorkFlowLineageController.java | 4 +- .../api/controller/WorkerGroupController.java | 26 +- .../api/dto/DagDataSchedule.java | 47 ++ .../dolphinscheduler/api/dto/ProcessMeta.java | 231 --------- .../api/service/ProcessDefinitionService.java | 16 +- .../impl/ProcessDefinitionServiceImpl.java | 486 ++++-------------- .../ProcessDefinitionControllerTest.java | 6 +- .../api/service/DataAnalysisServiceTest.java | 18 +- .../service/ProcessDefinitionServiceTest.java | 260 +--------- .../dolphinscheduler/common/Constants.java | 5 + .../dolphinscheduler/dao/entity/DagData.java | 3 + .../dao/entity/ProcessDefinition.java | 16 +- .../dolphinscheduler/dao/entity/Project.java | 10 +- .../mapper/ProcessDefinitionLogMapper.java | 8 +- .../dao/mapper/ProcessDefinitionMapper.java | 30 +- .../mapper/ProcessTaskRelationLogMapper.java | 5 - .../dao/mapper/ProcessTaskRelationMapper.java | 10 +- .../dao/mapper/ProjectMapper.java | 4 +- .../dao/mapper/TaskDefinitionLogMapper.java | 2 +- .../dao/mapper/TaskDefinitionMapper.java | 8 +- .../dao/mapper/ProcessDefinitionMapper.xml | 7 - .../mapper/ProcessTaskRelationLogMapper.xml | 9 - .../mapper/ProcessDefinitionMapperTest.java | 11 - .../service/process/ProcessService.java | 2 +- .../service/process/ProcessServiceTest.java | 1 + 45 files changed, 730 insertions(+), 1469 deletions(-) create mode 100644 dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.java delete mode 100644 dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/ProcessMeta.java diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java index ebf4a3d628..7e336b58c6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AccessTokenController.java @@ -64,10 +64,10 @@ public class AccessTokenController extends BaseController { /** * create token * - * @param loginUser login user - * @param userId token for user id + * @param loginUser login user + * @param userId token for user id * @param expireTime expire time for the token - * @param token token + * @param token token * @return create result state code */ @ApiIgnore @@ -87,8 +87,8 @@ public class AccessTokenController extends BaseController { /** * generate token string * - * @param loginUser login user - * @param userId token for user + * @param loginUser login user + * @param userId token for user * @param expireTime expire time * @return token string */ @@ -108,16 +108,16 @@ public class AccessTokenController extends BaseController { * query access token list paging * * @param loginUser login user - * @param pageNo page number + * @param pageNo page number * @param searchVal search value - * @param pageSize page size + * @param pageSize page size * @return token list of page number and page size */ @ApiOperation(value = "queryAccessTokenList", notes = "QUERY_ACCESS_TOKEN_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -141,7 +141,7 @@ public class AccessTokenController extends BaseController { * delete access token by id * * @param loginUser login user - * @param id token id + * @param id token id * @return delete result code */ @ApiIgnore @@ -159,11 +159,11 @@ public class AccessTokenController extends BaseController { /** * update token * - * @param loginUser login user - * @param id token id - * @param userId token for user + * @param loginUser login user + * @param id token id + * @param userId token for user * @param expireTime token expire time - * @param token token string + * @param token token string * @return update result code */ @ApiIgnore diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java index 59a6eaa72c..1a05f277de 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertGroupController.java @@ -76,9 +76,9 @@ public class AlertGroupController extends BaseController { */ @ApiOperation(value = "createAlertgroup", notes = "CREATE_ALERT_GROUP_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), - @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") + @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), + @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -120,9 +120,9 @@ public class AlertGroupController extends BaseController { */ @ApiOperation(value = "queryAlertGroupListPaging", notes = "QUERY_ALERT_GROUP_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -153,10 +153,10 @@ public class AlertGroupController extends BaseController { */ @ApiOperation(value = "updateAlertgroup", notes = "UPDATE_ALERT_GROUP_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), - @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") + @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), + @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -181,7 +181,7 @@ public class AlertGroupController extends BaseController { */ @ApiOperation(value = "delAlertgroupById", notes = "DELETE_ALERT_GROUP_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -203,7 +203,7 @@ public class AlertGroupController extends BaseController { */ @ApiOperation(value = "verifyGroupName", notes = "VERIFY_ALERT_GROUP_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), }) @GetMapping(value = "/verify-group-name") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java index f9f58ed801..4ccbadfb3e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/AlertPluginInstanceController.java @@ -77,9 +77,9 @@ public class AlertPluginInstanceController extends BaseController { */ @ApiOperation(value = "createAlertPluginInstance", notes = "CREATE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pluginDefineId", value = "ALERT_PLUGIN_DEFINE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), - @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") + @ApiImplicitParam(name = "pluginDefineId", value = "ALERT_PLUGIN_DEFINE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), + @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -104,9 +104,9 @@ public class AlertPluginInstanceController extends BaseController { */ @ApiOperation(value = "updateAlertPluginInstance", notes = "UPDATE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "alertPluginInstanceId", value = "ALERT_PLUGIN_INSTANCE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), - @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") + @ApiImplicitParam(name = "alertPluginInstanceId", value = "ALERT_PLUGIN_INSTANCE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), + @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -129,7 +129,7 @@ public class AlertPluginInstanceController extends BaseController { */ @ApiOperation(value = "deleteAlertPluginInstance", notes = "DELETE_ALERT_PLUGIN_INSTANCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -185,7 +185,7 @@ public class AlertPluginInstanceController extends BaseController { */ @ApiOperation(value = "verifyAlertInstanceName", notes = "VERIFY_ALERT_INSTANCE_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), }) @GetMapping(value = "/verify-alert-instance-name") @ResponseStatus(HttpStatus.OK) @@ -216,8 +216,8 @@ public class AlertPluginInstanceController extends BaseController { */ @ApiOperation(value = "queryAlertPluginInstanceListPaging", notes = "QUERY_ALERT_PLUGIN_INSTANCE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java index f42b554791..cc9f5d7959 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java @@ -110,6 +110,7 @@ public class BaseController { /** * return data list with paging + * * @param result result code * @return result code */ @@ -119,7 +120,7 @@ public class BaseController { result.put(Constants.MSG, Status.SUCCESS.getMsg()); PageInfo pageInfo = (PageInfo) result.get(Constants.DATA_LIST); return success(pageInfo.getLists(), pageInfo.getCurrentPage(), pageInfo.getTotalCount(), - pageInfo.getTotalPage()); + pageInfo.getTotalPage()); } else { Integer code = status.getCode(); String msg = (String) result.get(Constants.MSG); @@ -193,11 +194,11 @@ public class BaseController { * @param totalList success object list * @param currentPage current page * @param total total - * @param totalPage total page + * @param totalPage total page * @return success result code */ public Result success(Object totalList, Integer currentPage, - Integer total, Integer totalPage) { + Integer total, Integer totalPage) { Result result = new Result(); result.setCode(Status.SUCCESS.getCode()); result.setMsg(Status.SUCCESS.getMsg()); @@ -261,6 +262,7 @@ public class BaseController { /** * get result + * * @param msg message * @param list object list * @return result code diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java index a99ceb4d8a..424f4aba30 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataAnalysisController.java @@ -63,7 +63,7 @@ public class DataAnalysisController extends BaseController { * * @param loginUser login user * @param startDate count start date - * @param endDate count end date + * @param endDate count end date * @param projectCode project code * @return task instance count data */ @@ -91,7 +91,7 @@ public class DataAnalysisController extends BaseController { * * @param loginUser login user * @param startDate start date - * @param endDate end date + * @param endDate end date * @param projectCode project code * @return process instance data */ diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java index e8e4672105..a77f05ce31 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java @@ -101,7 +101,7 @@ public class DataSourceController extends BaseController { */ @ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), + @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -116,12 +116,12 @@ public class DataSourceController extends BaseController { * query data source detail * * @param loginUser login user - * @param id datasource id + * @param id datasource id * @return data source detail */ @ApiOperation(value = "queryDataSource", notes = "QUERY_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/update-ui") @@ -139,12 +139,12 @@ public class DataSourceController extends BaseController { * query datasouce by type * * @param loginUser login user - * @param type data source type + * @param type data source type * @return data source list page */ @ApiOperation(value = "queryDataSourceList", notes = "QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "DB_TYPE", required = true, dataType = "DbType") + @ApiImplicitParam(name = "type", value = "DB_TYPE", required = true, dataType = "DbType") }) @GetMapping(value = "/list") @ResponseStatus(HttpStatus.OK) @@ -161,15 +161,15 @@ public class DataSourceController extends BaseController { * * @param loginUser login user * @param searchVal search value - * @param pageNo page number - * @param pageSize page size + * @param pageNo page number + * @param pageSize page size * @return data source list page */ @ApiOperation(value = "queryDataSourceListPaging", notes = "QUERY_DATA_SOURCE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -192,12 +192,12 @@ public class DataSourceController extends BaseController { * connect datasource * * @param loginUser login user - * @param dataSourceParam datasource param + * @param dataSourceParam datasource param * @return connect result code */ @ApiOperation(value = "connectDataSource", notes = "CONNECT_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), + @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), }) @PostMapping(value = "/connect") @ResponseStatus(HttpStatus.OK) @@ -214,12 +214,12 @@ public class DataSourceController extends BaseController { * connection test * * @param loginUser login user - * @param id data source id + * @param id data source id * @return connect result code */ @ApiOperation(value = "connectionTest", notes = "CONNECT_DATA_SOURCE_TEST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/connect-by-id") @ResponseStatus(HttpStatus.OK) @@ -234,12 +234,12 @@ public class DataSourceController extends BaseController { * delete datasource by id * * @param loginUser login user - * @param id datasource id + * @param id datasource id * @return delete result */ @ApiOperation(value = "deleteDataSource", notes = "DELETE_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -254,12 +254,12 @@ public class DataSourceController extends BaseController { * verify datasource name * * @param loginUser login user - * @param name data source name + * @param name data source name * @return true if data source name not exists.otherwise return false */ @ApiOperation(value = "verifyDataSourceName", notes = "VERIFY_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType = "String") }) @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @@ -276,12 +276,12 @@ public class DataSourceController extends BaseController { * unauthorized datasource * * @param loginUser login user - * @param userId user id + * @param userId user id * @return unauthed data source result code */ @ApiOperation(value = "unauthDatasource", notes = "UNAUTHORIZED_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/unauth-datasource") @ResponseStatus(HttpStatus.OK) @@ -299,12 +299,12 @@ public class DataSourceController extends BaseController { * authorized datasource * * @param loginUser login user - * @param userId user id + * @param userId user id * @return authorized result code */ @ApiOperation(value = "authedDatasource", notes = "AUTHORIZED_DATA_SOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/authed-datasource") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java index 0a5c8a10dd..605a960879 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java @@ -128,8 +128,8 @@ public class ExecutorController extends BaseController { startParamMap = JSONUtils.toMap(startParams); } Map result = execService.execProcessInstance(loginUser, projectCode, processDefinitionCode, scheduleTime, execType, failureStrategy, - startNodeList, taskDependType, warningType, - warningGroupId, runMode, processInstancePriority, workerGroup, timeout, startParamMap); + startNodeList, taskDependType, warningType, + warningGroupId, runMode, processInstancePriority, workerGroup, timeout, startParamMap); return returnDataList(result); } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java index 4990d34d6f..3800264f6b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoggerController.java @@ -59,26 +59,26 @@ public class LoggerController extends BaseController { /** * query task log * - * @param loginUser login user + * @param loginUser login user * @param taskInstanceId task instance id - * @param skipNum skip number - * @param limit limit + * @param skipNum skip number + * @param limit limit * @return task log content */ @ApiOperation(value = "queryLog", notes = "QUERY_TASK_INSTANCE_LOG_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskInstanceId", value = "TASK_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "taskInstanceId", value = "TASK_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/detail") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_TASK_INSTANCE_LOG_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryLog(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam(value = "taskInstanceId") int taskInstanceId, - @RequestParam(value = "skipLineNum") int skipNum, - @RequestParam(value = "limit") int limit) { + @RequestParam(value = "taskInstanceId") int taskInstanceId, + @RequestParam(value = "skipLineNum") int skipNum, + @RequestParam(value = "limit") int limit) { return loggerService.queryLog(taskInstanceId, skipNum, limit); } @@ -86,13 +86,13 @@ public class LoggerController extends BaseController { /** * download log file * - * @param loginUser login user + * @param loginUser login user * @param taskInstanceId task instance id * @return log file content */ @ApiOperation(value = "downloadTaskLog", notes = "DOWNLOAD_TASK_INSTANCE_LOG_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskInstanceId", value = "TASK_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "taskInstanceId", value = "TASK_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/download-log") @ResponseBody @@ -102,9 +102,9 @@ public class LoggerController extends BaseController { @RequestParam(value = "taskInstanceId") int taskInstanceId) { byte[] logBytes = loggerService.getLogBytes(taskInstanceId); return ResponseEntity - .ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + System.currentTimeMillis() + ".log" + "\"") - .body(logBytes); + .ok() + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + System.currentTimeMillis() + ".log" + "\"") + .body(logBytes); } } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java index dda9192232..1527408e7b 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java @@ -70,16 +70,16 @@ public class LoginController extends BaseController { /** * login * - * @param userName user name + * @param userName user name * @param userPassword user password - * @param request request - * @param response response + * @param request request + * @param response response * @return login result */ @ApiOperation(value = "login", notes = "LOGIN_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, dataType = "String") + @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, dataType = "String") }) @PostMapping(value = "/login") @ApiException(USER_LOGIN_FAILURE) @@ -91,7 +91,7 @@ public class LoginController extends BaseController { //user name check if (StringUtils.isEmpty(userName)) { return error(Status.USER_NAME_NULL.getCode(), - Status.USER_NAME_NULL.getMsg()); + Status.USER_NAME_NULL.getMsg()); } // user ip check @@ -121,7 +121,7 @@ public class LoginController extends BaseController { * sign out * * @param loginUser login user - * @param request request + * @param request request * @return sign out result */ @ApiOperation(value = "signOut", notes = "SIGNOUT_NOTES") diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java index a5dd7aefbc..6dae09f523 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java @@ -108,10 +108,10 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "save", notes = "CREATE_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), - @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String") + @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), + @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), + @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String") }) @PostMapping(value = "/save") @ResponseStatus(HttpStatus.CREATED) @@ -129,7 +129,7 @@ public class ProcessDefinitionController extends BaseController { @RequestParam(value = "taskRelationJson", required = true) String taskRelationJson) throws JsonProcessingException { Map result = processDefinitionService.createProcessDefinition(loginUser, projectCode, name, description, globalParams, - connects, locations, timeout, tenantCode, taskRelationJson); + connects, locations, timeout, tenantCode, taskRelationJson); return returnDataList(result); } @@ -144,8 +144,8 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "copy", notes = "COPY_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"), - @ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123") + @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"), + @ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123") }) @PostMapping(value = "/copy") @ResponseStatus(HttpStatus.OK) @@ -169,8 +169,8 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "moveProcessDefinition", notes = "MOVE_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"), - @ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123") + @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, dataType = "String", example = "3,4"), + @ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataType = "Long", example = "123") }) @PostMapping(value = "/move") @ResponseStatus(HttpStatus.OK) @@ -193,7 +193,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "verify-name", notes = "VERIFY_PROCESS_DEFINITION_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String") + @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String") }) @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @@ -225,12 +225,12 @@ public class ProcessDefinitionController extends BaseController { @ApiOperation(value = "update", notes = "UPDATE_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), - @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), - @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"), - @ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState") + @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), + @ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type = "String"), + @ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type = "String"), + @ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, type = "String"), + @ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataType = "ReleaseState") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -250,7 +250,7 @@ public class ProcessDefinitionController extends BaseController { @RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) { Map result = processDefinitionService.updateProcessDefinition(loginUser, projectCode, name, code, description, globalParams, - connects, locations, timeout, tenantCode, taskRelationJson); + connects, locations, timeout, tenantCode, taskRelationJson); // If the update fails, the result will be returned directly if (result.get(Constants.STATUS) != Status.SUCCESS) { return returnDataList(result); @@ -275,9 +275,9 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "queryVersions", notes = "QUERY_PROCESS_DEFINITION_VERSIONS_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "1") }) @GetMapping(value = "/versions") @ResponseStatus(HttpStatus.OK) @@ -303,8 +303,8 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "switchVersion", notes = "SWITCH_PROCESS_DEFINITION_VERSION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100") + @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100") }) @GetMapping(value = "/version/switch") @ResponseStatus(HttpStatus.OK) @@ -329,8 +329,8 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "deleteVersion", notes = "DELETE_PROCESS_DEFINITION_VERSION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100") + @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Long", example = "100") }) @GetMapping(value = "/version/delete") @ResponseStatus(HttpStatus.OK) @@ -355,9 +355,9 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "release", notes = "RELEASE_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), - @ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "ReleaseState"), + @ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789"), + @ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "ReleaseState"), }) @PostMapping(value = "/release") @ResponseStatus(HttpStatus.OK) @@ -381,7 +381,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "queryProcessDefinitionByCode", notes = "QUERY_PROCESS_DEFINITION_BY_CODE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789") + @ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "123456789") }) @GetMapping(value = "/select-by-code") @ResponseStatus(HttpStatus.OK) @@ -404,7 +404,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "queryProcessDefinitionByName", notes = "QUERY_PROCESS_DEFINITION_BY_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionName", value = "PROCESS_DEFINITION_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "processDefinitionName", value = "PROCESS_DEFINITION_NAME", required = true, dataType = "String") }) @GetMapping(value = "/select-by-name") @ResponseStatus(HttpStatus.OK) @@ -448,10 +448,10 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "queryListPaging", notes = "QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"), - @ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"), + @ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -508,17 +508,17 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "getNodeListByDefinitionCode", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100") + @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100") }) @GetMapping(value = "gen-task-list") @ResponseStatus(HttpStatus.OK) @ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR) public Result getNodeListByDefinitionCode( - @ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode, - @RequestParam("processDefinitionCode") long processDefinitionCode) { + @ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode, + @RequestParam("processDefinitionCode") long processDefinitionCode) { logger.info("query task node name list by definitionCode, login user:{}, project name:{}, code : {}", - loginUser.getUserName(), projectCode, processDefinitionCode); + loginUser.getUserName(), projectCode, processDefinitionCode); Map result = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, processDefinitionCode); return returnDataList(result); } @@ -533,7 +533,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "getNodeListByDefinitionCodes", notes = "GET_NODE_LIST_BY_DEFINITION_CODE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, type = "String", example = "100,200,300") + @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODES", required = true, type = "String", example = "100,200,300") }) @GetMapping(value = "gen-task-list-map") @ResponseStatus(HttpStatus.OK) @@ -555,7 +555,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "deleteByCode", notes = "DELETE_PROCESS_DEFINITION_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100") + @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -578,7 +578,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "batchDeleteByCodes", notes = "BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", type = "String") + @ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_IDS", type = "String") }) @GetMapping(value = "/batch-delete") @ResponseStatus(HttpStatus.OK) @@ -620,23 +620,22 @@ public class ProcessDefinitionController extends BaseController { * * @param loginUser login user * @param projectCode project code - * @param processDefinitionIds process definition ids + * @param processDefinitionCodes process definition codes * @param response response */ - - @ApiOperation(value = "batchExportByCodes", notes = "BATCH_EXPORT_PROCESS_DEFINITION_BY_IDS_NOTES") + @ApiOperation(value = "batchExportByCodes", notes = "BATCH_EXPORT_PROCESS_DEFINITION_BY_CODES_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionIds", value = "PROCESS_DEFINITION_ID", required = true, dataType = "String") + @ApiImplicitParam(name = "processDefinitionCodes", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "String") }) @GetMapping(value = "/export") @ResponseBody @AccessLogAnnotation(ignoreRequestArgs = {"loginUser", "response"}) - public void batchExportProcessDefinitionByIds(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode, - @RequestParam("processDefinitionIds") String processDefinitionIds, - HttpServletResponse response) { + public void batchExportProcessDefinitionByCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, + @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode, + @RequestParam("processDefinitionCodes") String processDefinitionCodes, + HttpServletResponse response) { try { - processDefinitionService.batchExportProcessDefinitionByIds(loginUser, projectCode, processDefinitionIds, response); + processDefinitionService.batchExportProcessDefinitionByCodes(loginUser, projectCode, processDefinitionCodes, response); } catch (Exception e) { logger.error(Status.BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR.getMsg(), e); } @@ -670,7 +669,7 @@ public class ProcessDefinitionController extends BaseController { */ @ApiOperation(value = "importProcessDefinition", notes = "IMPORT_PROCESS_DEFINITION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") + @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") }) @PostMapping(value = "/import") @ApiException(IMPORT_PROCESS_DEFINE_ERROR) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java index c99f2d58ec..9a6a3de07a 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessInstanceController.java @@ -85,29 +85,29 @@ public class ProcessInstanceController extends BaseController { /** * query process instance list paging * - * @param loginUser login user - * @param projectName project name - * @param pageNo page number - * @param pageSize page size + * @param loginUser login user + * @param projectName project name + * @param pageNo page number + * @param pageSize page size * @param processDefinitionId process definition id - * @param searchVal search value - * @param stateType state type - * @param host host - * @param startTime start time - * @param endTime end time + * @param searchVal search value + * @param stateType state type + * @param host host + * @param startTime start time + * @param endTime end time * @return process instance list */ @ApiOperation(value = "queryProcessInstanceList", notes = "QUERY_PROCESS_INSTANCE_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), - @ApiImplicitParam(name = "executorName", value = "EXECUTOR_NAME", type = "String"), - @ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type = "ExecutionStatus"), - @ApiImplicitParam(name = "host", value = "HOST", type = "String"), - @ApiImplicitParam(name = "startDate", value = "START_DATE", type = "String"), - @ApiImplicitParam(name = "endDate", value = "END_DATE", type = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), + @ApiImplicitParam(name = "executorName", value = "EXECUTOR_NAME", type = "String"), + @ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type = "ExecutionStatus"), + @ApiImplicitParam(name = "host", value = "HOST", type = "String"), + @ApiImplicitParam(name = "startDate", value = "START_DATE", type = "String"), + @ApiImplicitParam(name = "endDate", value = "END_DATE", type = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "list-paging") @ResponseStatus(HttpStatus.OK) @@ -131,21 +131,21 @@ public class ProcessInstanceController extends BaseController { } searchVal = ParameterUtils.handleEscapes(searchVal); result = processInstanceService.queryProcessInstanceList( - loginUser, projectName, processDefinitionId, startTime, endTime, searchVal, executorName, stateType, host, pageNo, pageSize); + loginUser, projectName, processDefinitionId, startTime, endTime, searchVal, executorName, stateType, host, pageNo, pageSize); return returnDataListPaging(result); } /** * query task list by process instance id * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceId process instance id * @return task list for the process instance */ @ApiOperation(value = "queryTaskListByProcessId", notes = "QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/task-list-by-process-id") @ResponseStatus(HttpStatus.OK) @@ -162,26 +162,26 @@ public class ProcessInstanceController extends BaseController { /** * update process instance * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceJson process instance json - * @param processInstanceId process instance id - * @param scheduleTime schedule time - * @param syncDefine sync define - * @param flag flag - * @param locations locations - * @param connects connects + * @param processInstanceId process instance id + * @param scheduleTime schedule time + * @param syncDefine sync define + * @param flag flag + * @param locations locations + * @param connects connects * @return update result code */ @ApiOperation(value = "updateProcessInstance", notes = "UPDATE_PROCESS_INSTANCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceJson", value = "PROCESS_INSTANCE_JSON", type = "String"), - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"), - @ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", required = true, type = "Boolean"), - @ApiImplicitParam(name = "locations", value = "PROCESS_INSTANCE_LOCATIONS", type = "String"), - @ApiImplicitParam(name = "connects", value = "PROCESS_INSTANCE_CONNECTS", type = "String"), - @ApiImplicitParam(name = "flag", value = "RECOVERY_PROCESS_INSTANCE_FLAG", type = "Flag"), + @ApiImplicitParam(name = "processInstanceJson", value = "PROCESS_INSTANCE_JSON", type = "String"), + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"), + @ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", required = true, type = "Boolean"), + @ApiImplicitParam(name = "locations", value = "PROCESS_INSTANCE_LOCATIONS", type = "String"), + @ApiImplicitParam(name = "connects", value = "PROCESS_INSTANCE_CONNECTS", type = "String"), + @ApiImplicitParam(name = "flag", value = "RECOVERY_PROCESS_INSTANCE_FLAG", type = "Flag"), }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -198,21 +198,21 @@ public class ProcessInstanceController extends BaseController { @RequestParam(value = "flag", required = false) Flag flag ) throws ParseException { Map result = processInstanceService.updateProcessInstance(loginUser, projectName, - processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations, connects); + processInstanceId, processInstanceJson, scheduleTime, syncDefine, flag, locations, connects); return returnDataList(result); } /** * query process instance by id * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceId process instance id * @return process instance detail */ @ApiOperation(value = "queryProcessInstanceById", notes = "QUERY_PROCESS_INSTANCE_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/select-by-id") @ResponseStatus(HttpStatus.OK) @@ -229,32 +229,32 @@ public class ProcessInstanceController extends BaseController { /** * query top n process instance order by running duration * - * @param loginUser login user - * @param projectName project name - * @param size number of process instance - * @param startTime start time - * @param endTime end time - * @return list of process instance + * @param loginUser login user + * @param projectName project name + * @param size number of process instance + * @param startTime start time + * @param endTime end time + * @return list of process instance */ @ApiOperation(value = "queryTopNLongestRunningProcessInstance", notes = "QUERY_TOPN_LONGEST_RUNNING_PROCESS_INSTANCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "size", value = "PROCESS_INSTANCE_SIZE", required = true, dataType = "Int", example = "10"), - @ApiImplicitParam(name = "startTime", value = "PROCESS_INSTANCE_START_TIME", required = true, dataType = "String"), - @ApiImplicitParam(name = "endTime", value = "PROCESS_INSTANCE_END_TIME", required = true, dataType = "String"), + @ApiImplicitParam(name = "size", value = "PROCESS_INSTANCE_SIZE", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "startTime", value = "PROCESS_INSTANCE_START_TIME", required = true, dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "PROCESS_INSTANCE_END_TIME", required = true, dataType = "String"), }) @GetMapping(value = "/top-n") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_PROCESS_INSTANCE_BY_ID_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryTopNLongestRunningProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, - @RequestParam("size") Integer size, - @RequestParam(value = "startTime",required = true) String startTime, - @RequestParam(value = "endTime",required = true) String endTime + @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, + @RequestParam("size") Integer size, + @RequestParam(value = "startTime", required = true) String startTime, + @RequestParam(value = "endTime", required = true) String endTime ) { - projectName=ParameterUtils.handleEscapes(projectName); - Map result=processInstanceService.queryTopNLongestRunningProcessInstance(loginUser, projectName, size, startTime, endTime); + projectName = ParameterUtils.handleEscapes(projectName); + Map result = processInstanceService.queryTopNLongestRunningProcessInstance(loginUser, projectName, size, startTime, endTime); return returnDataList(result); } @@ -262,14 +262,14 @@ public class ProcessInstanceController extends BaseController { * delete process instance by id, at the same time, * delete task instance and their mapping relation data * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceId process instance id * @return delete result code */ @ApiOperation(value = "deleteProcessInstanceById", notes = "DELETE_PROCESS_INSTANCE_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -287,14 +287,14 @@ public class ProcessInstanceController extends BaseController { /** * query sub process instance detail info by task id * - * @param loginUser login user + * @param loginUser login user * @param projectName project name - * @param taskId task id + * @param taskId task id * @return sub process instance detail */ @ApiOperation(value = "querySubProcessInstanceByTaskId", notes = "QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskId", value = "TASK_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "taskId", value = "TASK_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/select-sub-process") @ResponseStatus(HttpStatus.OK) @@ -310,14 +310,14 @@ public class ProcessInstanceController extends BaseController { /** * query parent process instance detail info by sub process instance id * - * @param loginUser login user + * @param loginUser login user * @param projectName project name - * @param subId sub process id + * @param subId sub process id * @return parent instance detail */ @ApiOperation(value = "queryParentInstanceBySubId", notes = "QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "subId", value = "SUB_PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "subId", value = "SUB_PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/select-parent-process") @ResponseStatus(HttpStatus.OK) @@ -333,13 +333,13 @@ public class ProcessInstanceController extends BaseController { /** * query process instance global variables and local variables * - * @param loginUser login user + * @param loginUser login user * @param processInstanceId process instance id * @return variables data */ @ApiOperation(value = "viewVariables", notes = "QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/view-variables") @ResponseStatus(HttpStatus.OK) @@ -354,14 +354,14 @@ public class ProcessInstanceController extends BaseController { /** * encapsulation gantt structure * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceId process instance id * @return gantt tree data */ @ApiOperation(value = "vieGanttTree", notes = "VIEW_GANTT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/view-gantt") @ResponseStatus(HttpStatus.OK) @@ -378,15 +378,15 @@ public class ProcessInstanceController extends BaseController { * batch delete process instance by ids, at the same time, * delete task instance and their mapping relation data * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceIds process instance id * @return delete result code */ @ApiOperation(value = "batchDeleteProcessInstanceByIds", notes = "BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "processInstanceIds", value = "PROCESS_INSTANCE_IDS", required = true, dataType = "String"), + @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "processInstanceIds", value = "PROCESS_INSTANCE_IDS", required = true, dataType = "String"), }) @GetMapping(value = "/batch-delete") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java index 9032905831..ca7e081a58 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java @@ -74,8 +74,8 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "create", notes = "CREATE_PROJECT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), - @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String") + @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), + @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -99,10 +99,10 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "update", notes = "UPDATE_PROJECT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456"), - @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), - @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"), - @ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"), + @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456"), + @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), + @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"), + @ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"), }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -126,7 +126,7 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "queryProjectByCode", notes = "QUERY_PROJECT_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456") + @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456") }) @GetMapping(value = "/query-by-code") @ResponseStatus(HttpStatus.OK) @@ -149,9 +149,9 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "queryProjectListPaging", notes = "QUERY_PROJECT_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -179,7 +179,7 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "delete", notes = "DELETE_PROJECT_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456") + @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "123456") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -200,7 +200,7 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "queryUnauthorizedProject", notes = "QUERY_UNAUTHORIZED_PROJECT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") }) @GetMapping(value = "/unauth-project") @ResponseStatus(HttpStatus.OK) @@ -222,7 +222,7 @@ public class ProjectController extends BaseController { */ @ApiOperation(value = "queryAuthorizedProject", notes = "QUERY_AUTHORIZED_PROJECT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") }) @GetMapping(value = "/authed-project") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java index 0ca5513165..affd88b784 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/QueueController.java @@ -81,16 +81,16 @@ public class QueueController extends BaseController { * query queue list paging * * @param loginUser login user - * @param pageNo page number + * @param pageNo page number * @param searchVal search value - * @param pageSize page size + * @param pageSize page size * @return queue list */ @ApiOperation(value = "queryQueueListPaging", notes = "QUERY_QUEUE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -114,14 +114,14 @@ public class QueueController extends BaseController { * create queue * * @param loginUser login user - * @param queue queue + * @param queue queue * @param queueName queue name * @return create result */ @ApiOperation(value = "createQueue", notes = "CREATE_QUEUE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -138,16 +138,16 @@ public class QueueController extends BaseController { * update queue * * @param loginUser login user - * @param queue queue - * @param id queue id + * @param queue queue + * @param id queue id * @param queueName queue name * @return update result code */ @ApiOperation(value = "updateQueue", notes = "UPDATE_QUEUE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "id", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.CREATED) @@ -165,14 +165,14 @@ public class QueueController extends BaseController { * verify queue and queue name * * @param loginUser login user - * @param queue queue + * @param queue queue * @param queueName queue name * @return true if the queue name not exists, otherwise return false */ @ApiOperation(value = "verifyQueue", notes = "VERIFY_QUEUE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") }) @PostMapping(value = "/verify-queue") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java index 8dc69afc57..9597befc46 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java @@ -96,22 +96,21 @@ public class ResourcesController extends BaseController { private UdfFuncService udfFuncService; /** - * - * @param loginUser login user - * @param type type - * @param alias alias + * @param loginUser login user + * @param type type + * @param alias alias * @param description description - * @param pid parent id - * @param currentDir current directory + * @param pid parent id + * @param currentDir current directory * @return create result code */ @ApiOperation(value = "createDirctory", notes = "CREATE_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), - @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), - @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), + @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") }) @PostMapping(value = "/directory/create") @ApiException(CREATE_RESOURCE_ERROR) @@ -127,23 +126,17 @@ public class ResourcesController extends BaseController { /** * create resource - * @param loginUser - * @param type - * @param alias - * @param description - * @param file - * @param pid - * @param currentDir + * * @return create result code */ @ApiOperation(value = "createResource", notes = "CREATE_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), - @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile"), - @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), - @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), + @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile"), + @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") }) @PostMapping(value = "/create") @ApiException(CREATE_RESOURCE_ERROR) @@ -166,16 +159,16 @@ public class ResourcesController extends BaseController { * @param resourceId resource id * @param type resource type * @param description description - * @param file resource file + * @param file resource file * @return update result code */ @ApiOperation(value = "updateResource", notes = "UPDATE_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), - @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), + @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") }) @PostMapping(value = "/update") @ApiException(UPDATE_RESOURCE_ERROR) @@ -185,7 +178,7 @@ public class ResourcesController extends BaseController { @RequestParam(value = "type") ResourceType type, @RequestParam(value = "name") String alias, @RequestParam(value = "description", required = false) String description, - @RequestParam(value = "file" ,required = false) MultipartFile file) { + @RequestParam(value = "file", required = false) MultipartFile file) { return resourceService.updateResource(loginUser, resourceId, alias, description, type, file); } @@ -198,7 +191,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryResourceList", notes = "QUERY_RESOURCE_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") }) @GetMapping(value = "/list") @ResponseStatus(HttpStatus.OK) @@ -223,11 +216,11 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryResourceListPaging", notes = "QUERY_RESOURCE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "int", example = "10"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "int", example = "10"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -260,7 +253,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "deleteResource", notes = "DELETE_RESOURCE_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -283,8 +276,8 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "verifyResourceName", notes = "VERIFY_RESOURCE_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String") }) @GetMapping(value = "/verify-name") @ResponseStatus(HttpStatus.OK) @@ -306,7 +299,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryResourceByProgramType", notes = "QUERY_RESOURCE_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") }) @GetMapping(value = "/list/jar") @ResponseStatus(HttpStatus.OK) @@ -314,9 +307,9 @@ public class ResourcesController extends BaseController { @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "type") ResourceType type, - @RequestParam(value = "programType",required = false) ProgramType programType + @RequestParam(value = "programType", required = false) ProgramType programType ) { - Map result = resourceService.queryResourceByProgramType(loginUser, type,programType); + Map result = resourceService.queryResourceByProgramType(loginUser, type, programType); return returnDataList(result); } @@ -331,9 +324,9 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryResource", notes = "QUERY_BY_RESOURCE_NAME") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10") }) @GetMapping(value = "/queryResource") @ResponseStatus(HttpStatus.OK) @@ -359,9 +352,9 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "viewResource", notes = "VIEW_RESOURCE_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/view") @ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR) @@ -376,25 +369,18 @@ public class ResourcesController extends BaseController { /** * create resource file online - * @param loginUser - * @param type - * @param fileName - * @param fileSuffix - * @param description - * @param content - * @param pid - * @param currentDir + * * @return create result code */ @ApiOperation(value = "onlineCreateResource", notes = "ONLINE_CREATE_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), - @ApiImplicitParam(name = "fileName", value = "RESOURCE_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "suffix", value = "SUFFIX", required = true, dataType = "String"), - @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), - @ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String"), - @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), - @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") + @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"), + @ApiImplicitParam(name = "fileName", value = "RESOURCE_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "suffix", value = "SUFFIX", required = true, dataType = "String"), + @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), + @ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String"), + @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") }) @PostMapping(value = "/online-create") @ApiException(CREATE_RESOURCE_FILE_ON_LINE_ERROR) @@ -425,8 +411,8 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "updateResourceContent", notes = "UPDATE_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") }) @PostMapping(value = "/update-content") @ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR) @@ -451,7 +437,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "downloadResource", notes = "DOWNLOAD_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/download") @ResponseBody @@ -464,9 +450,9 @@ public class ResourcesController extends BaseController { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.RESOURCE_NOT_EXIST.getMsg()); } return ResponseEntity - .ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"") - .body(file); + .ok() + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"") + .body(file); } @@ -485,13 +471,13 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "createUdfFunc", notes = "CREATE_UDF_FUNCTION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"), - @ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "className", value = "CLASS_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"), - @ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"), - @ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"), - @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"), + @ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "className", value = "CLASS_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"), + @ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"), + @ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"), + @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/udf-func/create") @@ -518,7 +504,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "viewUIUdfFunction", notes = "VIEW_UDF_FUNCTION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/udf-func/update-ui") @@ -547,14 +533,14 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "updateUdfFunc", notes = "UPDATE_UDF_FUNCTION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "UDF_ID", required = true, dataType = "Int"), - @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"), - @ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "className", value = "CLASS_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"), - @ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"), - @ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"), - @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "UDF_ID", required = true, dataType = "Int"), + @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"), + @ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "className", value = "CLASS_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"), + @ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"), + @ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"), + @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/udf-func/update") @@ -584,18 +570,18 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryUdfFuncListPaging", notes = "QUERY_UDF_FUNCTION_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/udf-func/list-paging") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryUdfFuncListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("pageNo") Integer pageNo, - @RequestParam(value = "searchVal", required = false) String searchVal, - @RequestParam("pageSize") Integer pageSize + @RequestParam("pageNo") Integer pageNo, + @RequestParam(value = "searchVal", required = false) String searchVal, + @RequestParam("pageSize") Integer pageSize ) { Map result = checkPageParams(pageNo, pageSize); if (result.get(Constants.STATUS) != Status.SUCCESS) { @@ -615,14 +601,14 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "queryUdfFuncList", notes = "QUERY_UDF_FUNC_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType") + @ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType") }) @GetMapping(value = "/udf-func/list") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_DATASOURCE_BY_TYPE_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryUdfFuncList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestParam("type") UdfType type) { + @RequestParam("type") UdfType type) { Map result = udfFuncService.queryUdfFuncList(loginUser, type.ordinal()); return returnDataList(result); } @@ -636,7 +622,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "verifyUdfFuncName", notes = "VERIFY_UDF_FUNCTION_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "name", value = "FUNC_NAME", required = true, dataType = "String") + @ApiImplicitParam(name = "name", value = "FUNC_NAME", required = true, dataType = "String") }) @GetMapping(value = "/udf-func/verify-name") @@ -659,7 +645,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "deleteUdfFunc", notes = "DELETE_UDF_FUNCTION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/udf-func/delete") @ResponseStatus(HttpStatus.OK) @@ -680,7 +666,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "authorizedFile", notes = "AUTHORIZED_FILE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/authed-file") @ResponseStatus(HttpStatus.CREATED) @@ -702,7 +688,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "authorizeResourceTree", notes = "AUTHORIZE_RESOURCE_TREE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/authorize-resource-tree") @ResponseStatus(HttpStatus.CREATED) @@ -724,7 +710,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "unauthUDFFunc", notes = "UNAUTHORIZED_UDF_FUNC_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/unauth-udf-func") @ResponseStatus(HttpStatus.CREATED) @@ -747,7 +733,7 @@ public class ResourcesController extends BaseController { */ @ApiOperation(value = "authUDFFunc", notes = "AUTHORIZED_UDF_FUNC_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/authed-udf-func") @ResponseStatus(HttpStatus.CREATED) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java index abd142ee98..eebf4f3066 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java @@ -92,14 +92,14 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "createSchedule", notes = "CREATE_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"), - @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", - example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','timezoneId':'America/Phoenix','crontab':'0 0 3/6 * * ? *'}"), - @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), - @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), - @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"), + @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"), + @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", + example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','timezoneId':'America/Phoenix','crontab':'0 0 3/6 * * ? *'}"), + @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), + @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), + @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"), }) @PostMapping("/create") @ResponseStatus(HttpStatus.CREATED) @@ -115,7 +115,7 @@ public class SchedulerController extends BaseController { @RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup, @RequestParam(value = "processInstancePriority", required = false, defaultValue = DEFAULT_PROCESS_INSTANCE_PRIORITY) Priority processInstancePriority) { Map result = schedulerService.insertSchedule(loginUser, projectCode, processDefinitionCode, schedule, - warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup); + warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup); return returnDataList(result); } @@ -136,13 +136,13 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "updateSchedule", notes = "UPDATE_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"), - @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), - @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), - @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"), + @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"), + @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), + @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), + @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"), }) @PostMapping("/update") @ApiException(UPDATE_SCHEDULE_ERROR) @@ -158,7 +158,7 @@ public class SchedulerController extends BaseController { @RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority) { Map result = schedulerService.updateSchedule(loginUser, projectCode, id, schedule, - warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup); + warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup); return returnDataList(result); } @@ -172,7 +172,7 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "online", notes = "ONLINE_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") }) @PostMapping("/online") @ApiException(PUBLISH_SCHEDULE_ONLINE_ERROR) @@ -194,7 +194,7 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "offline", notes = "OFFLINE_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") }) @PostMapping("/offline") @ApiException(OFFLINE_SCHEDULE_ERROR) @@ -220,10 +220,10 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "queryScheduleListPaging", notes = "QUERY_SCHEDULE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100") + @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100") }) @GetMapping("/list-paging") @@ -255,7 +255,7 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "deleteScheduleById", notes = "OFFLINE_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "scheduleId", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "scheduleId", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -295,7 +295,7 @@ public class SchedulerController extends BaseController { */ @ApiOperation(value = "previewSchedule", notes = "PREVIEW_SCHEDULE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"), + @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"), }) @PostMapping("/preview") @ResponseStatus(HttpStatus.CREATED) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java index a31da46302..852a1a3709 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskDefinitionController.java @@ -56,7 +56,6 @@ import io.swagger.annotations.ApiParam; import springfox.documentation.annotations.ApiIgnore; - /** * task definition controller */ @@ -131,9 +130,9 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "queryVersions", notes = "QUERY_TASK_DEFINITION_VERSIONS_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") }) @GetMapping(value = "/versions") @ResponseStatus(HttpStatus.OK) @@ -159,8 +158,8 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "switchVersion", notes = "SWITCH_TASK_DEFINITION_VERSION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"), - @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"), + @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/version/switch") @ResponseStatus(HttpStatus.OK) @@ -185,8 +184,8 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "deleteVersion", notes = "DELETE_TASK_DEFINITION_VERSION_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"), - @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"), + @ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/version/delete") @ResponseStatus(HttpStatus.OK) @@ -210,7 +209,7 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "deleteTaskDefinition", notes = "DELETE_TASK_DEFINITION_BY_CODE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") + @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") }) @GetMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -233,7 +232,7 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "queryTaskDefinitionDetail", notes = "QUERY_TASK_DEFINITION_DETAIL_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") + @ApiImplicitParam(name = "taskDefinitionCode", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1") }) @GetMapping(value = "/select-by-code") @ResponseStatus(HttpStatus.OK) @@ -259,10 +258,10 @@ public class TaskDefinitionController extends BaseController { */ @ApiOperation(value = "queryTaskDefinitionListPaging", notes = "QUERY_TASK_DEFINITION_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"), - @ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"), + @ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java index e9bb0f650e..98c7cb8c03 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TaskInstanceController.java @@ -58,39 +58,38 @@ import springfox.documentation.annotations.ApiIgnore; @RequestMapping("/projects/{projectName}/task-instance") public class TaskInstanceController extends BaseController { - @Autowired TaskInstanceService taskInstanceService; /** * query task list paging * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param processInstanceId process instance id - * @param searchVal search value - * @param taskName task name - * @param stateType state type - * @param host host - * @param startTime start time - * @param endTime end time - * @param pageNo page number - * @param pageSize page size + * @param searchVal search value + * @param taskName task name + * @param stateType state type + * @param host host + * @param startTime start time + * @param endTime end time + * @param pageNo page number + * @param pageSize page size * @return task list page */ @ApiOperation(value = "queryTaskListPaging", notes = "QUERY_TASK_INSTANCE_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = false, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "processInstanceName", value = "PROCESS_INSTANCE_NAME", required = false, type = "String"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), - @ApiImplicitParam(name = "taskName", value = "TASK_NAME", type = "String"), - @ApiImplicitParam(name = "executorName", value = "EXECUTOR_NAME", type = "String"), - @ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type = "ExecutionStatus"), - @ApiImplicitParam(name = "host", value = "HOST", type = "String"), - @ApiImplicitParam(name = "startDate", value = "START_DATE", type = "String"), - @ApiImplicitParam(name = "endDate", value = "END_DATE", type = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = false, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "processInstanceName", value = "PROCESS_INSTANCE_NAME", required = false, type = "String"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), + @ApiImplicitParam(name = "taskName", value = "TASK_NAME", type = "String"), + @ApiImplicitParam(name = "executorName", value = "EXECUTOR_NAME", type = "String"), + @ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type = "ExecutionStatus"), + @ApiImplicitParam(name = "host", value = "HOST", type = "String"), + @ApiImplicitParam(name = "startDate", value = "START_DATE", type = "String"), + @ApiImplicitParam(name = "endDate", value = "END_DATE", type = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping("/list-paging") @ResponseStatus(HttpStatus.OK) @@ -117,21 +116,21 @@ public class TaskInstanceController extends BaseController { } searchVal = ParameterUtils.handleEscapes(searchVal); result = taskInstanceService.queryTaskListPaging( - loginUser, projectName, processInstanceId, processInstanceName, taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize); + loginUser, projectName, processInstanceId, processInstanceName, taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize); return returnDataListPaging(result); } /** * change one task instance's state from FAILURE to FORCED_SUCCESS * - * @param loginUser login user - * @param projectName project name + * @param loginUser login user + * @param projectName project name * @param taskInstanceId task instance id * @return the result code and msg */ @ApiOperation(value = "force-success", notes = "FORCE_TASK_SUCCESS") @ApiImplicitParams({ - @ApiImplicitParam(name = "taskInstanceId", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12") + @ApiImplicitParam(name = "taskInstanceId", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12") }) @PostMapping(value = "/force-success") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java index 2cd7bf2b99..01d214616f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/TenantController.java @@ -73,10 +73,9 @@ public class TenantController extends BaseController { */ @ApiOperation(value = "createTenant", notes = "CREATE_TENANT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), - @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "description", value = "TENANT_DESC", dataType = "String") - + @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), + @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "description", value = "TENANT_DESC", dataType = "String") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -102,9 +101,9 @@ public class TenantController extends BaseController { */ @ApiOperation(value = "queryTenantlistPaging", notes = "QUERY_TENANT_LIST_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -153,10 +152,10 @@ public class TenantController extends BaseController { */ @ApiOperation(value = "updateTenant", notes = "UPDATE_TENANT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), - @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "description", value = "TENANT_DESC", type = "String") + @ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), + @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "description", value = "TENANT_DESC", type = "String") }) @PostMapping(value = "/update") @@ -182,7 +181,7 @@ public class TenantController extends BaseController { */ @ApiOperation(value = "deleteTenantById", notes = "DELETE_TENANT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/delete") @@ -204,7 +203,7 @@ public class TenantController extends BaseController { */ @ApiOperation(value = "verifyTenantCode", notes = "VERIFY_TENANT_CODE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String") + @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String") }) @GetMapping(value = "/verify-tenant-code") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UiPluginController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UiPluginController.java index 276f4ea9fe..3d080addf1 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UiPluginController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UiPluginController.java @@ -75,7 +75,7 @@ public class UiPluginController extends BaseController { @ApiOperation(value = "queryUiPluginDetailById", notes = "QUERY_UI_PLUGIN_DETAIL_BY_ID") @ApiImplicitParams({ - @ApiImplicitParam(name = "pluginId", value = "PLUGIN_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "pluginId", value = "PLUGIN_ID", required = true, dataType = "Int", example = "100"), }) @PostMapping(value = "/queryUiPluginDetailById") @ResponseStatus(HttpStatus.CREATED) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java index cc1681419c..293dc7eda7 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/UsersController.java @@ -79,24 +79,24 @@ public class UsersController extends BaseController { /** * create user * - * @param loginUser login user - * @param userName user name + * @param loginUser login user + * @param userName user name * @param userPassword user password - * @param email email - * @param tenantId tenant id - * @param phone phone - * @param queue queue + * @param email email + * @param tenantId tenant id + * @param phone phone + * @param queue queue * @return create result code */ @ApiOperation(value = "createUser", notes = "CREATE_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), - @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "String"), - @ApiImplicitParam(name = "email", value = "EMAIL", required = true, dataType = "String"), - @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "String"), - @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") + @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), + @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "String"), + @ApiImplicitParam(name = "email", value = "EMAIL", required = true, dataType = "String"), + @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "String"), + @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/create") @ResponseStatus(HttpStatus.CREATED) @@ -118,16 +118,16 @@ public class UsersController extends BaseController { * query user list paging * * @param loginUser login user - * @param pageNo page number + * @param pageNo page number * @param searchVal search avlue - * @param pageSize page size + * @param pageSize page size * @return user list page */ @ApiOperation(value = "queryUserList", notes = "QUERY_USER_LIST_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -150,26 +150,26 @@ public class UsersController extends BaseController { /** * update user * - * @param loginUser login user - * @param id user id - * @param userName user name + * @param loginUser login user + * @param id user id + * @param userName user name * @param userPassword user password - * @param email email - * @param tenantId tennat id - * @param phone phone - * @param queue queue + * @param email email + * @param tenantId tennat id + * @param phone phone + * @param queue queue * @return update result code */ @ApiOperation(value = "updateUser", notes = "UPDATE_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "USER_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), - @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "String"), - @ApiImplicitParam(name = "email", value = "EMAIL", required = true, dataType = "String"), - @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "String"), - @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") + @ApiImplicitParam(name = "id", value = "USER_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), + @ApiImplicitParam(name = "tenantId", value = "TENANT_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "String"), + @ApiImplicitParam(name = "email", value = "EMAIL", required = true, dataType = "String"), + @ApiImplicitParam(name = "phone", value = "PHONE", dataType = "String"), + @ApiImplicitParam(name = "state", value = "STATE", dataType = "Int", example = "1") }) @PostMapping(value = "/update") @ResponseStatus(HttpStatus.OK) @@ -192,12 +192,12 @@ public class UsersController extends BaseController { * delete user by id * * @param loginUser login user - * @param id user id + * @param id user id * @return delete result code */ @ApiOperation(value = "delUserById", notes = "DELETE_USER_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "USER_ID", required = true, dataType = "Int", example = "100") + @ApiImplicitParam(name = "id", value = "USER_ID", required = true, dataType = "Int", example = "100") }) @PostMapping(value = "/delete") @ResponseStatus(HttpStatus.OK) @@ -212,15 +212,15 @@ public class UsersController extends BaseController { /** * grant project * - * @param loginUser login user - * @param userId user id + * @param loginUser login user + * @param userId user id * @param projectIds project id array * @return grant result code */ @ApiOperation(value = "grantProject", notes = "GRANT_PROJECT_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "projectIds", value = "PROJECT_IDS", required = true, type = "String") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "projectIds", value = "PROJECT_IDS", required = true, type = "String") }) @PostMapping(value = "/grant-project") @ResponseStatus(HttpStatus.OK) @@ -236,15 +236,15 @@ public class UsersController extends BaseController { /** * grant resource * - * @param loginUser login user - * @param userId user id + * @param loginUser login user + * @param userId user id * @param resourceIds resource id array * @return grant result code */ @ApiOperation(value = "grantResource", notes = "GRANT_RESOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "resourceIds", value = "RESOURCE_IDS", required = true, type = "String") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "resourceIds", value = "RESOURCE_IDS", required = true, type = "String") }) @PostMapping(value = "/grant-file") @ResponseStatus(HttpStatus.OK) @@ -262,14 +262,14 @@ public class UsersController extends BaseController { * grant udf function * * @param loginUser login user - * @param userId user id - * @param udfIds udf id array + * @param userId user id + * @param udfIds udf id array * @return grant result code */ @ApiOperation(value = "grantUDFFunc", notes = "GRANT_UDF_FUNC_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "udfIds", value = "UDF_IDS", required = true, type = "String") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "udfIds", value = "UDF_IDS", required = true, type = "String") }) @PostMapping(value = "/grant-udf-func") @ResponseStatus(HttpStatus.OK) @@ -286,15 +286,15 @@ public class UsersController extends BaseController { /** * grant datasource * - * @param loginUser login user - * @param userId user id + * @param loginUser login user + * @param userId user id * @param datasourceIds data source id array * @return grant result code */ @ApiOperation(value = "grantDataSource", notes = "GRANT_DATASOURCE_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), - @ApiImplicitParam(name = "datasourceIds", value = "DATASOURCE_IDS", required = true, type = "String") + @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100"), + @ApiImplicitParam(name = "datasourceIds", value = "DATASOURCE_IDS", required = true, type = "String") }) @PostMapping(value = "/grant-datasource") @ResponseStatus(HttpStatus.OK) @@ -361,12 +361,12 @@ public class UsersController extends BaseController { * verify username * * @param loginUser login user - * @param userName user name + * @param userName user name * @return true if user name not exists, otherwise return false */ @ApiOperation(value = "verifyUserName", notes = "VERIFY_USER_NAME_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String") + @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String") }) @GetMapping(value = "/verify-user-name") @ResponseStatus(HttpStatus.OK) @@ -382,13 +382,13 @@ public class UsersController extends BaseController { /** * unauthorized user * - * @param loginUser login user + * @param loginUser login user * @param alertgroupId alert group id * @return unauthorize result code */ @ApiOperation(value = "unauthorizedUser", notes = "UNAUTHORIZED_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "alertgroupId", value = "ALERT_GROUP_ID", required = true, type = "String") + @ApiImplicitParam(name = "alertgroupId", value = "ALERT_GROUP_ID", required = true, type = "String") }) @GetMapping(value = "/unauth-user") @ResponseStatus(HttpStatus.OK) @@ -404,13 +404,13 @@ public class UsersController extends BaseController { /** * authorized user * - * @param loginUser login user + * @param loginUser login user * @param alertgroupId alert group id * @return authorized result code */ @ApiOperation(value = "authorizedUser", notes = "AUTHORIZED_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "alertgroupId", value = "ALERT_GROUP_ID", required = true, type = "String") + @ApiImplicitParam(name = "alertgroupId", value = "ALERT_GROUP_ID", required = true, type = "String") }) @GetMapping(value = "/authed-user") @ResponseStatus(HttpStatus.OK) @@ -430,26 +430,26 @@ public class UsersController extends BaseController { /** * user registry * - * @param userName user name - * @param userPassword user password + * @param userName user name + * @param userPassword user password * @param repeatPassword repeat password - * @param email user email + * @param email user email */ - @ApiOperation(value="registerUser",notes = "REGISTER_USER_NOTES") + @ApiOperation(value = "registerUser", notes = "REGISTER_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), - @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), - @ApiImplicitParam(name = "repeatPassword", value = "REPEAT_PASSWORD", required = true, type = "String"), - @ApiImplicitParam(name = "email", value = "EMAIL", required = true, type = "String"), + @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), + @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), + @ApiImplicitParam(name = "repeatPassword", value = "REPEAT_PASSWORD", required = true, type = "String"), + @ApiImplicitParam(name = "email", value = "EMAIL", required = true, type = "String"), }) @PostMapping("/register") @ResponseStatus(HttpStatus.OK) @ApiException(CREATE_USER_ERROR) @AccessLogAnnotation public Result registerUser(@RequestParam(value = "userName") String userName, - @RequestParam(value = "userPassword") String userPassword, - @RequestParam(value = "repeatPassword") String repeatPassword, - @RequestParam(value = "email") String email) throws Exception { + @RequestParam(value = "userPassword") String userPassword, + @RequestParam(value = "repeatPassword") String repeatPassword, + @RequestParam(value = "email") String email) throws Exception { userName = ParameterUtils.handleEscapes(userName); userPassword = ParameterUtils.handleEscapes(userPassword); repeatPassword = ParameterUtils.handleEscapes(repeatPassword); @@ -461,11 +461,11 @@ public class UsersController extends BaseController { /** * user activate * - * @param userName user name + * @param userName user name */ - @ApiOperation(value="activateUser",notes = "ACTIVATE_USER_NOTES") + @ApiOperation(value = "activateUser", notes = "ACTIVATE_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userName", value = "USER_NAME", type = "String"), + @ApiImplicitParam(name = "userName", value = "USER_NAME", type = "String"), }) @PostMapping("/activate") @ResponseStatus(HttpStatus.OK) @@ -481,18 +481,18 @@ public class UsersController extends BaseController { /** * user batch activate * - * @param userNames user names + * @param userNames user names */ - @ApiOperation(value = "batchActivateUser",notes = "BATCH_ACTIVATE_USER_NOTES") + @ApiOperation(value = "batchActivateUser", notes = "BATCH_ACTIVATE_USER_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "userNames", value = "USER_NAMES", required = true, type = "String"), + @ApiImplicitParam(name = "userNames", value = "USER_NAMES", required = true, type = "String"), }) @PostMapping("/batch/activate") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_USER_ERROR) @AccessLogAnnotation public Result batchActivateUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, - @RequestBody List userNames) { + @RequestBody List userNames) { List formatUserNames = userNames.stream().map(ParameterUtils::handleEscapes).collect(Collectors.toList()); Map result = usersService.batchActivateUser(loginUser, formatUserNames); return returnDataList(result); diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java index f5e17e3cb6..f32a280e29 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkFlowLineageController.java @@ -73,7 +73,7 @@ public class WorkFlowLineageController extends BaseController { Map result = workFlowLineageService.queryWorkFlowLineageByName(searchVal, projectCode); return returnDataList(result); } catch (Exception e) { - logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); + logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(), e); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); } } @@ -98,7 +98,7 @@ public class WorkFlowLineageController extends BaseController { Map result = workFlowLineageService.queryWorkFlowLineageByIds(idsSet, projectCode); return returnDataList(result); } catch (Exception e) { - logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); + logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(), e); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); } } diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java index 2df708b7ea..7f92ccecef 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/WorkerGroupController.java @@ -64,16 +64,16 @@ public class WorkerGroupController extends BaseController { * create or update a worker group * * @param loginUser login user - * @param id worker group id - * @param name worker group name - * @param addrList addr list + * @param id worker group id + * @param name worker group name + * @param addrList addr list * @return create or update result code */ @ApiOperation(value = "saveWorkerGroup", notes = "CREATE_WORKER_GROUP_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", dataType = "Int", example = "10", defaultValue = "0"), - @ApiImplicitParam(name = "name", value = "WORKER_GROUP_NAME", required = true, dataType = "String"), - @ApiImplicitParam(name = "addrList", value = "WORKER_ADDR_LIST", required = true, dataType = "String") + @ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", dataType = "Int", example = "10", defaultValue = "0"), + @ApiImplicitParam(name = "name", value = "WORKER_GROUP_NAME", required = true, dataType = "String"), + @ApiImplicitParam(name = "addrList", value = "WORKER_ADDR_LIST", required = true, dataType = "String") }) @PostMapping(value = "/save") @ResponseStatus(HttpStatus.OK) @@ -92,16 +92,16 @@ public class WorkerGroupController extends BaseController { * query worker groups paging * * @param loginUser login user - * @param pageNo page number + * @param pageNo page number * @param searchVal search value - * @param pageSize page size + * @param pageSize page size * @return worker group list page */ @ApiOperation(value = "queryAllWorkerGroupsPaging", notes = "QUERY_WORKER_GROUP_PAGING_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), - @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), - @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String") + @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), + @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), + @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String") }) @GetMapping(value = "/list-paging") @ResponseStatus(HttpStatus.OK) @@ -141,12 +141,12 @@ public class WorkerGroupController extends BaseController { * delete worker group by id * * @param loginUser login user - * @param id group id + * @param id group id * @return delete result code */ @ApiOperation(value = "deleteById", notes = "DELETE_WORKER_GROUP_BY_ID_NOTES") @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", required = true, dataType = "Int", example = "10"), + @ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", required = true, dataType = "Int", example = "10"), }) @PostMapping(value = "/delete-by-id") @ResponseStatus(HttpStatus.OK) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.java new file mode 100644 index 0000000000..249d8b3a68 --- /dev/null +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/DagDataSchedule.java @@ -0,0 +1,47 @@ +/* + * 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.dto; + +import org.apache.dolphinscheduler.dao.entity.DagData; +import org.apache.dolphinscheduler.dao.entity.Schedule; + +/** + * DagDataSchedule + */ +public class DagDataSchedule extends DagData { + + /** + * schedule + */ + private Schedule schedule; + + public DagDataSchedule(DagData dagData) { + super(); + this.setProcessDefinition(dagData.getProcessDefinition()); + this.setTaskDefinitionList(dagData.getTaskDefinitionList()); + this.setProcessTaskRelationList(dagData.getProcessTaskRelationList()); + } + + public Schedule getSchedule() { + return schedule; + } + + public void setSchedule(Schedule schedule) { + this.schedule = schedule; + } +} diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/ProcessMeta.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/ProcessMeta.java deleted file mode 100644 index 61e3752c69..0000000000 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/ProcessMeta.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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.dto; - -/** - * ProcessMeta - */ -public class ProcessMeta { - - /** - * project name - */ - private String projectName; - - /** - * process definition name - */ - private String processDefinitionName; - - /** - * processs definition json - */ - private String processDefinitionJson; - - /** - * process definition desc - */ - private String processDefinitionDescription; - - /** - * process definition locations - */ - private String processDefinitionLocations; - - /** - * process definition connects - */ - private String processDefinitionConnects; - - /** - * warning type - */ - private String scheduleWarningType; - - /** - * warning group id - */ - private Integer scheduleWarningGroupId; - - /** - * warning group name - */ - private String scheduleWarningGroupName; - - /** - * start time - */ - private String scheduleStartTime; - - /** - * end time - */ - private String scheduleEndTime; - - /** - * crontab - */ - private String scheduleCrontab; - - /** - * failure strategy - */ - private String scheduleFailureStrategy; - - /** - * release state - */ - private String scheduleReleaseState; - - /** - * process instance priority - */ - private String scheduleProcessInstancePriority; - - /** - * worker group name - */ - private String scheduleWorkerGroupName; - - public String getProjectName() { - return projectName; - } - - public void setProjectName(String projectName) { - this.projectName = projectName; - } - - public String getProcessDefinitionName() { - return processDefinitionName; - } - - public void setProcessDefinitionName(String processDefinitionName) { - this.processDefinitionName = processDefinitionName; - } - - public String getProcessDefinitionJson() { - return processDefinitionJson; - } - - public void setProcessDefinitionJson(String processDefinitionJson) { - this.processDefinitionJson = processDefinitionJson; - } - - public String getProcessDefinitionDescription() { - return processDefinitionDescription; - } - - public void setProcessDefinitionDescription(String processDefinitionDescription) { - this.processDefinitionDescription = processDefinitionDescription; - } - - public String getProcessDefinitionLocations() { - return processDefinitionLocations; - } - - public void setProcessDefinitionLocations(String processDefinitionLocations) { - this.processDefinitionLocations = processDefinitionLocations; - } - - public String getProcessDefinitionConnects() { - return processDefinitionConnects; - } - - public void setProcessDefinitionConnects(String processDefinitionConnects) { - this.processDefinitionConnects = processDefinitionConnects; - } - - public String getScheduleWarningType() { - return scheduleWarningType; - } - - public void setScheduleWarningType(String scheduleWarningType) { - this.scheduleWarningType = scheduleWarningType; - } - - public Integer getScheduleWarningGroupId() { - return scheduleWarningGroupId; - } - - public void setScheduleWarningGroupId(int scheduleWarningGroupId) { - this.scheduleWarningGroupId = scheduleWarningGroupId; - } - - public String getScheduleWarningGroupName() { - return scheduleWarningGroupName; - } - - public void setScheduleWarningGroupName(String scheduleWarningGroupName) { - this.scheduleWarningGroupName = scheduleWarningGroupName; - } - - public String getScheduleStartTime() { - return scheduleStartTime; - } - - public void setScheduleStartTime(String scheduleStartTime) { - this.scheduleStartTime = scheduleStartTime; - } - - public String getScheduleEndTime() { - return scheduleEndTime; - } - - public void setScheduleEndTime(String scheduleEndTime) { - this.scheduleEndTime = scheduleEndTime; - } - - public String getScheduleCrontab() { - return scheduleCrontab; - } - - public void setScheduleCrontab(String scheduleCrontab) { - this.scheduleCrontab = scheduleCrontab; - } - - public String getScheduleFailureStrategy() { - return scheduleFailureStrategy; - } - - public void setScheduleFailureStrategy(String scheduleFailureStrategy) { - this.scheduleFailureStrategy = scheduleFailureStrategy; - } - - public String getScheduleReleaseState() { - return scheduleReleaseState; - } - - public void setScheduleReleaseState(String scheduleReleaseState) { - this.scheduleReleaseState = scheduleReleaseState; - } - - public String getScheduleProcessInstancePriority() { - return scheduleProcessInstancePriority; - } - - public void setScheduleProcessInstancePriority(String scheduleProcessInstancePriority) { - this.scheduleProcessInstancePriority = scheduleProcessInstancePriority; - } - - public String getScheduleWorkerGroupName() { - return scheduleWorkerGroupName; - } - - public void setScheduleWorkerGroupName(String scheduleWorkerGroupName) { - this.scheduleWorkerGroupName = scheduleWorkerGroupName; - } -} diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java index a4a4b983a8..999ccae788 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java @@ -208,17 +208,17 @@ public interface ProcessDefinitionService { ReleaseState releaseState); /** - * batch export process definition by ids + * batch export process definition by codes * * @param loginUser login user * @param projectCode project code - * @param processDefinitionIds process definition ids + * @param processDefinitionCodes process definition codes * @param response http servlet response */ - void batchExportProcessDefinitionByIds(User loginUser, - long projectCode, - String processDefinitionIds, - HttpServletResponse response); + void batchExportProcessDefinitionByCodes(User loginUser, + long projectCode, + String processDefinitionCodes, + HttpServletResponse response); /** * import process definition @@ -263,8 +263,8 @@ public interface ProcessDefinitionService { * @return task node list */ Map getNodeListMapByDefinitionCodes(User loginUser, - long projectCode, - String defineCodeList); + long projectCode, + String defineCodeList); /** * query process definition all by project code diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 239396aabd..3a0b1be700 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -19,7 +19,7 @@ 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.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; @@ -30,16 +30,10 @@ 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.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; @@ -49,7 +43,6 @@ import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils; import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils.SnowFlakeException; -import org.apache.dolphinscheduler.common.utils.StreamUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.ProcessData; @@ -72,14 +65,13 @@ import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; +import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.service.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; -import org.apache.commons.collections.map.HashedMap; - import java.io.BufferedOutputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -108,9 +100,6 @@ 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.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; @@ -164,6 +153,9 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper; + @Autowired + private TaskDefinitionMapper taskDefinitionMapper; + @Autowired private SchedulerService schedulerService; @@ -663,12 +655,11 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } /** - * batch export process definition by ids + * batch export process definition by codes */ @Override - public void batchExportProcessDefinitionByIds(User loginUser, long projectCode, String processDefinitionIds, HttpServletResponse response) { - - if (StringUtils.isEmpty(processDefinitionIds)) { + public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String processDefinitionCodes, HttpServletResponse response) { + if (StringUtils.isEmpty(processDefinitionCodes)) { return; } Project project = projectMapper.queryByCode(projectCode); @@ -677,42 +668,25 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro if (result.get(Constants.STATUS) != Status.SUCCESS) { return; } - - List processDefinitionList = - getProcessDefinitionList(processDefinitionIds); - - if (CollectionUtils.isNotEmpty(processDefinitionList)) { - downloadProcessDefinitionFile(response, processDefinitionList); - } - } - - /** - * get process definition list by ids - */ - private List getProcessDefinitionList(String processDefinitionIds) { - String[] processDefinitionIdArray = processDefinitionIds.split(","); - - List processDefinitionList = new ArrayList<>(); - for (String strProcessDefinitionId : processDefinitionIdArray) { - //get workflow info - int processDefinitionId = Integer.parseInt(strProcessDefinitionId); - ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineId(processDefinitionId); - processDefinitionList.add(exportProcessMetaData(processDefinition)); + Set defineCodeSet = Lists.newArrayList(processDefinitionCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); + List processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); + List dagDataSchedules = processDefinitionList.stream().map(this::exportProcessDagData).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(dagDataSchedules)) { + downloadProcessDefinitionFile(response, dagDataSchedules); } - return processDefinitionList; } /** * download the process definition file */ - private void downloadProcessDefinitionFile(HttpServletResponse response, List processDefinitionList) { + private void downloadProcessDefinitionFile(HttpServletResponse response, List dagDataSchedules) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); - buff.write(JSONUtils.toJsonString(processDefinitionList).getBytes(StandardCharsets.UTF_8)); + buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { @@ -736,71 +710,20 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro } /** - * get export process metadata string + * get export process dag data * * @param processDefinition process definition - * @return export process metadata string + * @return DagDataSchedule */ - public ProcessMeta exportProcessMetaData(ProcessDefinition processDefinition) { - ProcessData processData = processService.genProcessData(processDefinition); - //correct task param which has data source or dependent param - addExportTaskNodeSpecialParam(processData); - - //export process metadata - ProcessMeta exportProcessMeta = new ProcessMeta(); - exportProcessMeta.setProjectName(processDefinition.getProjectName()); - exportProcessMeta.setProcessDefinitionName(processDefinition.getName()); - exportProcessMeta.setProcessDefinitionJson(JSONUtils.toJsonString(processService.genProcessData(processDefinition))); - exportProcessMeta.setProcessDefinitionDescription(processDefinition.getDescription()); - exportProcessMeta.setProcessDefinitionLocations(processDefinition.getLocations()); - exportProcessMeta.setProcessDefinitionConnects(processDefinition.getConnects()); - - //schedule info + public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) { List schedules = scheduleMapper.queryByProcessDefinitionId(processDefinition.getId()); + DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition)); if (!schedules.isEmpty()) { Schedule schedule = schedules.get(0); - exportProcessMeta.setScheduleWarningType(schedule.getWarningType().toString()); - exportProcessMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); - 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()); - } - //create workflow json file - return exportProcessMeta; - } - - /** - * correct task param which has datasource or dependent - * - * @param processData process data - * @return correct processDefinitionJson - */ - private void addExportTaskNodeSpecialParam(ProcessData processData) { - List taskNodeList = processData.getTasks(); - List tmpNodeList = new ArrayList<>(); - for (TaskNode taskNode : taskNodeList) { - ProcessAddTaskParam addTaskParam = TaskNodeParamFactory.getByTaskType(taskNode.getType()); - JsonNode jsonNode = JSONUtils.toJsonNode(taskNode); - if (null != addTaskParam) { - addTaskParam.addExportSpecialParam(jsonNode); - } - tmpNodeList.add(JSONUtils.parseObject(jsonNode.toString(), TaskNode.class)); + schedule.setReleaseState(ReleaseState.OFFLINE); + dagDataSchedule.setSchedule(schedule); } - processData.setTasks(tmpNodeList); - } - - /** - * 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.getDesc()); + return dagDataSchedule; } /** @@ -815,124 +738,98 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro @Transactional(rollbackFor = RuntimeException.class) public Map importProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map result = new HashMap<>(); - String processMetaJson = FileUtils.file2String(file); - List processMetaList = JSONUtils.toList(processMetaJson, ProcessMeta.class); - + String dagDataScheduleJson = FileUtils.file2String(file); + List dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class); //check file content - if (CollectionUtils.isEmpty(processMetaList)) { + if (CollectionUtils.isEmpty(dagDataScheduleList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } - - for (ProcessMeta processMeta : processMetaList) { - - if (!checkAndImportProcessDefinition(loginUser, projectCode, result, processMeta)) { + for (DagDataSchedule dagDataSchedule : dagDataScheduleList) { + if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) { return result; } } - return result; } /** - * check and import process definition + * check and import */ - private boolean checkAndImportProcessDefinition(User loginUser, long projectCode, Map result, ProcessMeta processMeta) { - - if (!checkImportanceParams(processMeta, result)) { + private boolean checkAndImport(User loginUser, long projectCode, Map result, DagDataSchedule dagDataSchedule) { + if (!checkImportanceParams(dagDataSchedule, result)) { return false; } - - //deal with process name - String processDefinitionName = processMeta.getProcessDefinitionName(); - //use currentProjectName to query - Project targetProject = projectMapper.queryByCode(projectCode); - if (null != targetProject) { - processDefinitionName = recursionProcessDefinitionName(targetProject.getCode(), - processDefinitionName, 1); - } - + ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); //unique check - Map checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinitionName); - Status status = (Status) checkResult.get(Constants.STATUS); - if (Status.SUCCESS.equals(status)) { + Map checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName()); + if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } - - // get create process result - Map createProcessResult = - getCreateProcessResult(loginUser, - targetProject.getName(), - result, - processMeta, - processDefinitionName, - addImportTaskNodeParam(loginUser, processMeta.getProcessDefinitionJson(), targetProject)); - - if (createProcessResult == null) { + String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1); + processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp()); + processDefinition.setUserId(loginUser.getId()); + try { + processDefinition.setCode(SnowFlakeUtils.getInstance().nextId()); + } catch (SnowFlakeException e) { + putMsg(result, Status.CREATE_PROCESS_DEFINITION); return false; } - - //create process definition - Integer processDefinitionId = - Objects.isNull(createProcessResult.get(Constants.DATA_LIST)) - ? null : Integer.parseInt(createProcessResult.get(Constants.DATA_LIST).toString()); - - //scheduler param - return getImportProcessScheduleResult(loginUser, - targetProject.getName(), - result, - processMeta, - processDefinitionName, - processDefinitionId); - } - - /** - * get create process result - */ - private Map getCreateProcessResult(User loginUser, - String currentProjectName, - Map result, - ProcessMeta processMeta, - String processDefinitionName, - String importProcessParam) { - Map createProcessResult = null; - try { - // TODO import - // 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); + List taskDefinitionList = dagDataSchedule.getTaskDefinitionList(); + Map taskCodeMap = new HashMap<>(); + Date now = new Date(); + for (TaskDefinitionLog taskDefinitionLog : taskDefinitionList) { + taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp()); + taskDefinitionLog.setProjectCode(projectCode); + taskDefinitionLog.setUserId(loginUser.getId()); + taskDefinitionLog.setVersion(Constants.VERSION_FIRST); + taskDefinitionLog.setCreateTime(now); + taskDefinitionLog.setUpdateTime(now); + taskDefinitionLog.setOperator(loginUser.getId()); + taskDefinitionLog.setOperateTime(now); + try { + long code = SnowFlakeUtils.getInstance().nextId(); + taskCodeMap.put(taskDefinitionLog.getCode(), code); + taskDefinitionLog.setCode(code); + } catch (SnowFlakeException e) { + logger.error("Task code get error, ", e); + putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); + return false; + } + } + int insert = taskDefinitionMapper.batchInsert(taskDefinitionList); + int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionList); + if ((logInsert & insert) == 0) { + putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); + return false; } - return createProcessResult; - } - - /** - * get import process schedule result - */ - private boolean getImportProcessScheduleResult(User loginUser, - String currentProjectName, - Map result, - ProcessMeta processMeta, - String processDefinitionName, - Integer processDefinitionId) { - if (null != processMeta.getScheduleCrontab() && null != processDefinitionId) { - int scheduleInsert = importProcessSchedule(loginUser, - currentProjectName, - processMeta, - processDefinitionName, - processDefinitionId); + List taskRelationList = dagDataSchedule.getProcessTaskRelationList(); + taskRelationList.forEach(processTaskRelationLog -> { + processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); + processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); + processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST); + processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); + }); + Map createProcessResult = createProcessDefine(loginUser, result, taskRelationList, processDefinition); + if (Status.SUCCESS.equals(createProcessResult.get(Constants.STATUS))) { + putMsg(createProcessResult, Status.SUCCESS); + } else { + result.putAll(createProcessResult); + return false; + } + Schedule schedule = dagDataSchedule.getSchedule(); + if (null != schedule) { + ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode()); + schedule.setProcessDefinitionId(newProcessDefinition.getId()); + schedule.setUserId(loginUser.getId()); + schedule.setCreateTime(now); + schedule.setUpdateTime(now); + int scheduleInsert = scheduleMapper.insert(schedule); if (0 == scheduleInsert) { putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return false; @@ -944,189 +841,35 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro /** * check importance params */ - private boolean checkImportanceParams(ProcessMeta processMeta, Map result) { - if (StringUtils.isEmpty(processMeta.getProjectName())) { - putMsg(result, Status.DATA_IS_NULL, "projectName"); + private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map result) { + if (dagDataSchedule.getProcessDefinition() == null) { + putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition"); return false; } - if (StringUtils.isEmpty(processMeta.getProcessDefinitionName())) { - putMsg(result, Status.DATA_IS_NULL, "processDefinitionName"); + if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) { + putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList"); return false; } - if (StringUtils.isEmpty(processMeta.getProcessDefinitionJson())) { - putMsg(result, Status.DATA_IS_NULL, "processDefinitionJson"); + if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) { + putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList"); return false; } - return true; } - /** - * 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); - //add sql and dependent param - 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); - } - } - - //recursive sub-process parameter correction map key for old process code value for new process code - Map subProcessCodeMap = new HashMap<>(); - - List 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, subProcessCodeMap); - } - - jsonObject.set(TASKS, jsonArray); - return jsonObject.toString(); - } - - /** - * 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()) { - 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 subProcessCodeMap correct sub process id map - */ - private void importSubProcess(User loginUser, Project targetProject, ArrayNode jsonArray, Map subProcessCodeMap) { - for (int i = 0; i < jsonArray.size(); i++) { - ObjectNode taskNode = (ObjectNode) jsonArray.path(i); - String taskType = taskNode.path("type").asText(); - - if (!checkTaskHasSubProcess(taskType)) { - continue; - } - //get sub process info - ObjectNode subParams = (ObjectNode) taskNode.path("params"); - Long subProcessCode = subParams.path(PROCESSDEFINITIONCODE).asLong(); - ProcessDefinition subProcess = processDefinitionMapper.queryByCode(subProcessCode); - //check is sub process exist in db - if (null == subProcess) { - continue; - } - - String subProcessJson = JSONUtils.toJsonString(processService.genProcessData(subProcess)); - //check current project has sub process - ProcessDefinition currentProjectSubProcess = processDefinitionMapper.queryByDefineName(targetProject.getCode(), subProcess.getName()); - - if (null == currentProjectSubProcess) { - ArrayNode subJsonArray = (ArrayNode) JSONUtils.parseObject(subProcessJson).get(TASKS); - - List 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, subProcessCodeMap); - //sub process processId correct - if (!subProcessCodeMap.isEmpty()) { - - for (Map.Entry entry : subProcessCodeMap.entrySet()) { - String oldSubProcessCode = "\"processDefinitionCode\":" + entry.getKey(); - String newSubProcessCode = "\"processDefinitionCode\":" + entry.getValue(); - subProcessJson = subProcessJson.replaceAll(oldSubProcessCode, newSubProcessCode); - } - - subProcessCodeMap.clear(); - } - } - - try { - // TODO import subProcess - // createProcessDefinition(loginUser - // , targetProject.getName(), - // subProcess.getName(), - // subProcessJson, - // subProcess.getDescription(), - // subProcess.getLocations(), - // subProcess.getConnects()); - logger.info("create sub process, project: {}, process name: {}", targetProject.getName(), subProcess.getName()); - - } catch (Exception e) { - logger.error("import process meta json data: {}", e.getMessage(), e); - } - - //modify task node - ProcessDefinition newSubProcessDefine = processDefinitionMapper.queryByDefineName(subProcess.getCode(), subProcess.getName()); - - if (null != newSubProcessDefine) { - subProcessCodeMap.put(subProcessCode, newSubProcessDefine.getCode()); - subParams.put(PROCESSDEFINITIONCODE, newSubProcessDefine.getId()); - taskNode.set("params", subParams); - } + private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) { + ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, 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(projectCode, processDefinitionName, num + 1); } /** @@ -1412,21 +1155,6 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro return graph.hasCycle(); } - private String recursionProcessDefinitionName(Long projectCode, String processDefinitionName, int num) { - ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, 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(projectCode, processDefinitionName, num + 1); - } - /** * batch copy process definition * diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java index b75540e7c5..77bd2065f0 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java @@ -349,12 +349,12 @@ public class ProcessDefinitionControllerTest { } @Test - public void testBatchExportProcessDefinitionByIds() throws Exception { + public void testBatchExportProcessDefinitionByCodes() { String processDefinitionIds = "1,2"; long projectCode = 1L; HttpServletResponse response = new MockHttpServletResponse(); - Mockito.doNothing().when(this.processDefinitionService).batchExportProcessDefinitionByIds(user, projectCode, processDefinitionIds, response); - processDefinitionController.batchExportProcessDefinitionByIds(user, projectCode, processDefinitionIds, response); + Mockito.doNothing().when(this.processDefinitionService).batchExportProcessDefinitionByCodes(user, projectCode, processDefinitionIds, response); + processDefinitionController.batchExportProcessDefinitionByCodes(user, projectCode, processDefinitionIds, response); } @Test diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java index deb8cf0124..aade722362 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataAnalysisServiceTest.java @@ -126,12 +126,12 @@ public class DataAnalysisServiceTest { Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), any())).thenReturn(result); - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); // SUCCESS Mockito.when(taskInstanceMapper.countTaskInstanceStateByUser(DateUtils.getScheduleDate(startDate), DateUtils.getScheduleDate(endDate), new Long[] {1L})).thenReturn(getTaskInstanceStateCounts()); - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); result = dataAnalysisServiceImpl.countTaskStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @@ -154,7 +154,7 @@ public class DataAnalysisServiceTest { Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), any())).thenReturn(result); - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); // when date in illegal format then return error message String startDate2 = "illegalDateString"; @@ -180,7 +180,7 @@ public class DataAnalysisServiceTest { Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), any())).thenReturn(result); - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); // when general user doesn't have any task then return all count are 0 user.setUserType(UserType.GENERAL_USER); @@ -199,7 +199,7 @@ public class DataAnalysisServiceTest { Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); Mockito.when(projectService.checkProjectAndAuth(any(), any(), any())).thenReturn(result); - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); // when instanceStateCounter return null, then return nothing user.setUserType(UserType.GENERAL_USER); @@ -213,13 +213,13 @@ public class DataAnalysisServiceTest { String startDate = "2020-02-11 16:02:18"; String endDate = "2020-02-11 16:03:18"; - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); //checkProject false Map failResult = new HashMap<>(); putMsg(failResult, Status.PROJECT_NOT_FOUNT, 1); Mockito.when(projectService.checkProjectAndAuth(any(), any(), any())).thenReturn(failResult); - failResult = dataAnalysisServiceImpl.countProcessInstanceStateByProject(user, 2, startDate, endDate); + failResult = dataAnalysisServiceImpl.countProcessInstanceStateByProject(user, 1, startDate, endDate); Assert.assertEquals(Status.PROJECT_NOT_FOUNT, failResult.get(Constants.STATUS)); Map result = new HashMap<>(); @@ -237,7 +237,7 @@ public class DataAnalysisServiceTest { @Test public void testCountDefinitionByUser() { - Mockito.when(projectMapper.queryByCode(Mockito.any())).thenReturn(getProject("test")); + Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject("test")); Map result = new HashMap<>(); putMsg(result, Status.SUCCESS, null); @@ -318,7 +318,7 @@ public class DataAnalysisServiceTest { */ private Project getProject(String projectName) { Project project = new Project(); - project.setCode(11L); + project.setCode(1L); project.setId(1); project.setName(projectName); project.setUserId(1); diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java index bf89ed198a..6fea42a4b6 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java @@ -20,7 +20,6 @@ package org.apache.dolphinscheduler.api.service; import static org.powermock.api.mockito.PowerMockito.mock; import static org.powermock.api.mockito.PowerMockito.when; -import org.apache.dolphinscheduler.api.dto.ProcessMeta; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; @@ -812,110 +811,6 @@ public class ProcessDefinitionServiceTest { } - @Test - public void testImportProcessDefinitionById() throws IOException { - - String processJson = "[\n" - + " {\n" - + " \"projectName\": \"testProject\",\n" - + " \"processDefinitionName\": \"shell-4\",\n" - + " \"processDefinitionJson\": \"{\\\"tenantId\\\":1" - + ",\\\"globalParams\\\":[],\\\"tasks\\\":[{\\\"workerGroupId\\\":\\\"3\\\",\\\"description\\\"" - + ":\\\"\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SHELL\\\",\\\"params\\\":{\\\"rawScript\\\"" - + ":\\\"#!/bin/bash\\\\necho \\\\\\\"shell-4\\\\\\\"\\\",\\\"localParams\\\":[],\\\"resourceList\\\":[]}" - + ",\\\"timeout\\\":{\\\"enable\\\":false,\\\"strategy\\\":\\\"\\\"},\\\"maxRetryTimes\\\":\\\"0\\\"" - + ",\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-4\\\",\\\"dependence\\\":{}" - + ",\\\"retryInterval\\\":\\\"1\\\",\\\"preTasks\\\":[],\\\"id\\\":\\\"tasks-84090\\\"}" - + ",{\\\"taskInstancePriority\\\":\\\"MEDIUM\\\",\\\"name\\\":\\\"shell-5\\\",\\\"workerGroupId\\\"" - + ":\\\"3\\\",\\\"description\\\":\\\"\\\",\\\"dependence\\\":{},\\\"preTasks\\\":[\\\"shell-4\\\"]" - + ",\\\"id\\\":\\\"tasks-87364\\\",\\\"runFlag\\\":\\\"NORMAL\\\",\\\"type\\\":\\\"SUB_PROCESS\\\"" - + ",\\\"params\\\":{\\\"processDefinitionId\\\":46},\\\"timeout\\\":{\\\"enable\\\":false" - + ",\\\"strategy\\\":\\\"\\\"}}],\\\"timeout\\\":0}\",\n" - + " \"processDefinitionDescription\": \"\",\n" - + " \"processDefinitionLocations\": \"{\\\"tasks-84090\\\":{\\\"name\\\":\\\"shell-4\\\"" - + ",\\\"targetarr\\\":\\\"\\\",\\\"x\\\":128,\\\"y\\\":114},\\\"tasks-87364\\\":{\\\"name\\\"" - + ":\\\"shell-5\\\",\\\"targetarr\\\":\\\"tasks-84090\\\",\\\"x\\\":266,\\\"y\\\":115}}\",\n" - + " \"processDefinitionConnects\": \"[{\\\"endPointSourceId\\\":\\\"tasks-84090\\\"" - + ",\\\"endPointTargetId\\\":\\\"tasks-87364\\\"}]\"\n" - + " }\n" - + "]"; - - String subProcessJson = "{\n" - + " \"globalParams\": [\n" - + " \n" - + " ],\n" - + " \"tasks\": [\n" - + " {\n" - + " \"type\": \"SHELL\",\n" - + " \"id\": \"tasks-52423\",\n" - + " \"name\": \"shell-5\",\n" - + " \"params\": {\n" - + " \"resourceList\": [\n" - + " \n" - + " ],\n" - + " \"localParams\": [\n" - + " \n" - + " ],\n" - + " \"rawScript\": \"echo \\\"shell-5\\\"\"\n" - + " },\n" - + " \"description\": \"\",\n" - + " \"runFlag\": \"NORMAL\",\n" - + " \"dependence\": {\n" - + " \n" - + " },\n" - + " \"maxRetryTimes\": \"0\",\n" - + " \"retryInterval\": \"1\",\n" - + " \"timeout\": {\n" - + " \"strategy\": \"\",\n" - + " \"interval\": null,\n" - + " \"enable\": false\n" - + " },\n" - + " \"taskInstancePriority\": \"MEDIUM\",\n" - + " \"workerGroupId\": \"3\",\n" - + " \"preTasks\": [\n" - + " \n" - + " ]\n" - + " }\n" - + " ],\n" - + " \"tenantId\": 1,\n" - + " \"timeout\": 0\n" - + "}"; - - FileUtils.writeStringToFile(new File("/tmp/task.json"), processJson); - - File file = new File("/tmp/task.json"); - - FileInputStream fileInputStream = new FileInputStream("/tmp/task.json"); - - MultipartFile multipartFile = new MockMultipartFile(file.getName(), file.getName(), - ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream); - - User loginUser = new User(); - loginUser.setId(1); - loginUser.setUserType(UserType.ADMIN_USER); - - long currentProjectCode = 1L; - Map result = new HashMap<>(); - putMsg(result, Status.SUCCESS, currentProjectCode); - - ProcessDefinition shellDefinition2 = new ProcessDefinition(); - shellDefinition2.setId(46); - shellDefinition2.setName("shell-5"); - shellDefinition2.setProjectId(2); - shellDefinition2.setProcessDefinitionJson(subProcessJson); - - Mockito.when(projectMapper.queryByCode(currentProjectCode)).thenReturn(getProject(currentProjectCode)); - Mockito.when(projectService.checkProjectAndAuth(loginUser, getProject(currentProjectCode), "test")).thenReturn(result); - - Map importProcessResult = processDefinitionService.importProcessDefinition(loginUser, currentProjectCode, multipartFile); - - Assert.assertEquals(Status.SUCCESS, importProcessResult.get(Constants.STATUS)); - - boolean delete = file.delete(); - - Assert.assertTrue(delete); - } - @Test public void testUpdateProcessDefinition() { User loginUser = new User(); @@ -933,113 +828,20 @@ public class ProcessDefinitionServiceTest { Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); - String sqlDependentJson = "{\n" - + " \"globalParams\": [\n" - + " \n" - + " ],\n" - + " \"tasks\": [\n" - + " {\n" - + " \"type\": \"SQL\",\n" - + " \"id\": \"tasks-27297\",\n" - + " \"name\": \"sql\",\n" - + " \"params\": {\n" - + " \"type\": \"MYSQL\",\n" - + " \"datasource\": 1,\n" - + " \"sql\": \"select * from test\",\n" - + " \"udfs\": \"\",\n" - + " \"sqlType\": \"1\",\n" - + " \"title\": \"\",\n" - + " \"receivers\": \"\",\n" - + " \"receiversCc\": \"\",\n" - + " \"showType\": \"TABLE\",\n" - + " \"localParams\": [\n" - + " \n" - + " ],\n" - + " \"connParams\": \"\",\n" - + " \"preStatements\": [\n" - + " \n" - + " ],\n" - + " \"postStatements\": [\n" - + " \n" - + " ]\n" - + " },\n" - + " \"description\": \"\",\n" - + " \"runFlag\": \"NORMAL\",\n" - + " \"dependence\": {\n" - + " \n" - + " },\n" - + " \"maxRetryTimes\": \"0\",\n" - + " \"retryInterval\": \"1\",\n" - + " \"timeout\": {\n" - + " \"strategy\": \"\",\n" - + " \"enable\": false\n" - + " },\n" - + " \"taskInstancePriority\": \"MEDIUM\",\n" - + " \"workerGroupId\": -1,\n" - + " \"preTasks\": [\n" - + " \"dependent\"\n" - + " ]\n" - + " },\n" - + " {\n" - + " \"type\": \"DEPENDENT\",\n" - + " \"id\": \"tasks-33787\",\n" - + " \"name\": \"dependent\",\n" - + " \"params\": {\n" - + " \n" - + " },\n" - + " \"description\": \"\",\n" - + " \"runFlag\": \"NORMAL\",\n" - + " \"dependence\": {\n" - + " \"relation\": \"AND\",\n" - + " \"dependTaskList\": [\n" - + " {\n" - + " \"relation\": \"AND\",\n" - + " \"dependItemList\": [\n" - + " {\n" - + " \"projectId\": 2,\n" - + " \"definitionId\": 46,\n" - + " \"depTasks\": \"ALL\",\n" - + " \"cycle\": \"day\",\n" - + " \"dateValue\": \"today\"\n" - + " }\n" - + " ]\n" - + " }\n" - + " ]\n" - + " },\n" - + " \"maxRetryTimes\": \"0\",\n" - + " \"retryInterval\": \"1\",\n" - + " \"timeout\": {\n" - + " \"strategy\": \"\",\n" - + " \"enable\": false\n" - + " },\n" - + " \"taskInstancePriority\": \"MEDIUM\",\n" - + " \"workerGroupId\": -1,\n" - + " \"preTasks\": [\n" - + " \n" - + " ]\n" - + " }\n" - + " ],\n" - + " \"tenantId\": 1,\n" - + " \"timeout\": 0\n" - + "}"; + String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":123456789," + + "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}},{\"name\":\"\",\"preTaskCode\":123456789," + + "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}}]"; Map updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1, - "", "", "", "", 0, "root", sqlDependentJson); + "", "", "", "", 0, "root", taskRelationJson); Assert.assertEquals(Status.DATA_IS_NOT_VALID, updateResult.get(Constants.STATUS)); } @Test - public void testBatchExportProcessDefinitionByIds() throws IOException { - processDefinitionService.batchExportProcessDefinitionByIds( + public void testBatchExportProcessDefinitionByCodes() throws IOException { + processDefinitionService.batchExportProcessDefinitionByCodes( null, 1L, null, null); - String processDefinitionJson = "{\"globalParams\":[],\"tasks\":[{\"conditionResult\":" - + "{\"failedNode\":[\"\"],\"successNode\":[\"\"]},\"delayTime\":\"0\",\"dependence\":{}" - + ",\"description\":\"\",\"id\":\"tasks-3011\",\"maxRetryTimes\":\"0\",\"name\":\"tsssss\"" - + ",\"params\":{\"localParams\":[],\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[]}" - + ",\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\",\"taskInstancePriority\":\"MEDIUM\"" - + ",\"timeout\":{\"enable\":false,\"interval\":null,\"strategy\":\"\"},\"type\":\"SHELL\"" - + ",\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],\"tenantId\":4,\"timeout\":0}"; User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); @@ -1052,27 +854,22 @@ public class ProcessDefinitionServiceTest { Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(result); - processDefinitionService.batchExportProcessDefinitionByIds( + processDefinitionService.batchExportProcessDefinitionByCodes( loginUser, projectCode, "1", null); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(1); - processDefinition.setProcessDefinitionJson(processDefinitionJson); Map checkResult = new HashMap<>(); checkResult.put(Constants.STATUS, Status.SUCCESS); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, project.getName())).thenReturn(checkResult); - Mockito.when(processDefineMapper.queryByDefineId(1)).thenReturn(processDefinition); HttpServletResponse response = mock(HttpServletResponse.class); - ProcessData processData = JSONUtils.parseObject(processDefinitionJson, ProcessData.class); - Mockito.when(processService.genProcessData(processDefinition)).thenReturn(processData); - - ServletOutputStream outputStream = mock(ServletOutputStream.class); - when(response.getOutputStream()).thenReturn(outputStream); - processDefinitionService.batchExportProcessDefinitionByIds( + DagData dagData = new DagData(getProcessDefinition(), null, null); + Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData); + processDefinitionService.batchExportProcessDefinitionByCodes( loginUser, projectCode, "1", response); - Assert.assertNotNull(processDefinitionService.exportProcessMetaData(processDefinition)); + Assert.assertNotNull(processDefinitionService.exportProcessDagData(processDefinition)); } /** @@ -1167,26 +964,6 @@ public class ProcessDefinitionServiceTest { return schedule; } - /** - * get mock processMeta - * - * @return processMeta - */ - private ProcessMeta getProcessMeta() { - ProcessMeta processMeta = new ProcessMeta(); - Schedule schedule = getSchedule(); - processMeta.setScheduleCrontab(schedule.getCrontab()); - processMeta.setScheduleStartTime(DateUtils.dateToString(schedule.getStartTime())); - processMeta.setScheduleEndTime(DateUtils.dateToString(schedule.getEndTime())); - processMeta.setScheduleWarningType(String.valueOf(schedule.getWarningType())); - processMeta.setScheduleWarningGroupId(schedule.getWarningGroupId()); - processMeta.setScheduleFailureStrategy(String.valueOf(schedule.getFailureStrategy())); - processMeta.setScheduleReleaseState(String.valueOf(schedule.getReleaseState())); - processMeta.setScheduleProcessInstancePriority(String.valueOf(schedule.getProcessInstancePriority())); - processMeta.setScheduleWorkerGroupName("workgroup1"); - return processMeta; - } - private List getSchedulerList() { List scheduleList = new ArrayList<>(); scheduleList.add(getSchedule()); @@ -1201,19 +978,4 @@ public class ProcessDefinitionServiceTest { result.put(Constants.MSG, status.getMsg()); } } - - @Test - public void testImportProcessSchedule() { - User loginUser = new User(); - loginUser.setId(1); - loginUser.setUserType(UserType.ADMIN_USER); - Integer processDefinitionId = 111; - String processDefinitionName = "testProcessDefinition"; - String projectName = "project_test1"; - Map result = new HashMap<>(); - putMsg(result, Status.PROJECT_NOT_FOUNT); - ProcessMeta processMeta = new ProcessMeta(); - Assert.assertEquals(0, processDefinitionService.importProcessSchedule(loginUser, projectName, processMeta, processDefinitionName, processDefinitionId)); - } - } diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java index 14abf82b16..e818c87adc 100644 --- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java +++ b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java @@ -635,6 +635,11 @@ public final class Constants { */ public static final int DEFINITION_FAILURE = -1; + /** + * process or task definition first version + */ + public static final int VERSION_FIRST = 1; + /** * date format of yyyyMMdd */ diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DagData.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DagData.java index d44e1d5d01..e66d4d09e0 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DagData.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/DagData.java @@ -45,6 +45,9 @@ public class DagData { this.taskDefinitionList = taskDefinitionList; } + public DagData() { + } + public ProcessDefinition getProcessDefinition() { return processDefinition; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java index d43667cd77..be1a9a8728 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessDefinition.java @@ -51,7 +51,7 @@ public class ProcessDefinition { /** * code */ - private Long code; + private long code; /** * name @@ -78,7 +78,7 @@ public class ProcessDefinition { /** * project code */ - private Long projectCode; + private long projectCode; /** * definition json string @@ -190,9 +190,9 @@ public class ProcessDefinition { public ProcessDefinition(){} - public ProcessDefinition(Long projectCode, + public ProcessDefinition(long projectCode, String name, - Long code, + long code, String description, String globalParams, String locations, @@ -422,19 +422,19 @@ public class ProcessDefinition { this.modifyBy = modifyBy; } - public Long getCode() { + public long getCode() { return code; } - public void setCode(Long code) { + public void setCode(long code) { this.code = code; } - public Long getProjectCode() { + public long getProjectCode() { return projectCode; } - public void setProjectCode(Long projectCode) { + public void setProjectCode(long projectCode) { this.projectCode = projectCode; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Project.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Project.java index ad173b8547..82e5cd7a8f 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Project.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Project.java @@ -50,7 +50,7 @@ public class Project { /** * project code */ - private Long code; + private long code; /** * project name @@ -90,11 +90,11 @@ public class Project { @TableField(exist = false) private int instRunningCount; - public Long getCode() { + public long getCode() { return code; } - public void setCode(Long code) { + public void setCode(long code) { this.code = code; } @@ -228,7 +228,7 @@ public class Project { private int id; private int userId; private String userName; - private Long code; + private long code; private String name; private String description; private Date createTime; @@ -240,7 +240,7 @@ public class Project { private Builder() { } - public Builder code(Long code) { + public Builder code(long code) { this.code = code; return this; } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.java index 4511051a43..e5f3279a0d 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionLogMapper.java @@ -39,7 +39,7 @@ public interface ProcessDefinitionLogMapper extends BaseMapper queryByDefinitionName(@Param("projectCode") Long projectCode, + List queryByDefinitionName(@Param("projectCode") long projectCode, @Param("processDefinitionName") String name); /** @@ -67,7 +67,7 @@ public interface ProcessDefinitionLogMapper extends BaseMapper queryProcessDefinitionVersionsPaging(Page page, - @Param("processDefinitionCode") Long processDefinitionCode); + @Param("processDefinitionCode") long processDefinitionCode); /** * delete the certain process definition version by process definition id and version number @@ -87,5 +87,5 @@ public interface ProcessDefinitionLogMapper extends BaseMapper { * @param code code * @return process definition */ - ProcessDefinition queryByCode(@Param("code") Long code); + ProcessDefinition queryByCode(@Param("code") long code); /** * query process definition by code list @@ -59,8 +59,8 @@ public interface ProcessDefinitionMapper extends BaseMapper { * @param code code * @return delete result */ - int deleteByCode(@Param("code") Long code); - + int deleteByCode(@Param("code") long code); + /** * verify process definition by name * @@ -68,8 +68,8 @@ public interface ProcessDefinitionMapper extends BaseMapper { * @param name name * @return process definition */ - ProcessDefinition verifyByDefineName(@Param("projectCode") Long projectCode, - @Param("processDefinitionName") String name); + ProcessDefinition verifyByDefineName(@Param("projectCode") long projectCode, + @Param("processDefinitionName") String name); /** * query process definition by name @@ -78,7 +78,7 @@ public interface ProcessDefinitionMapper extends BaseMapper { * @param name name * @return process definition */ - ProcessDefinition queryByDefineName(@Param("projectCode") Long projectCode, + ProcessDefinition queryByDefineName(@Param("projectCode") long projectCode, @Param("processDefinitionName") String name); /** @@ -102,7 +102,7 @@ public interface ProcessDefinitionMapper extends BaseMapper { IPage queryDefineListPaging(IPage page, @Param("searchVal") String searchVal, @Param("userId") int userId, - @Param("projectCode") Long projectCode, + @Param("projectCode") long projectCode, @Param("isAdmin") boolean isAdmin); /** @@ -111,7 +111,7 @@ public interface ProcessDefinitionMapper extends BaseMapper { * @param projectCode projectCode * @return process definition list */ - List queryAllDefinitionList(@Param("projectCode") Long projectCode); + List queryAllDefinitionList(@Param("projectCode") long projectCode); /** * query process definition by ids @@ -158,21 +158,13 @@ public interface ProcessDefinitionMapper extends BaseMapper { @MapKey("id") List> listResourcesByUser(@Param("userId") Integer userId); - /** - * update process definition version by process definitionId - * - * @param processDefinitionId process definition id - * @param version version - */ - void updateVersionByProcessDefinitionId(@Param("processDefinitionId") int processDefinitionId, @Param("version") long version); - /** * list all project ids + * * @return project ids list */ List listProjectIds(); - /** * query the paging process definition version list by pagination info * @@ -181,9 +173,11 @@ public interface ProcessDefinitionMapper extends BaseMapper { * @return the paging process definition version list */ IPage queryProcessDefinitionVersionsPaging(Page page, - @Param("processDefinitionCode") Long processDefinitionCode); + @Param("processDefinitionCode") long processDefinitionCode); + /** * query has associated definition by id and version + * * @param processDefinitionId process definition id * @param version version * @return definition id diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.java index 55ab26fb68..e735a1cff7 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationLogMapper.java @@ -40,11 +40,6 @@ public interface ProcessTaskRelationLogMapper extends BaseMapper queryByProcessCodeAndVersion(@Param("processCode") long processCode, @Param("processVersion") int processVersion); - List queryByTaskRelationList(@Param("processCode") long processCode, - @Param("processVersion") int processVersion, - @Param("taskCode") long taskCode, - @Param("taskVersion") long taskVersion); - /** * batch insert process task relation * diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java index 0d94f96701..c9c3a8aac3 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.java @@ -38,8 +38,8 @@ public interface ProcessTaskRelationMapper extends BaseMapper queryByProcessCode(@Param("projectCode") Long projectCode, - @Param("processCode") Long processCode); + List queryByProcessCode(@Param("projectCode") long projectCode, + @Param("processCode") long processCode); /** * process task relation by taskCode @@ -55,7 +55,7 @@ public interface ProcessTaskRelationMapper extends BaseMapper queryByTaskCode(@Param("taskCode") Long taskCode); + List queryByTaskCode(@Param("taskCode") long taskCode); /** * delete process task relation by processCode @@ -64,8 +64,8 @@ public interface ProcessTaskRelationMapper extends BaseMapper { * @param projectCode projectCode * @return project */ - Project queryByCode(@Param("projectCode") Long projectCode); + Project queryByCode(@Param("projectCode") long projectCode); /** * TODO: delete @@ -51,7 +51,7 @@ public interface ProjectMapper extends BaseMapper { * @param projectCode projectCode * @return project */ - Project queryDetailByCode(@Param("projectCode") Long projectCode); + Project queryDetailByCode(@Param("projectCode") long projectCode); /** * query project by name diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.java index eb29b647bc..0d3d85ed00 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.java @@ -39,7 +39,7 @@ public interface TaskDefinitionLogMapper extends BaseMapper { * @param name name * @return task definition log list */ - List queryByDefinitionName(@Param("projectCode") Long projectCode, + List queryByDefinitionName(@Param("projectCode") long projectCode, @Param("taskDefinitionName") String name); /** diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java index 99503b2de5..51353191e1 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java @@ -40,7 +40,7 @@ public interface TaskDefinitionMapper extends BaseMapper { * @param name name * @return task definition */ - TaskDefinition queryByDefinitionName(@Param("projectCode") Long projectCode, + TaskDefinition queryByDefinitionName(@Param("projectCode") long projectCode, @Param("taskDefinitionName") String name); /** @@ -57,7 +57,7 @@ public interface TaskDefinitionMapper extends BaseMapper { * @param taskDefinitionCode taskDefinitionCode * @return task definition */ - TaskDefinition queryByDefinitionCode(@Param("taskDefinitionCode") Long taskDefinitionCode); + TaskDefinition queryByDefinitionCode(@Param("taskDefinitionCode") long taskDefinitionCode); /** * query all task definition list @@ -65,7 +65,7 @@ public interface TaskDefinitionMapper extends BaseMapper { * @param projectCode projectCode * @return task definition list */ - List queryAllDefinitionList(@Param("projectCode") Long projectCode); + List queryAllDefinitionList(@Param("projectCode") long projectCode); /** * query task definition by ids @@ -105,7 +105,7 @@ public interface TaskDefinitionMapper extends BaseMapper { * @param code code * @return int */ - int deleteByCode(@Param("code") Long code); + int deleteByCode(@Param("code") long code); /** * batch insert task definitions diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml index a16480fd6a..d33963f2b3 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml @@ -167,13 +167,6 @@ FROM t_ds_project - - - update t_ds_process_definition - set version = #{version} - where id = #{processDefinitionId} - - - insert into t_ds_process_task_relation_log (`name`, process_definition_version, project_code, process_definition_code, pre_task_code, pre_task_version, post_task_code, post_task_version, condition_type, condition_params, operator, operate_time, diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java index 41af5b7eba..1eb9cf7b96 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapperTest.java @@ -368,17 +368,6 @@ public class ProcessDefinitionMapperTest { Assert.assertNotNull(maps); } - @Test - public void testUpdateVersionByProcessDefinitionId() { - int expectedVersion = 10; - ProcessDefinition processDefinition = insertOne(); - processDefinition.setVersion(expectedVersion); - processDefinitionMapper.updateVersionByProcessDefinitionId( - processDefinition.getId(), processDefinition.getVersion()); - ProcessDefinition processDefinition1 = processDefinitionMapper.selectById(processDefinition.getId()); - Assert.assertEquals(expectedVersion, processDefinition1.getVersion()); - } - @Test public void listProjectIds() { ProcessDefinition processDefinition = insertOne(); diff --git a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java index 080b474b1a..b65441e635 100644 --- a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java +++ b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java @@ -2193,7 +2193,7 @@ public class ProcessService { public int saveProcessDefine(User operator, ProcessDefinition processDefinition, Boolean isFromProcessDefine) { ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition); Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinition.getCode()); - int insertVersion = version == null || version == 0 ? 1 : version + 1; + int insertVersion = version == null || version == 0 ? Constants.VERSION_FIRST : version + 1; processDefinitionLog.setVersion(insertVersion); processDefinitionLog.setReleaseState(isFromProcessDefine ? ReleaseState.OFFLINE : ReleaseState.ONLINE); processDefinitionLog.setOperator(operator.getId()); diff --git a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java index 643dc09c6a..00c1435794 100644 --- a/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java +++ b/dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java @@ -359,6 +359,7 @@ public class ProcessServiceTest { public void testSwitchVersion() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setCode(1L); + processDefinition.setProjectCode(1L); processDefinition.setId(123); processDefinition.setName("test"); processDefinition.setVersion(1);