use of io.hops.hopsworks.common.dao.dataset.DataSetDTO in project hopsworks by logicalclocks.
the class ProjectService method getDatasetInfo.
@GET
@Path("{projectId}/getInodeInfo/{inodeId}")
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.ANYONE })
public Response getDatasetInfo(@PathParam("projectId") Integer projectId, @PathParam("inodeId") Long inodeId, @Context SecurityContext sc) throws ProjectException, DatasetException {
Inode inode = inodes.findById(inodeId);
if (inode == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.INODE_NOT_FOUND, Level.FINE, "inodeId: " + inodeId);
}
Project project = projectFacade.find(projectId);
if (project == null) {
throw new ProjectException(RESTCodes.ProjectErrorCode.PROJECT_NOT_FOUND, Level.FINE, "projectId: " + projectId);
}
DataSetDTO dataset = new DataSetDTO(inode.getInodePK().getName(), inodeId, project);
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(dataset).build();
}
use of io.hops.hopsworks.common.dao.dataset.DataSetDTO in project hopsworks by logicalclocks.
the class ProjectService method getDatasetInfo.
@GET
@Path("getDatasetInfo/{inodeId}")
@Produces(MediaType.APPLICATION_JSON)
public Response getDatasetInfo(@PathParam("inodeId") Long inodeId, @Context SecurityContext sc) throws DatasetException {
Inode inode = inodes.findById(inodeId);
Project proj = datasetController.getOwningProject(inode);
Dataset ds = datasetFacade.findByProjectAndInode(proj, inode);
if (ds == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.DATASET_NOT_FOUND, Level.FINE, "inodeId: " + inodeId);
}
Collection<DatasetSharedWith> projectsContainingInode = proj.getDatasetSharedWithCollection();
List<String> sharedWith = new ArrayList<>();
for (DatasetSharedWith d : projectsContainingInode) {
if (!d.getProject().getId().equals(proj.getId())) {
sharedWith.add(d.getProject().getName());
}
}
DataSetDTO dataset = new DataSetDTO(ds, proj, sharedWith);
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(dataset).build();
}
use of io.hops.hopsworks.common.dao.dataset.DataSetDTO in project hopsworks by logicalclocks.
the class DelaClusterService method getPublicDatasets.
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getPublicDatasets(@Context SecurityContext sc) {
List<Dataset> clusterDatasets = clusterDatasetCtrl.getPublicDatasets();
List<DataSetDTO> localDS = new LinkedList<>();
for (Dataset ds : clusterDatasets) {
localDS.add(new DataSetDTO(ds));
}
GenericEntity<List<DataSetDTO>> datasets = new GenericEntity<List<DataSetDTO>>(localDS) {
};
return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(datasets).build();
}
Aggregations