use of com.linkedin.thirdeye.datalayer.pojo.DetectionStatusBean in project pinot by linkedin.
the class DetectionStatusManagerImpl method findLatestEntryForFunctionId.
@Override
public DetectionStatusDTO findLatestEntryForFunctionId(long functionId) {
Predicate predicate = Predicate.EQ("functionId", functionId);
List<DetectionStatusBean> list = genericPojoDao.get(predicate, DetectionStatusBean.class);
DetectionStatusDTO result = null;
if (CollectionUtils.isNotEmpty(list)) {
Collections.sort(list);
result = (DetectionStatusDTO) MODEL_MAPPER.map(list.get(list.size() - 1), DetectionStatusDTO.class);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.pojo.DetectionStatusBean in project pinot by linkedin.
the class DetectionStatusManagerImpl method findAllInTimeRangeForFunctionAndDetectionRun.
@Override
public List<DetectionStatusDTO> findAllInTimeRangeForFunctionAndDetectionRun(long startTime, long endTime, long functionId, boolean detectionRun) {
Predicate predicate = Predicate.AND(Predicate.EQ("functionId", functionId), Predicate.LE("dateToCheckInMS", endTime), Predicate.GE("dateToCheckInMS", startTime), Predicate.EQ("detectionRun", detectionRun));
List<DetectionStatusBean> list = genericPojoDao.get(predicate, DetectionStatusBean.class);
List<DetectionStatusDTO> results = new ArrayList<>();
for (DetectionStatusBean bean : list) {
results.add((DetectionStatusDTO) MODEL_MAPPER.map(bean, DetectionStatusDTO.class));
}
return results;
}
use of com.linkedin.thirdeye.datalayer.pojo.DetectionStatusBean in project pinot by linkedin.
the class DetectionStatusManagerImpl method deleteRecordsOlderThanDays.
@Override
@Transactional
public int deleteRecordsOlderThanDays(int days) {
DateTime expireDate = new DateTime().minusDays(days);
Timestamp expireTimestamp = new Timestamp(expireDate.getMillis());
Predicate timestampPredicate = Predicate.LT("createTime", expireTimestamp);
List<DetectionStatusBean> list = genericPojoDao.get(timestampPredicate, DetectionStatusBean.class);
for (DetectionStatusBean bean : list) {
deleteById(bean.getId());
}
return list.size();
}
Aggregations