本文整理汇总了Java中org.activiti.engine.repository.Model.setMetaInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Model.setMetaInfo方法的具体用法?Java Model.setMetaInfo怎么用?Java Model.setMetaInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.repository.Model的用法示例。
在下文中一共展示了Model.setMetaInfo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createModel
点赞 4
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
@PostMapping("createModel")
@ResponseStatus(value = HttpStatus.CREATED)
public ResponseMessage createModel(@RequestBody JSONObject model) throws Exception {
JSONObject stencilset = new JSONObject();
stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
JSONObject editorNode = new JSONObject();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
editorNode.put("stencilset", stencilset);
JSONObject modelObjectNode = new JSONObject();
modelObjectNode.put(MODEL_REVISION, 1);
modelObjectNode.put(MODEL_DESCRIPTION, model.getString(MODEL_DESCRIPTION));
modelObjectNode.put(MODEL_KEY, model.getString(MODEL_KEY));
modelObjectNode.put(MODEL_NAME, model.getString(MODEL_NAME));
Model modelData = repositoryService.newModel();
modelData.setMetaInfo(modelObjectNode.toJSONString());
modelData.setName(model.getString(MODEL_NAME));
modelData.setKey(model.getString(MODEL_KEY));
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
return ResponseMessage.ok(modelData);
}
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:24,
示例2: testNewModelPersistence
点赞 3
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
public void testNewModelPersistence() {
Model model = repositoryService.newModel();
assertNotNull(model);
model.setName("Test model");
model.setCategory("test");
model.setMetaInfo("meta");
repositoryService.saveModel(model);
assertNotNull(model.getId());
model = repositoryService.getModel(model.getId());
assertNotNull(model);
assertEquals("Test model", model.getName());
assertEquals("test", model.getCategory());
assertEquals("meta", model.getMetaInfo());
assertNotNull(model.getCreateTime());
assertEquals(Integer.valueOf(1), model.getVersion());
repositoryService.deleteModel(model.getId());
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:21,
示例3: create
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
/**
* 创建模型
*/
@RequestMapping(value = "create", method = RequestMethod.POST)
public void create(@RequestParam("name") String name, @RequestParam("key") String key, @RequestParam("description") String description,
HttpServletRequest request, HttpServletResponse response) {
try {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.put("stencilset", stencilSetNode);
Model modelData = repositoryService.newModel();
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
description = StringUtils.defaultString(description);
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
modelData.setMetaInfo(modelObjectNode.toString());
modelData.setName(name);
modelData.setKey(StringUtils.defaultString(key));
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), editorNode.toString().getBytes("utf-8"));
response.sendRedirect(request.getContextPath() + "/modeler.html?modelId=" + modelData.getId());
} catch (Exception e) {
logger.error("创建模型失败:", e);
}
}
开发者ID:batizhao,项目名称:microservice,代码行数:34,
示例4: saveNewModel
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
@RequestMapping(value = "/model/create", method = RequestMethod.POST)
public void saveNewModel(Map map, String tenantId, String key, String name, String desc) {
try {
// "properties":{"process_id":"appleave","name":"璇峰亣鍗曞鎵?
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode properties = objectMapper.createObjectNode();
properties.put("process_id", key);
properties.put("name", name);
editorNode.set("properties", properties);
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.set("stencilset", stencilSetNode);
Model model = repositoryService.newModel();
ObjectNode metaInfo = new ObjectMapper().createObjectNode();
metaInfo.put("name", name);
metaInfo.put("revision", 1);
metaInfo.put("description", desc);
model.setMetaInfo(metaInfo.toString());
model.setName(name);
if (StringUtils.isNotEmpty(tenantId)) {
model.setTenantId(tenantId);
}
model.setKey(key);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("UTF-8"));
} catch (Exception e) {
logger.error("Error Save New Model", e);
throw new ActivitiException("Error Save New Model", e);
}
}
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:41,
示例5: saveModel
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
@RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, @RequestBody MultiValueMap values) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, values.getFirst("name"));
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
model.setMetaInfo(modelJson.toString());
model.setName(values.getFirst("name"));
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:38,
示例6: newModel
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
/**
* 新建一个空模型
*
* @return
* @throws UnsupportedEncodingException
*/
@RequestMapping(value = "/model/new", method = RequestMethod.GET)
public String newModel() throws UnsupportedEncodingException {
//初始化一个空模型
Model model = repositoryService.newModel();
//设置一些默认信息
String name = "new-process";
String description = "";
int revision = 1;
String key = "process";
ObjectNode modelNode = objectMapper.createObjectNode();
modelNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
modelNode.put(ModelDataJsonConstants.MODEL_REVISION, revision);
model.setName(name);
model.setKey(key);
model.setMetaInfo(modelNode.toString());
repositoryService.saveModel(model);
String id = model.getId();
//完善ModelEditorSource
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace",
"http://b3mn.org/stencilset/bpmn2.0#");
editorNode.put("stencilset", stencilSetNode);
repositoryService.addModelEditorSource(id, editorNode.toString().getBytes("utf-8"));
//return ToWeb.buildResult().redirectUrl("/modeler.html?modelId="+id);
return "redirect:/activiti/modeler/" + id;
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:42,
示例7: create
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
/**
* 创建模型
*/
@RequestMapping(value = "create")
public void create(@RequestParam("name") String name, @RequestParam("key") String key,
@RequestParam(value = "description", required = false) String description,
HttpServletRequest request, HttpServletResponse response) {
try {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.put("stencilset", stencilSetNode);
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
description = StringUtils.defaultString(description);
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
Model newModel = repositoryService.newModel();
newModel.setMetaInfo(modelObjectNode.toString());
newModel.setName(name);
newModel.setKey(StringUtils.defaultString(key));
repositoryService.saveModel(newModel);
repositoryService.addModelEditorSource(newModel.getId(), editorNode.toString().getBytes("utf-8"));
response.sendRedirect(request.getContextPath() + "/mservice/editor?id=" + newModel.getId());
} catch (Exception e) {
logger.error("创建模型失败:", e);
}
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:36,
示例8: convertToModel
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
/**
* 转换流程定义为模型
* @param processDefinitionId
* @return
* @throws UnsupportedEncodingException
* @throws XMLStreamException
*/
@RequestMapping(value = "/process/convert-to-model/{processDefinitionId}")
public String convertToModel(@PathVariable("processDefinitionId") String processDefinitionId)
throws UnsupportedEncodingException, XMLStreamException {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId).singleResult();
InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
processDefinition.getResourceName());
XMLInputFactory xif = XMLInputFactory.newInstance();
InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
BpmnJsonConverter converter = new BpmnJsonConverter();
ObjectNode modelNode = converter.convertToJson(bpmnModel);
Model modelData = repositoryService.newModel();
modelData.setKey(processDefinition.getKey());
modelData.setName(processDefinition.getResourceName());
modelData.setCategory(processDefinition.getDeploymentId());
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
modelData.setMetaInfo(modelObjectNode.toString());
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
return "redirect:/chapter20/model/list";
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:39,
示例9: testUpdateModelPersistence
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
public void testUpdateModelPersistence() throws Exception {
Model model = repositoryService.newModel();
assertNotNull(model);
model.setName("Test model");
model.setCategory("test");
model.setMetaInfo("meta");
repositoryService.saveModel(model);
assertNotNull(model.getId());
model = repositoryService.getModel(model.getId());
assertNotNull(model);
model.setName("New name");
model.setCategory("New category");
model.setMetaInfo("test");
model.setVersion(2);
repositoryService.saveModel(model);
assertNotNull(model.getId());
repositoryService.addModelEditorSource(model.getId(), "new".getBytes("utf-8"));
repositoryService.addModelEditorSourceExtra(model.getId(), "new".getBytes("utf-8"));
model = repositoryService.getModel(model.getId());
assertEquals("New name", model.getName());
assertEquals("New category", model.getCategory());
assertEquals("test", model.getMetaInfo());
assertNotNull(model.getCreateTime());
assertEquals(Integer.valueOf(2), model.getVersion());
assertEquals("new", new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
assertEquals("new", new String(repositoryService.getModelEditorSourceExtra(model.getId()), "utf-8"));
repositoryService.deleteModel(model.getId());
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:36,
示例10: importModel
点赞 2
import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
@RequestMapping(value = "/model/import", method = RequestMethod.POST)
public void importModel(String key, String tenantId, MultipartFile file) {
try {
String fileName = file.getOriginalFilename();
if (fileName.endsWith(".bpmn20.xml") || fileName.endsWith(".bpmn")) {
XMLInputFactory xif = XmlUtil.createSafeXmlInputFactory();
InputStreamReader in = new InputStreamReader(new ByteArrayInputStream(file.getBytes()), "UTF-8");
XMLStreamReader xtr = xif.createXMLStreamReader(in);
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
if (bpmnModel.getMainProcess() != null && bpmnModel.getMainProcess().getId() != null) {
if (!bpmnModel.getLocationMap().isEmpty()) {
String processName = bpmnModel.getMainProcess().getName();
if (StringUtils.isEmpty(processName)) {
processName = bpmnModel.getMainProcess().getId();
}
Model model = repositoryService.newModel();
ObjectNode metaInfo = new ObjectMapper().createObjectNode();
metaInfo.put("name", processName);
metaInfo.put("revision", 1);
model.setMetaInfo(metaInfo.toString());
model.setName(processName);
if (StringUtils.isNotEmpty(tenantId)) {
model.setTenantId(tenantId);
}
model.setKey(key);
repositoryService.saveModel(model);
ObjectNode editorNode = new BpmnJsonExConverter().convertToJson(bpmnModel);
repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("UTF-8"));
}
}
}
} catch (Exception e) {
logger.error("Error Import Model", e);
throw new ActivitiException("Error Import Model", e);
}
}
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:47,
注:本文中的org.activiti.engine.repository.Model.setMetaInfo方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。