Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import io.micrometer.observation.ObservationRegistry;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.ArrayUtils;
Expand Down Expand Up @@ -771,6 +770,25 @@ protected Function<? super Throwable, Mono<ActionExecutionResult>> executionExce
};
}

/**
* This function deep copies the actionConfiguration object to send the original object to mixpanel which contains
* the actual user query with bindings
* @param actionConfiguration
* @return
*/
private ActionConfiguration deepCopyActionConfiguration(ActionConfiguration actionConfiguration) {
try {
// Convert the ActionConfiguration object to JSON string
String json = objectMapper.writeValueAsString(actionConfiguration);

// Convert the JSON string back to an ActionConfiguration object
return objectMapper.readValue(json, ActionConfiguration.class);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return null;
}

/**
* Handles the execution logic, call to pluginExecutor with the payload post retrieval and validation of action, datasource, and plugin
*
Expand Down Expand Up @@ -799,9 +817,7 @@ protected Mono<ActionExecutionResult> getActionExecutionResult(
ActionConfiguration rawActionConfiguration = null;
if (actionDTO != null && actionDTO.getActionConfiguration() != null) {
// deep copying the actionConfiguration to avoid any changes in the original object
Gson gson = commonConfig.gsonInstance();
rawActionConfiguration = gson.fromJson(
gson.toJson(actionDTO.getActionConfiguration()), ActionConfiguration.class);
rawActionConfiguration = this.deepCopyActionConfiguration(actionDTO.getActionConfiguration());
}

log.debug(
Expand Down