private void deployAndStartTestProcess(string elementId, string eventName) { IBpmnModelInstance modelInstance = ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess(PROCESS_ID).StartEvent(START_ID).SequenceFlowId(SEQUENCE_FLOW_ID) .IntermediateCatchEvent(CATCH_EVENT_ID).ParallelGateway(GATEWAY_ID).UserTask(USER_TASK_ID).EndEvent(END_ID).Done(); addMessageEventDefinition((ICatchEvent)modelInstance.GetModelElementById/*<ICatchEvent>*/ (CATCH_EVENT_ID)); addExecutionListener((IBaseElement)modelInstance.GetModelElementById/*<IBaseElement>*/ (elementId), eventName); deployAndStartProcess(modelInstance); }
protected internal static void initEndEvent(IBpmnModelInstance modelInstance, string endEventId) { var endEvent = modelInstance.GetModelElementById/*<IEndEvent>*/ (endEventId); var terminateDefinition = modelInstance.NewInstance <ITerminateEventDefinition>(typeof(ITerminateEventDefinition)); endEvent.AddChildElement(terminateDefinition); }
protected internal static void makeCancelEvent(IBpmnModelInstance model, string eventId) { var element = model.GetModelElementById/*<IModelElementInstance>*/ (eventId) as IModelElementInstance; var eventDefinition = model.NewInstance <ICancelEventDefinition>(typeof(ICancelEventDefinition)); element.AddChildElement(eventDefinition); }
protected internal static void addTaskListener(IBpmnModelInstance targetModel, string activityId, string @event, string className) { var taskListener = targetModel.NewInstance <ICamundaTaskListener>(typeof(ICamundaTaskListener)); taskListener.CamundaClass = className; taskListener.CamundaEvent = @event; var task = targetModel.GetModelElementById/*<IUserTask>*/ (activityId) as IUserTask; task.Builder() .AddExtensionElement(taskListener); }
public static void addUserTaskCompensationHandler(IBpmnModelInstance modelInstance, string boundaryEventId, string compensationHandlerId) { var boundaryEvent = (IBoundaryEvent)modelInstance.GetModelElementById/*<IBoundaryEvent>*/ (boundaryEventId); var scope = (IBaseElement)boundaryEvent.ParentElement; var compensationHandler = modelInstance.NewInstance <IUserTask>(typeof(IUserTask)); compensationHandler.Id = compensationHandlerId; compensationHandler.ForCompensation = true; scope.AddChildElement(compensationHandler); var association = modelInstance.NewInstance <IAssociation>(typeof(IAssociation)); association.AssociationDirection = AssociationDirection.One; association.Source = boundaryEvent; association.Target = compensationHandler; scope.AddChildElement(association); }
public virtual void testRepositoryService() { string processDefinitionId = repositoryService.CreateProcessDefinitionQuery(c => c.Key == PROCESS_KEY).First().Id; IBpmnModelInstance modelInstance = repositoryService.GetBpmnModelInstance(processDefinitionId); Assert.NotNull(modelInstance); IEnumerable <IEvent> events = modelInstance.GetModelElementsByType <IEvent>(typeof(IEvent)); Assert.AreEqual(2, events.Count()); IEnumerable <ISequenceFlow> sequenceFlows = modelInstance.GetModelElementsByType <ISequenceFlow>(typeof(ISequenceFlow)); Assert.AreEqual(1, sequenceFlows.Count()); IStartEvent startEvent = (IStartEvent)modelInstance.GetModelElementById/*<IStartEvent>*/ ("start"); Assert.NotNull(startEvent); }
private void addServiceTaskCompensationHandler(IBpmnModelInstance modelInstance, string boundaryEventId, string compensationHandlerId) { IBoundaryEvent boundaryEvent = (IBoundaryEvent)modelInstance.GetModelElementById/*<IBoundaryEvent>*/ (boundaryEventId); IBaseElement scope = (IBaseElement)boundaryEvent.ParentElement; IServiceTask compensationHandler = modelInstance.NewInstance <IServiceTask>(typeof(IServiceTask)); compensationHandler.Id = compensationHandlerId; compensationHandler.ForCompensation = true; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method: compensationHandler.CamundaClass = typeof(IncreaseCurrentTimeServiceTask).FullName; scope.AddChildElement(compensationHandler); IAssociation association = modelInstance.NewInstance <IAssociation>(typeof(IAssociation)); association.AssociationDirection = AssociationDirection.One; association.Source = boundaryEvent; association.Target = compensationHandler; scope.AddChildElement(association); }
public virtual void testBusinessRuleTask() { IBpmnModelInstance modelInstance = ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess("testProcess").StartEvent().BusinessRuleTask("task").EndEvent().Done(); IBusinessRuleTask task = (IBusinessRuleTask)modelInstance.GetModelElementById/*<IBusinessRuleTask>*/ ("task"); task.CamundaDecisionRef = "decision"; DeploymentId = repositoryService.CreateDeployment().AddModelInstance("process.bpmn", modelInstance).AddClasspathResource(DMN_FILE).Deploy().Id; Assert.AreEqual(0l, ExecutedDecisionElements); Assert.AreEqual(0l, ExecutedDecisionElementsFromDmnEngine); runtimeService.StartProcessInstanceByKey("testProcess", VARIABLES); Assert.AreEqual(16l, ExecutedDecisionElements); Assert.AreEqual(16l, ExecutedDecisionElementsFromDmnEngine); processEngineConfiguration.DbMetricsReporter.ReportNow(); Assert.AreEqual(16l, ExecutedDecisionElements); Assert.AreEqual(16l, ExecutedDecisionElementsFromDmnEngine); }
//public virtual T GetModelElementById<T>(string id) where T : IModelElementInstance //{ // return modelInstance.GetModelElementById<T>(id); //} public virtual IModelElementInstance GetModelElementById(string id) { return(modelInstance.GetModelElementById(id)); }