use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method updateAnomalyFeedback.
public void updateAnomalyFeedback(MergedAnomalyResultDTO entity) {
MergedAnomalyResultBean bean = convertDTO2Bean(entity, MergedAnomalyResultBean.class);
if (entity.getFeedback() != null) {
if (entity.getFeedback().getId() == null) {
AnomalyFeedbackBean feedbackBean = (AnomalyFeedbackBean) convertDTO2Bean(entity.getFeedback(), AnomalyFeedbackBean.class);
Long feedbackId = genericPojoDao.put(feedbackBean);
entity.getFeedback().setId(feedbackId);
} else {
AnomalyFeedbackBean feedbackBean = genericPojoDao.get(entity.getFeedback().getId(), AnomalyFeedbackBean.class);
feedbackBean.setStatus(entity.getFeedback().getStatus());
feedbackBean.setFeedbackType(entity.getFeedback().getFeedbackType());
feedbackBean.setComment(entity.getFeedback().getComment());
genericPojoDao.update(feedbackBean);
}
bean.setAnomalyFeedbackId(entity.getFeedback().getId());
}
genericPojoDao.update(bean);
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method findById.
public MergedAnomalyResultDTO findById(Long id, boolean loadRawAnomalies) {
MergedAnomalyResultBean mergedAnomalyResultBean = genericPojoDao.get(id, MergedAnomalyResultBean.class);
if (mergedAnomalyResultBean != null) {
MergedAnomalyResultDTO mergedAnomalyResultDTO;
mergedAnomalyResultDTO = convertMergedAnomalyBean2DTO(mergedAnomalyResultBean, loadRawAnomalies);
return mergedAnomalyResultDTO;
} else {
return null;
}
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method findByCollectionTime.
@Override
public List<MergedAnomalyResultDTO> findByCollectionTime(String collection, long startTime, long endTime, boolean loadRawAnomalies) {
Predicate predicate = Predicate.AND(Predicate.EQ("collection", collection), Predicate.GT("startTime", startTime), Predicate.LT("endTime", endTime));
List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
return batchConvertMergedAnomalyBean2DTO(list, loadRawAnomalies);
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method batchConvertMergedAnomalyBean2DTO.
protected List<MergedAnomalyResultDTO> batchConvertMergedAnomalyBean2DTO(List<MergedAnomalyResultBean> mergedAnomalyResultBeanList, boolean loadRawAnomalies) {
List<Future<MergedAnomalyResultDTO>> mergedAnomalyResultDTOFutureList = new ArrayList<>(mergedAnomalyResultBeanList.size());
for (MergedAnomalyResultBean mergedAnomalyResultBean : mergedAnomalyResultBeanList) {
Future<MergedAnomalyResultDTO> future = executorService.submit(() -> convertMergedAnomalyBean2DTO(mergedAnomalyResultBean, loadRawAnomalies));
mergedAnomalyResultDTOFutureList.add(future);
}
List<MergedAnomalyResultDTO> mergedAnomalyResultDTOList = new ArrayList<>(mergedAnomalyResultBeanList.size());
for (Future future : mergedAnomalyResultDTOFutureList) {
try {
mergedAnomalyResultDTOList.add((MergedAnomalyResultDTO) future.get(60, TimeUnit.SECONDS));
} catch (InterruptedException | TimeoutException | ExecutionException e) {
LOG.warn("Failed to convert MergedAnomalyResultDTO from bean: {}", e.toString());
}
}
return mergedAnomalyResultDTOList;
}
use of com.linkedin.thirdeye.datalayer.pojo.MergedAnomalyResultBean in project pinot by linkedin.
the class MergedAnomalyResultManagerImpl method findByStartTimeInRangeAndFunctionId.
@Override
public List<MergedAnomalyResultDTO> findByStartTimeInRangeAndFunctionId(long startTime, long endTime, long functionId) {
Predicate predicate = Predicate.AND(Predicate.GE("startTime", startTime), Predicate.LT("endTime", endTime), Predicate.EQ("functionId", functionId));
List<MergedAnomalyResultBean> list = genericPojoDao.get(predicate, MergedAnomalyResultBean.class);
return batchConvertMergedAnomalyBean2DTO(list, true);
}
Aggregations