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();
}
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();
}
Aggregations