use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.
the class FeaturestoreKeywordBuilder method build.
public KeywordDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Featuregroup featureGroup, TrainingDataset trainingDataset, List<String> keywords) {
KeywordDTO dto = new KeywordDTO();
if (featureGroup != null) {
dto.setHref(uri(uriInfo, project, featureGroup.getFeaturestore(), featureGroup));
} else {
dto.setHref(uri(uriInfo, project, trainingDataset.getFeaturestore(), trainingDataset));
}
dto.setExpand(expand(resourceRequest));
if (dto.isExpand()) {
dto.setKeywords(keywords);
}
return dto;
}
use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.
the class FeaturestoreKeywordResource method getKeywords.
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Get keywords")
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
public Response getKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException, MetadataException {
Users user = jwtHelper.getUserPrincipal(sc);
List<String> keywords = keywordControllerIface.getAll(project, user, featuregroup, trainingDataset);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, keywords);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.
the class FeaturestoreService method getUsedKeywords.
@Path("keywords")
@GET
@Produces(MediaType.APPLICATION_JSON)
@AllowedProjectRoles({ AllowedProjectRoles.DATA_OWNER, AllowedProjectRoles.DATA_SCIENTIST })
@ApiKeyRequired(acceptedScopes = { ApiScope.FEATURESTORE }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@JWTRequired(acceptedTokens = { Audience.API, Audience.JOB }, allowedUserRoles = { "HOPS_ADMIN", "HOPS_USER" })
@ApiOperation(value = "Get available keywords for the featurestore", response = KeywordDTO.class)
public Response getUsedKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo) throws FeaturestoreException {
List<String> keywords = keywordControllerIface.getUsedKeywords();
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, keywords);
return Response.ok().entity(dto).build();
}
Aggregations