@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#project, 'ADMINISTRATION') or hasPermission(#project, 'MANAGEMENT')") public CubeDesc saveCube(CubeDesc desc, ProjectInstance project) throws IOException { Message msg = MsgPicker.getMsg(); desc.setDraft(false); if (desc.getUuid() == null) desc.updateRandomUuid(); try { createCubeAndDesc(project, desc); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
public CubeDesc updateCube(CubeInstance cube, CubeDesc desc, ProjectInstance project) throws IOException { aclEvaluate.checkProjectWritePermission(cube); Message msg = MsgPicker.getMsg(); String projectName = project.getName(); desc.setDraft(false); try { if (cube.getSegments().size() != 0 && !cube.getDescriptor().consistentWith(desc)) { throw new BadRequestException( String.format(Locale.ROOT, msg.getINCONSISTENT_CUBE_DESC(), desc.getName())); } desc = updateCubeAndDesc(cube, desc, projectName, true); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
public static CubeDesc getCopyOf(CubeDesc cubeDesc) { CubeDesc newCubeDesc = new CubeDesc(); newCubeDesc.setName(cubeDesc.getName()); newCubeDesc.setDraft(cubeDesc.isDraft()); newCubeDesc.setModelName(cubeDesc.getModelName()); newCubeDesc.setDescription(cubeDesc.getDescription());
public static CubeDesc getCopyOf(CubeDesc cubeDesc) { CubeDesc newCubeDesc = new CubeDesc(); newCubeDesc.setName(cubeDesc.getName()); newCubeDesc.setDraft(cubeDesc.isDraft()); newCubeDesc.setModelName(cubeDesc.getModelName()); newCubeDesc.setDescription(cubeDesc.getDescription());