macksonmu commented on code in PR #1866:
URL: 
https://github.com/apache/incubator-streampark/pull/1866#discussion_r1000109636


##########
streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/service/impl/VariableServiceImpl.java:
##########
@@ -79,4 +105,65 @@ public Variable findByVariableCode(Long teamId, String 
variableCode) {
     public List<Variable> findByTeamId(Long teamId) {
         return baseMapper.selectByTeamId(teamId);
     }
+
+    /**
+     * Replace placeholders with defined variable codes.
+     * @param teamId
+     * @param paramWithPlaceholders Parameters with placeholders
+     * @return
+     */
+    @Override
+    public String replacePlaceholder(Long teamId, String 
paramWithPlaceholders) {
+        if (StringUtils.isEmpty(paramWithPlaceholders)) {
+            return paramWithPlaceholders;
+        }
+        String restore = paramWithPlaceholders;
+        Matcher matcher = placeholderPattern.matcher(paramWithPlaceholders);
+        while (matcher.find()) {
+            String placeholder = matcher.group();
+            String variableCode = getCodeFromPlaceholder(placeholder);
+            Variable variable = findByVariableCode(teamId, variableCode);
+            if (variable != null) {
+                restore = restore.replace(placeholder, 
variable.getVariableValue());
+            }
+        }
+        return restore;
+    }
+
+    private boolean isDependByApplications(Variable variable) {
+        // Detect whether the variable is dependent on the args of the 
application
+        List<Application> applications = 
applicationService.getByTeamId(variable.getTeamId());
+        Iterator<Application> appIt = applications.iterator();
+        while (appIt.hasNext()) {
+            Application application = appIt.next();
+            Matcher matcher = 
placeholderPattern.matcher(application.getArgs());
+            if (matcher.find()) {

Review Comment:
   it was my mistake



-- 
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]

Reply via email to