Search in sources :

Example 6 with SourceFileDetailEntity

use of org.apache.inlong.manager.dao.entity.SourceFileDetailEntity in project incubator-inlong by apache.

the class SourceFileServiceImpl method updateDetail.

@Transactional(rollbackFor = Throwable.class)
@Override
public boolean updateDetail(SourceFileDetailInfo detailInfo, String operator) {
    LOGGER.info("begin to update file data source detail={}", detailInfo);
    Preconditions.checkNotNull(detailInfo, "file data source detail is empty");
    Integer id = detailInfo.getId();
    Preconditions.checkNotNull(id, Constant.ID_IS_EMPTY);
    SourceFileDetailEntity entity = fileDetailMapper.selectByPrimaryKey(id);
    if (entity == null) {
        LOGGER.error("file data source detail not found by id=" + id);
        throw new BusinessException(ErrorCodeEnum.SOURCE_DETAIL_NOT_FOUND);
    }
    // After the approval is passed, the status needs to be revised to be revised to be issued: 205
    this.checkGroupIsTempStatus(detailInfo.getInlongGroupId());
    detailInfo.setStatus(EntityStatus.AGENT_ADD.getCode());
    SourceFileDetailEntity updateEntity = CommonBeanUtils.copyProperties(detailInfo, SourceFileDetailEntity::new);
    updateEntity.setModifier(operator);
    updateEntity.setModifyTime(new Date());
    fileDetailMapper.updateByPrimaryKeySelective(updateEntity);
    LOGGER.info("success to update file data source detail");
    return true;
}
Also used : BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException) SourceFileDetailEntity(org.apache.inlong.manager.dao.entity.SourceFileDetailEntity) Date(java.util.Date) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SourceFileDetailEntity (org.apache.inlong.manager.dao.entity.SourceFileDetailEntity)6 BusinessException (org.apache.inlong.manager.common.exceptions.BusinessException)5 Date (java.util.Date)3 Transactional (org.springframework.transaction.annotation.Transactional)3 InlongGroupEntity (org.apache.inlong.manager.dao.entity.InlongGroupEntity)2 CommandInfoBean (org.apache.inlong.manager.common.pojo.agent.FileAgentCommandInfo.CommandInfoBean)1 SourceFileDetailInfo (org.apache.inlong.manager.common.pojo.source.SourceFileDetailInfo)1 DataSourceCmdConfigEntity (org.apache.inlong.manager.dao.entity.DataSourceCmdConfigEntity)1 SourceFileBasicEntity (org.apache.inlong.manager.dao.entity.SourceFileBasicEntity)1