Search in sources :

Example 1 with FeatureViewDTO

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;
}
Also used : KeywordDTO(io.hops.hopsworks.common.featurestore.keyword.KeywordDTO) TagsDTO(io.hops.hopsworks.common.tags.TagsDTO) FeatureViewDTO(io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO) ResourceRequest(io.hops.hopsworks.common.api.ResourceRequest)

Example 2 with FeatureViewDTO

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;
}
Also used : FeatureViewDTO(io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO) FeatureView(io.hops.hopsworks.persistence.entity.featurestore.featureview.FeatureView)

Example 3 with 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;
}
Also used : FeatureViewDTO(io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO) UserDTO(io.hops.hopsworks.common.dao.user.UserDTO)

Aggregations

FeatureViewDTO (io.hops.hopsworks.common.featurestore.featureview.FeatureViewDTO)3 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)1 UserDTO (io.hops.hopsworks.common.dao.user.UserDTO)1 KeywordDTO (io.hops.hopsworks.common.featurestore.keyword.KeywordDTO)1 TagsDTO (io.hops.hopsworks.common.tags.TagsDTO)1 FeatureView (io.hops.hopsworks.persistence.entity.featurestore.featureview.FeatureView)1