Search in sources :

Example 16 with InlongStreamInfo

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;
}
Also used : BusinessException(org.apache.inlong.manager.common.exceptions.BusinessException) InlongStreamEntity(org.apache.inlong.manager.dao.entity.InlongStreamEntity) InlongStreamInfo(org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)

Example 17 with InlongStreamInfo

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;
}
Also used : SourceDbDetailInfo(org.apache.inlong.manager.common.pojo.source.SourceDbDetailInfo) SourceFileDetailInfo(org.apache.inlong.manager.common.pojo.source.SourceFileDetailInfo) SinkRequest(org.apache.inlong.manager.common.pojo.sink.SinkRequest) InlongStreamInfo(org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

InlongStreamInfo (org.apache.inlong.manager.common.pojo.stream.InlongStreamInfo)17 InlongGroupInfo (org.apache.inlong.manager.common.pojo.group.InlongGroupInfo)4 GroupResourceProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.GroupResourceProcessForm)4 UpdateGroupProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm)4 InlongStreamEntity (org.apache.inlong.manager.dao.entity.InlongStreamEntity)4 SinkRequest (org.apache.inlong.manager.common.pojo.sink.SinkRequest)3 ProcessResponse (org.apache.inlong.manager.common.pojo.workflow.ProcessResponse)3 WorkflowResult (org.apache.inlong.manager.common.pojo.workflow.WorkflowResult)3 ProcessForm (org.apache.inlong.manager.common.pojo.workflow.form.ProcessForm)3 WorkflowServiceImplTest (org.apache.inlong.manager.service.workflow.WorkflowServiceImplTest)3 WorkflowContext (org.apache.inlong.manager.workflow.WorkflowContext)3 ServiceTask (org.apache.inlong.manager.workflow.definition.ServiceTask)3 WorkflowProcess (org.apache.inlong.manager.workflow.definition.WorkflowProcess)3 WorkflowTask (org.apache.inlong.manager.workflow.definition.WorkflowTask)3 TaskEventListener (org.apache.inlong.manager.workflow.event.task.TaskEventListener)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 BusinessException (org.apache.inlong.manager.common.exceptions.BusinessException)2 SourceDbDetailInfo (org.apache.inlong.manager.common.pojo.source.SourceDbDetailInfo)2 SourceFileDetailInfo (org.apache.inlong.manager.common.pojo.source.SourceFileDetailInfo)2