This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch release-1.3.0 in repository https://gitbox.apache.org/repos/asf/inlong.git
commit cd807f6db6936aca32529ca27aa370bc5aa55ca2 Author: woofyzhao <[email protected]> AuthorDate: Thu Aug 25 10:46:48 2022 +0800 [INLONG-5678][Manager] Provide source info for group status (#5679) Co-authored-by: woofyzhao <[email protected]> --- .../manager/client/api/InlongGroupContext.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/InlongGroupContext.java b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/InlongGroupContext.java index c930d4846..3ba3a0aec 100644 --- a/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/InlongGroupContext.java +++ b/inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/InlongGroupContext.java @@ -28,6 +28,7 @@ import org.apache.inlong.manager.common.enums.SimpleSourceStatus; import org.apache.inlong.manager.client.api.inner.InnerGroupContext; import org.apache.inlong.manager.pojo.group.InlongGroupExtInfo; import org.apache.inlong.manager.pojo.group.InlongGroupInfo; +import org.apache.inlong.manager.pojo.group.InlongGroupStatusInfo; import org.apache.inlong.manager.pojo.source.StreamSource; import org.apache.inlong.manager.common.util.Preconditions; @@ -57,6 +58,8 @@ public class InlongGroupContext implements Serializable { private SimpleGroupStatus status; + private InlongGroupStatusInfo statusInfo; + public InlongGroupContext(InnerGroupContext groupContext) { InlongGroupInfo groupInfo = groupContext.getGroupInfo(); Preconditions.checkNotNull(groupInfo, "inlong group info cannot be null"); @@ -66,6 +69,11 @@ public class InlongGroupContext implements Serializable { this.inlongStreamMap = groupContext.getStreamMap(); this.status = SimpleGroupStatus.parseStatusByCode(groupInfo.getStatus()); recheckState(); + this.statusInfo = InlongGroupStatusInfo.builder() + .inlongGroupId(groupInfo.getInlongGroupId()) + .originalStatus(groupInfo.getStatus()) + .simpleGroupStatus(this.status) + .streamSources(getGroupSources()).build(); this.extensions = Maps.newHashMap(); List<InlongGroupExtInfo> extInfos = groupInfo.getExtList(); if (CollectionUtils.isNotEmpty(extInfos)) { @@ -75,6 +83,22 @@ public class InlongGroupContext implements Serializable { } } + private List<StreamSource> getGroupSources() { + List<StreamSource> groupSources = Lists.newArrayList(); + this.inlongStreamMap.values().forEach(inlongStream -> { + Map<String, StreamSource> sources = inlongStream.getSources(); + if (MapUtils.isNotEmpty(sources)) { + for (Map.Entry<String, StreamSource> entry : sources.entrySet()) { + StreamSource source = entry.getValue(); + if (source != null) { + groupSources.add(source); + } + } + } + }); + return groupSources; + } + private void recheckState() { if (MapUtils.isEmpty(this.inlongStreamMap)) { return;
