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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations