protected internal virtual string provideTenantId(DecisionDefinition decisionDefinition, HistoricDecisionInstanceEntity @event) { TenantIdProvider tenantIdProvider = Context.ProcessEngineConfiguration.TenantIdProvider; string tenantId = null; if (tenantIdProvider != null) { TenantIdProviderHistoricDecisionInstanceContext ctx = null; if (!string.ReferenceEquals(@event.ExecutionId, null)) { ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition, getExecution(@event)); } else if (!string.ReferenceEquals(@event.CaseExecutionId, null)) { ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition, getCaseExecution(@event)); } else { ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition); } tenantId = tenantIdProvider.provideTenantIdForHistoricDecisionInstance(ctx); } return(tenantId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dmnDeploymentWithDecisionLiteralExpression() public virtual void dmnDeploymentWithDecisionLiteralExpression() { string deploymentId = testRule.deploy(DMN_DECISION_LITERAL_EXPRESSION).Id; // there should be decision deployment DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.count()); // there should be one decision definition DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery(); assertEquals(1, query.count()); DecisionDefinition decisionDefinition = query.singleResult(); assertTrue(decisionDefinition.Id.StartsWith("decisionLiteralExpression:1:", StringComparison.Ordinal)); assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category); assertEquals("decisionLiteralExpression", decisionDefinition.Key); assertEquals("Decision with Literal Expression", decisionDefinition.Name); assertEquals(1, decisionDefinition.Version); assertEquals(DMN_DECISION_LITERAL_EXPRESSION, decisionDefinition.ResourceName); assertEquals(deploymentId, decisionDefinition.DeploymentId); assertNull(decisionDefinition.DiagramResourceName); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void decisionDefinitionProperties() public virtual void decisionDefinitionProperties() { IList <DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().orderByDecisionDefinitionName().asc().orderByDecisionDefinitionVersion().asc().orderByDecisionDefinitionCategory().asc().list(); DecisionDefinition decisionDefinition = decisionDefinitions[0]; assertEquals("one", decisionDefinition.Key); assertEquals("One", decisionDefinition.Name); assertTrue(decisionDefinition.Id.StartsWith("one:1", StringComparison.Ordinal)); assertEquals("Examples", decisionDefinition.Category); assertEquals(1, decisionDefinition.Version); assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.ResourceName); assertEquals(firstDeploymentId, decisionDefinition.DeploymentId); decisionDefinition = decisionDefinitions[1]; assertEquals("one", decisionDefinition.Key); assertEquals("One", decisionDefinition.Name); assertTrue(decisionDefinition.Id.StartsWith("one:2", StringComparison.Ordinal)); assertEquals("Examples", decisionDefinition.Category); assertEquals(2, decisionDefinition.Version); assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.ResourceName); assertEquals(secondDeploymentId, decisionDefinition.DeploymentId); decisionDefinition = decisionDefinitions[2]; assertEquals("two", decisionDefinition.Key); assertEquals("Two", decisionDefinition.Name); assertTrue(decisionDefinition.Id.StartsWith("two:1", StringComparison.Ordinal)); assertEquals("Examples2", decisionDefinition.Category); assertEquals(1, decisionDefinition.Version); assertEquals("org/camunda/bpm/engine/test/repository/two.dmn", decisionDefinition.ResourceName); assertEquals(firstDeploymentId, decisionDefinition.DeploymentId); }
public virtual void testQueryByVersionTag() { DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().versionTag("1.0.0").singleResult(); assertEquals("versionTag", decisionDefinition.Key); assertEquals("1.0.0", decisionDefinition.VersionTag); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void deployDecisionIndependentFromDrd() public virtual void deployDecisionIndependentFromDrd() { string deploymentIdDecision = testRule.deploy(DMN_SCORE_RESOURCE).Id; string deploymentIdDrd = testRule.deploy(DRD_SCORE_RESOURCE).Id; // there should be one decision requirements definition DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); assertEquals(1, query.count()); DecisionRequirementsDefinition decisionRequirementsDefinition = query.singleResult(); assertEquals(1, decisionRequirementsDefinition.Version); assertEquals(deploymentIdDrd, decisionRequirementsDefinition.DeploymentId); // and two deployed decisions with different versions IList <DecisionDefinition> decisions = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey("score-decision").orderByDecisionDefinitionVersion().asc().list(); assertEquals(2, decisions.Count); DecisionDefinition firstDecision = decisions[0]; assertEquals(1, firstDecision.Version); assertEquals(deploymentIdDecision, firstDecision.DeploymentId); assertNull(firstDecision.DecisionRequirementsDefinitionId); DecisionDefinition secondDecision = decisions[1]; assertEquals(2, secondDecision.Version); assertEquals(deploymentIdDrd, secondDecision.DeploymentId); assertEquals(decisionRequirementsDefinition.Id, secondDecision.DecisionRequirementsDefinitionId); }
protected internal virtual HistoricDecisionInstanceEntity createDecisionEvaluatedEvt(DmnDecisionLogicEvaluationEvent evaluationEvent, ExecutionEntity execution) { // create event instance HistoricDecisionInstanceEntity @event = newDecisionInstanceEventEntity(execution, evaluationEvent); setReferenceToProcessInstance(@event, execution); if (HistoryRemovalTimeStrategyStart) { provideRemovalTime(@event); } // initialize event initDecisionInstanceEvent(@event, evaluationEvent, HistoryEventTypes.DMN_DECISION_EVALUATE); DecisionDefinition decisionDefinition = (DecisionDefinition)evaluationEvent.Decision; string tenantId = execution.TenantId; if (string.ReferenceEquals(tenantId, null)) { tenantId = provideTenantId(decisionDefinition, @event); } @event.TenantId = tenantId; return(@event); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpRuntime() public virtual void setUpRuntime() { DecisionDefinition mockDecisionDefinition = MockProvider.createMockDecisionDefinition(); UpRuntimeData = mockDecisionDefinition; setUpDecisionService(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testEvaluateDecisionByKeyAndTenantId() public virtual void testEvaluateDecisionByKeyAndTenantId() { DecisionDefinition mockDefinition = MockProvider.mockDecisionDefinition().tenantId(MockProvider.EXAMPLE_TENANT_ID).build(); UpRuntimeData = mockDefinition; DmnDecisionResult decisionResult = MockProvider.createMockDecisionResult(); when(decisionEvaluationBuilderMock.evaluate()).thenReturn(decisionResult); IDictionary <string, object> json = new Dictionary <string, object>(); json["variables"] = VariablesBuilder.create().variable("amount", 420).variable("invoiceCategory", "MISC").Variables; given().pathParam("key", MockProvider.EXAMPLE_DECISION_DEFINITION_KEY).pathParam("tenant-id", MockProvider.EXAMPLE_TENANT_ID).contentType(POST_JSON_CONTENT_TYPE).body(json).then().expect().statusCode(Status.OK.StatusCode).when().post(EVALUATE_DECISION_BY_KEY_AND_TENANT_ID_URL); IDictionary <string, object> expectedVariables = new Dictionary <string, object>(); expectedVariables["amount"] = 420; expectedVariables["invoiceCategory"] = "MISC"; verify(decisionDefinitionQueryMock).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID); verify(decisionEvaluationBuilderMock).variables(expectedVariables); verify(decisionEvaluationBuilderMock).evaluate(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment @Test public void longDecisionDefinitionKey() public virtual void longDecisionDefinitionKey() { DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); assertFalse(decisionDefinition.Id.StartsWith("o123456789", StringComparison.Ordinal)); assertEquals("o123456789o123456789o123456789o123456789o123456789o123456789o123456789", decisionDefinition.Key); }
public virtual void testDecisionInstancePropertiesOfDecisionLiteralExpression() { DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); decisionService.evaluateDecisionByKey("decision").variables(Variables.createVariables().putValue("sum", 2205)).evaluate(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().includeInputs().includeOutputs(); assertThat(query.count(), @is(1L)); HistoricDecisionInstance historicDecisionInstance = query.singleResult(); assertThat(historicDecisionInstance.DecisionDefinitionId, @is(decisionDefinition.Id)); assertThat(historicDecisionInstance.DecisionDefinitionKey, @is("decision")); assertThat(historicDecisionInstance.DecisionDefinitionName, @is("Decision with Literal Expression")); assertThat(historicDecisionInstance.EvaluationTime, @is(notNullValue())); assertThat(historicDecisionInstance.Inputs.Count, @is(0)); IList <HistoricDecisionOutputInstance> outputs = historicDecisionInstance.Outputs; assertThat(outputs.Count, @is(1)); HistoricDecisionOutputInstance output = outputs[0]; assertThat(output.VariableName, @is("result")); assertThat(output.TypeName, @is("string")); assertThat((string)output.Value, @is("ok")); assertThat(output.ClauseId, @is(nullValue())); assertThat(output.ClauseName, @is(nullValue())); assertThat(output.RuleId, @is(nullValue())); assertThat(output.RuleOrder, @is(nullValue())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dmnDeploymentWithDmnSuffix() public virtual void dmnDeploymentWithDmnSuffix() { string deploymentId = testRule.deploy(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX).Id; // there should be one deployment DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.count()); // there should be one case definition DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery(); assertEquals(1, query.count()); DecisionDefinition decisionDefinition = query.singleResult(); assertTrue(decisionDefinition.Id.StartsWith("decision:1:", StringComparison.Ordinal)); assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category); assertEquals("CheckOrder", decisionDefinition.Name); assertEquals("decision", decisionDefinition.Key); assertEquals(1, decisionDefinition.Version); assertEquals(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX, decisionDefinition.ResourceName); assertEquals(deploymentId, decisionDefinition.DeploymentId); assertNull(decisionDefinition.DiagramResourceName); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getDecisionDefinitionWithAuthenticatedTenant() public virtual void getDecisionDefinitionWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId); assertThat(definition.TenantId, @is(TENANT_ONE)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getDecisionDefinitionDisabledTenantCheck() public virtual void getDecisionDefinitionDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId); assertThat(definition.TenantId, @is(TENANT_ONE)); }
protected internal virtual void createDefaultAuthorizations(DecisionDefinition decisionDefinition) { if (AuthorizationEnabled) { ResourceAuthorizationProvider provider = ResourceAuthorizationProvider; AuthorizationEntity[] authorizations = provider.newDecisionDefinition(decisionDefinition); saveDefaultAuthorizations(authorizations); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDefinitionRetrieval_ByKeyAndTenantId() public virtual void testDefinitionRetrieval_ByKeyAndTenantId() { DecisionDefinition mockDefinition = MockProvider.mockDecisionDefinition().tenantId(MockProvider.EXAMPLE_TENANT_ID).build(); UpRuntimeData = mockDefinition; given().pathParam("key", MockProvider.EXAMPLE_DECISION_DEFINITION_KEY).pathParam("tenant-id", MockProvider.EXAMPLE_TENANT_ID).then().expect().statusCode(Status.OK.StatusCode).body("id", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_ID)).body("key", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_KEY)).body("category", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_CATEGORY)).body("name", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_NAME)).body("deploymentId", equalTo(MockProvider.EXAMPLE_DEPLOYMENT_ID)).body("version", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_VERSION)).body("resource", equalTo(MockProvider.EXAMPLE_DECISION_DEFINITION_RESOURCE_NAME)).body("decisionRequirementsDefinitionId", equalTo(MockProvider.EXAMPLE_DECISION_REQUIREMENTS_DEFINITION_ID)).body("decisionRequirementsDefinitionKey", equalTo(MockProvider.EXAMPLE_DECISION_REQUIREMENTS_DEFINITION_KEY)).body("tenantId", equalTo(MockProvider.EXAMPLE_TENANT_ID)).when().get(SINGLE_DECISION_DEFINITION_BY_KEY_AND_TENANT_ID_URL); verify(decisionDefinitionQueryMock).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID); verify(repositoryServiceMock).getDecisionDefinition(MockProvider.EXAMPLE_DECISION_DEFINITION_ID); }
protected internal virtual DmnDecisionResult doEvaluateDecision(DecisionDefinition decisionDefinition, VariableMap variables) { try { return(evaluateDecision(decisionDefinition, variables)); } catch (Exception e) { throw new ProcessEngineException("Exception while evaluating decision with key '" + decisionDefinitionKey + "'", e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void updateHistoryTimeToLiveWithAuthenticatedTenant() public virtual void updateHistoryTimeToLiveWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinitionId, 6); DecisionDefinition definition = repositoryService.getDecisionDefinition(decisionDefinitionId); assertThat(definition.TenantId, @is(TENANT_ONE)); assertThat(definition.HistoryTimeToLive, @is(6)); }
public virtual void testGetDecisionDefinition() { // given string decisionDefinitionId = selectDecisionDefinitionByKey(DECISION_DEFINITION_KEY).Id; createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ); // when DecisionDefinition decisionDefinition = repositoryService.getDecisionDefinition(decisionDefinitionId); // then assertNotNull(decisionDefinition); }
public virtual void noDrdForSingleDecisionDeployment() { // when the DMN file contains only a single decision definition assertEquals(1, repositoryService.createDecisionDefinitionQuery().count()); // then no decision requirements definition should be created assertEquals(0, repositoryService.createDecisionRequirementsDefinitionQuery().count()); // and the decision should not be linked to a decision requirements definition DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); assertNull(decisionDefinition.DecisionRequirementsDefinitionId); assertNull(decisionDefinition.DecisionRequirementsDefinitionKey); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public java.io.InputStream execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public virtual Stream execute(CommandContext commandContext) { DecisionDefinition decisionDefinition = (new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId)).execute(commandContext); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String deploymentId = decisionDefinition.getDeploymentId(); string deploymentId = decisionDefinition.DeploymentId; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String resourceName = decisionDefinition.getResourceName(); string resourceName = decisionDefinition.ResourceName; return(commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext, deploymentId, resourceName))); }
public virtual DecisionDefinitionResource getDecisionDefinitionByKeyAndTenantId(string decisionDefinitionKey, string tenantId) { DecisionDefinition decisionDefinition = ProcessEngine.RepositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(decisionDefinitionKey).tenantIdIn(tenantId).latestVersion().singleResult(); if (decisionDefinition == null) { string errorMessage = string.Format("No matching decision definition with key: {0} and tenant-id: {1}", decisionDefinitionKey, tenantId); throw new RestException(Status.NOT_FOUND, errorMessage); } else { return(getDecisionDefinitionById(decisionDefinition.Id)); } }
public virtual void testQueryByLatestWithoutTenantId() { // deploy a second version without tenant id deployment(DMN); DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().withoutTenantId(); assertThat(query.count(), @is(1L)); DecisionDefinition decisionDefinition = query.singleResult(); assertThat(decisionDefinition.TenantId, @is(nullValue())); assertThat(decisionDefinition.Version, @is(2)); }
public virtual void testDeleteHistoricDecisionInstances() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY); startProcessInstanceAndEvaluateDecision(); assertThat(query.count(), @is(1L)); DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); historyService.deleteHistoricDecisionInstanceByDefinitionId(decisionDefinition.Id); assertThat(query.count(), @is(0L)); }
public virtual DmnDecisionResult execute(CommandContext commandContext) { ensureOnlyOneNotNull("either decision definition id or key must be set", decisionDefinitionId, decisionDefinitionKey); DecisionDefinition decisionDefinition = getDecisionDefinition(commandContext); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkEvaluateDecision(decisionDefinition); } writeUserOperationLog(commandContext, decisionDefinition); return(doEvaluateDecision(decisionDefinition, variables)); }
public virtual void evaluateDecisionByKeyAndVersion() { // given DecisionDefinition decisionDefinition = engineRule.RepositoryService.createDecisionDefinitionQuery().singleResult(); // when authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start(); DmnDecisionTableResult decisionResult = engineRule.DecisionService.evaluateDecisionTableByKeyAndVersion(decisionDefinition.Key, decisionDefinition.Version, createVariables()); // then if (authRule.assertScenario(scenario)) { assertThatDecisionHasExpectedResult(decisionResult); } }
public virtual void testQueryWithReadPermissionOnOneDecisionDefinition() { // given user gets read permission on the decision definition createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ); // when DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery(); // then verifyQueryResults(query, 1); DecisionDefinition definition = query.singleResult(); assertNotNull(definition); assertEquals(DECISION_DEFINITION_KEY, definition.Key); }
protected internal virtual void initDecisionInstanceEvent(HistoricDecisionInstanceEntity @event, DmnDecisionLogicEvaluationEvent evaluationEvent, HistoryEventTypes eventType, HistoricDecisionInstanceEntity rootDecisionInstance) { @event.EventType = eventType.EventName; DecisionDefinition decision = (DecisionDefinition)evaluationEvent.Decision; @event.DecisionDefinitionId = decision.Id; @event.DecisionDefinitionKey = decision.Key; @event.DecisionDefinitionName = decision.Name; if (!string.ReferenceEquals(decision.DecisionRequirementsDefinitionId, null)) { @event.DecisionRequirementsDefinitionId = decision.DecisionRequirementsDefinitionId; @event.DecisionRequirementsDefinitionKey = decision.DecisionRequirementsDefinitionKey; } // set current time as evaluation time @event.EvaluationTime = ClockUtil.CurrentTime; if (string.ReferenceEquals(@event.RootProcessInstanceId, null) && string.ReferenceEquals(@event.CaseInstanceId, null)) { if (rootDecisionInstance != null) { @event.RemovalTime = rootDecisionInstance.RemovalTime; } else { DateTime removalTime = calculateRemovalTime(@event, decision); @event.RemovalTime = removalTime; } } if (evaluationEvent is DmnDecisionTableEvaluationEvent) { initDecisionInstanceEventForDecisionTable(@event, (DmnDecisionTableEvaluationEvent)evaluationEvent); } else if (evaluationEvent is DmnDecisionLiteralExpressionEvaluationEvent) { initDecisionInstanceEventForDecisionLiteralExpression(@event, (DmnDecisionLiteralExpressionEvaluationEvent)evaluationEvent); } else { @event.Inputs = System.Linq.Enumerable.Empty <HistoricDecisionInputInstance> (); @event.Outputs = System.Linq.Enumerable.Empty <HistoricDecisionOutputInstance> (); } }
public virtual void getDecisionDiagramResource() { string resourcePrefix = "org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDecisionDiagramResource"; DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); assertEquals(resourcePrefix + ".dmn11.xml", decisionDefinition.ResourceName); assertEquals("decision", decisionDefinition.Key); string diagramResourceName = decisionDefinition.DiagramResourceName; assertEquals(resourcePrefix + ".png", diagramResourceName); Stream diagramStream = repositoryService.getResourceAsStream(decisionDefinition.DeploymentId, diagramResourceName); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final byte[] diagramBytes = org.camunda.bpm.engine.impl.util.IoUtil.readInputStream(diagramStream, "diagram stream"); sbyte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream"); assertEquals(2540, diagramBytes.Length); }
protected internal virtual HistoricDecisionInstanceEntity createDecisionEvaluatedEvt(DmnDecisionLogicEvaluationEvent evaluationEvent, HistoricDecisionInstanceEntity rootDecisionInstance) { // create event instance HistoricDecisionInstanceEntity @event = newDecisionInstanceEventEntity(evaluationEvent); // initialize event initDecisionInstanceEvent(@event, evaluationEvent, HistoryEventTypes.DMN_DECISION_EVALUATE, rootDecisionInstance); // set the user id if there is an authenticated user and no process instance UserId = @event; DecisionDefinition decisionDefinition = (DecisionDefinition)evaluationEvent.Decision; string tenantId = decisionDefinition.TenantId; if (string.ReferenceEquals(tenantId, null)) { tenantId = provideTenantId(decisionDefinition, @event); } @event.TenantId = tenantId; return(@event); }
public virtual void testDecisionDefinitionPassedToHistoryLevel() { RecordHistoryLevel historyLevel = (RecordHistoryLevel)processEngineConfiguration.HistoryLevel; DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey("testDecision").singleResult(); VariableMap variables = Variables.createVariables().putValue("input1", true); decisionService.evaluateDecisionTableByKey("testDecision", variables); IList <RecordHistoryLevel.ProducedHistoryEvent> producedHistoryEvents = historyLevel.ProducedHistoryEvents; assertEquals(1, producedHistoryEvents.Count); RecordHistoryLevel.ProducedHistoryEvent producedHistoryEvent = producedHistoryEvents[0]; assertEquals(HistoryEventTypes.DMN_DECISION_EVALUATE, producedHistoryEvent.eventType); DecisionDefinition entity = (DecisionDefinition)producedHistoryEvent.entity; assertNotNull(entity); assertEquals(decisionDefinition.Id, entity.Id); }
static void Load() { if(0 != allDecisions.Count) { return; } //we haven't loaded, read the file List<List<string>> defs = DecisionReader.ReadFile ("./Assets/Data/Decisions/Newspaper.txt"); foreach(List<string> def in defs) { //has to be the right number of lines if(def.Count != 7) { Debug.Log ("Rejecting Newspaper Decision, not enough lines: " + def [0]); continue; } try { DecisionDefinition d = new DecisionDefinition(); d.title = def[0]; d.topic = TopicUtil.MapTopic(def[1]); d.minLevel = Int32.Parse(def[2]); d.maxLevel = Int32.Parse(def[3]); d.options = new DecisionOption[3]; for(int i = 0; i < 3; ++i) { d.options[i] = new DecisionOption(); string[] parts = def[4 + i].Split(' '); d.options[i].description = def[4 + i].Substring( 0, def[4+i].Length - parts[parts.Length-1].Length-1 ); d.options[i].value = Int32.Parse(parts[parts.Length-1]); } allDecisions.Add(d); } catch(Exception e) { Debug.Log ("Rejecting Newspaper Decision, invalid: " + def [0]); Debug.Log (e.Message); Debug.Log ((new System.Diagnostics.StackTrace(e, true)).ToString()); continue; } } }
public override void Define(DecisionDefinition def, Dictionary<string, string> values) { base.Define (def, values); UpdateUI(); }
public virtual void Define(DecisionDefinition def, Dictionary<string, string> values) { definition = def; CompileDefitionTitle (values); }