org.camunda.bpm.engine.impl.externaltask
Class ExternalTaskQueryTopicBuilderImpl

java.lang.Object
  extended by org.camunda.bpm.engine.impl.externaltask.ExternalTaskQueryTopicBuilderImpl
All Implemented Interfaces:
ExternalTaskQueryBuilder, ExternalTaskQueryTopicBuilder

public class ExternalTaskQueryTopicBuilderImpl
extends Object
implements ExternalTaskQueryTopicBuilder

Author:
Thorben Lindhauer, Christopher Zell

Field Summary
protected  CommandExecutor commandExecutor
           
protected  TopicFetchInstruction currentInstruction
           
protected  boolean filterByBusinessKey
           
protected  Map<String,TopicFetchInstruction> instructions
           
protected  int maxTasks
           
protected  boolean usePriority
          Indicates that priority is enabled.
protected  String workerId
           
 
Constructor Summary
ExternalTaskQueryTopicBuilderImpl(CommandExecutor commandExecutor, String workerId, int maxTasks, boolean usePriority)
           
 
Method Summary
 ExternalTaskQueryTopicBuilder businessKey(String businessKey)
          Define business key value to filter external tasks by (Process Instance) Business Key.
 ExternalTaskQueryTopicBuilder enableCustomObjectDeserialization()
          Enable deserialization of variable values that are custom objects.
 List<LockedExternalTask> execute()
          Performs the fetching.
 ExternalTaskQueryTopicBuilder processInstanceVariableEquals(Map<String,Object> variables)
          Define a HashMap of variables and their values to filter correlated tasks.
 ExternalTaskQueryTopicBuilder processInstanceVariableEquals(String name, Object value)
          Define a single variable and its name to filter tasks in a topic.
protected  void submitCurrentInstruction()
           
 ExternalTaskQueryTopicBuilder topic(String topicName, long lockDuration)
          Specifies that tasks of a topic should be fetched and locked for a certain amount of time
 ExternalTaskQueryTopicBuilder variables(List<String> variables)
          Define variables to fetch with all tasks for the current topic.
 ExternalTaskQueryTopicBuilder variables(String... variables)
          Define variables to fetch with all tasks for the current topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandExecutor

protected CommandExecutor commandExecutor

workerId

protected String workerId

maxTasks

protected int maxTasks

usePriority

protected boolean usePriority
Indicates that priority is enabled.


instructions

protected Map<String,TopicFetchInstruction> instructions

filterByBusinessKey

protected boolean filterByBusinessKey

currentInstruction

protected TopicFetchInstruction currentInstruction
Constructor Detail

ExternalTaskQueryTopicBuilderImpl

public ExternalTaskQueryTopicBuilderImpl(CommandExecutor commandExecutor,
                                         String workerId,
                                         int maxTasks,
                                         boolean usePriority)
Method Detail

execute

public List<LockedExternalTask> execute()
Description copied from interface: ExternalTaskQueryBuilder
Performs the fetching. Locks candidate tasks of the given topics for the specified duration.

Specified by:
execute in interface ExternalTaskQueryBuilder
Returns:
fetched external tasks that match the topic and that can be successfully locked

topic

public ExternalTaskQueryTopicBuilder topic(String topicName,
                                           long lockDuration)
Description copied from interface: ExternalTaskQueryBuilder
Specifies that tasks of a topic should be fetched and locked for a certain amount of time

Specified by:
topic in interface ExternalTaskQueryBuilder
Parameters:
topicName - the name of the topic
lockDuration - the duration in milliseconds for which tasks should be locked; begins at the time of fetching
Returns:

variables

public ExternalTaskQueryTopicBuilder variables(String... variables)
Description copied from interface: ExternalTaskQueryTopicBuilder
Define variables to fetch with all tasks for the current topic. Calling this method multiple times overrides the previously specified variables.

Specified by:
variables in interface ExternalTaskQueryTopicBuilder
Parameters:
variables - the variable names to fetch, if null all variables will be fetched
Returns:
this builder

variables

public ExternalTaskQueryTopicBuilder variables(List<String> variables)
Description copied from interface: ExternalTaskQueryTopicBuilder
Define variables to fetch with all tasks for the current topic. Calling this method multiple times overrides the previously specified variables.

Specified by:
variables in interface ExternalTaskQueryTopicBuilder
Parameters:
variables - the variable names to fetch, if null all variables will be fetched
Returns:
this builder

processInstanceVariableEquals

public ExternalTaskQueryTopicBuilder processInstanceVariableEquals(Map<String,Object> variables)
Description copied from interface: ExternalTaskQueryTopicBuilder
Define a HashMap of variables and their values to filter correlated tasks. Calling this method multiple times overrides the previously specified variables.

Specified by:
processInstanceVariableEquals in interface ExternalTaskQueryTopicBuilder
Parameters:
variables - a HashMap of the variable names (keys) and the values to filter by
Returns:
this builder

processInstanceVariableEquals

public ExternalTaskQueryTopicBuilder processInstanceVariableEquals(String name,
                                                                   Object value)
Description copied from interface: ExternalTaskQueryTopicBuilder
Define a single variable and its name to filter tasks in a topic. Multiple calls to this method add to the existing "variable filters".

Specified by:
processInstanceVariableEquals in interface ExternalTaskQueryTopicBuilder
Parameters:
name - the name of the variable you want to fetch and query by
value - the value of the variable which you want to filter
Returns:
this builder

businessKey

public ExternalTaskQueryTopicBuilder businessKey(String businessKey)
Description copied from interface: ExternalTaskQueryTopicBuilder
Define business key value to filter external tasks by (Process Instance) Business Key.

Specified by:
businessKey in interface ExternalTaskQueryTopicBuilder
Parameters:
businessKey - the value of the Business Key to filter by
Returns:
this builder

submitCurrentInstruction

protected void submitCurrentInstruction()

enableCustomObjectDeserialization

public ExternalTaskQueryTopicBuilder enableCustomObjectDeserialization()
Description copied from interface: ExternalTaskQueryTopicBuilder
Enable deserialization of variable values that are custom objects. By default, the query will not attempt to deserialize the value of these variables.

Specified by:
enableCustomObjectDeserialization in interface ExternalTaskQueryTopicBuilder
Returns:
this builder


Copyright © 2018 camunda services GmbH. All rights reserved.