Package io.camunda.migrator.impl
Class VariableService
java.lang.Object
io.camunda.migrator.impl.VariableService
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetC7IdFromJob(io.camunda.client.api.response.ActivatedJob job) Retrieves the legacyId from a job's variables.getGlobalVariables(String c7ProcessInstanceId) Retrieves and processes all variables for a process instance, including global variables with the legacyId added.getLocalVariables(String activityInstanceId, String subProcessInstanceId) Retrieves and processes local variables for an activity instance.booleanisExternallyStartedJob(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.processVariablesToActivityGroups(List<org.camunda.bpm.engine.runtime.VariableInstance> variables) Processes a list of variable instances and converts them to ActivityVariables record.processVariablesToMapSingleActivity(List<org.camunda.bpm.engine.runtime.VariableInstance> variables) Processes a list of variable instances and converts them to a single variable map.
-
Field Details
-
configuredVariableInterceptors
-
-
Constructor Details
-
VariableService
public VariableService()
-
-
Method Details
-
getGlobalVariables
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
Retrieves and processes local variables for an activity instance.- Parameters:
activityInstanceId- the activity instance IDsubProcessInstanceId- 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
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
-