Search in sources :

Example 1 with EmailConfigurationBean

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

the class EmailConfigurationManagerImpl method findByCollectionMetric.

@Override
public List<EmailConfigurationDTO> findByCollectionMetric(String collection, String metric) {
    Predicate predicate = Predicate.AND(Predicate.EQ("collection", collection), Predicate.EQ("metric", metric));
    List<EmailConfigurationBean> list = genericPojoDao.get(predicate, EmailConfigurationBean.class);
    List<EmailConfigurationDTO> result = new ArrayList<>();
    for (EmailConfigurationBean bean : list) {
        EmailConfigurationDTO dto = convertEmailConfigurationBean2DTO(bean);
        result.add(dto);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean) EmailConfigurationDTO(com.linkedin.thirdeye.datalayer.dto.EmailConfigurationDTO) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 2 with EmailConfigurationBean

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

the class EmailConfigurationManagerImpl method save.

@Override
public Long save(EmailConfigurationDTO emailConfigurationDTO) {
    if (emailConfigurationDTO.getId() != null) {
        //TODO: throw exception and force the caller to call update instead
        update(emailConfigurationDTO);
        return emailConfigurationDTO.getId();
    }
    EmailConfigurationBean bean = (EmailConfigurationBean) convertEmailConfigurationDTO2Bean(emailConfigurationDTO);
    Long id = genericPojoDao.put(bean);
    emailConfigurationDTO.setId(id);
    return id;
}
Also used : EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean)

Example 3 with EmailConfigurationBean

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

the class MergedAnomalyResultManagerImpl method getAllByTimeEmailIdAndNotifiedFalse.

@Override
public List<MergedAnomalyResultDTO> getAllByTimeEmailIdAndNotifiedFalse(long startTime, long endTime, long emailConfigId) {
    EmailConfigurationBean emailConfigurationBean = genericPojoDao.get(emailConfigId, EmailConfigurationBean.class);
    List<Long> functionIds = emailConfigurationBean.getFunctionIds();
    if (functionIds == null || functionIds.isEmpty()) {
        return Collections.emptyList();
    }
    Long[] functionIdArray = functionIds.toArray(new Long[] {});
    Predicate predicate = //
    Predicate.AND(//
    Predicate.LT("startTime", endTime), //
    Predicate.GT("endTime", startTime), //
    Predicate.IN("functionId", functionIdArray), //
    Predicate.EQ("notified", false));
    List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
    return batchConvertMergedAnomalyBean2DTO(list, true);
}
Also used : MergedAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean) EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 4 with EmailConfigurationBean

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

the class EmailConfigurationManagerImpl method convertEmailConfigurationDTO2Bean.

private EmailConfigurationBean convertEmailConfigurationDTO2Bean(EmailConfigurationDTO emailConfigurationDTO) {
    EmailConfigurationBean emailConfigurationBean = convertDTO2Bean(emailConfigurationDTO, EmailConfigurationBean.class);
    List<Long> functionIds = new ArrayList<>();
    for (AnomalyFunctionDTO function : emailConfigurationDTO.getFunctions()) {
        functionIds.add(function.getId());
    }
    emailConfigurationBean.setFunctionIds(functionIds);
    return emailConfigurationBean;
}
Also used : ArrayList(java.util.ArrayList) EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean) AnomalyFunctionDTO(com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO)

Example 5 with EmailConfigurationBean

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

the class EmailConfigurationManagerImpl method findByFunctionId.

@Override
public List<EmailConfigurationDTO> findByFunctionId(Long functionId) {
    List<EmailConfigurationBean> list = genericPojoDao.getAll(EmailConfigurationBean.class);
    List<EmailConfigurationDTO> result = new ArrayList<>();
    for (EmailConfigurationBean bean : list) {
        if (bean.getFunctionIds() != null && bean.getFunctionIds().contains(functionId)) {
            EmailConfigurationDTO dto = convertEmailConfigurationBean2DTO(bean);
            result.add(dto);
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) EmailConfigurationBean(com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean) EmailConfigurationDTO(com.linkedin.thirdeye.datalayer.dto.EmailConfigurationDTO)

Aggregations

EmailConfigurationBean (com.linkedin.thirdeye.datalayer.pojo.EmailConfigurationBean)7 ArrayList (java.util.ArrayList)5 EmailConfigurationDTO (com.linkedin.thirdeye.datalayer.dto.EmailConfigurationDTO)4 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)3 AnomalyFunctionDTO (com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO)1 MergedAnomalyResultBean (com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean)1