本文整理汇总了Java中org.activiti.engine.repository.ProcessDefinition.getId方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessDefinition.getId方法的具体用法?Java ProcessDefinition.getId怎么用?Java ProcessDefinition.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.repository.ProcessDefinition
的用法示例。
在下文中一共展示了ProcessDefinition.getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* Convert a {@link ProcessDefinition} into a {@link WorkflowDefinition}.
* @param definition ProcessDefinition
* @return WorkflowDefinition
*/
public WorkflowDefinition convert(ProcessDefinition definition)
{
if(definition==null)
return null;
String defId = definition.getId();
String defName = definition.getKey();
int version = definition.getVersion();
String defaultTitle = definition.getName();
String startTaskName = null;
StartFormData startFormData = getStartFormData(defId, defName);
if(startFormData != null)
{
startTaskName = startFormData.getFormKey();
}
ReadOnlyProcessDefinition def = activitiUtil.getDeployedProcessDefinition(defId);
PvmActivity startEvent = def.getInitial();
WorkflowTaskDefinition startTask = getTaskDefinition(startEvent, startTaskName, definition.getKey(), true);
return factory.createDefinition(defId,
defName, version, defaultTitle,
null, startTask);
}
示例2: SimpleProcessDefinition
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public SimpleProcessDefinition(ProcessDefinition definition) {
id = definition.getId();
category = definition.getCategory();
name = definition.getName();
key = definition.getKey();
description = definition.getDescription();
version = definition.getVersion();
resourceName = definition.getResourceName();
deploymentId = definition.getDeploymentId();
diagramResourceName = definition.getResourceName();
suspended = definition.isSuspended();
hasGraphicalNotation = definition.hasGraphicalNotation();
hasStartFormKey = definition.hasStartFormKey();
tenantId = definition.getTenantId();
}
示例3: getUserTasksByProcDefKey
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Override
public List<ActivityImpl> getUserTasksByProcDefKey(String procDefKey) {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(procDefKey).orderByProcessDefinitionVersion().desc().list().get(0);
String procDefId = definition.getId();
List<ActivityImpl> activities = findActivities(procDefId, activity -> "userTask".equals(activity.getProperty("type")));
//
// ProcessDefinitionEntity pde = getProcessDefinition(procDefId);
// List<ActivityImpl> activities = new ArrayList<>();
// for (ActivityImpl activity : pde.getActivities()) {
// if (activity.getProperty("type").equals("userTask"))
// activities.add(activity);
// }
if (null != activities) {
activities.sort(Comparator.comparing(ProcessElementImpl::getId));
}
return activities;
}
示例4: deploy
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 根据Model部署流程
*/
public String deploy(String id) {
String message = "";
try {
org.activiti.engine.repository.Model modelData = repositoryService.getModel(id);
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);
String processName = modelData.getName();
if (!StringUtils.endsWith(processName, ".bpmn20.xml")){
processName += ".bpmn20.xml";
}
// System.out.println("========="+processName+"============"+modelData.getName());
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
Deployment deployment = repositoryService.createDeployment().name(modelData.getName())
.addInputStream(processName, in).deploy();
// .addString(processName, new String(bpmnBytes)).deploy();
// 设置流程分类
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
for (ProcessDefinition processDefinition : list) {
repositoryService.setProcessDefinitionCategory(processDefinition.getId(), modelData.getCategory());
message = "部署成功,流程ID=" + processDefinition.getId();
}
if (list.size() == 0){
message = "部署失败,没有流程。";
}
} catch (Exception e) {
throw new ActivitiException("设计模型图不正确,检查模型正确性,模型ID="+id, e);
}
return message;
}
示例5: processDefinitionQueryTest
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Test
public void processDefinitionQueryTest() {
List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
.list();
for (ProcessDefinition processDefinition : processDefinitionList) {
String tmp = "\r\n" +
"#=======================================================================================================================#\r\n" +
"# Spring MVC Context 容器初始化完成之后的处理:\r\n" +
"#\t getId " + processDefinition.getId() + "\r\n" +
"#\t getCategory " + processDefinition.getCategory() + "\r\n" +
"#\t getName " + processDefinition.getName() + "\r\n" +
"#\t getKey " + processDefinition.getKey() + "\r\n" +
"#\t getDescription " + processDefinition.getDescription() + "\r\n" +
"#\t getVersion " + processDefinition.getVersion() + "\r\n" +
"#\t getResourceName " + processDefinition.getResourceName() + "\r\n" +
"#\t getDeploymentId " + processDefinition.getDeploymentId() + "\r\n" +
"#\t getDiagramResourceName " + processDefinition.getDiagramResourceName() + "\r\n" +
"#\t hasStartFormKey " + processDefinition.hasStartFormKey() + "\r\n" +
"#\t hasGraphicalNotation " + processDefinition.hasGraphicalNotation() + "\r\n" +
"#\t isSuspended " + processDefinition.isSuspended() + "\r\n" +
"#\t getTenantId " + processDefinition.getTenantId() + "\r\n" +
"#=======================================================================================================================#\r\n";
logger.info(tmp);
}
// org.activiti.rest.service.application.ActivitiRestServicesApplication
// org.activiti.rest.service.api.RestActionRequest
}
示例6: BpmModelVo
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public BpmModelVo(ProcessDefinition o) {
this.id = o.getId();
this.category = o.getCategory();
this.name = o.getName();
this.key = o.getKey();
this.description = o.getDescription();
this.version = o.getVersion();
this.deploymentId = o.getDeploymentId();
this.resourceName = o.getResourceName();
this.diagramResourceName = o.getDiagramResourceName();
}
示例7: ProcessDefinitionVo
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public ProcessDefinitionVo(ProcessDefinition o) {
this.id = o.getId();
this.category = o.getCategory();
this.name = o.getName();
this.key = o.getKey();
this.description = o.getDescription();
this.version = o.getVersion();
this.resourceName = o.getResourceName();
this.deploymentId = o.getDeploymentId();
this.diagramResourceName = o.getDiagramResourceName();
this.hasStartFormKey = o.hasStartFormKey();
this.hasGraphicalNotation = o.hasGraphicalNotation();
this.suspended = o.isSuspended();
this.tenantId = o.getTenantId();
}
示例8: deleteDeployment
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public void deleteDeployment(String deploymentId, boolean cascade) {
if (cascade) {
List<ProcessDefinition> processDefinitions = getDbSqlSession()
.createProcessDefinitionQuery()
.deploymentId(deploymentId)
.list();
for (ProcessDefinition processDefinition: processDefinitions) {
String processDefinitionId = processDefinition.getId();
getProcessInstanceManager()
.deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted deployment", cascade);
Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.removeProcessDefinition(processDefinitionId);
}
}
getProcessDefinitionManager()
.deleteProcessDefinitionsByDeploymentId(deploymentId);
getResourceManager()
.deleteResourcesByDeploymentId(deploymentId);
getDbSqlSession().delete("deleteDeployment", deploymentId);
}
示例9: testTaskFormsWithVacationRequestProcess
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Deployment(resources = {
"org/activiti/examples/taskforms/VacationRequest_deprecated_forms.bpmn20.xml",
"org/activiti/examples/taskforms/approve.form",
"org/activiti/examples/taskforms/request.form",
"org/activiti/examples/taskforms/adjustRequest.form" })
public void testTaskFormsWithVacationRequestProcess() {
// Get start form
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
Object startForm = formService.getRenderedStartForm(procDefId);
assertNotNull(startForm);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
String processDefinitionId = processDefinition.getId();
assertEquals("org/activiti/examples/taskforms/request.form", formService.getStartFormData(processDefinitionId).getFormKey());
// Define variables that would be filled in through the form
Map<String, String> formProperties = new HashMap<String, String>();
formProperties.put("employeeName", "kermit");
formProperties.put("numberOfDays", "4");
formProperties.put("vacationMotivation", "I'm tired");
formService.submitStartFormData(procDefId, formProperties);
// Management should now have a task assigned to them
Task task = taskService.createTaskQuery().taskCandidateGroup("management").singleResult();
assertEquals("Vacation request by kermit", task.getDescription());
Object taskForm = formService.getRenderedTaskForm(task.getId());
assertNotNull(taskForm);
// Rejecting the task should put the process back to first task
taskService.complete(task.getId(), CollectionUtil.singletonMap("vacationApproved", "false"));
task = taskService.createTaskQuery().singleResult();
assertEquals("Adjust vacation request", task.getName());
}
示例10: processBusiness
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public void processBusiness(ProcessDefinition processDefinition) {
String processDefinitionId = processDefinition.getId();
List<HumanTaskDefinition> humanTaskDefinitions = humanTaskConnector
.findHumanTaskDefinitions(processDefinitionId);
ModelInfo modelInfo = modelInfoManager.findUniqueBy("code",
processDefinitionId);
if (modelInfo == null) {
modelInfo = new ModelInfo();
modelInfo.setCode(processDefinitionId);
modelInfo.setName(processDefinition.getName());
modelInfo.setTenantId(processDefinition.getTenantId());
modelInfoManager.save(modelInfo);
}
Map<String, FormField> formFieldMap = new HashMap<String, FormField>();
for (HumanTaskDefinition humanTaskDefinition : humanTaskDefinitions) {
try {
com.mossle.spi.humantask.FormDTO formDto = taskDefinitionConnector
.findForm(humanTaskDefinition.getKey(),
processDefinitionId);
if (formDto == null) {
continue;
}
String formKey = formDto.getKey();
this.processForm(processDefinitionId, formKey,
modelInfo.getTenantId(), formFieldMap);
} catch (IOException ex) {
logger.error(ex.getMessage(), ex);
}
}
for (FormField formField : formFieldMap.values()) {
String hql = "from ModelField where name=? and modelInfo=?";
ModelField modelField = modelFieldManager.findUnique(hql,
formField.getName(), modelInfo);
if (modelField != null) {
continue;
}
modelField = new ModelField();
modelField.setModelInfo(modelInfo);
modelField.setCode(formField.getName());
modelField.setType(formField.getType());
modelField.setName(formField.getLabel());
modelField.setSearchable("true");
modelField.setDisplayable("true");
modelField.setViewForm("true");
modelField.setViewList("true");
modelField.setTenantId(modelInfo.getTenantId());
modelFieldManager.save(modelField);
}
}
示例11: deploy
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 部署流程 - 保存
* @param file
* @return
*/
@Transactional(readOnly = false)
public String deploy(String exportDir, String category, MultipartFile file) {
String message = "";
String fileName = file.getOriginalFilename();
try {
InputStream fileInputStream = file.getInputStream();
Deployment deployment = null;
String extension = FilenameUtils.getExtension(fileName);
if (extension.equals("zip") || extension.equals("bar")) {
ZipInputStream zip = new ZipInputStream(fileInputStream);
deployment = repositoryService.createDeployment().addZipInputStream(zip).deploy();
} else if (extension.equals("png")) {
deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
} else if (fileName.indexOf("bpmn20.xml") != -1) {
deployment = repositoryService.createDeployment().addInputStream(fileName, fileInputStream).deploy();
} else if (extension.equals("bpmn")) { // bpmn扩展名特殊处理,转换为bpmn20.xml
String baseName = FilenameUtils.getBaseName(fileName);
deployment = repositoryService.createDeployment().addInputStream(baseName + ".bpmn20.xml", fileInputStream).deploy();
} else {
message = "不支持的文件类型:" + extension;
}
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
// 设置流程分类
for (ProcessDefinition processDefinition : list) {
// ActUtils.exportDiagramToFile(repositoryService, processDefinition, exportDir);
repositoryService.setProcessDefinitionCategory(processDefinition.getId(), category);
message += "部署成功,流程ID=" + processDefinition.getId() + "<br/>";
}
if (list.size() == 0){
message = "部署失败,没有流程。";
}
} catch (Exception e) {
throw new ActivitiException("部署失败!", e);
}
return message;
}