Java Code Examples for org.apache.kylin.rest.request.CubeRequest#setMessage()

The following examples show how to use org.apache.kylin.rest.request.CubeRequest#setMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubeController.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
/**
 * save cubeDesc
 *
 * @return Table metadata array
 * @throws IOException
 */
@RequestMapping(value = "", method = { RequestMethod.POST }, produces = { "application/json" })
@ResponseBody
public CubeRequest saveCubeDesc(@RequestBody CubeRequest cubeRequest) {

    CubeDesc desc = deserializeCubeDesc(cubeRequest);

    if (desc == null) {
        cubeRequest.setMessage("CubeDesc is null.");
        return cubeRequest;
    }
    String name = desc.getName();
    if (StringUtils.isEmpty(name)) {
        logger.info("Cube name should not be empty.");
        throw new BadRequestException("Cube name should not be empty.");
    }
    if (!ValidateUtil.isAlphanumericUnderscore(name)) {
        throw new BadRequestException("Invalid Cube name, only letters, numbers and underscore supported.");
    }

    validateColumnFamily(desc);

    try {
        desc.setUuid(RandomUtil.randomUUID().toString());
        String projectName = (null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME
                : cubeRequest.getProject();
        ProjectInstance project = cubeService.getProjectManager().getProject(projectName);
        if (project == null) {
            throw new NotFoundException("Project " + projectName + " doesn't exist");
        }
        cubeService.createCubeAndDesc(project, desc);
    } catch (Exception e) {
        logger.error("Failed to deal with the request.", e);
        throw new InternalErrorException(e.getLocalizedMessage(), e);
    }

    cubeRequest.setUuid(desc.getUuid());
    cubeRequest.setSuccessful(true);
    return cubeRequest;
}
 
Example 2
Source File: CubeController.java    From kylin with Apache License 2.0 5 votes vote down vote up
/**
 * save cubeDesc
 *
 * @return Table metadata array
 * @throws IOException
 */
@RequestMapping(value = "", method = { RequestMethod.POST }, produces = { "application/json" })
@ResponseBody
public CubeRequest saveCubeDesc(@RequestBody CubeRequest cubeRequest) {

    CubeDesc desc = deserializeCubeDesc(cubeRequest);

    if (desc == null) {
        cubeRequest.setMessage("CubeDesc is null.");
        return cubeRequest;
    }
    String name = desc.getName();
    if (StringUtils.isEmpty(name)) {
        logger.info("Cube name should not be empty.");
        throw new BadRequestException("Cube name should not be empty.");
    }
    if (!ValidateUtil.isAlphanumericUnderscore(name)) {
        throw new BadRequestException("Invalid Cube name, only letters, numbers and underscore supported.");
    }

    validateColumnFamily(desc);

    try {
        desc.setUuid(RandomUtil.randomUUID().toString());
        String projectName = (null == cubeRequest.getProject()) ? ProjectInstance.DEFAULT_PROJECT_NAME
                : cubeRequest.getProject();
        ProjectInstance project = cubeService.getProjectManager().getProject(projectName);
        if (project == null) {
            throw new NotFoundException("Project " + projectName + " doesn't exist");
        }
        cubeService.createCubeAndDesc(project, desc);
    } catch (Exception e) {
        logger.error("Failed to deal with the request.", e);
        throw new InternalErrorException(e.getLocalizedMessage(), e);
    }

    cubeRequest.setUuid(desc.getUuid());
    cubeRequest.setSuccessful(true);
    return cubeRequest;
}
 
Example 3
Source File: CubeController.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
private void updateRequest(CubeRequest request, boolean success, String message) {
    request.setCubeDescData("");
    request.setSuccessful(success);
    request.setMessage(message);
}
 
Example 4
Source File: CubeController.java    From kylin with Apache License 2.0 4 votes vote down vote up
private void updateRequest(CubeRequest request, boolean success, String message) {
    request.setCubeDescData("");
    request.setSuccessful(success);
    request.setMessage(message);
}
 
Example 5
Source File: CubeController.java    From Kylin with Apache License 2.0 4 votes vote down vote up
private void updateRequest(CubeRequest request, boolean success, String message) {
    request.setCubeDescData("");
    request.setSuccessful(success);
    request.setMessage(message);
}