本文整理汇总了Java中org.activiti.engine.RepositoryService.getModel方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryService.getModel方法的具体用法?Java RepositoryService.getModel怎么用?Java RepositoryService.getModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.RepositoryService
的用法示例。
在下文中一共展示了RepositoryService.getModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: modelSave
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@RequestMapping("model/{modelId}/save")
@ResponseBody
public String modelSave(@PathVariable("modelId") String modelId,
@RequestParam("description") String description,
@RequestParam("json_xml") String jsonXml,
@RequestParam("name") String name,
@RequestParam("svg_xml") String svgXml) throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
Model model = repositoryService.getModel(modelId);
model.setName(name);
// model.setMetaInfo(root.toString());
logger.info("jsonXml : {}", jsonXml);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(),
jsonXml.getBytes("utf-8"));
return "{}";
}
示例2: open
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@RequestMapping("modeler-open")
public String open(@RequestParam(value = "id", required = false) String id)
throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
Model model = null;
if (!StringUtils.isEmpty(id)) {
model = repositoryService.getModel(id);
}
if (model == null) {
model = repositoryService.newModel();
repositoryService.saveModel(model);
id = model.getId();
}
// return "redirect:/cdn/modeler/editor.html?id=" + id;
//return "redirect:/widgets/modeler/modeler.html?modelId=" + id;
return "redirect:/cdn/modeler/modeler.html?modelId=" + id;
}
示例3: deploy
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@RequestMapping("modeler-deploy")
public String deploy(@RequestParam("id") String id,
org.springframework.ui.Model theModel) throws Exception {
String tenantId = tenantHolder.getTenantId();
RepositoryService repositoryService = processEngine
.getRepositoryService();
Model modelData = repositoryService.getModel(id);
byte[] bytes = repositoryService
.getModelEditorSource(modelData.getId());
if (bytes == null) {
theModel.addAttribute("message", "模型数据为空,请先设计流程并成功保存,再进行发布。");
return "modeler/failure";
}
JsonNode modelNode = (JsonNode) new ObjectMapper().readTree(bytes);
byte[] bpmnBytes = null;
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment()
.name(modelData.getName())
.addString(processName, new String(bpmnBytes, "UTF-8"))
.tenantId(tenantId).deploy();
modelData.setDeploymentId(deployment.getId());
repositoryService.saveModel(modelData);
List<ProcessDefinition> processDefinitions = repositoryService
.createProcessDefinitionQuery()
.deploymentId(deployment.getId()).list();
for (ProcessDefinition processDefinition : processDefinitions) {
processEngine.getManagementService().executeCommand(
new SyncProcessCmd(processDefinition.getId()));
}
return "redirect:/modeler/modeler-list.do";
}