Class ProcessDataContext

java.lang.Object
org.camunda.bpm.engine.impl.interceptor.ProcessDataContext

public class ProcessDataContext extends Object
Holds the contextual process data.
New context properties are always part of a section that can be started by pushSection(ExecutionEntity). The section keeps track of all pushed properties. Those can easily be cleared by popping the section with popSection() afterwards, e.g. after the successful execution.
A property can be pushed to the logging context (MDC) if there is a configured non-empty context name for it in the process engine configuration. The following configuration options are available:
  • loggingContextActivityId - the context property for the activity id
  • loggingContextApplicationName - the context property for the application name
  • loggingContextBusinessKey - the context property for the business key
  • loggingContextDefinitionId - the context property for the definition id
  • loggingContextProcessInstanceId - the context property for the instance id
  • loggingContextTenantId - the context property for the tenant id
  • Field Details

    • NULL_VALUE

      protected static final String NULL_VALUE
      See Also:
    • mdcPropertyActivityId

      protected String mdcPropertyActivityId
    • mdcPropertyActivityName

      protected String mdcPropertyActivityName
    • mdcPropertyApplicationName

      protected String mdcPropertyApplicationName
    • mdcPropertyBusinessKey

      protected String mdcPropertyBusinessKey
    • mdcPropertyDefinitionId

      protected String mdcPropertyDefinitionId
    • mdcPropertyDefinitionKey

      protected String mdcPropertyDefinitionKey
    • mdcPropertyInstanceId

      protected String mdcPropertyInstanceId
    • mdcPropertyTenantId

      protected String mdcPropertyTenantId
    • mdcPropertyEngineName

      protected String mdcPropertyEngineName
    • handleMdc

      protected boolean handleMdc
    • activityIdStack

      protected ProcessDataContext.ProcessDataStack activityIdStack
    • mdcDataStacks

      All data stacks we need to keep for MDC logging
    • sections

  • Constructor Details

  • Method Details

    • initProperty

      protected String initProperty(Supplier<String> configSupplier)
    • pushSection

      public boolean pushSection(ExecutionEntity execution)
      Start a new section that keeps track of the pushed properties. If logging context properties are defined, the MDC is updated as well. This also includes clearing the MDC for the first section that is pushed for the logging context so that only the current properties will be present in the MDC (might be less than previously present in the MDC). The previous logging context needs to be reset in the MDC when this one is closed. This can be achieved by using #updateMdc(String) with the previous logging context.
      Parameters:
      execution - the execution to retrieve the context data from
      Returns:
      true if the section contains any updates and therefore should be popped later by popSection()
    • hasNoMdcValues

      protected boolean hasNoMdcValues()
    • popSection

      public void popSection()
      Pop the latest section, remove all pushed properties of that section and - if logging context properties are defined - update the MDC accordingly.
    • clearMdc

      public void clearMdc()
      Remove all logging context properties from the MDC
    • updateMdcFromCurrentValues

      public void updateMdcFromCurrentValues()
      Update the MDC with the current values of this logging context
    • getLatestActivityId

      public String getLatestActivityId()
      Returns:
      the latest value of the activity id property if exists, null otherwise
    • addToStack

      protected void addToStack(String value, String property)
    • addToStack

      protected void addToStack(ProcessDataContext.ProcessDataStack stack, String value)
    • isNotBlank

      protected static boolean isNotBlank(String property)
    • valuesEqual

      protected static boolean valuesEqual(String val1, String val2)
    • isNull

      protected static boolean isNull(String value)