Search in sources :

Example 1 with RawAnomalyResultBean

use of com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean in project pinot by linkedin.

the class RawAnomalyResultManagerImpl method update.

public int update(RawAnomalyResultDTO entity) {
    RawAnomalyResultBean bean = (RawAnomalyResultBean) convertDTO2Bean(entity, RawAnomalyResultBean.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);
        }
        bean.setAnomalyFeedbackId(entity.getFeedback().getId());
    }
    if (entity.getFunction() != null) {
        bean.setFunctionId(entity.getFunction().getId());
    }
    return genericPojoDao.update(bean);
}
Also used : RawAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean) AnomalyFeedbackBean(com.linkedin.thirdeye.datalayer.pojo.AnomalyFeedbackBean)

Example 2 with RawAnomalyResultBean

use of com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean in project pinot by linkedin.

the class RawAnomalyResultManagerImpl method save.

public Long save(RawAnomalyResultDTO entity) {
    if (entity.getId() != null) {
        //TODO: throw exception and force the caller to call update instead
        update(entity);
        return entity.getId();
    }
    RawAnomalyResultBean bean = (RawAnomalyResultBean) convertDTO2Bean(entity, RawAnomalyResultBean.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);
        }
        bean.setAnomalyFeedbackId(entity.getFeedback().getId());
    }
    if (entity.getFunction() != null) {
        bean.setFunctionId(entity.getFunction().getId());
    }
    Long id = genericPojoDao.put(bean);
    entity.setId(id);
    return id;
}
Also used : RawAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean) AnomalyFeedbackBean(com.linkedin.thirdeye.datalayer.pojo.AnomalyFeedbackBean)

Example 3 with RawAnomalyResultBean

use of com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean in project pinot by linkedin.

the class MergedAnomalyResultManagerImpl method convertMergedAnomalyBean2DTO.

protected MergedAnomalyResultDTO convertMergedAnomalyBean2DTO(MergedAnomalyResultBean mergedAnomalyResultBean, boolean loadRawAnomalies) {
    MergedAnomalyResultDTO mergedAnomalyResultDTO;
    mergedAnomalyResultDTO = MODEL_MAPPER.map(mergedAnomalyResultBean, MergedAnomalyResultDTO.class);
    if (mergedAnomalyResultBean.getFunctionId() != null) {
        AnomalyFunctionBean anomalyFunctionBean = genericPojoDao.get(mergedAnomalyResultBean.getFunctionId(), AnomalyFunctionBean.class);
        AnomalyFunctionDTO anomalyFunctionDTO = MODEL_MAPPER.map(anomalyFunctionBean, AnomalyFunctionDTO.class);
        mergedAnomalyResultDTO.setFunction(anomalyFunctionDTO);
    }
    if (mergedAnomalyResultBean.getAnomalyFeedbackId() != null) {
        AnomalyFeedbackBean anomalyFeedbackBean = genericPojoDao.get(mergedAnomalyResultBean.getAnomalyFeedbackId(), AnomalyFeedbackBean.class);
        AnomalyFeedbackDTO anomalyFeedbackDTO = MODEL_MAPPER.map(anomalyFeedbackBean, AnomalyFeedbackDTO.class);
        mergedAnomalyResultDTO.setFeedback(anomalyFeedbackDTO);
    }
    if (loadRawAnomalies && mergedAnomalyResultBean.getRawAnomalyIdList() != null && !mergedAnomalyResultBean.getRawAnomalyIdList().isEmpty()) {
        List<RawAnomalyResultDTO> anomalyResults = new ArrayList<>();
        List<RawAnomalyResultBean> list = genericPojoDao.get(mergedAnomalyResultBean.getRawAnomalyIdList(), RawAnomalyResultBean.class);
        for (RawAnomalyResultBean rawAnomalyResultBean : list) {
            anomalyResults.add(createRawAnomalyDTOFromBean(rawAnomalyResultBean));
        }
        mergedAnomalyResultDTO.setAnomalyResults(anomalyResults);
    }
    return mergedAnomalyResultDTO;
}
Also used : RawAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean) RawAnomalyResultDTO(com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO) AnomalyFeedbackBean(com.linkedin.thirdeye.datalayer.pojo.AnomalyFeedbackBean) MergedAnomalyResultDTO(com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO) AnomalyFunctionBean(com.linkedin.thirdeye.datalayer.pojo.AnomalyFunctionBean) AnomalyFeedbackDTO(com.linkedin.thirdeye.datalayer.dto.AnomalyFeedbackDTO) ArrayList(java.util.ArrayList) AnomalyFunctionDTO(com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO)

Example 4 with RawAnomalyResultBean

use of com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean in project pinot by linkedin.

the class RawAnomalyResultManagerImpl method findById.

public RawAnomalyResultDTO findById(Long id) {
    RawAnomalyResultBean rawAnomalyResultBean = genericPojoDao.get(id, RawAnomalyResultBean.class);
    if (rawAnomalyResultBean != null) {
        RawAnomalyResultDTO rawAnomalyResultDTO;
        rawAnomalyResultDTO = createRawAnomalyDTOFromBean(rawAnomalyResultBean);
        return rawAnomalyResultDTO;
    } else {
        return null;
    }
}
Also used : RawAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean) RawAnomalyResultDTO(com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO)

Example 5 with RawAnomalyResultBean

use of com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean in project pinot by linkedin.

the class RawAnomalyResultManagerImpl method findByPredicate.

private List<RawAnomalyResultDTO> findByPredicate(Predicate predicate) {
    List<RawAnomalyResultBean> list = genericPojoDao.get(predicate, RawAnomalyResultBean.class);
    List<RawAnomalyResultDTO> result = new ArrayList<>();
    for (RawAnomalyResultBean bean : list) {
        result.add(createRawAnomalyDTOFromBean(bean));
    }
    return result;
}
Also used : RawAnomalyResultBean(com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean) RawAnomalyResultDTO(com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO) ArrayList(java.util.ArrayList)

Aggregations

RawAnomalyResultBean (com.linkedin.thirdeye.datalayer.pojo.RawAnomalyResultBean)5 RawAnomalyResultDTO (com.linkedin.thirdeye.datalayer.dto.RawAnomalyResultDTO)3 AnomalyFeedbackBean (com.linkedin.thirdeye.datalayer.pojo.AnomalyFeedbackBean)3 ArrayList (java.util.ArrayList)2 AnomalyFeedbackDTO (com.linkedin.thirdeye.datalayer.dto.AnomalyFeedbackDTO)1 AnomalyFunctionDTO (com.linkedin.thirdeye.datalayer.dto.AnomalyFunctionDTO)1 MergedAnomalyResultDTO (com.linkedin.thirdeye.datalayer.dto.MergedAnomalyResultDTO)1 AnomalyFunctionBean (com.linkedin.thirdeye.datalayer.pojo.AnomalyFunctionBean)1