//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception public virtual void execute(DelegateExecution execution) { RuntimeService runtimeService = execution.ProcessEngineServices.RuntimeService; bool? allFlag = (bool?)execution.getVariable("allFlag"); if (allFlag.Value) { // 1. message IDictionary <string, object> variablesFirstCall = new Dictionary <string, object>(); variablesFirstCall["someVariable"] = "someValue1"; runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesFirstCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateAllWithResult(); // 2. message IDictionary <string, object> variablesSecondCall = new Dictionary <string, object>(); variablesSecondCall["someVariable"] = "someValue2"; runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesSecondCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateAllWithResult(); } else { // 1. message IDictionary <string, object> variablesFirstCall = new Dictionary <string, object>(); variablesFirstCall["someVariable"] = "someValue1"; runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesFirstCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateWithResult(); // 2. message IDictionary <string, object> variablesSecondCall = new Dictionary <string, object>(); variablesSecondCall["someVariable"] = "someValue2"; runtimeService.createMessageCorrelation("waitForCorrelationKeyMessage").setVariables(variablesSecondCall).processInstanceVariableEquals("correlationKey", "someCorrelationKey").correlateWithResult(); } }
private void createMessageCorrelationBuilderMock() { mockMessageCorrelationBuilder = mock(typeof(MessageCorrelationBuilder)); mockMessageCorrelationResult = mock(typeof(MessageCorrelationResult)); 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.any <IDictionary <string, object> >())).thenReturn(mockMessageCorrelationBuilder); when(mockMessageCorrelationBuilder.setVariable(anyString(), any())).thenReturn(mockMessageCorrelationBuilder); }
protected internal virtual MessageCorrelationBuilder createMessageCorrelationBuilder(CorrelationMessageDto messageDto) { RuntimeService runtimeService = processEngine.RuntimeService; ObjectMapper objectMapper = ObjectMapper; IDictionary <string, object> correlationKeys = VariableValueDto.toMap(messageDto.CorrelationKeys, processEngine, objectMapper); IDictionary <string, object> localCorrelationKeys = VariableValueDto.toMap(messageDto.LocalCorrelationKeys, processEngine, objectMapper); IDictionary <string, object> processVariables = VariableValueDto.toMap(messageDto.ProcessVariables, processEngine, objectMapper); IDictionary <string, object> processVariablesLocal = VariableValueDto.toMap(messageDto.ProcessVariablesLocal, processEngine, objectMapper); MessageCorrelationBuilder builder = runtimeService.createMessageCorrelation(messageDto.MessageName); if (processVariables != null) { builder.Variables = processVariables; } if (processVariablesLocal != null) { builder.VariablesLocal = processVariablesLocal; } if (!string.ReferenceEquals(messageDto.BusinessKey, null)) { builder.processInstanceBusinessKey(messageDto.BusinessKey); } if (correlationKeys != null && correlationKeys.Count > 0) { foreach (KeyValuePair <string, object> correlationKey in correlationKeys.SetOfKeyValuePairs()) { string name = correlationKey.Key; object value = correlationKey.Value; builder.processInstanceVariableEquals(name, value); } } if (localCorrelationKeys != null && localCorrelationKeys.Count > 0) { foreach (KeyValuePair <string, object> correlationKey in localCorrelationKeys.SetOfKeyValuePairs()) { string name = correlationKey.Key; object value = correlationKey.Value; builder.localVariableEquals(name, value); } } if (!string.ReferenceEquals(messageDto.TenantId, null)) { builder.tenantId(messageDto.TenantId); } else if (messageDto.WithoutTenantId) { builder.withoutTenantId(); } string processInstanceId = messageDto.ProcessInstanceId; if (!string.ReferenceEquals(processInstanceId, null)) { builder.processInstanceId(processInstanceId); } return(builder); }