//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployAndGetCaseDefinition() throws Exception public virtual void testDeployAndGetCaseDefinition() { // given case model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.cmmn.CmmnModelInstance modelInstance = createCmmnModelInstance(); CmmnModelInstance modelInstance = createCmmnModelInstance(); // when case model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.cmmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then deployment contains deployed case definition IList <CaseDefinition> deployedCaseDefinitions = deployment.DeployedCaseDefinitions; assertEquals(1, deployedCaseDefinitions.Count); assertNull(deployment.DeployedProcessDefinitions); assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and persisted case definition is equal to deployed case definition CaseDefinition persistedCaseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionResourceName("foo.cmmn").singleResult(); assertEquals(persistedCaseDefinition.Id, deployedCaseDefinitions[0].Id); }
protected internal virtual ISet <string> retrieveProcessKeysFromResources(IDictionary <string, ResourceEntity> resources) { ISet <string> keys = new HashSet <string>(); foreach (ResourceEntity resource in resources.Values) { if (isBpmnResource(resource)) { MemoryStream byteStream = new MemoryStream(resource.Bytes); BpmnModelInstance model = Bpmn.readModelFromStream(byteStream); foreach (Process process in model.Definitions.getChildElementsByType(typeof(Process))) { keys.Add(process.Id); } } else if (isCmmnResource(resource)) { MemoryStream byteStream = new MemoryStream(resource.Bytes); CmmnModelInstance model = Cmmn.readModelFromStream(byteStream); foreach (Case cmmnCase in model.Definitions.Cases) { keys.Add(cmmnCase.Id); } } } return(keys); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void setup() { modelInstance = Cmmn.createEmptyModel(); definitions = modelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; caseDefinition = createElement(definitions, "aCaseDefinition", typeof(Case)); casePlanModel = createElement(caseDefinition, "aCasePlanModel", typeof(CasePlanModel)); context = new CmmnHandlerContext(); CaseDefinitionEntity caseDefinition = new CaseDefinitionEntity(); caseDefinition.TaskDefinitions = new Dictionary <string, TaskDefinition>(); context.CaseDefinition = caseDefinition; ExpressionManager expressionManager = new ExpressionManager(); context.ExpressionManager = expressionManager; DeploymentEntity deployment = new DeploymentEntity(); deployment.Id = "foo"; context.Deployment = deployment; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getCmmnModelInstanceWithAuthenticatedTenant() public virtual void getCmmnModelInstanceWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); CmmnModelInstance modelInstance = repositoryService.getCmmnModelInstance(caseDefinitionId); assertThat(modelInstance, notNullValue()); }
public static T createElement <T>(CmmnModelInstance modelInstance, CmmnModelElementInstance parentElement, string id, Type elementClass) where T : org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance { elementClass = typeof(T); T element = modelInstance.newInstance(elementClass); element.setAttributeValue("id", id, true); parentElement.addChildElement(element); return(element); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getCmmnModelInstanceDisabledTenantCheck() public virtual void getCmmnModelInstanceDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); CmmnModelInstance modelInstance = repositoryService.getCmmnModelInstance(caseDefinitionId); assertThat(modelInstance, notNullValue()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployCmmnModelInstance() throws Exception public virtual void testDeployCmmnModelInstance() { // given CmmnModelInstance modelInstance = createCmmnModelInstance(); // when deploymentWithBuilder(repositoryService.createDeployment().addModelInstance("foo.cmmn", modelInstance)); // then assertNotNull(repositoryService.createCaseDefinitionQuery().caseDefinitionResourceName("foo.cmmn").singleResult()); }
public virtual DeploymentBuilder addModelInstance(string resourceName, CmmnModelInstance modelInstance) { ensureNotNull("modelInstance", modelInstance); validateResouceName(resourceName, CmmnDeployer.CMMN_RESOURCE_SUFFIXES); MemoryStream outputStream = new MemoryStream(); Cmmn.writeModelToStream(outputStream, modelInstance); return(addBytes(resourceName, outputStream.toByteArray())); }
public virtual void addListenerToElement(CmmnModelInstance modelInstance, CmmnModelElementInstance modelElement) { ExtensionElements extensionElements = SpecUtil.createElement(modelInstance, modelElement, null, typeof(ExtensionElements)); CamundaCaseExecutionListener caseExecutionListener = SpecUtil.createElement(modelInstance, extensionElements, null, typeof(CamundaCaseExecutionListener)); if (!ANY_EVENT.Equals(eventNameToRegisterOn)) { caseExecutionListener.CamundaEvent = eventNameToRegisterOn; } configureCaseExecutionListener(modelInstance, caseExecutionListener); foreach (FieldSpec fieldSpec in fieldSpecs) { fieldSpec.addFieldToListenerElement(modelInstance, caseExecutionListener); } }
protected internal virtual void initializeActivity(Case element, CmmnActivity activity, CmmnHandlerContext context) { CaseDefinitionEntity definition = (CaseDefinitionEntity)activity; Deployment deployment = context.Deployment; definition.Key = element.Id; definition.Name = element.Name; definition.DeploymentId = deployment.Id; definition.TaskDefinitions = new Dictionary <string, TaskDefinition>(); definition.HistoryTimeToLive = ParseUtil.parseHistoryTimeToLive(element.CamundaHistoryTimeToLiveString); CmmnModelInstance model = context.Model; Definitions definitions = model.Definitions; string category = definitions.TargetNamespace; definition.Category = category; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void setup() { CmmnTransformer transformerWrapper = new CmmnTransformer(null, new DefaultCmmnElementHandlerRegistry(), null); transformer = new CmmnTransform(transformerWrapper); deployment = new DeploymentEntity(); deployment.Id = "aDeploymentId"; transformer.Deployment = deployment; modelInstance = Cmmn.createEmptyModel(); definitions = modelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; caseDefinition = createElement(definitions, "aCaseDefinition", typeof(Case)); casePlanModel = createElement(caseDefinition, "aCasePlanModel", typeof(CasePlanModel)); }
public virtual void testRepositoryService() { string caseDefinitionId = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(CASE_KEY).singleResult().Id; CmmnModelInstance modelInstance = repositoryService.getCmmnModelInstance(caseDefinitionId); assertNotNull(modelInstance); ICollection <ModelElementInstance> humanTasks = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(HumanTask))); assertEquals(1, humanTasks.Count); ICollection <ModelElementInstance> planItems = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(PlanItem))); assertEquals(1, planItems.Count); ICollection <ModelElementInstance> cases = modelInstance.getModelElementsByType(modelInstance.Model.getType(typeof(Case))); assertEquals(1, cases.Count); }
public virtual IList <CaseDefinitionEntity> transform() { // get name of resource string resourceName = resource_Renamed.Name; // create an input stream sbyte[] bytes = resource_Renamed.Bytes; MemoryStream inputStream = new MemoryStream(bytes); try { // read input stream model = Cmmn.readModelFromStream(inputStream); } catch (CmmnModelException e) { throw LOG.transformResourceException(resourceName, e); } // TODO: use model API to validate (ie. // semantic and execution validation) model context.Model = model; context.Deployment = deployment_Renamed; context.ExpressionManager = expressionManager; try { transformRootElement(); } catch (Exception e) { // ALL unexpected exceptions should bubble up since they are not handled // accordingly by underlying parse-methods and the process can't be deployed throw LOG.parseProcessException(resourceName, e); } return(caseDefinitions); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployEmptyCaseDefinition() throws Exception public virtual void testDeployEmptyCaseDefinition() { // given empty case model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.cmmn.CmmnModelInstance modelInstance = org.camunda.bpm.model.cmmn.Cmmn.createEmptyModel(); CmmnModelInstance modelInstance = Cmmn.createEmptyModel(); org.camunda.bpm.model.cmmn.instance.Definitions definitions = modelInstance.newInstance(typeof(org.camunda.bpm.model.cmmn.instance.Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; // when case model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.cmmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then no case definition is deployed assertNull(deployment.DeployedCaseDefinitions); // and there exist not persisted case definition assertNull(repositoryService.createCaseDefinitionQuery().caseDefinitionResourceName("foo.cmmn").singleResult()); }
protected internal static CmmnModelInstance createCmmnModelInstance() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.cmmn.CmmnModelInstance modelInstance = org.camunda.bpm.model.cmmn.Cmmn.createEmptyModel(); CmmnModelInstance modelInstance = Cmmn.createEmptyModel(); org.camunda.bpm.model.cmmn.instance.Definitions definitions = modelInstance.newInstance(typeof(org.camunda.bpm.model.cmmn.instance.Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; Case caseElement = modelInstance.newInstance(typeof(Case)); caseElement.Id = "a-case"; definitions.addChildElement(caseElement); CasePlanModel casePlanModel = modelInstance.newInstance(typeof(CasePlanModel)); caseElement.CasePlanModel = casePlanModel; Cmmn.writeModelToStream(System.out, modelInstance); return(modelInstance); }
protected internal override void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener) { listener.CamundaDelegateExpression = DELEGATE_EXPRESSION; }
protected internal override void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener) { listener.CamundaClass = CLASS_NAME; }
protected internal abstract void configureCaseExecutionListener(CmmnModelInstance modelInstance, CamundaCaseExecutionListener listener);