本文整理了Java中org.activiti.engine.RepositoryService.getModelEditorSourceExtra
方法的一些代码示例,展示了RepositoryService.getModelEditorSourceExtra
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryService.getModelEditorSourceExtra
方法的具体详情如下:
包路径:org.activiti.engine.RepositoryService
类名称:RepositoryService
方法名:getModelEditorSourceExtra
[英]Returns the model editor source extra as a byte array
[中]以字节数组的形式返回模型编辑器源
代码示例来源:origin: bill1012/AdminEAP
/**
* 导出model的png文件
*/
@RequestMapping(value = "/model/export/image/{modelId}", method = RequestMethod.GET)
public void exportPng(@PathVariable("modelId") String modelId, HttpServletResponse response) {
try {
Model modelData = repositoryService.getModel(modelId);
byte[] pngBytes = repositoryService.getModelEditorSourceExtra(modelData.getId());
ByteArrayInputStream in = new ByteArrayInputStream(pngBytes);
IOUtils.copy(in, response.getOutputStream());
String filename = modelData.getKey() + ".process.model.png";
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
response.flushBuffer();
} catch (Exception e) {
LOGGER.error("导出model的png文件失败:modelId={}", modelId, e);
}
}
代码示例来源:origin: bill1012/AdminEAP
/**
* 校验资源文件是否存在
*
* @param type xml image 类型
* @param modelId 模型id
* @return
* @throws IOException
*/
@RequestMapping(value = "/model/exist/{type}/{modelId}", method = RequestMethod.POST)
@ResponseBody
public Result resourceExist(@PathVariable("type") String type, @PathVariable("modelId") String modelId) throws IOException {
Model modelData = repositoryService.getModel(modelId);
if (type.equals("xml")) {
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
JsonNode editorNode = objectMapper.readTree(repositoryService.getModelEditorSource(modelData.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
return new Result(!bpmnModel.getProcesses().isEmpty());
} else {
byte[] pngBytes = repositoryService.getModelEditorSourceExtra(modelData.getId());
return new Result(pngBytes.length > 0);
}
}
代码示例来源:origin: bill1012/AdminEAP
return new Result(true, realName, "成功生成流程配置xml");
} else {
byte[] pngBytes = repositoryService.getModelEditorSourceExtra(modelId);
String fileName = model.getKey() + ".model.png";
String realPath = dirPath + File.separator + DIR_PATH + File.separator + fileName;
代码示例来源:origin: bill1012/AdminEAP
/**
* 模型复制
*
* @param id
* @return
*/
@RequestMapping(value = "/model/copy/{id}", method = RequestMethod.POST)
@ResponseBody
public Result copyModal(@PathVariable("id") String id) throws IOException {
ModelEntity newModel = (ModelEntity) repositoryService.newModel();
ModelEntity model = (ModelEntity) repositoryService.getModel(id);
BeanUtils.copyProperties(model, newModel, "id", "revision");
ObjectNode modelNode;
if (!StrUtil.isEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
newModel.setMetaInfo(modelNode.toString());
}
newModel.setDeploymentId(null);
newModel.setEditorSourceExtraValueId(null);
newModel.setEditorSourceValueId(null);
newModel.setName(model.getName() + "(副本)");
repositoryService.saveModel(newModel);
repositoryService.addModelEditorSource(newModel.getId(), repositoryService.getModelEditorSource(model.getId()));
repositoryService.addModelEditorSourceExtra(newModel.getId(), repositoryService.getModelEditorSourceExtra
(model.getId()));
return new Result(true, newModel.getId(), "流程复制成功");
}
代码示例来源:origin: org.activiti/activiti-rest
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Indicates the model was found and source is returned."),
@ApiResponse(code = 404, message = "Indicates the requested model was not found.")
})
@ApiOperation(value = "Get the extra editor source for a model", tags = {"Models"},
notes = "Response body contains the model’s raw editor source. The response’s content-type is set to application/octet-stream, regardless of the content of the source.")
@RequestMapping(value = "/repository/models/{modelId}/source-extra", method = RequestMethod.GET)
protected @ResponseBody
byte[] getModelBytes(@ApiParam(name = "modelId", value="The id of the model.") @PathVariable String modelId, HttpServletResponse response) {
byte[] editorSource = repositoryService.getModelEditorSourceExtra(modelId);
if (editorSource == null) {
throw new ActivitiObjectNotFoundException("Model with id '" + modelId + "' does not have extra source available.", String.class);
}
response.setContentType("application/octet-stream");
return editorSource;
}
代码示例来源:origin: org.activiti/activiti-explorer
public void buttonClick(ClickEvent event) {
if (StringUtils.isEmpty((String) nameTextField.getValue())) {
form.setComponentError(new UserError("The name field is required."));
return;
}
Model newModelData = repositoryService.newModel();
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(MODEL_NAME, (String) nameTextField.getValue());
String description = null;
if (StringUtils.isNotEmpty((String) descriptionTextArea.getValue())) {
description = (String) descriptionTextArea.getValue();
} else {
description = "";
}
modelObjectNode.put(MODEL_DESCRIPTION, description);
newModelData.setMetaInfo(modelObjectNode.toString());
newModelData.setName((String) nameTextField.getValue());
repositoryService.saveModel(newModelData);
repositoryService.addModelEditorSource(newModelData.getId(), repositoryService.getModelEditorSource(modelData.getId()));
repositoryService.addModelEditorSourceExtra(newModelData.getId(), repositoryService.getModelEditorSourceExtra(modelData.getId()));
close();
ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(newModelData.getId());
}
});
代码示例来源:origin: org.activiti/activiti-explorer
final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId());
if (editorSourceExtra != null) {
streamSource = new StreamSource() {
内容来源于网络,如有侵权,请联系作者删除!