Search in sources :

Example 1 with SinkApproveDTO

use of org.apache.inlong.manager.common.pojo.sink.SinkApproveDTO in project incubator-inlong by apache.

the class StreamSinkServiceImpl method updateAfterApprove.

@Override
public Boolean updateAfterApprove(List<SinkApproveDTO> approveList, String operator) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("begin to update sink after approve={}", approveList);
    }
    if (CollectionUtils.isEmpty(approveList)) {
        return true;
    }
    Date now = new Date();
    for (SinkApproveDTO dto : approveList) {
        // According to the sink type, save sink information
        String sinkType = dto.getSinkType();
        Preconditions.checkNotNull(sinkType, Constant.SINK_TYPE_IS_EMPTY);
        StreamSinkEntity entity = new StreamSinkEntity();
        entity.setId(dto.getId());
        int status = (dto.getStatus() == null) ? EntityStatus.SINK_CONFIG_ING.getCode() : dto.getStatus();
        entity.setPreviousStatus(entity.getStatus());
        entity.setStatus(status);
        entity.setModifier(operator);
        entity.setModifyTime(now);
        sinkMapper.updateByPrimaryKeySelective(entity);
    }
    LOGGER.info("success to update sink after approve");
    return true;
}
Also used : StreamSinkEntity(org.apache.inlong.manager.dao.entity.StreamSinkEntity) SinkApproveDTO(org.apache.inlong.manager.common.pojo.sink.SinkApproveDTO) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 SinkApproveDTO (org.apache.inlong.manager.common.pojo.sink.SinkApproveDTO)1 StreamSinkEntity (org.apache.inlong.manager.dao.entity.StreamSinkEntity)1