use of io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO 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;
}
use of io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO in project hopsworks by logicalclocks.
the class FeatureViewBuilder method build.
public FeatureViewDTO build(List<FeatureView> featureViews, ResourceRequest resourceRequest, Project project, Users user, UriInfo uriInfo) throws FeaturestoreException, ServiceException, IOException, MetadataException, DatasetException, SchematizedTagException {
FeatureViewDTO featureViewDTO = new FeatureViewDTO();
featureViewDTO.setHref(uriInfo.getRequestUri());
if (featureViews.size() == 1) {
return buildSingle(featureViews.get(0), resourceRequest, project, user, uriInfo);
}
for (FeatureView featureView : featureViews) {
FeatureViewDTO featureViewItem = buildSingle(featureView, resourceRequest, project, user, uriInfo);
featureViewItem.setHref(uriInfo.getRequestUriBuilder().path("version").path(featureView.getVersion().toString()).build());
featureViewDTO.addItem(featureViewItem);
}
if (featureViews.size() > 1) {
featureViewDTO.setCount(Long.valueOf(featureViews.size()));
}
return featureViewDTO;
}
use of io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO in project hopsworks by logicalclocks.
the class FeatureViewBuilder method convertToDTO.
public FeatureViewDTO convertToDTO(FeatureView featureView) {
FeatureViewDTO featureViewDTO = new FeatureViewDTO();
featureViewDTO.setFeaturestoreId(featureView.getFeaturestore().getId());
featureViewDTO.setFeaturestoreName(featureView.getFeaturestore().getProject().getName());
featureViewDTO.setDescription(featureView.getDescription());
featureViewDTO.setCreated(featureView.getCreated());
featureViewDTO.setCreator(new UserDTO(featureView.getCreator()));
featureViewDTO.setVersion(featureView.getVersion());
featureViewDTO.setName(featureView.getName());
featureViewDTO.setId(featureView.getId());
featureViewDTO.setLabel(featureView.getLabel());
return featureViewDTO;
}
Aggregations