If you want to import a file into the MODELER, you need DI-information. There is no auto-layouting going on there. Deploying such a process to the engine itself (using either REST or java API) should work just fine. If you want to edit the process in the modeller, you'll have to run it through the auto-layout module first. See http://stacktrace.be/blog/2013/03/dynamic-process-creation-and-deployment-in-100-lines/ - instead of making a model in Java, you just need to deploy the bpmn20.xml, get the Model pogo from it and run it through the auto-layout…
I ran the following code with activiti 5.16 try { ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource(CONFIG_FILE).buildProcessEngine(); RepositoryService repositoryService = processEngine.getRepositoryService(); Deployment deployment = repositoryService.createDeployment() .addClasspathResource("InitialProjectPlan.bpmn20.xml") .disableBpmnValidation() .disableSchemaValidation() .deploy(); System.out.println("Name >>" + deployment.getName() + "ID >> " + deployment.getId()); } catch(Exception ex) { ex.printStackTrace(); }
I have used disableBpmnValidation() and disableSchemaValidation() to pass thru deployment . otherwise it is not allowing to deploy through this code. I have attached Initial Project Plan.bpmn20.xml . ran this with isExecutable="true". After this it was allowing to deploy because not able to find the import type.
Following is the error org.activiti.engine.ActivitiException: Could not import item of type http://www.omg.org/spec/BPMN/20100524/MODELorg.activiti.engine.ActivitiException: Could not import item of type http://www. omg.org/spec/BPMN/20100524/MODEL at org.activiti.engine.impl.bpmn.parser.BpmnParse.createImports(BpmnPars e.java:303) at org.activiti.engine.impl.bpmn.parser.BpmnParse.execute(BpmnParse.java :227) at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeploy er.java:112)
============= So I commented all the import lines and tried to deploy . Now I was able to deploy and it is loaded in the process definitions But diagram is not displayed and not able to edit the model because the Button is disabled.
1) Where you able to deploy the attached file(without bpmndi xml tags) through the code and see the diagram and able to edit the model? Please help me in this regard to solve the problem