Java Code Examples for org.apache.kylin.metadata.project.ProjectInstance#getName()
The following examples show how to use
org.apache.kylin.metadata.project.ProjectInstance#getName() .
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: ProjectService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public ProjectInstance createProject(ProjectInstance newProject) throws IOException { Message msg = MsgPicker.getMsg(); String projectName = newProject.getName(); String description = newProject.getDescription(); LinkedHashMap<String, String> overrideProps = newProject.getOverrideKylinProps(); ProjectInstance currentProject = getProjectManager().getProject(projectName); if (currentProject != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getPROJECT_ALREADY_EXIST(), projectName)); } String owner = SecurityContextHolder.getContext().getAuthentication().getName(); ProjectInstance createdProject = getProjectManager().createProject(projectName, owner, description, overrideProps); accessService.init(createdProject, AclPermission.ADMINISTRATION); logger.debug("New project created."); return createdProject; }
Example 2
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
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; }
Example 3
Source File: ProjectService.java From kylin with Apache License 2.0 | 6 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public ProjectInstance createProject(ProjectInstance newProject) throws IOException { Message msg = MsgPicker.getMsg(); String projectName = newProject.getName(); String description = newProject.getDescription(); LinkedHashMap<String, String> overrideProps = newProject.getOverrideKylinProps(); ProjectInstance currentProject = getProjectManager().getProject(projectName); if (currentProject != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getPROJECT_ALREADY_EXIST(), projectName)); } String owner = SecurityContextHolder.getContext().getAuthentication().getName(); ProjectInstance createdProject = getProjectManager().createProject(projectName, owner, description, overrideProps); accessService.init(createdProject, AclPermission.ADMINISTRATION); logger.debug("New project created."); return createdProject; }
Example 4
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
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; }
Example 5
Source File: ProjectController.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@RequestMapping(value = "", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public ProjectInstance updateProject(@RequestBody ProjectRequest projectRequest) { String formerProjectName = projectRequest.getFormerProjectName(); if (StringUtils.isEmpty(formerProjectName)) { throw new InternalErrorException("A project name must be given to update a project"); } ProjectInstance projectDesc = deserializeProjectDesc(projectRequest); ProjectInstance updatedProj = null; try { ProjectInstance currentProject = projectService.getProjectManager().getProject(formerProjectName); if (currentProject == null) { throw new NotFoundException("The project named " + formerProjectName + " does not exists"); } if (projectDesc.getName().equals(currentProject.getName())) { updatedProj = projectService.updateProject(projectDesc, currentProject); } else { throw new IllegalStateException("Rename project is not supported yet, from " + formerProjectName + " to " + projectDesc.getName()); } } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } return updatedProj; }
Example 6
Source File: ProjectService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#currentProject, 'ADMINISTRATION')") public ProjectInstance updateProject(ProjectInstance newProject, ProjectInstance currentProject) throws IOException { String newProjectName = newProject.getName(); String newDescription = newProject.getDescription(); LinkedHashMap<String, String> overrideProps = newProject.getOverrideKylinProps(); ProjectInstance updatedProject = getProjectManager().updateProject(currentProject, newProjectName, newDescription, overrideProps); logger.debug("Project updated."); return updatedProject; }
Example 7
Source File: ProjectService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public String getProjectOfCube(String cubeName) { for (ProjectInstance p : getProjectManager().listAllProjects()) { if (p.containsRealization(RealizationType.CUBE, cubeName)) return p.getName(); } return null; }
Example 8
Source File: ProjectService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public String getProjectOfModel(String modelName) { for (ProjectInstance p : getProjectManager().listAllProjects()) { if (p.containsModel(modelName)) return p.getName(); } return null; }
Example 9
Source File: ProjectController.java From kylin with Apache License 2.0 | 5 votes |
@RequestMapping(value = "", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody public ProjectInstance updateProject(@RequestBody ProjectRequest projectRequest) { String formerProjectName = projectRequest.getFormerProjectName(); if (StringUtils.isEmpty(formerProjectName)) { throw new InternalErrorException("A project name must be given to update a project"); } ProjectInstance projectDesc = deserializeProjectDesc(projectRequest); ProjectInstance updatedProj = null; try { ProjectInstance currentProject = projectService.getProjectManager().getProject(formerProjectName); if (currentProject == null) { throw new NotFoundException("The project named " + formerProjectName + " does not exists"); } if (projectDesc.getName().equals(currentProject.getName())) { updatedProj = projectService.updateProject(projectDesc, currentProject); } else { throw new IllegalStateException("Rename project is not supported yet, from " + formerProjectName + " to " + projectDesc.getName()); } } catch (Exception e) { logger.error("Failed to deal with the request.", e); throw new InternalErrorException(e.getLocalizedMessage(), e); } return updatedProj; }
Example 10
Source File: ProjectService.java From kylin with Apache License 2.0 | 5 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#currentProject, 'ADMINISTRATION')") public ProjectInstance updateProject(ProjectInstance newProject, ProjectInstance currentProject) throws IOException { String newProjectName = newProject.getName(); String newDescription = newProject.getDescription(); LinkedHashMap<String, String> overrideProps = newProject.getOverrideKylinProps(); ProjectInstance updatedProject = getProjectManager().updateProject(currentProject, newProjectName, newDescription, overrideProps); logger.debug("Project updated."); return updatedProject; }
Example 11
Source File: ProjectService.java From kylin with Apache License 2.0 | 5 votes |
public String getProjectOfCube(String cubeName) { for (ProjectInstance p : getProjectManager().listAllProjects()) { if (p.containsRealization(RealizationType.CUBE, cubeName)) return p.getName(); } return null; }
Example 12
Source File: ProjectService.java From kylin with Apache License 2.0 | 5 votes |
public String getProjectOfModel(String modelName) { for (ProjectInstance p : getProjectManager().listAllProjects()) { if (p.containsModel(modelName)) return p.getName(); } return null; }
Example 13
Source File: RangerKylinAuthorizer.java From ranger with Apache License 2.0 | 5 votes |
@Override public boolean checkPermission(String user, List<String> groups, String entityType, String entityUuid, Permission permission) { if (LOG.isDebugEnabled()) { LOG.debug("==> RangerKylinAuthorizer.checkPermission( user=" + user + ", groups=" + groups + ", entityType=" + entityType + ", entityUuid=" + entityUuid + ", permission=" + permission + ")"); } boolean ret = false; if (kylinPlugin != null) { String projectName = null; KylinConfig kylinConfig = KylinConfig.getInstanceFromEnv(); if (AclEntityType.PROJECT_INSTANCE.equals(entityType)) { ProjectInstance projectInstance = ProjectManager.getInstance(kylinConfig).getPrjByUuid(entityUuid); if (projectInstance != null) { projectName = projectInstance.getName(); } else { if (LOG.isWarnEnabled()) { LOG.warn("Could not find kylin project for given uuid=" + entityUuid); } } } String accessType = ExternalAclProvider.transformPermission(permission); RangerKylinAccessRequest request = new RangerKylinAccessRequest(projectName, user, groups, accessType, clientIPAddress); RangerAccessResult result = kylinPlugin.isAccessAllowed(request); if (result != null && result.getIsAllowed()) { ret = true; } } if (LOG.isDebugEnabled()) { LOG.debug("<== RangerKylinAuthorizer.checkPermission(): result=" + ret); } return ret; }