use of org.apache.inlong.manager.common.exceptions.BusinessException in project incubator-inlong by apache.
the class InlongStreamServiceImpl method updateField.
/**
* Update field information
* <p/>First physically delete the existing field information, and then add the field information of this batch
*/
@Transactional(rollbackFor = Throwable.class)
void updateField(String groupId, String streamId, List<InlongStreamFieldInfo> fieldInfoList) {
LOGGER.debug("begin to update inlong stream field, groupId={}, streamId={}, field={}", groupId, streamId, fieldInfoList);
try {
streamFieldMapper.deleteAllByIdentifier(groupId, streamId);
saveField(groupId, streamId, fieldInfoList);
LOGGER.info("success to update inlong stream field for groupId={}", groupId);
} catch (Exception e) {
LOGGER.error("failed to update inlong stream field: ", e);
throw new BusinessException(ErrorCodeEnum.STREAM_FIELD_SAVE_FAILED);
}
}
use of org.apache.inlong.manager.common.exceptions.BusinessException in project incubator-inlong by apache.
the class InlongStreamServiceImpl method updateExt.
/**
* Update extended information
* <p/>First physically delete the existing extended information, and then add this batch of extended information
*/
@Transactional(rollbackFor = Throwable.class)
void updateExt(String groupId, String streamId, List<InlongStreamExtInfo> extInfoList) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("begin to update inlong stream ext, groupId={}, streamId={}, ext={}", groupId, streamId, extInfoList);
}
try {
streamExtMapper.deleteAllByIdentifier(groupId, streamId);
saveExt(groupId, streamId, extInfoList, new Date());
LOGGER.info("success to update inlong stream ext for groupId={}", groupId);
} catch (Exception e) {
LOGGER.error("failed to update inlong stream ext: ", e);
throw new BusinessException(ErrorCodeEnum.STREAM_EXT_SAVE_FAILED);
}
}
use of org.apache.inlong.manager.common.exceptions.BusinessException in project incubator-inlong by apache.
the class InlongStreamServiceImpl method insertDlqOrRlq.
@Override
public void insertDlqOrRlq(String groupId, String topicName, String operator) {
Integer count = streamMapper.selectExistByIdentifier(groupId, topicName);
if (count >= 1) {
LOGGER.error("DLQ/RLQ topic already exists with name={}", topicName);
throw new BusinessException(ErrorCodeEnum.STREAM_ID_DUPLICATE, "DLQ/RLQ topic already exists");
}
InlongStreamEntity streamEntity = new InlongStreamEntity();
streamEntity.setInlongGroupId(groupId);
streamEntity.setInlongStreamId(topicName);
streamEntity.setMqResourceObj(topicName);
streamEntity.setDescription("This is DLQ / RLQ topic created by SYSTEM");
streamEntity.setDailyRecords(1000);
streamEntity.setDailyStorage(1000);
streamEntity.setPeakRecords(1000);
streamEntity.setMaxLength(1000);
streamEntity.setStatus(EntityStatus.STREAM_CONFIG_SUCCESSFUL.getCode());
streamEntity.setIsDeleted(EntityStatus.UN_DELETED.getCode());
streamEntity.setCreator(operator);
streamEntity.setModifier(operator);
Date now = new Date();
streamEntity.setCreateTime(now);
streamEntity.setModifyTime(now);
streamMapper.insert(streamEntity);
}
use of org.apache.inlong.manager.common.exceptions.BusinessException in project incubator-inlong by apache.
the class SourceDbServiceImpl method updateDetail.
@Transactional(rollbackFor = Throwable.class)
@Override
public boolean updateDetail(SourceDbDetailInfo detailInfo, String operator) {
LOGGER.info("begin to update db data source detail={}", detailInfo);
Preconditions.checkNotNull(detailInfo, "db data source detail is empty");
Preconditions.checkNotNull(detailInfo.getInlongGroupId(), Constant.GROUP_ID_IS_EMPTY);
Preconditions.checkNotNull(detailInfo.getInlongStreamId(), Constant.STREAM_ID_IS_EMPTY);
// The groupId may be modified, it is necessary to determine whether the inlong group status of
// the modified groupId supports modification
this.checkGroupIsTempStatus(detailInfo.getInlongGroupId());
// id exists, update, otherwise add
if (detailInfo.getId() != null) {
SourceDbDetailEntity entity = dbDetailMapper.selectByPrimaryKey(detailInfo.getId());
if (entity == null) {
LOGGER.error("db data source detail not found by id=" + detailInfo.getId());
throw new BusinessException(ErrorCodeEnum.SOURCE_DETAIL_NOT_FOUND);
}
SourceDbDetailEntity dbEntity = CommonBeanUtils.copyProperties(detailInfo, SourceDbDetailEntity::new);
dbEntity.setStatus(EntityStatus.GROUP_CONFIG_ING.getCode());
dbEntity.setModifier(operator);
dbDetailMapper.updateByPrimaryKeySelective(dbEntity);
} else {
saveDetailOpt(detailInfo, operator);
}
LOGGER.info("success to update db data source detail");
return true;
}
use of org.apache.inlong.manager.common.exceptions.BusinessException in project incubator-inlong by apache.
the class ConsumptionPassTaskListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws WorkflowListenerException {
NewConsumptionProcessForm form = (NewConsumptionProcessForm) context.getProcessForm();
ConsumptionApproveForm approveForm = (ConsumptionApproveForm) context.getActionContext().getForm();
ConsumptionInfo info = form.getConsumptionInfo();
if (StringUtils.equals(approveForm.getConsumerGroupId(), info.getConsumerGroupId())) {
return ListenerResult.success("The consumer group name has not been modified");
}
boolean exist = consumptionService.isConsumerGroupIdExists(approveForm.getConsumerGroupId(), info.getId());
if (exist) {
log.error("consumerGroupId already exist! duplicate :{}", approveForm.getConsumerGroupId());
throw new BusinessException(ErrorCodeEnum.CONSUMER_GROUP_NAME_DUPLICATED);
}
return ListenerResult.success("Consumer group name from" + info.getConsumerGroupId() + "change to " + approveForm.getConsumerGroupId());
}
Aggregations