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, FeatureView featureView, List<String> keywords) {
KeywordDTO dto = new KeywordDTO();
dto.setHref(uri(uriInfo, project, featureView.getFeaturestore(), featureView));
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 FeaturestoreKeywordBuilder method build.
public KeywordDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, List<String> keywords) {
KeywordDTO dto = new KeywordDTO();
dto.setHref(uri(uriInfo, project));
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 deleteKeywords.
@DELETE
@ApiOperation(value = "Delete a keyword")
@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 deleteKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo, @QueryParam("keyword") String keyword) throws FeaturestoreException, MetadataException {
Users user = jwtHelper.getUserPrincipal(sc);
List<String> updatedKeywords = keywordControllerIface.deleteKeywords(project, user, featuregroup, trainingDataset, Arrays.asList(keyword));
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, updatedKeywords);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.
the class FeaturestoreKeywordResource method replaceKeywords.
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create keywords or replace existing ones")
@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 replaceKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo, KeywordDTO keywordDTO) throws FeaturestoreException, MetadataException {
Users user = jwtHelper.getUserPrincipal(sc);
List<String> updatedKeywords = keywordControllerIface.replaceKeywords(project, user, featuregroup, trainingDataset, keywordDTO.getKeywords());
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, featuregroup, trainingDataset, updatedKeywords);
return Response.ok().entity(dto).build();
}
use of io.hops.hopsworks.common.featurestore.keyword.KeywordDTO in project hopsworks by logicalclocks.
the class FeatureViewBuilder method buildSingle.
private FeatureViewDTO buildSingle(FeatureView featureView, ResourceRequest resourceRequest, Project project, Users user, UriInfo uriInfo) throws FeaturestoreException, ServiceException, IOException, MetadataException, DatasetException, SchematizedTagException {
FeatureViewDTO base = convertToDTO(featureView);
if (resourceRequest != null) {
if (resourceRequest.contains(ResourceRequest.Name.QUERY)) {
// For the overview page of UI
base.setQueryString(queryBuilder.build(uriInfo, project, user, featureView));
}
if (resourceRequest.contains(ResourceRequest.Name.FEATURES)) {
base.setFeatures(makeFeatures(featureView, project));
}
if (resourceRequest.contains(ResourceRequest.Name.KEYWORDS)) {
// TODO feature view: revisit after implementation of keyword endpoint
List<String> keywords = keywordControllerIface.getAll(project, user, featureView);
ResourceRequest keywordResourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS);
KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, keywordResourceRequest, project, featureView, keywords);
base.setKeywords(dto);
}
if (resourceRequest.contains(ResourceRequest.Name.TAGS)) {
// TODO feature view: revisit after implementation of tag endpoint
Map<String, String> result = tagController.getAll(project, user, featureView.getFeaturestore(), featureView);
ResourceRequest tagsResourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS);
TagsDTO dto = tagsBuilder.build(uriInfo, tagsResourceRequest, project, featureView.getFeaturestore().getId(), ResourceRequest.Name.FEATUREVIEW.name(), featureView.getId(), result);
base.setTags(dto);
}
}
return base;
}
Aggregations