Class DefaultPriorityProvider<T>

    • Field Detail

      • DEFAULT_PRIORITY

        public static long DEFAULT_PRIORITY
        The default priority.
      • DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE

        public static long DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE
        The default priority in case of resolution failure.
    • Constructor Detail

      • DefaultPriorityProvider

        public DefaultPriorityProvider()
    • Method Detail

      • getDefaultPriority

        public long getDefaultPriority()
        Returns the default priority.
        Returns:
        the default priority
      • getDefaultPriorityOnResolutionFailure

        public long getDefaultPriorityOnResolutionFailure()
        Returns the default priority in case of resolution failure.
        Returns:
        the default priority
      • evaluateValueProvider

        protected Long evaluateValueProvider​(ParameterValueProvider valueProvider,
                                             ExecutionEntity execution,
                                             String errorMessageHeading)
        Evaluates a given value provider with the given execution entity to determine the correct value. The error message heading is used for the error message if the validation fails because the value is no valid priority.
        Parameters:
        valueProvider - the provider which contains the value
        execution - the execution entity
        errorMessageHeading - the heading which is used for the error message
        Returns:
        the valid priority value
      • determinePriority

        public long determinePriority​(ExecutionEntity execution,
                                      T param,
                                      String jobDefinitionId)
        Specified by:
        determinePriority in interface PriorityProvider<T>
        Parameters:
        execution - may be null when the job is not created in the context of a running process instance (e.g. a timer start event)
        param - extra parameter to determine priority on
        jobDefinitionId - the job definition id if related to a job
        Returns:
        the determined priority
      • getSpecificPriority

        protected abstract Long getSpecificPriority​(ExecutionEntity execution,
                                                    T param,
                                                    String jobDefinitionId)
        Returns the priority defined in the specific entity. Like a job definition priority or an activity priority. The result can also be null in that case the process priority will be used.
        Parameters:
        execution - the current execution
        param - the generic param
        jobDefinitionId - the job definition id if related to a job
        Returns:
        the specific priority
      • getProcessDefinitionPriority

        protected abstract Long getProcessDefinitionPriority​(ExecutionEntity execution,
                                                             T param)
        Returns the priority defined in the process definition. Can also be null in that case the fallback is the default priority.
        Parameters:
        execution - the current execution
        param - the generic param
        Returns:
        the priority defined in the process definition
      • getProcessDefinedPriority

        protected Long getProcessDefinedPriority​(ProcessDefinitionImpl processDefinition,
                                                 String propertyKey,
                                                 ExecutionEntity execution,
                                                 String errorMsgHead)
        Returns the priority which is defined in the given process definition. The priority value is identified with the given propertyKey. Returns null if the process definition is null or no priority was defined.
        Parameters:
        processDefinition - the process definition that should contains the priority
        propertyKey - the key which identifies the property
        execution - the current execution
        errorMsgHead - the error message header which is used if the evaluation fails
        Returns:
        the priority defined in the given process
      • logNotDeterminingPriority

        protected abstract void logNotDeterminingPriority​(ExecutionEntity execution,
                                                          Object value,
                                                          ProcessEngineException e)
        Logs the exception which was thrown if the priority can not be determined.
        Parameters:
        execution - the current execution entity
        value - the current value
        e - the exception which was catched
      • isSymptomOfContextSwitchFailure

        protected boolean isSymptomOfContextSwitchFailure​(Throwable t,
                                                          ExecutionEntity contextExecution)
      • isValidLongValue

        protected boolean isValidLongValue​(Number value)
        Checks if the given number is a valid long value.
        Parameters:
        value - the number which should be checked
        Returns:
        true if is a valid long value, false otherwise