io.holunda.camunda.taskpool.enricher.ProcessVariablesTaskCommandEnricher.kt Maven / Gradle / Ivy
package io.holunda.camunda.taskpool.enricher
import io.holunda.camunda.taskpool.api.task.TaskIdentityWithPayloadAndCorrelations
import org.camunda.bpm.engine.RuntimeService
/**
* Enriches commands with process variables from the VariableContext.
* @param runtimeService Camunda API to access the execution.
* @param processVariablesFilter filter to whitelist or blacklist the variables which should be added to the task.
*/
open class ProcessVariablesTaskCommandEnricher(
private val runtimeService: RuntimeService,
private val processVariablesFilter: ProcessVariablesFilter,
private val processVariablesCorrelator: ProcessVariablesCorrelator
) : VariablesEnricher {
override fun enrich(command: T): T {
// Payload enrichment
command.payload.putAllTyped(
processVariablesFilter.filterVariables(
command.sourceReference.definitionKey,
command.taskDefinitionKey,
runtimeService.getVariablesTyped(command.sourceReference.executionId)
)
)
// Correlations
command.correlations.putAllTyped(
processVariablesCorrelator.correlateVariables(
command.sourceReference.definitionKey,
command.taskDefinitionKey,
runtimeService.getVariablesTyped(command.sourceReference.executionId)
)
)
// Mark as enriched
command.enriched = true
return command
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy