|
|
@ -17,6 +17,7 @@ |
|
|
|
package org.apache.dolphinscheduler.api.controller; |
|
|
|
package org.apache.dolphinscheduler.api.controller; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
import org.apache.dolphinscheduler.api.enums.Status; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.exceptions.ApiException; |
|
|
|
import org.apache.dolphinscheduler.api.service.ResourcesService; |
|
|
|
import org.apache.dolphinscheduler.api.service.ResourcesService; |
|
|
|
import org.apache.dolphinscheduler.api.service.UdfFuncService; |
|
|
|
import org.apache.dolphinscheduler.api.service.UdfFuncService; |
|
|
|
import org.apache.dolphinscheduler.api.utils.Result; |
|
|
|
import org.apache.dolphinscheduler.api.utils.Result; |
|
|
@ -44,6 +45,7 @@ import springfox.documentation.annotations.ApiIgnore; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
import static org.apache.dolphinscheduler.api.enums.Status.*; |
|
|
|
import static org.apache.dolphinscheduler.api.enums.Status.*; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* resources controller |
|
|
|
* resources controller |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -71,7 +73,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* |
|
|
|
|
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param type type |
|
|
|
* @param type type |
|
|
|
* @param alias alias |
|
|
|
* @param alias alias |
|
|
@ -88,20 +89,16 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") |
|
|
|
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/directory/create") |
|
|
|
@PostMapping(value = "/directory/create") |
|
|
|
|
|
|
|
@ApiException(CREATE_RESOURCE_ERROR) |
|
|
|
public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "currentDir") String currentDir) { |
|
|
|
@RequestParam(value = "currentDir") String currentDir) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}", |
|
|
|
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}", |
|
|
|
loginUser.getUserName(), type, alias, description, pid, currentDir); |
|
|
|
loginUser.getUserName(), type, alias, description, pid, currentDir); |
|
|
|
return resourceService.createDirectory(loginUser, alias, description, type, pid, currentDir); |
|
|
|
return resourceService.createDirectory(loginUser, alias, description, type, pid, currentDir); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(CREATE_RESOURCE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(CREATE_RESOURCE_ERROR.getCode(), CREATE_RESOURCE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -122,6 +119,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") |
|
|
|
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/create") |
|
|
|
@PostMapping(value = "/create") |
|
|
|
|
|
|
|
@ApiException(CREATE_RESOURCE_ERROR) |
|
|
|
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
@ -129,14 +127,9 @@ public class ResourcesController extends BaseController{ |
|
|
|
@RequestParam("file") MultipartFile file, |
|
|
|
@RequestParam("file") MultipartFile file, |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "currentDir") String currentDir) { |
|
|
|
@RequestParam(value = "currentDir") String currentDir) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}", |
|
|
|
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}", |
|
|
|
loginUser.getUserName(), type, alias, description, file.getName(), file.getOriginalFilename()); |
|
|
|
loginUser.getUserName(), type, alias, description, file.getName(), file.getOriginalFilename()); |
|
|
|
return resourceService.createResource(loginUser, alias, description, type, file, pid, currentDir); |
|
|
|
return resourceService.createResource(loginUser, alias, description, type, file, pid, currentDir); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(CREATE_RESOURCE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(CREATE_RESOURCE_ERROR.getCode(), CREATE_RESOURCE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -157,19 +150,15 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String") |
|
|
|
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/update") |
|
|
|
@PostMapping(value = "/update") |
|
|
|
|
|
|
|
@ApiException(UPDATE_RESOURCE_ERROR) |
|
|
|
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
@RequestParam(value = "name") String alias, |
|
|
|
@RequestParam(value = "description", required = false) String description) { |
|
|
|
@RequestParam(value = "description", required = false) String description) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, update resource, type: {}, resource alias: {}, desc: {}", |
|
|
|
logger.info("login user {}, update resource, type: {}, resource alias: {}, desc: {}", |
|
|
|
loginUser.getUserName(), type, alias, description); |
|
|
|
loginUser.getUserName(), type, alias, description); |
|
|
|
return resourceService.updateResource(loginUser, resourceId, alias, description, type); |
|
|
|
return resourceService.updateResource(loginUser, resourceId, alias, description, type); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(UPDATE_RESOURCE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.UPDATE_RESOURCE_ERROR.getCode(), Status.UPDATE_RESOURCE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -185,17 +174,13 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/list") |
|
|
|
@GetMapping(value = "/list") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(QUERY_RESOURCES_LIST_ERROR) |
|
|
|
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type); |
|
|
|
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type); |
|
|
|
Map<String, Object> result = resourceService.queryResourceList(loginUser, type); |
|
|
|
Map<String, Object> result = resourceService.queryResourceList(loginUser, type); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_RESOURCES_LIST_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.QUERY_RESOURCES_LIST_ERROR.getCode(), Status.QUERY_RESOURCES_LIST_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -218,6 +203,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/list-paging") |
|
|
|
@GetMapping(value = "/list-paging") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(QUERY_RESOURCES_LIST_PAGING) |
|
|
|
public Result queryResourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryResourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "id") int id, |
|
|
|
@RequestParam(value = "id") int id, |
|
|
@ -225,7 +211,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
@RequestParam(value = "searchVal", required = false) String searchVal, |
|
|
|
@RequestParam(value = "searchVal", required = false) String searchVal, |
|
|
|
@RequestParam("pageSize") Integer pageSize |
|
|
|
@RequestParam("pageSize") Integer pageSize |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("query resource list, login user:{}, resource type:{}, search value:{}", |
|
|
|
logger.info("query resource list, login user:{}, resource type:{}, search value:{}", |
|
|
|
loginUser.getUserName(), type, searchVal); |
|
|
|
loginUser.getUserName(), type, searchVal); |
|
|
|
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
|
|
|
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
|
|
@ -236,10 +221,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
searchVal = ParameterUtils.handleEscapes(searchVal); |
|
|
|
searchVal = ParameterUtils.handleEscapes(searchVal); |
|
|
|
result = resourceService.queryResourceListPaging(loginUser, id, type, searchVal, pageNo, pageSize); |
|
|
|
result = resourceService.queryResourceListPaging(loginUser, id, type, searchVal, pageNo, pageSize); |
|
|
|
return returnDataListPaging(result); |
|
|
|
return returnDataListPaging(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_RESOURCES_LIST_PAGING.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.QUERY_RESOURCES_LIST_PAGING.getCode(), Status.QUERY_RESOURCES_LIST_PAGING.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -256,17 +237,13 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/delete") |
|
|
|
@GetMapping(value = "/delete") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(DELETE_RESOURCE_ERROR) |
|
|
|
public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int resourceId |
|
|
|
@RequestParam(value = "id") int resourceId |
|
|
|
) { |
|
|
|
) throws Exception { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, delete resource id: {}", |
|
|
|
logger.info("login user {}, delete resource id: {}", |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
return resourceService.delete(loginUser, resourceId); |
|
|
|
return resourceService.delete(loginUser, resourceId); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(DELETE_RESOURCE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.DELETE_RESOURCE_ERROR.getCode(), Status.DELETE_RESOURCE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -285,19 +262,15 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/verify-name") |
|
|
|
@GetMapping(value = "/verify-name") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR) |
|
|
|
public Result verifyResourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result verifyResourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "fullName") String fullName, |
|
|
|
@RequestParam(value = "fullName") String fullName, |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
) { |
|
|
|
) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, verfiy resource alias: {},resource type: {}", |
|
|
|
logger.info("login user {}, verfiy resource alias: {},resource type: {}", |
|
|
|
loginUser.getUserName(), fullName, type); |
|
|
|
loginUser.getUserName(), fullName, type); |
|
|
|
|
|
|
|
|
|
|
|
return resourceService.verifyResourceName(fullName, type, loginUser); |
|
|
|
return resourceService.verifyResourceName(fullName, type, loginUser); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR.getMsg(), e); |
|
|
|
|
|
|
|
return error(Status.VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR.getCode(), Status.VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -313,17 +286,13 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/list/jar") |
|
|
|
@GetMapping(value = "/list/jar") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(QUERY_RESOURCES_LIST_ERROR) |
|
|
|
public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type.toString()); |
|
|
|
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type.toString()); |
|
|
|
Map<String, Object> result = resourceService.queryResourceJarList(loginUser, type); |
|
|
|
Map<String, Object> result = resourceService.queryResourceJarList(loginUser, type); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_RESOURCES_LIST_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.QUERY_RESOURCES_LIST_ERROR.getCode(), Status.QUERY_RESOURCES_LIST_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -341,20 +310,16 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/queryResource") |
|
|
|
@GetMapping(value = "/queryResource") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(RESOURCE_NOT_EXIST) |
|
|
|
public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "fullName", required = false) String fullName, |
|
|
|
@RequestParam(value = "fullName", required = false) String fullName, |
|
|
|
@RequestParam(value = "id", required = false) Integer id, |
|
|
|
@RequestParam(value = "id", required = false) Integer id, |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
@RequestParam(value = "type") ResourceType type |
|
|
|
) { |
|
|
|
) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, query resource by full name: {} or id: {},resource type: {}", |
|
|
|
logger.info("login user {}, query resource by full name: {} or id: {},resource type: {}", |
|
|
|
loginUser.getUserName(), fullName, id, type); |
|
|
|
loginUser.getUserName(), fullName, id, type); |
|
|
|
|
|
|
|
|
|
|
|
return resourceService.queryResource(fullName, id, type); |
|
|
|
return resourceService.queryResource(fullName, id, type); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(RESOURCE_NOT_EXIST.getMsg(), e); |
|
|
|
|
|
|
|
return error(Status.RESOURCE_NOT_EXIST.getCode(), Status.RESOURCE_NOT_EXIST.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -373,20 +338,16 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") |
|
|
|
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/view") |
|
|
|
@GetMapping(value = "/view") |
|
|
|
|
|
|
|
@ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR) |
|
|
|
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "skipLineNum") int skipLineNum, |
|
|
|
@RequestParam(value = "skipLineNum") int skipLineNum, |
|
|
|
@RequestParam(value = "limit") int limit |
|
|
|
@RequestParam(value = "limit") int limit |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, view resource : {}, skipLineNum {} , limit {}", |
|
|
|
logger.info("login user {}, view resource : {}, skipLineNum {} , limit {}", |
|
|
|
loginUser.getUserName(), resourceId, skipLineNum, limit); |
|
|
|
loginUser.getUserName(), resourceId, skipLineNum, limit); |
|
|
|
|
|
|
|
|
|
|
|
return resourceService.readResource(resourceId, skipLineNum, limit); |
|
|
|
return resourceService.readResource(resourceId, skipLineNum, limit); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(VIEW_RESOURCE_FILE_ON_LINE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.VIEW_RESOURCE_FILE_ON_LINE_ERROR.getCode(), Status.VIEW_RESOURCE_FILE_ON_LINE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -409,6 +370,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") |
|
|
|
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/online-create") |
|
|
|
@PostMapping(value = "/online-create") |
|
|
|
|
|
|
|
@ApiException(CREATE_RESOURCE_FILE_ON_LINE_ERROR) |
|
|
|
public Result onlineCreateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result onlineCreateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "type") ResourceType type, |
|
|
|
@RequestParam(value = "fileName") String fileName, |
|
|
|
@RequestParam(value = "fileName") String fileName, |
|
|
@ -418,7 +380,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "pid") int pid, |
|
|
|
@RequestParam(value = "currentDir") String currentDir |
|
|
|
@RequestParam(value = "currentDir") String currentDir |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, online create resource! fileName : {}, type : {}, suffix : {},desc : {},content : {}", |
|
|
|
logger.info("login user {}, online create resource! fileName : {}, type : {}, suffix : {},desc : {},content : {}", |
|
|
|
loginUser.getUserName(), fileName, type, fileSuffix, description, content, pid, currentDir); |
|
|
|
loginUser.getUserName(), fileName, type, fileSuffix, description, content, pid, currentDir); |
|
|
|
if (StringUtils.isEmpty(content)) { |
|
|
|
if (StringUtils.isEmpty(content)) { |
|
|
@ -426,10 +387,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg()); |
|
|
|
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return resourceService.onlineCreateResource(loginUser, type, fileName, fileSuffix, description, content, pid, currentDir); |
|
|
|
return resourceService.onlineCreateResource(loginUser, type, fileName, fileSuffix, description, content, pid, currentDir); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(CREATE_RESOURCE_FILE_ON_LINE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.CREATE_RESOURCE_FILE_ON_LINE_ERROR.getCode(), Status.CREATE_RESOURCE_FILE_ON_LINE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -446,11 +403,11 @@ public class ResourcesController extends BaseController{ |
|
|
|
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") |
|
|
|
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/update-content") |
|
|
|
@PostMapping(value = "/update-content") |
|
|
|
|
|
|
|
@ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR) |
|
|
|
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "id") int resourceId, |
|
|
|
@RequestParam(value = "content") String content |
|
|
|
@RequestParam(value = "content") String content |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, updateProcessInstance resource : {}", |
|
|
|
logger.info("login user {}, updateProcessInstance resource : {}", |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
if (StringUtils.isEmpty(content)) { |
|
|
|
if (StringUtils.isEmpty(content)) { |
|
|
@ -458,10 +415,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg()); |
|
|
|
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return resourceService.updateResourceContent(resourceId, content); |
|
|
|
return resourceService.updateResourceContent(resourceId, content); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(EDIT_RESOURCE_FILE_ON_LINE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.EDIT_RESOURCE_FILE_ON_LINE_ERROR.getCode(), Status.EDIT_RESOURCE_FILE_ON_LINE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -477,9 +430,9 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/download") |
|
|
|
@GetMapping(value = "/download") |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiException(DOWNLOAD_RESOURCE_FILE_ERROR) |
|
|
|
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int resourceId) { |
|
|
|
@RequestParam(value = "id") int resourceId) throws Exception { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("login user {}, download resource : {}", |
|
|
|
logger.info("login user {}, download resource : {}", |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
loginUser.getUserName(), resourceId); |
|
|
|
Resource file = resourceService.downloadResource(resourceId); |
|
|
|
Resource file = resourceService.downloadResource(resourceId); |
|
|
@ -490,18 +443,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
.ok() |
|
|
|
.ok() |
|
|
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"") |
|
|
|
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"") |
|
|
|
.body(file); |
|
|
|
.body(file); |
|
|
|
}catch (RuntimeException e){ |
|
|
|
|
|
|
|
logger.error(e.getMessage(),e); |
|
|
|
|
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(e.getMessage()); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(DOWNLOAD_RESOURCE_FILE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.DOWNLOAD_RESOURCE_FILE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* create udf function |
|
|
|
* create udf function |
|
|
|
|
|
|
|
* |
|
|
|
* @param loginUser login user |
|
|
|
* @param loginUser login user |
|
|
|
* @param type udf type |
|
|
|
* @param type udf type |
|
|
|
* @param funcName function name |
|
|
|
* @param funcName function name |
|
|
@ -525,6 +472,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/udf-func/create") |
|
|
|
@PostMapping(value = "/udf-func/create") |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
@ApiException(CREATE_UDF_FUNCTION_ERROR) |
|
|
|
public Result createUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result createUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "type") UdfType type, |
|
|
|
@RequestParam(value = "type") UdfType type, |
|
|
|
@RequestParam(value = "funcName") String funcName, |
|
|
|
@RequestParam(value = "funcName") String funcName, |
|
|
@ -535,12 +483,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
logger.info("login user {}, create udf function, type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}", |
|
|
|
logger.info("login user {}, create udf function, type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}", |
|
|
|
loginUser.getUserName(), type, funcName, argTypes, database, description, resourceId); |
|
|
|
loginUser.getUserName(), type, funcName, argTypes, database, description, resourceId); |
|
|
|
try { |
|
|
|
|
|
|
|
return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(CREATE_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.CREATE_UDF_FUNCTION_ERROR.getCode(), Status.CREATE_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -557,17 +500,13 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/udf-func/update-ui") |
|
|
|
@GetMapping(value = "/udf-func/update-ui") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(VIEW_UDF_FUNCTION_ERROR) |
|
|
|
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("id") int id) { |
|
|
|
@RequestParam("id") int id) { |
|
|
|
logger.info("login user {}, query udf{}", |
|
|
|
logger.info("login user {}, query udf{}", |
|
|
|
loginUser.getUserName(), id); |
|
|
|
loginUser.getUserName(), id); |
|
|
|
try { |
|
|
|
|
|
|
|
Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id); |
|
|
|
Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id); |
|
|
|
return returnDataList(map); |
|
|
|
return returnDataList(map); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(VIEW_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.VIEW_UDF_FUNCTION_ERROR.getCode(), Status.VIEW_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -596,6 +535,7 @@ public class ResourcesController extends BaseController{ |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
@PostMapping(value = "/udf-func/update") |
|
|
|
@PostMapping(value = "/udf-func/update") |
|
|
|
|
|
|
|
@ApiException(UPDATE_UDF_FUNCTION_ERROR) |
|
|
|
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int udfFuncId, |
|
|
|
@RequestParam(value = "id") int udfFuncId, |
|
|
|
@RequestParam(value = "type") UdfType type, |
|
|
|
@RequestParam(value = "type") UdfType type, |
|
|
@ -605,15 +545,10 @@ public class ResourcesController extends BaseController{ |
|
|
|
@RequestParam(value = "database", required = false) String database, |
|
|
|
@RequestParam(value = "database", required = false) String database, |
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
@RequestParam(value = "description", required = false) String description, |
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
@RequestParam(value = "resourceId") int resourceId) { |
|
|
|
try { |
|
|
|
|
|
|
|
logger.info("login user {}, updateProcessInstance udf function id: {},type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}", |
|
|
|
logger.info("login user {}, updateProcessInstance udf function id: {},type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}", |
|
|
|
loginUser.getUserName(), udfFuncId, type, funcName, argTypes, database, description, resourceId); |
|
|
|
loginUser.getUserName(), udfFuncId, type, funcName, argTypes, database, description, resourceId); |
|
|
|
Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
logger.error(UPDATE_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.UPDATE_UDF_FUNCTION_ERROR.getCode(), Status.UPDATE_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -633,12 +568,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/udf-func/list-paging") |
|
|
|
@GetMapping(value = "/udf-func/list-paging") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR) |
|
|
|
public Result queryUdfFuncList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryUdfFuncList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("pageNo") Integer pageNo, |
|
|
|
@RequestParam("pageNo") Integer pageNo, |
|
|
|
@RequestParam(value = "searchVal", required = false) String searchVal, |
|
|
|
@RequestParam(value = "searchVal", required = false) String searchVal, |
|
|
|
@RequestParam("pageSize") Integer pageSize |
|
|
|
@RequestParam("pageSize") Integer pageSize |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("query udf functions list, login user:{},search value:{}", |
|
|
|
logger.info("query udf functions list, login user:{},search value:{}", |
|
|
|
loginUser.getUserName(), searchVal); |
|
|
|
loginUser.getUserName(), searchVal); |
|
|
|
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
|
|
|
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
|
|
@ -648,10 +583,6 @@ public class ResourcesController extends BaseController{ |
|
|
|
|
|
|
|
|
|
|
|
result = udfFuncService.queryUdfFuncListPaging(loginUser, searchVal, pageNo, pageSize); |
|
|
|
result = udfFuncService.queryUdfFuncListPaging(loginUser, searchVal, pageNo, pageSize); |
|
|
|
return returnDataListPaging(result); |
|
|
|
return returnDataListPaging(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.QUERY_UDF_FUNCTION_LIST_PAGING_ERROR.getCode(), Status.QUERY_UDF_FUNCTION_LIST_PAGING_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -667,16 +598,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/udf-func/list") |
|
|
|
@GetMapping(value = "/udf-func/list") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(QUERY_DATASOURCE_BY_TYPE_ERROR) |
|
|
|
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("type") UdfType type) { |
|
|
|
@RequestParam("type") UdfType type) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("query datasource list, user:{}, type:{}", loginUser.getUserName(), type); |
|
|
|
logger.info("query datasource list, user:{}, type:{}", loginUser.getUserName(), type); |
|
|
|
Map<String, Object> result = udfFuncService.queryResourceList(loginUser, type.ordinal()); |
|
|
|
Map<String, Object> result = udfFuncService.queryResourceList(loginUser, type.ordinal()); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(QUERY_DATASOURCE_BY_TYPE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.QUERY_DATASOURCE_BY_TYPE_ERROR.getCode(),QUERY_DATASOURCE_BY_TYPE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -693,19 +620,14 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/udf-func/verify-name") |
|
|
|
@GetMapping(value = "/udf-func/verify-name") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(VERIFY_UDF_FUNCTION_NAME_ERROR) |
|
|
|
public Result verifyUdfFuncName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result verifyUdfFuncName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "name") String name |
|
|
|
@RequestParam(value = "name") String name |
|
|
|
) { |
|
|
|
) { |
|
|
|
logger.info("login user {}, verfiy udf function name: {}", |
|
|
|
logger.info("login user {}, verfiy udf function name: {}", |
|
|
|
loginUser.getUserName(), name); |
|
|
|
loginUser.getUserName(), name); |
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return udfFuncService.verifyUdfFuncByName(name); |
|
|
|
return udfFuncService.verifyUdfFuncByName(name); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(VERIFY_UDF_FUNCTION_NAME_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.VERIFY_UDF_FUNCTION_NAME_ERROR.getCode(), Status.VERIFY_UDF_FUNCTION_NAME_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -721,17 +643,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/udf-func/delete") |
|
|
|
@GetMapping(value = "/udf-func/delete") |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
@ResponseStatus(HttpStatus.OK) |
|
|
|
|
|
|
|
@ApiException(DELETE_UDF_FUNCTION_ERROR) |
|
|
|
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam(value = "id") int udfFuncId |
|
|
|
@RequestParam(value = "id") int udfFuncId |
|
|
|
) { |
|
|
|
) { |
|
|
|
try{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("login user {}, delete udf function id: {}", loginUser.getUserName(), udfFuncId); |
|
|
|
logger.info("login user {}, delete udf function id: {}", loginUser.getUserName(), udfFuncId); |
|
|
|
return udfFuncService.delete(udfFuncId); |
|
|
|
return udfFuncService.delete(udfFuncId); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(DELETE_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.DELETE_UDF_FUNCTION_ERROR.getCode(), Status.DELETE_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -747,16 +664,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/authed-file") |
|
|
|
@GetMapping(value = "/authed-file") |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
@ApiException(AUTHORIZED_FILE_RESOURCE_ERROR) |
|
|
|
public Result authorizedFile(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result authorizedFile(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("authorized file resource, user: {}, user id:{}", loginUser.getUserName(), userId); |
|
|
|
logger.info("authorized file resource, user: {}, user id:{}", loginUser.getUserName(), userId); |
|
|
|
Map<String, Object> result = resourceService.authorizedFile(loginUser, userId); |
|
|
|
Map<String, Object> result = resourceService.authorizedFile(loginUser, userId); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(AUTHORIZED_FILE_RESOURCE_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.AUTHORIZED_FILE_RESOURCE_ERROR.getCode(), Status.AUTHORIZED_FILE_RESOURCE_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -773,16 +686,12 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/authorize-resource-tree") |
|
|
|
@GetMapping(value = "/authorize-resource-tree") |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
@ApiException(AUTHORIZE_RESOURCE_TREE) |
|
|
|
public Result authorizeResourceTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result authorizeResourceTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("all resource file, user:{}, user id:{}", loginUser.getUserName(), userId); |
|
|
|
logger.info("all resource file, user:{}, user id:{}", loginUser.getUserName(), userId); |
|
|
|
Map<String, Object> result = resourceService.authorizeResourceTree(loginUser, userId); |
|
|
|
Map<String, Object> result = resourceService.authorizeResourceTree(loginUser, userId); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(AUTHORIZE_RESOURCE_TREE.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.AUTHORIZE_RESOURCE_TREE.getCode(), Status.AUTHORIZE_RESOURCE_TREE.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -799,17 +708,13 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/unauth-udf-func") |
|
|
|
@GetMapping(value = "/unauth-udf-func") |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
@ApiException(UNAUTHORIZED_UDF_FUNCTION_ERROR) |
|
|
|
public Result unauthUDFFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result unauthUDFFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("unauthorized udf function, login user:{}, unauthorized user id:{}", loginUser.getUserName(), userId); |
|
|
|
logger.info("unauthorized udf function, login user:{}, unauthorized user id:{}", loginUser.getUserName(), userId); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> result = resourceService.unauthorizedUDFFunction(loginUser, userId); |
|
|
|
Map<String, Object> result = resourceService.unauthorizedUDFFunction(loginUser, userId); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(UNAUTHORIZED_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.UNAUTHORIZED_UDF_FUNCTION_ERROR.getCode(), Status.UNAUTHORIZED_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -826,15 +731,11 @@ public class ResourcesController extends BaseController{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
@GetMapping(value = "/authed-udf-func") |
|
|
|
@GetMapping(value = "/authed-udf-func") |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
@ResponseStatus(HttpStatus.CREATED) |
|
|
|
|
|
|
|
@ApiException(AUTHORIZED_UDF_FUNCTION_ERROR) |
|
|
|
public Result authorizedUDFFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
public Result authorizedUDFFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
@RequestParam("userId") Integer userId) { |
|
|
|
try{ |
|
|
|
|
|
|
|
logger.info("auth udf function, login user:{}, auth user id:{}", loginUser.getUserName(), userId); |
|
|
|
logger.info("auth udf function, login user:{}, auth user id:{}", loginUser.getUserName(), userId); |
|
|
|
Map<String, Object> result = resourceService.authorizedUDFFunction(loginUser, userId); |
|
|
|
Map<String, Object> result = resourceService.authorizedUDFFunction(loginUser, userId); |
|
|
|
return returnDataList(result); |
|
|
|
return returnDataList(result); |
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
logger.error(AUTHORIZED_UDF_FUNCTION_ERROR.getMsg(),e); |
|
|
|
|
|
|
|
return error(Status.AUTHORIZED_UDF_FUNCTION_ERROR.getCode(), Status.AUTHORIZED_UDF_FUNCTION_ERROR.getMsg()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |