use of com.linkedin.thirdeye.datalayer.pojo.TaskBean in project pinot by linkedin.
the class TaskManagerImpl method findByStatusOrderByCreateTime.
@Override
public List<TaskDTO> findByStatusOrderByCreateTime(TaskStatus status, int fetchSize, boolean asc) {
Map<String, Object> parameterMap = new HashMap<>();
parameterMap.put("status", status.toString());
List<TaskBean> list;
String queryClause = (asc) ? FIND_BY_STATUS_ORDER_BY_CREATE_TIME_ASC : FIND_BY_STATUS_ORDER_BY_CREATE_TIME_DESC;
list = genericPojoDao.executeParameterizedSQL(queryClause, parameterMap, TaskBean.class);
List<TaskDTO> result = new ArrayList<>();
for (TaskBean bean : list) {
result.add((TaskDTO) MODEL_MAPPER.map(bean, TaskDTO.class));
}
return result;
}
use of com.linkedin.thirdeye.datalayer.pojo.TaskBean in project pinot by linkedin.
the class TaskManagerImpl method deleteRecordsOlderThanDaysWithStatus.
@Override
@Transactional
public int deleteRecordsOlderThanDaysWithStatus(int days, TaskStatus status) {
DateTime expireDate = new DateTime().minusDays(days);
Timestamp expireTimestamp = new Timestamp(expireDate.getMillis());
Predicate timestampPredicate = Predicate.LT("createTime", expireTimestamp);
Predicate statusPredicate = Predicate.EQ("status", status.toString());
List<TaskBean> list = genericPojoDao.get(Predicate.AND(statusPredicate, timestampPredicate), TaskBean.class);
for (TaskBean bean : list) {
deleteById(bean.getId());
}
return list.size();
}
use of com.linkedin.thirdeye.datalayer.pojo.TaskBean in project pinot by linkedin.
the class TaskManagerImpl method findByJobIdStatusNotIn.
@Override
public List<TaskDTO> findByJobIdStatusNotIn(Long jobId, TaskStatus status) {
Predicate jobIdPredicate = Predicate.EQ("jobId", jobId);
Predicate statusPredicate = Predicate.NEQ("status", status.toString());
List<TaskBean> list = genericPojoDao.get(Predicate.AND(statusPredicate, jobIdPredicate), TaskBean.class);
List<TaskDTO> result = new ArrayList<>();
for (TaskBean bean : list) {
result.add((TaskDTO) MODEL_MAPPER.map(bean, TaskDTO.class));
}
return result;
}
use of com.linkedin.thirdeye.datalayer.pojo.TaskBean in project pinot by linkedin.
the class TaskManagerImpl method save.
public Long save(TaskDTO entity) {
if (entity.getId() != null) {
//TODO: throw exception and force the caller to call update instead
update(entity);
return entity.getId();
}
TaskBean bean = (TaskBean) convertDTO2Bean(entity, TaskBean.class);
Long id = genericPojoDao.put(bean);
entity.setId(id);
return id;
}
use of com.linkedin.thirdeye.datalayer.pojo.TaskBean in project pinot by linkedin.
the class TaskManagerImpl method findByStatusNotIn.
@Override
@Transactional
public List<TaskDTO> findByStatusNotIn(TaskStatus status) {
Predicate statusPredicate = Predicate.NEQ("status", status.toString());
List<TaskBean> list = genericPojoDao.get(statusPredicate, TaskBean.class);
List<TaskDTO> result = new ArrayList<>();
for (TaskBean bean : list) {
result.add((TaskDTO) MODEL_MAPPER.map(bean, TaskDTO.class));
}
return result;
}
Aggregations