Package org.camunda.bpm.engine.impl
Class DefaultPriorityProvider<T>
java.lang.Object
org.camunda.bpm.engine.impl.DefaultPriorityProvider<T>
- Type Parameters:
T
- the type of the param to determine the priority
- All Implemented Interfaces:
PriorityProvider<T>
- Direct Known Subclasses:
DefaultExternalTaskPriorityProvider
,DefaultJobPriorityProvider
Represents a default priority provider, which contains some functionality to evaluate the priority.
Can be used as base class for other priority providers. *
- Author:
- Christopher Zell <christopher.zell@camunda.com>
-
Field Summary
Modifier and TypeFieldDescriptionstatic long
The default priority.static long
The default priority in case of resolution failure. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
determinePriority
(ExecutionEntity execution, T param, String jobDefinitionId) protected Long
evaluateValueProvider
(ParameterValueProvider valueProvider, ExecutionEntity execution, String errorMessageHeading) Evaluates a given value provider with the given execution entity to determine the correct value.long
Returns the default priority.long
Returns the default priority in case of resolution failure.protected Long
getProcessDefinedPriority
(ProcessDefinitionImpl processDefinition, String propertyKey, ExecutionEntity execution, String errorMsgHead) Returns the priority which is defined in the given process definition.protected abstract Long
getProcessDefinitionPriority
(ExecutionEntity execution, T param) Returns the priority defined in the process definition.protected abstract Long
getSpecificPriority
(ExecutionEntity execution, T param, String jobDefinitionId) Returns the priority defined in the specific entity.protected boolean
isSymptomOfContextSwitchFailure
(Throwable t, ExecutionEntity contextExecution) protected boolean
isValidLongValue
(Number value) Checks if the given number is a valid long value.protected abstract void
logNotDeterminingPriority
(ExecutionEntity execution, Object value, ProcessEngineException e) Logs the exception which was thrown if the priority can not be determined.
-
Field Details
-
DEFAULT_PRIORITY
public static long DEFAULT_PRIORITYThe default priority. -
DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE
public static long DEFAULT_PRIORITY_ON_RESOLUTION_FAILUREThe default priority in case of resolution failure.
-
-
Constructor Details
-
DefaultPriorityProvider
public DefaultPriorityProvider()
-
-
Method Details
-
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 valueexecution
- the execution entityerrorMessageHeading
- the heading which is used for the error message- Returns:
- the valid priority value
-
determinePriority
- Specified by:
determinePriority
in interfacePriorityProvider<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 onjobDefinitionId
- 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 executionparam
- the generic paramjobDefinitionId
- the job definition id if related to a job- Returns:
- the specific priority
-
getProcessDefinitionPriority
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 executionparam
- 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 prioritypropertyKey
- the key which identifies the propertyexecution
- the current executionerrorMsgHead
- 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 entityvalue
- the current valuee
- the exception which was catched
-
isSymptomOfContextSwitchFailure
-
isValidLongValue
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
-