protected String createModel(String process_id,String process_author,String name,String modelname,String description,String category) throws UnsupportedEncodingException{
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvs");
editorNode.put("resourceId", "canvs");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
stencilSetNode.put("author", "fhadmin.cn");
editorNode.set("stencilset", stencilSetNode);
ObjectNode propertiesNode = objectMapper.createObjectNode();
propertiesNode.put("process_id",process_id);
propertiesNode.put("process_author",process_author);
propertiesNode.put("name",name);
editorNode.set("properties", propertiesNode);
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put("name", modelname);
modelObjectNode.put("revision", 1);
modelObjectNode.put("description", description);
Model modelData = repositoryService.newModel();
modelData.setCategory(category);
modelData.setDeploymentId(null);
modelData.setKey(null);
modelData.setMetaInfo(modelObjectNode.toString());
modelData.setName(modelname);
modelData.setTenantId("");
modelData.setVersion(1);
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
return modelData.getId();
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結