Search in sources :

Example 1 with UserDTO

use of io.hops.hopsworks.api.user.UserDTO in project hopsworks by logicalclocks.

the class ElasticFeaturestoreItemBuilder method fromFeaturegroup.

public ElasticFeaturestoreItemDTO.Base fromFeaturegroup(ElasticFeaturestoreHit hit, HopsworksJAXBContext converter) throws GenericException {
    ElasticFeaturestoreItemDTO.Base item = new ElasticFeaturestoreItemDTO.Base();
    item.elasticId = hit.getId();
    item.name = hit.getName();
    item.version = hit.getVersion();
    item.datasetIId = hit.getDatasetIId();
    item.parentProjectId = hit.getProjectId();
    item.parentProjectName = hit.getProjectName();
    for (Map.Entry<String, Object> e : hit.getXattrs().entrySet()) {
        switch(e.getKey()) {
            case FeaturestoreXAttrsConstants.FEATURESTORE:
                {
                    Gson gson = new Gson();
                    FeaturegroupXAttr.FullDTO fg = converter.unmarshal(gson.toJson(e.getValue()), FeaturegroupXAttr.FullDTO.class);
                    item.featurestoreId = fg.getFeaturestoreId();
                    item.description = fg.getDescription();
                    item.created = new Date(fg.getCreateDate());
                    item.creator = new UserDTO(userFacade.findByEmail(fg.getCreator()));
                }
                break;
        }
    }
    return item;
}
Also used : UserDTO(io.hops.hopsworks.api.user.UserDTO) Gson(com.google.gson.Gson) Map(java.util.Map) Date(java.util.Date)

Example 2 with UserDTO

use of io.hops.hopsworks.api.user.UserDTO in project hopsworks by logicalclocks.

the class ElasticFeaturestoreItemBuilder method fromTrainingDataset.

public ElasticFeaturestoreItemDTO.Base fromTrainingDataset(ElasticFeaturestoreHit hit, HopsworksJAXBContext converter) throws GenericException {
    ElasticFeaturestoreItemDTO.Base item = new ElasticFeaturestoreItemDTO.Base();
    item.elasticId = hit.getId();
    item.name = hit.getName();
    item.version = hit.getVersion();
    item.datasetIId = hit.getDatasetIId();
    item.parentProjectId = hit.getProjectId();
    item.parentProjectName = hit.getProjectName();
    for (Map.Entry<String, Object> e : hit.getXattrs().entrySet()) {
        switch(e.getKey()) {
            case FeaturestoreXAttrsConstants.FEATURESTORE:
                {
                    Gson gson = new Gson();
                    TrainingDatasetXAttrDTO td = converter.unmarshal(gson.toJson(e.getValue()), TrainingDatasetXAttrDTO.class);
                    item.featurestoreId = td.getFeaturestoreId();
                    item.description = td.getDescription();
                    item.created = new Date(td.getCreateDate());
                    item.creator = new UserDTO(userFacade.findByEmail(td.getCreator()));
                }
                break;
        }
    }
    return item;
}
Also used : TrainingDatasetXAttrDTO(io.hops.hopsworks.common.featurestore.xattr.dto.TrainingDatasetXAttrDTO) UserDTO(io.hops.hopsworks.api.user.UserDTO) Gson(com.google.gson.Gson) Map(java.util.Map) Date(java.util.Date)

Aggregations

Gson (com.google.gson.Gson)2 UserDTO (io.hops.hopsworks.api.user.UserDTO)2 Date (java.util.Date)2 Map (java.util.Map)2 TrainingDatasetXAttrDTO (io.hops.hopsworks.common.featurestore.xattr.dto.TrainingDatasetXAttrDTO)1