use of org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo in project incubator-inlong by apache.
the class InlongStreamServiceImpl method get.
@Override
public InlongStreamInfo get(String groupId, String streamId) {
LOGGER.debug("begin to get inlong stream by groupId={}, streamId={}", groupId, streamId);
Preconditions.checkNotNull(groupId, Constant.GROUP_ID_IS_EMPTY);
Preconditions.checkNotNull(streamId, Constant.STREAM_ID_IS_EMPTY);
InlongStreamEntity streamEntity = streamMapper.selectByIdentifier(groupId, streamId);
if (streamEntity == null) {
LOGGER.error("inlong stream not found by groupId={}, streamId={}", groupId, streamId);
throw new BusinessException(ErrorCodeEnum.STREAM_NOT_FOUND);
}
InlongStreamInfo streamInfo = CommonBeanUtils.copyProperties(streamEntity, InlongStreamInfo::new);
this.setStreamExtAndField(groupId, streamId, streamInfo);
LOGGER.info("success to get inlong stream for groupId={}", groupId);
return streamInfo;
}
use of org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo in project incubator-inlong by apache.
the class InlongStreamServiceImpl method saveAll.
@Transactional(rollbackFor = Throwable.class)
@Override
public boolean saveAll(FullStreamRequest fullStreamRequest, String operator) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("begin to save all stream page info: {}", fullStreamRequest);
}
Preconditions.checkNotNull(fullStreamRequest, "fullStreamRequest is empty");
InlongStreamInfo streamInfo = fullStreamRequest.getStreamInfo();
Preconditions.checkNotNull(streamInfo, "inlong stream info is empty");
// Check whether it can be added: check by lower-level specific services
// this.checkBizIsTempStatus(streamInfo.getInlongGroupId());
// 1. Save inlong stream
this.save(streamInfo, operator);
// 2.1 Save file data source information
if (fullStreamRequest.getFileBasicInfo() != null) {
sourceFileService.saveBasic(fullStreamRequest.getFileBasicInfo(), operator);
}
if (CollectionUtils.isNotEmpty(fullStreamRequest.getFileDetailInfoList())) {
for (SourceFileDetailInfo detailInfo : fullStreamRequest.getFileDetailInfoList()) {
sourceFileService.saveDetail(detailInfo, operator);
}
}
// 2.2 Save DB data source information
if (fullStreamRequest.getDbBasicInfo() != null) {
sourceDbService.saveBasic(fullStreamRequest.getDbBasicInfo(), operator);
}
if (CollectionUtils.isNotEmpty(fullStreamRequest.getDbDetailInfoList())) {
for (SourceDbDetailInfo detailInfo : fullStreamRequest.getDbDetailInfoList()) {
sourceDbService.saveDetail(detailInfo, operator);
}
}
// 3. Save data sink information
if (CollectionUtils.isNotEmpty(fullStreamRequest.getSinkInfo())) {
for (SinkRequest sinkInfo : fullStreamRequest.getSinkInfo()) {
sinkService.save(sinkInfo, operator);
}
}
LOGGER.info("success to save all stream page info");
return true;
}
Aggregations