Search in sources :

Example 1 with ApiException

use of com.flink.platform.web.config.annotation.ApiException in project flink-platform-backend by itinycheng.

the class JobFlowController method create.

@ApiException
@PostMapping(value = "/create")
public ResultInfo<Long> create(@RequestAttribute(value = Constant.SESSION_USER) User loginUser, @RequestBody JobFlowRequest jobFlowRequest) {
    String errorMsg = jobFlowRequest.validateOnCreate();
    if (StringUtils.isNotBlank(errorMsg)) {
        return failure(ERROR_PARAMETER, errorMsg);
    }
    JobFlow jobFlow = jobFlowRequest.getJobFlow();
    jobFlow.setId(null);
    jobFlow.setCode(UuidGenerator.generateShortUuid());
    jobFlow.setUserId(loginUser.getId());
    jobFlow.setStatus(JobFlowStatus.OFFLINE);
    jobFlowService.save(jobFlow);
    return ResultInfo.success(jobFlowRequest.getId());
}
Also used : JobFlow(com.flink.platform.dao.entity.JobFlow) PostMapping(org.springframework.web.bind.annotation.PostMapping) ApiException(com.flink.platform.web.config.annotation.ApiException)

Aggregations

JobFlow (com.flink.platform.dao.entity.JobFlow)1 ApiException (com.flink.platform.web.config.annotation.ApiException)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1