Class ProcessDataContext


  • public class ProcessDataContext
    extends java.lang.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 Detail

      • mdcPropertyActivityId

        protected java.lang.String mdcPropertyActivityId
      • mdcPropertyApplicationName

        protected java.lang.String mdcPropertyApplicationName
      • mdcPropertyBusinessKey

        protected java.lang.String mdcPropertyBusinessKey
      • mdcPropertyDefinitionId

        protected java.lang.String mdcPropertyDefinitionId
      • mdcPropertyInstanceId

        protected java.lang.String mdcPropertyInstanceId
      • mdcPropertyTenantId

        protected java.lang.String mdcPropertyTenantId
      • handleMdc

        protected boolean handleMdc
    • Method Detail

      • 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 java.lang.String getLatestActivityId()
        Returns:
        the latest value of the activity id property if exists, null otherwise
      • addToStack

        protected void addToStack​(java.lang.String value,
                                  java.lang.String property)
      • isNotBlank

        protected static boolean isNotBlank​(java.lang.String property)
      • valuesEqual

        protected static boolean valuesEqual​(java.lang.String val1,
                                             java.lang.String val2)
      • isNull

        protected static boolean isNull​(java.lang.String value)