CalvinKirs commented on a change in pull request #5774:
URL: https://github.com/apache/dolphinscheduler/pull/5774#discussion_r672246415



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ParamUtils.java
##########
@@ -95,6 +101,67 @@
         return globalParams;
     }
 
+    /**
+     * parameter conversion
+     * @param taskExecutionContext the context of this task instance
+     * @param parameters the parameters
+     * @return global params
+     */
+    public static Map<String,Property> convert(TaskExecutionContext 
taskExecutionContext, AbstractParameters parameters) {
+        Preconditions.checkNotNull(taskExecutionContext);
+        Preconditions.checkNotNull(parameters);
+        Map<String,Property> globalParams = 
getUserDefParamsMap(taskExecutionContext.getDefinedParams());
+        Map<String,String> globalParamsMap = 
taskExecutionContext.getDefinedParams();
+        CommandType commandType = 
CommandType.of(taskExecutionContext.getCmdTypeIfComplement());
+        Date scheduleTime = taskExecutionContext.getScheduleTime();
+
+        Map<String,Property> localParams = parameters.getLocalParametersMap();
+
+        if (globalParams == null && localParams == null) {
+            return null;
+        }
+        // if it is a complement,
+        // you need to pass in the task instance id to locate the time
+        // of the process instance complement
+        Map<String,String> timeParams = BusinessTimeUtils
+                .getBusinessTime(commandType,
+                        scheduleTime);
+
+        if (globalParamsMap != null) {
+            timeParams.putAll(globalParamsMap);
+        }
+
+        if (Strings.isNotBlank(taskExecutionContext.getExecutePath())) {
+            
timeParams.put(Constants.PARAMETER_TASK_EXECUTE_PATH,taskExecutionContext.getExecutePath());
+        }
+        
timeParams.put(Constants.PARAMETER_TASK_INSTANCE_ID,Integer.toString(taskExecutionContext.getTaskInstanceId()));
+

Review comment:
       I am referring to legacy question.:)




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