本文整理汇总了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
}
}
示例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
}
}
示例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;
}
示例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;
}
示例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());
}