use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method findLatestConflictByFunctionIdDimensions.
@Override
public MergedAnomalyResultDTO findLatestConflictByFunctionIdDimensions(Long functionId, String dimensions, long conflictWindowStart, long conflictWindowEnd) {
Map<String, Object> filterParams = new HashMap<>();
filterParams.put("functionId", functionId);
filterParams.put("dimensions", dimensions);
filterParams.put("startTime", conflictWindowStart);
filterParams.put("endTime", conflictWindowEnd);
List<MergedAnomalyResultBean> list = genericPojoDao.executeParameterizedSQL(FIND_LATEST_CONFLICT_BY_FUNCTION_AND_DIMENSIONS, filterParams, MergedAnomalyResultBean.class);
if (CollectionUtils.isNotEmpty(list)) {
MergedAnomalyResultBean mostRecentConflictMergedAnomalyResultBean = list.get(0);
return convertMergedAnomalyBean2DTO(mostRecentConflictMergedAnomalyResultBean, true);
}
return null;
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method convertMergeAnomalyDTO2Bean.
protected MergedAnomalyResultBean convertMergeAnomalyDTO2Bean(MergedAnomalyResultDTO entity) {
MergedAnomalyResultBean bean = convertDTO2Bean(entity, MergedAnomalyResultBean.class);
if (entity.getFeedback() != null && entity.getFeedback().getId() != null) {
bean.setAnomalyFeedbackId(entity.getFeedback().getId());
}
if (entity.getFunction() != null) {
bean.setFunctionId(entity.getFunction().getId());
}
if (entity.getAnomalyResults() != null && !entity.getAnomalyResults().isEmpty()) {
List<Long> rawAnomalyIds = new ArrayList<>();
for (RawAnomalyResultDTO rawAnomalyDTO : entity.getAnomalyResults()) {
rawAnomalyIds.add(rawAnomalyDTO.getId());
}
bean.setRawAnomalyIdList(rawAnomalyIds);
}
return bean;
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method save.
public Long save(MergedAnomalyResultDTO mergedAnomalyResultDTO) {
if (mergedAnomalyResultDTO.getId() != null) {
//TODO: throw exception and force the caller to call update instead
update(mergedAnomalyResultDTO);
return mergedAnomalyResultDTO.getId();
}
MergedAnomalyResultBean mergeAnomalyBean = convertMergeAnomalyDTO2Bean(mergedAnomalyResultDTO);
Long id = genericPojoDao.put(mergeAnomalyBean);
mergedAnomalyResultDTO.setId(id);
return id;
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method findByFunctionIdAndIdGreaterThan.
@Override
public List<MergedAnomalyResultDTO> findByFunctionIdAndIdGreaterThan(Long functionId, Long anomalyId) {
Predicate predicate = Predicate.AND(Predicate.EQ("functionId", functionId), Predicate.GT("baseId", anomalyId));
List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
return batchConvertMergedAnomalyBean2DTO(list, true);
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean 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);
}
Aggregations