本文整理汇总了Java中org.camunda.bpm.engine.runtime.MessageCorrelationBuilder类的典型用法代码示例。如果您正苦于以下问题:Java MessageCorrelationBuilder类的具体用法?Java MessageCorrelationBuilder怎么用?Java MessageCorrelationBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageCorrelationBuilder类属于org.camunda.bpm.engine.runtime包,在下文中一共展示了MessageCorrelationBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) throws Exception {
String message = getMessageName(execution);
notNull(message, () -> new BadArgument("message"));
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
MessageCorrelationBuilder correlation = runtimeService.createMessageCorrelation(message);
if (variableName != null) {
correlation.setVariable(variableName, variableValue);
}
if (correlateName != null) {
correlation.processInstanceVariableEquals(correlateName, correlateValue);
}
correlation.correlateWithResult();
}
示例2: execute
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) throws Exception {
String message = getMessageName(execution);
notNull(message, () -> new BadArgument("message"));
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
MessageCorrelationBuilder correlation = runtimeService.createMessageCorrelation(message);
if (variables != null) {
correlation.setVariables((Map<String, Object>) variables.getValue(execution));
}
if (correlateName != null) {
correlation.processInstanceVariableEquals((String) correlateName.getValue(execution), correlateValue.getValue(execution));
}
correlation.correlateWithResult();
}
示例3: setupMocks
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
@Before
public void setupMocks() {
runtimeServiceMock = mock(RuntimeService.class);
when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
messageCorrelationBuilderMock = mock(MessageCorrelationBuilder.class);
when(runtimeServiceMock.createMessageCorrelation(anyString())).thenReturn(messageCorrelationBuilderMock);
when(messageCorrelationBuilderMock.processInstanceId(anyString())).thenReturn(messageCorrelationBuilderMock);
when(messageCorrelationBuilderMock.processInstanceBusinessKey(anyString())).thenReturn(messageCorrelationBuilderMock);
when(messageCorrelationBuilderMock.processInstanceVariableEquals(anyString(), any())).thenReturn(messageCorrelationBuilderMock);
when(messageCorrelationBuilderMock.setVariables(Matchers.<Map<String,Object>>any())).thenReturn(messageCorrelationBuilderMock);
when(messageCorrelationBuilderMock.setVariable(anyString(), any())).thenReturn(messageCorrelationBuilderMock);
executionResult = MockProvider.createMessageCorrelationResult(MessageCorrelationResultType.Execution);
procInstanceResult = MockProvider.createMessageCorrelationResult(MessageCorrelationResultType.ProcessDefinition);
executionResultList = MockProvider.createMessageCorrelationResultList(MessageCorrelationResultType.Execution);
procInstanceResultList = MockProvider.createMessageCorrelationResultList(MessageCorrelationResultType.ProcessDefinition);
mixedResultList = new ArrayList<MessageCorrelationResult>(executionResultList);
mixedResultList.addAll(procInstanceResultList);
}
示例4: signalMessage
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
/**
* Signals a BPMN Message to a running process instance.
*
* todo: describe what will happen if non existing message is signalized.
*
* @param id Id of a process instance
* @param messageName Message name to signalize
*/
public void signalMessage(String id, String messageName, Map<String, Object> variables) {
eq(processExists(id), true, () -> new MissingObject(Task.class, id));
MessageCorrelationBuilder correlation = runtimeService.createMessageCorrelation(messageName);
if (variables != null) {
correlation.setVariables(variables);
}
correlation.processInstanceId(id).correlateAll();
}
示例5: processInstanceVariableEquals
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder processInstanceVariableEquals(String variableName, Object variableValue) {
ensureNotNull("variableName", variableName);
ensureCorrelationProcessInstanceVariablesInitialized();
correlationProcessInstanceVariables.put(variableName, variableValue);
return this;
}
示例6: processInstanceVariablesEqual
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder processInstanceVariablesEqual(Map<String, Object> variables) {
ensureNotNull("variables", variables);
ensureCorrelationProcessInstanceVariablesInitialized();
correlationProcessInstanceVariables.putAll(variables);
return this;
}
示例7: localVariableEquals
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder localVariableEquals(String variableName, Object variableValue) {
ensureNotNull("variableName", variableName);
ensureCorrelationLocalVariablesInitialized();
correlationLocalVariables.put(variableName, variableValue);
return this;
}
示例8: localVariablesEqual
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder localVariablesEqual(Map<String, Object> variables) {
ensureNotNull("variables", variables);
ensureCorrelationLocalVariablesInitialized();
correlationLocalVariables.putAll(variables);
return this;
}
示例9: setVariables
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder setVariables(Map<String, Object> variables) {
if (variables != null) {
ensurePayloadProcessInstanceVariablesInitialized();
payloadProcessInstanceVariables.putAll(variables);
}
return this;
}
示例10: createMessageCorrelationBuilderMock
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
private void createMessageCorrelationBuilderMock() {
mockMessageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
mockMessageCorrelationResult = mock(MessageCorrelationResult.class);
when(mockRuntimeService.createMessageCorrelation(anyString())).thenReturn(mockMessageCorrelationBuilder);
when(mockMessageCorrelationBuilder.correlateWithResult()).thenReturn(mockMessageCorrelationResult);
when(mockMessageCorrelationBuilder.processInstanceId(anyString())).thenReturn(mockMessageCorrelationBuilder);
when(mockMessageCorrelationBuilder.processInstanceBusinessKey(anyString())).thenReturn(mockMessageCorrelationBuilder);
when(mockMessageCorrelationBuilder.processInstanceVariableEquals(anyString(), any())).thenReturn(mockMessageCorrelationBuilder);
when(mockMessageCorrelationBuilder.setVariables(Matchers.<Map<String,Object>>any())).thenReturn(mockMessageCorrelationBuilder);
when(mockMessageCorrelationBuilder.setVariable(anyString(), any())).thenReturn(mockMessageCorrelationBuilder);
}
示例11: handleEvent
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
@Override
public boolean handleEvent(String type, String eventName, String transactionId, JsonObject event) {
if ("Event".equals(type) && "OrderPlaced".equals(eventName)) {
// Currently special handling to also persist the order
Order order = parseOrder(event.getJsonObject("order"));
// "Persist" order
orderRepository.persistOrder(order);
VariableMap variables = Variables.createVariables();
variables.put("orderId", order.getId());
variables.put("transactionId", transactionId);
engine.getRuntimeService().startProcessInstanceByKey("order", transactionId, variables);
return true;
} else {
// Currently the transaction is NOT used for correlation, as we can assume
// to hit some legacy system some time which is not able to handle it
// That's why we only use it for tracking / monitoring purposes
// Correlate by possible ids in this priority
VariableMap correlationKeys = getCorrelationKeys(event);
MessageCorrelationBuilder correlation = engine.getRuntimeService().createMessageCorrelation(eventName);
ExecutionQuery query = engine.getRuntimeService().createExecutionQuery().messageEventSubscriptionName(eventName);
for (String key : correlationKeys.keySet()) {
correlation.processInstanceVariableEquals(key, correlationKeys.get(key));
query.processVariableValueEquals(key, correlationKeys.get(key));
}
// if nobody waits for this event we consider it not to be for us
if (query.count()==0) {
return false;
}
// otherwise correlate it
// add all possible additional correlation keys as variables to the flow
VariableMap newVariables = getNewVariables(event);
correlation.setVariables(newVariables);
correlation.correlateWithResult();
return true;
}
}
示例12: processInstanceBusinessKey
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder processInstanceBusinessKey(String businessKey) {
ensureNotNull("businessKey", businessKey);
this.businessKey = businessKey;
return this;
}
示例13: processInstanceId
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder processInstanceId(String id) {
ensureNotNull("processInstanceId", id);
this.processInstanceId = id;
return this;
}
示例14: setVariable
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder setVariable(String variableName, Object variableValue) {
ensureNotNull("variableName", variableName);
ensurePayloadProcessInstanceVariablesInitialized();
payloadProcessInstanceVariables.put(variableName, variableValue);
return this;
}
示例15: withoutTenantId
import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; //导入依赖的package包/类
public MessageCorrelationBuilder withoutTenantId() {
isTenantIdSet = true;
tenantId = null;
return this;
}