Search in sources :

Example 61 with ProjectException

use of io.hops.hopsworks.exceptions.ProjectException in project hopsworks by logicalclocks.

the class ProjectsAdmin method deleteProject.

@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/projects/{id}")
public Response deleteProject(@Context HttpServletRequest req, @PathParam("id") Integer id) throws ProjectException, GenericException {
    Project project = projectFacade.find(id);
    if (project == null) {
        throw new ProjectException(RESTCodes.ProjectErrorCode.PROJECT_NOT_FOUND, Level.FINE, "projectId: " + id);
    }
    String sessionId = req.getSession().getId();
    projectController.removeProject(project.getOwner().getEmail(), id, sessionId);
    LOGGER.log(Level.INFO, "Deleted project with id: " + id);
    RESTApiJsonResponse response = new RESTApiJsonResponse();
    response.setSuccessMessage(ResponseMessages.PROJECT_REMOVED);
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(response).build();
}
Also used : ProjectException(io.hops.hopsworks.exceptions.ProjectException) Project(io.hops.hopsworks.persistence.entity.project.Project) RESTApiJsonResponse(io.hops.hopsworks.api.util.RESTApiJsonResponse) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 62 with ProjectException

use of io.hops.hopsworks.exceptions.ProjectException in project hopsworks by logicalclocks.

the class ProjectsAdmin method getProjectAdminInfo.

/**
 * Returns admin information about the requested project
 *
 * @param projectId
 * @return
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/projects/{id}")
public Response getProjectAdminInfo(@PathParam("id") Integer projectId, @Context SecurityContext sc) throws ProjectException {
    Project project = projectFacade.find(projectId);
    if (project == null) {
        throw new ProjectException(RESTCodes.ProjectErrorCode.PROJECT_NOT_FOUND, Level.FINE, "projectId: " + projectId);
    }
    ProjectAdminInfoDTO projectAdminInfoDTO = new ProjectAdminInfoDTO(project, projectController.getQuotasInternal(project));
    GenericEntity<ProjectAdminInfoDTO> projectEntity = new GenericEntity<ProjectAdminInfoDTO>(projectAdminInfoDTO) {
    };
    return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(projectEntity).build();
}
Also used : ProjectException(io.hops.hopsworks.exceptions.ProjectException) Project(io.hops.hopsworks.persistence.entity.project.Project) GenericEntity(javax.ws.rs.core.GenericEntity) ProjectAdminInfoDTO(io.hops.hopsworks.api.admin.dto.ProjectAdminInfoDTO) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ProjectException (io.hops.hopsworks.exceptions.ProjectException)62 Project (io.hops.hopsworks.persistence.entity.project.Project)43 IOException (java.io.IOException)19 Produces (javax.ws.rs.Produces)19 Users (io.hops.hopsworks.persistence.entity.user.Users)17 Path (javax.ws.rs.Path)17 AllowedProjectRoles (io.hops.hopsworks.api.filter.AllowedProjectRoles)12 DatasetException (io.hops.hopsworks.exceptions.DatasetException)12 GenericException (io.hops.hopsworks.exceptions.GenericException)12 ServiceException (io.hops.hopsworks.exceptions.ServiceException)11 JupyterProject (io.hops.hopsworks.persistence.entity.jupyter.JupyterProject)11 KafkaException (io.hops.hopsworks.exceptions.KafkaException)10 UserException (io.hops.hopsworks.exceptions.UserException)10 JWTRequired (io.hops.hopsworks.jwt.annotation.JWTRequired)10 ProjectTeam (io.hops.hopsworks.persistence.entity.project.team.ProjectTeam)9 ArrayList (java.util.ArrayList)8 GET (javax.ws.rs.GET)8 HopsSecurityException (io.hops.hopsworks.exceptions.HopsSecurityException)7 Inode (io.hops.hopsworks.persistence.entity.hdfs.inode.Inode)7 POST (javax.ws.rs.POST)7