healchow commented on code in PR #4938:
URL: https://github.com/apache/inlong/pull/4938#discussion_r917205733
##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/repository/DataProxyConfigRepository.java:
##########
@@ -313,4 +380,60 @@ public String getProxyMd5(String clusterName) {
public String getProxyConfigJson(String clusterName) {
return this.proxyConfigJson.get(clusterName);
}
+
+ /**
+ * changeClusterTag
+ */
+ public String changeClusterTag(String inlongGroupId, String clusterTag,
+ String topic) {
+ // select
+ InlongGroupEntity oldGroup =
inlongGroupMapper.selectByGroupId(inlongGroupId);
+ if (oldGroup == null) {
+ throw new BusinessException(ErrorCodeEnum.GROUP_NOT_FOUND);
+ }
+ // parse ext_params
+ String extParams = oldGroup.getExtParams();
+ if (StringUtils.isEmpty(extParams)) {
+ extParams = "{}";
+ }
+ // parse json
+ Gson gson = new Gson();
+ JsonObject extParamsObj = gson.fromJson(extParams, JsonObject.class);
+ // change cluster tag
+ extParamsObj.addProperty(KEY_SECOND_CLUSTER_TAG,
oldGroup.getInlongClusterTag());
+ extParamsObj.addProperty(KEY_SECOND_TOPIC, oldGroup.getMqResource());
+ oldGroup.setInlongClusterTag(clusterTag);
+ oldGroup.setMqResource(topic);
+ String newExtParams = extParamsObj.toString();
+ oldGroup.setExtParams(newExtParams);
+ // update
+ inlongGroupMapper.updateByIdentifierSelective(oldGroup);
+ return inlongGroupId;
+ }
+
+ /**
+ * removeSecondClusterTag
+ */
+ public String removeSecondClusterTag(String inlongGroupId) {
Review Comment:
Please add some UTs for those new APIs, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]