/*ObjectNode modelNode = (ObjectNode) objectMapper.readTree(modelForm.getFirstValue("json_xml"));
JsonToBpmnExport converter = new JsonToBpmnExport(modelNode);
byte[] bpmnBytes = converter.convert();
System.out.println("bpmn " + new String(bpmnBytes));*/
RepositoryService repositoryService = ProcessEngines.getDefaultProcessEngine().getRepositoryService();
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, modelForm.getFirstValue("name"));
modelJson.put(MODEL_DESCRIPTION, modelForm.getFirstValue("description"));
model.setMetaInfo(modelJson.toString());
model.setName(modelForm.getFirstValue("name"));
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), modelForm.getFirstValue("json_xml").getBytes("utf-8"));
repositoryService.addModelEditorSourceExtra(model.getId(), modelForm.getFirstValue("svg_xml").getBytes("utf-8"));
} catch(Exception e) {
LOGGER.log(Level.SEVERE, "Error saving model", e);
setStatus(Status.SERVER_ERROR_INTERNAL);
}