Search in sources :

Example 1 with MetricConfigBean

use of com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean in project pinot by linkedin.

the class MetricConfigManagerImpl method findByMetricAndDataset.

@Override
public MetricConfigDTO findByMetricAndDataset(String metricName, String dataset) {
    Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
    Predicate metricNamePredicate = Predicate.EQ("name", metricName);
    List<MetricConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, metricNamePredicate), MetricConfigBean.class);
    MetricConfigDTO result = null;
    if (CollectionUtils.isNotEmpty(list)) {
        result = MODEL_MAPPER.map(list.get(0), MetricConfigDTO.class);
    }
    return result;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigBean(com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 2 with MetricConfigBean

use of com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean in project pinot by linkedin.

the class MetricConfigManagerImpl method findByAliasAndDataset.

@Override
public MetricConfigDTO findByAliasAndDataset(String alias, String dataset) {
    Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
    Predicate aliasPredicate = Predicate.EQ("alias", alias);
    List<MetricConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, aliasPredicate), MetricConfigBean.class);
    MetricConfigDTO result = null;
    if (CollectionUtils.isNotEmpty(list)) {
        result = MODEL_MAPPER.map(list.get(0), MetricConfigDTO.class);
    }
    return result;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigBean(com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 3 with MetricConfigBean

use of com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean in project pinot by linkedin.

the class MetricConfigManagerImpl method findByMetricName.

public List<MetricConfigDTO> findByMetricName(String metricName) {
    Predicate metricNamePredicate = Predicate.EQ("name", metricName);
    List<MetricConfigBean> list = genericPojoDao.get(metricNamePredicate, MetricConfigBean.class);
    List<MetricConfigDTO> result = new ArrayList<>();
    for (MetricConfigBean abstractBean : list) {
        MetricConfigDTO dto = MODEL_MAPPER.map(abstractBean, MetricConfigDTO.class);
        result.add(dto);
    }
    return result;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigBean(com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean) ArrayList(java.util.ArrayList) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 4 with MetricConfigBean

use of com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean in project pinot by linkedin.

the class MetricConfigManagerImpl method findWhereNameLike.

@Override
public List<MetricConfigDTO> findWhereNameLike(String name) {
    Map<String, Object> parameterMap = new HashMap<>();
    parameterMap.put("name", name);
    List<MetricConfigBean> list = genericPojoDao.executeParameterizedSQL(FIND_BY_NAME_LIKE, parameterMap, MetricConfigBean.class);
    List<MetricConfigDTO> result = new ArrayList<>();
    for (MetricConfigBean bean : list) {
        result.add(MODEL_MAPPER.map(bean, MetricConfigDTO.class));
    }
    return result;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigBean(com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 5 with MetricConfigBean

use of com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean in project pinot by linkedin.

the class MetricConfigManagerImpl method findActiveByDataset.

@Override
public List<MetricConfigDTO> findActiveByDataset(String dataset) {
    Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
    Predicate activePredicate = Predicate.EQ("active", true);
    List<MetricConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, activePredicate), MetricConfigBean.class);
    List<MetricConfigDTO> result = new ArrayList<>();
    for (MetricConfigBean abstractBean : list) {
        MetricConfigDTO dto = MODEL_MAPPER.map(abstractBean, MetricConfigDTO.class);
        result.add(dto);
    }
    return result;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigBean(com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean) ArrayList(java.util.ArrayList) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Aggregations

MetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO)6 MetricConfigBean (com.linkedin.thirdeye.datalayer.pojo.MetricConfigBean)6 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)1