Class VariableService

java.lang.Object
io.camunda.migrator.impl.VariableService

@Service public class VariableService extends Object
Centralized service for handling all variable-related operations in the RuntimeMigrator. This service consolidates variable retrieval, transformation, and management logic that was previously scattered across multiple classes.
  • Field Details

    • configuredVariableInterceptors

      @Autowired(required=false) protected List<VariableInterceptor> configuredVariableInterceptors
  • Constructor Details

    • VariableService

      public VariableService()
  • Method Details

    • getGlobalVariables

      public Map<String,Object> getGlobalVariables(String c7ProcessInstanceId)
      Retrieves and processes all variables for a process instance, including global variables with the legacyId added.
      Parameters:
      c7ProcessInstanceId - the C7 process instance ID
      Returns:
      processed global variables ready for C8 process instance creation
    • getLocalVariables

      public Map<String,Object> getLocalVariables(String activityInstanceId, String subProcessInstanceId)
      Retrieves and processes local variables for an activity instance.
      Parameters:
      activityInstanceId - the activity instance ID
      subProcessInstanceId - optional subprocess instance ID to include as C7 ID
      Returns:
      processed local variables
    • isExternallyStartedJob

      public boolean isExternallyStartedJob(io.camunda.client.api.response.ActivatedJob job)
      Checks if a job was started externally (not through migration) by verifying the presence of the legacyId variable.
      Parameters:
      job - the activated job to check
      Returns:
      true if the job was started externally, false if it's a migrated job
    • getC7IdFromJob

      public String getC7IdFromJob(io.camunda.client.api.response.ActivatedJob job)
      Retrieves the legacyId from a job's variables.
      Parameters:
      job - the activated job
      Returns:
      the legacyId from the job variables
    • processVariablesToActivityGroups

      public ActivityVariables processVariablesToActivityGroups(List<org.camunda.bpm.engine.runtime.VariableInstance> variables)
      Processes a list of variable instances and converts them to ActivityVariables record. This provides a more readable way to work with variables grouped by activity.
      Parameters:
      variables - the list of variable instances to process
      Returns:
      ActivityVariables containing variables grouped by activity instance
    • processVariablesToMapSingleActivity

      public Map<String,Object> processVariablesToMapSingleActivity(List<org.camunda.bpm.engine.runtime.VariableInstance> variables)
      Processes a list of variable instances and converts them to a single variable map. This method applies all configured interceptors during processing.
      Parameters:
      variables - the list of variable instances to process
      Returns:
      map of variable name to value pairs