当前位置: 首页>>代码示例>>Java>>正文


Java Model类代码示例

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


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


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