Java Code Examples for org.apache.kylin.cube.CubeInstance#setCost()

The following examples show how to use org.apache.kylin.cube.CubeInstance#setCost() . 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: CubeService.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN)
public CubeInstance updateCubeCost(String cubeName, int cost) throws IOException {
    CubeInstance cube = getCubeManager().getCube(cubeName);
    if (cube == null) {
        throw new IOException("Cannot find cube " + cubeName);
    }
    if (cube.getCost() == cost) {
        // Do nothing
        return cube;
    }
    cube.setCost(cost);

    String owner = SecurityContextHolder.getContext().getAuthentication().getName();
    cube.setOwner(owner);

    return getCubeManager().updateCube(cube);
}
 
Example 2
Source File: CubeService.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public CubeInstance updateCubeCost(CubeInstance cube, int cost) throws IOException {
    aclEvaluate.checkProjectWritePermission(cube);
    if (cube.getCost() == cost) {
        // Do nothing
        return cube;
    }
    cube.setCost(cost);

    String owner = SecurityContextHolder.getContext().getAuthentication().getName();
    cube.setOwner(owner);

    CubeUpdate update = new CubeUpdate(cube.latestCopyForWrite()).setOwner(owner).setCost(cost);
    return getCubeManager().updateCube(update);
}
 
Example 3
Source File: CubeService.java    From kylin with Apache License 2.0 5 votes vote down vote up
public CubeInstance updateCubeCost(CubeInstance cube, int cost) throws IOException {
    aclEvaluate.checkProjectWritePermission(cube);
    if (cube.getCost() == cost) {
        // Do nothing
        return cube;
    }
    cube.setCost(cost);

    String owner = SecurityContextHolder.getContext().getAuthentication().getName();
    cube.setOwner(owner);

    CubeUpdate update = new CubeUpdate(cube.latestCopyForWrite()).setOwner(owner).setCost(cost);
    return getCubeManager().updateCube(update);
}