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


Java Model.setCategory方法代码示例

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


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

示例1: 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

示例2: 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

示例3: convertToModel

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

示例4: testUpdateModelPersistence

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

示例5: setUp

import org.activiti.engine.repository.Model; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  Model model = repositoryService.newModel();
  model.setName("my model");
  model.setKey("someKey");
  model.setCategory("test");
  repositoryService.saveModel(model);
  modelOneId = model.getId();
  
  repositoryService.addModelEditorSource(modelOneId, "bytes".getBytes("utf-8"));
  
  super.setUp();
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:14,代码来源:ModelQueryTest.java


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