Пример #1
0
        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()));
        }
Пример #2
0
        protected internal virtual IList <CaseDefinitionEntity> transform()
        {
            // convert the model to the XML string representation
            Stream outputStream = new MemoryStream();

            Cmmn.writeModelToStream(outputStream, modelInstance);
            Stream inputStream = IoUtil.convertOutputStreamToInputStream(outputStream);

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

            ResourceEntity resource = new ResourceEntity();

            resource.Bytes = model;
            resource.Name  = "test";

            transformer.Resource = resource;
            IList <CaseDefinitionEntity> definitions = transformer.transform();

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

            return(definitions);
        }