• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Model类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.repository.Model的典型用法代码示例。如果您正苦于以下问题:Java Model类的具体用法?Java Model怎么用?Java Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Model类属于org.activiti.engine.repository包,在下文中一共展示了Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: open

import org.activiti.engine.repository.Model; //导入依赖的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;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:22,代码来源:ModelerController.java


示例2: modelSave

import org.activiti.engine.repository.Model; //导入依赖的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 "{}";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:20,代码来源:ModelerController.java


示例3: deploy

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/**
 * 根据Model部署流程
 */
@RequestMapping(value = "deploy/{modelId}")
public String deploy(@PathVariable("modelId") String modelId, RedirectAttributes redirectAttributes) {
    try {
        Model modelData = repositoryService.getModel(modelId);
        ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
        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)).deploy();
        redirectAttributes.addFlashAttribute("message", "部署成功,部署ID=" + deployment.getId());
    } catch (Exception e) {
        logger.error("根据模型部署流程失败:modelId={}", modelId, e);
    }
    return "redirect:/workflow/model/list";
}
 
开发者ID:batizhao,项目名称:microservice,代码行数:22,代码来源:ModelController.java


示例4: createModel

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,代码来源:FlowableModelManagerController.java


示例5: deployModel

import org.activiti.engine.repository.Model; //导入依赖的package包/类
@PutMapping("{modelId}/deploy")
public ResponseMessage deployModel(@PathVariable String modelId) throws Exception {
    Model modelData = repositoryService.getModel(modelId);
    if (modelData == null) {
        throw new NotFoundException("模型不存在!");
    }
    ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
    BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
    byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
    String processName = modelData.getName() + ".bpmn20.xml";
    Deployment deployment = repositoryService.createDeployment()
            .name(modelData.getName())
            .addString(processName, new String(bpmnBytes, "utf8"))
            .deploy();
    return ResponseMessage.ok(deployment).include(Deployment.class, "id", "name", "new");
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:17,代码来源:FlowableModelManagerController.java


示例6: queryModelTest

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/***
 * 查询 模型信息
 */
@Test
public void queryModelTest() {
    // ACT_RE_MODEL
    List<Model> modelList = repositoryService.createModelQuery()
            .deploymentId("111")
            .modelCategory("222")
            .latestVersion()
            .list();
    logger.info("###================================================ modelList, {}", modelList);

    // 自定义SQL语句查询
    modelList = repositoryService.createNativeModelQuery()
            .sql("select distinct RES.* from ACT_RE_MODEL RES where RES.ID_ = #{id}")
            .parameter("id", "111")
            .list();
    logger.info("###================================================ modelList, {}", modelList);
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:21,代码来源:RepositoryServiceTest.java


示例7: uniqueKey

import org.activiti.engine.repository.Model; //导入依赖的package包/类
@RequestMapping(value = "/model/uniquekey", method = RequestMethod.POST)
@ResponseBody
public Map uniqueKey(String key, String id) {
    Map<String, Boolean> map = new HashMap<>();
    if (StrUtil.isEmpty(key)) {
        map.put("valid", true);
    } else {
        List<Model> models = repositoryService.createModelQuery().modelKey(key).list();
        if (StrUtil.isEmpty(id)) {
            if (models.isEmpty())
                map.put("valid", true);
            else
                map.put("valid", false);
        } else {
            map.put("valid", false);
            for (Model model : models) {
                if (model.getId().equals(id)) {
                    map.put("valid", true);
                    break;
                }
            }
        }
    }
    return map;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:26,代码来源:ModelOperationController.java


示例8: exportPng

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/**
 * 导出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);
    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:19,代码来源:ModelOperationController.java


示例9: getModelList

import org.activiti.engine.repository.Model; //导入依赖的package包/类
@Override
public List<Model> getModelList(QueryCondition condition, PageInfo pageInfo) {
    String name = null;
    if (condition != null)
        name = condition.getConditionMap().get("name").toString();
    List<Model> modelList;
    long count;
    ModelQuery query = repositoryService.createModelQuery();
    if (!StrUtil.isEmpty(name)) {
        query = query.modelNameLike(name);
    }
    count = query.count();
    modelList = query.orderByCreateTime().desc().listPage((pageInfo.getPageNum() - 1) * pageInfo.getPageSize(), pageInfo.getPageSize());
    pageInfo.setCount((int) count);
    return modelList;
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:17,代码来源:RepositoryPageServiceImpl.java


示例10: deploy

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/**
 * 根据Model部署流程
 */
@RequestMapping(value = "deploy/{modelId}")
public String deploy(@PathVariable("modelId") String modelId, RedirectAttributes redirectAttributes) {
    try {
        Model modelData = repositoryService.getModel(modelId);
        ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
        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)).deploy();
        redirectAttributes.addFlashAttribute("message", "部署成功,部署ID=" + deployment.getId());
    } catch (Exception e) {
        logger.error("根据模型部署流程失败:modelId={}", modelId, e);
    }
    return "redirect:/chapter20/model/list";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:22,代码来源:ModelController.java


示例11: export

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/**
 * 导出model的xml文件
 */
@RequestMapping(value = "export/{modelId}")
public void export(@PathVariable("modelId") String modelId, HttpServletResponse response) {
    try {
        Model modelData = repositoryService.getModel(modelId);
        BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
        JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
        BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
        BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
        byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);

        ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
        IOUtils.copy(in, response.getOutputStream());
        String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
        response.setHeader("Content-Disposition", "attachment; filename=" + filename);
        response.flushBuffer();
    } catch (Exception e) {
        logger.error("导出model的xml文件失败:modelId={}", modelId, e);
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:23,代码来源:ModelController.java


示例12: testNewModelPersistence

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,代码来源:RepositoryServiceTest.java


示例13: testNewModelWithSource

import org.activiti.engine.repository.Model; //导入依赖的package包/类
public void testNewModelWithSource() throws Exception {
  Model model = repositoryService.newModel();
  model.setName("Test model");
  byte[] testSource = "modelsource".getBytes("utf-8");
  repositoryService.saveModel(model);
  
  assertNotNull(model.getId());
  repositoryService.addModelEditorSource(model.getId(), testSource);
  
  model = repositoryService.getModel(model.getId());
  assertNotNull(model);
  assertEquals("Test model", model.getName());
  
  byte[] editorSourceBytes = repositoryService.getModelEditorSource(model.getId());
  assertEquals("modelsource", new String(editorSourceBytes, "utf-8"));
  
  repositoryService.deleteModel(model.getId());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:19,代码来源:RepositoryServiceTest.java


示例14: testByDeploymentId

import org.activiti.engine.repository.Model; //导入依赖的package包/类
public void testByDeploymentId() {
  Deployment deployment = repositoryService.createDeployment().addString("test", "test").deploy();
  
  assertEquals(0, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
  assertEquals(0, repositoryService.createModelQuery().deployed().count());
  assertEquals(1, repositoryService.createModelQuery().notDeployed().count());
  
  Model model = repositoryService.createModelQuery().singleResult();
  model.setDeploymentId(deployment.getId());
  repositoryService.saveModel(model);
  
  assertEquals(1, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
  assertEquals(1, repositoryService.createModelQuery().deployed().count());
  assertEquals(0, repositoryService.createModelQuery().notDeployed().count());
  
  // Cleanup
  repositoryService.deleteDeployment(deployment.getId(), true);
  
  // After cleanup the model should still exist
  assertEquals(0, repositoryService.createDeploymentQuery().count());
  assertEquals(0, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
  assertEquals(1, repositoryService.createModelQuery().notDeployed().count());
  assertEquals(1, repositoryService.createModelQuery().count());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:25,代码来源:ModelQueryTest.java


示例15: testByLatestVersion

import org.activiti.engine.repository.Model; //导入依赖的package包/类
public void testByLatestVersion() {
  ModelQuery query = repositoryService.createModelQuery().latestVersion().modelKey("someKey");
  Model model = query.singleResult();
  assertNotNull(model);
  
  // Add a new version of the model
  Model newVersion = repositoryService.newModel();
  newVersion.setName("my model");
  newVersion.setKey("someKey");
  newVersion.setCategory("test");
  newVersion.setVersion(model.getVersion() + 1);
  repositoryService.saveModel(newVersion);
  
  // Verify query
  model = query.singleResult();
  assertNotNull(model);
  assertTrue(model.getVersion() == 2);
  
  // Cleanup
  repositoryService.deleteModel(model.getId());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:22,代码来源:ModelQueryTest.java


示例16: testVerifyModelProperties

import org.activiti.engine.repository.Model; //导入依赖的package包/类
public void testVerifyModelProperties() {
  List<Model> models = repositoryService.createModelQuery()
    .orderByModelName()
    .asc()
    .list();
  
  Model modelOne = models.get(0);
  assertEquals("my model", modelOne.getName());
  assertEquals(modelOneId, modelOne.getId());

  models = repositoryService.createModelQuery()
    .modelNameLike("%model%")
    .orderByModelName()
    .asc()
    .list();
  
  assertEquals("my model", models.get(0).getName());
  assertEquals(1, models.size());

  assertEquals(1, repositoryService.createModelQuery()
    .orderByModelId()
    .asc()
    .list()
    .size());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:26,代码来源:ModelQueryTest.java


示例17: list

import org.activiti.engine.repository.Model; //导入依赖的package包/类
@RequestMapping("modeler-list")
public String list(org.springframework.ui.Model model) {
    List<Model> models = processEngine.getRepositoryService()
            .createModelQuery().list();
    model.addAttribute("models", models);

    return "modeler/modeler-list";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:9,代码来源:ModelerController.java


示例18: xml2json

import org.activiti.engine.repository.Model; //导入依赖的package包/类
@RequestMapping("xml2json")
public String xml2json(
        @RequestParam("processDefinitionId") String processDefinitionId)
        throws Exception {
    RepositoryService repositoryService = processEngine
            .getRepositoryService();

    ProcessDefinition processDefinition = repositoryService
            .getProcessDefinition(processDefinitionId);

    Model model = repositoryService.newModel();
    model.setName(processDefinition.getName());
    model.setDeploymentId(processDefinition.getDeploymentId());
    repositoryService.saveModel(model);

    BpmnModel bpmnModel = repositoryService
            .getBpmnModel(processDefinitionId);
    ObjectNode objectNode = new BpmnJsonConverter()
            .convertToJson(bpmnModel);

    String json = objectNode.toString();

    repositoryService.addModelEditorSource(model.getId(),
            json.getBytes("utf-8"));

    return "redirect:/modeler/modeler-list.do";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:28,代码来源:ModelerController.java


示例19: modelList

import org.activiti.engine.repository.Model; //导入依赖的package包/类
/**
 * 模型列表
 */
@RequestMapping(value = "list")
public ModelAndView modelList() {
    ModelAndView mav = new ModelAndView("workflow/model-list");
    List<Model> list = repositoryService.createModelQuery().list();
    mav.addObject("list", list);
    return mav;
}
 
开发者ID:batizhao,项目名称:microservice,代码行数:11,代码来源:ModelController.java


示例20: create

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,代码来源:ModelController.java



注:本文中的org.activiti.engine.repository.Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpResponses类代码示例发布时间:2022-05-21
下一篇:
Java AudioLoadResultHandler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap