当前位置: 首页>>代码示例>>Java>>正文


Java Cmmn.writeModelToStream方法代码示例

本文整理汇总了Java中org.camunda.bpm.model.cmmn.Cmmn.writeModelToStream方法的典型用法代码示例。如果您正苦于以下问题:Java Cmmn.writeModelToStream方法的具体用法?Java Cmmn.writeModelToStream怎么用?Java Cmmn.writeModelToStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.model.cmmn.Cmmn的用法示例。


在下文中一共展示了Cmmn.writeModelToStream方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldNotAbleToAddNewElement

import org.camunda.bpm.model.cmmn.Cmmn; //导入方法依赖的package包/类
@Test
public void shouldNotAbleToAddNewElement() {
  CmmnModelInstance modelInstance = getCmmnModelInstance();
  CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();

  HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
  casePlanModel.getPlanItemDefinitions().add(humanTask);

  try {
    Cmmn.writeModelToStream(System.out, modelInstance);
    fail("cannot save cmmn 1.0 model");
  }
  catch (Exception e) {
    // expected exception
  }
}
 
开发者ID:camunda,项目名称:camunda-cmmn-model,代码行数:17,代码来源:Cmmn10Test.java

示例2: shouldNotAbleToAddCmmn10Element

import org.camunda.bpm.model.cmmn.Cmmn; //导入方法依赖的package包/类
@Test
public void shouldNotAbleToAddCmmn10Element() {
  CmmnModelInstance modelInstance = Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn11Test.cmmn"));
  CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();

  Event event = modelInstance.newInstance(Event.class);
  casePlanModel.getPlanItemDefinitions().add(event);

  try {
    Cmmn.writeModelToStream(System.out, modelInstance);
    fail("cannot save cmmn 1.1 model");
  }
  catch (Exception e) {
    // expected exception
  }
}
 
开发者ID:camunda,项目名称:camunda-cmmn-model,代码行数:17,代码来源:Cmmn10Test.java

示例3: createCmmnModelInstance

import org.camunda.bpm.model.cmmn.Cmmn; //导入方法依赖的package包/类
protected static CmmnModelInstance createCmmnModelInstance() {
  final CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
  org.camunda.bpm.model.cmmn.instance.Definitions definitions = modelInstance.newInstance(org.camunda.bpm.model.cmmn.instance.Definitions.class);
  definitions.setTargetNamespace("http://camunda.org/examples");
  modelInstance.setDefinitions(definitions);

  Case caseElement = modelInstance.newInstance(Case.class);
  caseElement.setId("a-case");
  definitions.addChildElement(caseElement);

  CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class);
  caseElement.setCasePlanModel(casePlanModel);

  Cmmn.writeModelToStream(System.out, modelInstance);

  return modelInstance;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:CmmnDeployerTest.java

示例4: transform

import org.camunda.bpm.model.cmmn.Cmmn; //导入方法依赖的package包/类
protected List<CaseDefinitionEntity> transform() {
  // convert the model to the XML string representation
  OutputStream outputStream = new ByteArrayOutputStream();
  Cmmn.writeModelToStream(outputStream, modelInstance);
  InputStream inputStream = IoUtil.convertOutputStreamToInputStream(outputStream);

  byte[] model = org.camunda.bpm.engine.impl.util.IoUtil.readInputStream(inputStream, "model");

  ResourceEntity resource = new ResourceEntity();
  resource.setBytes(model);
  resource.setName("test");

  transformer.setResource(resource);
  List<CaseDefinitionEntity> definitions = transformer.transform();

  IoUtil.closeSilently(outputStream);
  IoUtil.closeSilently(inputStream);

  return definitions;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:CmmnTransformerTest.java

示例5: addModelInstance

import org.camunda.bpm.model.cmmn.Cmmn; //导入方法依赖的package包/类
public DeploymentBuilder addModelInstance(String resourceName, CmmnModelInstance modelInstance) {
  ensureNotNull("modelInstance", modelInstance);

  validateResouceName(resourceName, CmmnDeployer.CMMN_RESOURCE_SUFFIXES);

  ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  Cmmn.writeModelToStream(outputStream, modelInstance);

  return addBytes(resourceName, outputStream.toByteArray());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:DeploymentBuilderImpl.java


注:本文中的org.camunda.bpm.model.cmmn.Cmmn.writeModelToStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。