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


Java ProcessDefinition.getKey方法代码示例

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


在下文中一共展示了ProcessDefinition.getKey方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ActivitiTypeConverter.java

示例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();

}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:20,代码来源:SimpleProcessDefinition.java

示例3: exportDiagramToFile

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
 * 导出图片文件到硬盘
 *
 * @return 文件的全路径
 */
public static String exportDiagramToFile(RepositoryService repositoryService, ProcessDefinition processDefinition, String exportDir) throws IOException {
    String diagramResourceName = processDefinition.getDiagramResourceName();
    String key = processDefinition.getKey();
    int version = processDefinition.getVersion();
    String diagramPath = "";

    InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
    byte[] b = new byte[resourceAsStream.available()];

    @SuppressWarnings("unused")
    int len = -1;
    resourceAsStream.read(b, 0, b.length);

    // create file if not exist
    String diagramDir = exportDir + "/" + key + "/" + version;
    File diagramDirFile = new File(diagramDir);
    if (!diagramDirFile.exists()) {
        diagramDirFile.mkdirs();
    }
    diagramPath = diagramDir + "/" + diagramResourceName;
    File file = new File(diagramPath);

    // 文件存在退出
    if (file.exists()) {
        // 文件大小相同时直接返回否则重新创建文件(可能损坏)
        logger.debug("diagram exist, ignore... : {}", diagramPath);
        return diagramPath;
    } else {
        file.createNewFile();
    }

    logger.debug("export diagram to : {}", diagramPath);

    // wirte bytes to file
    FileUtils.writeByteArrayToFile(file, b, true);
    return diagramPath;
}
 
开发者ID:batizhao,项目名称:microservice,代码行数:43,代码来源:WorkflowUtils.java

示例4: 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
    }
 
开发者ID:Lzw2016,项目名称:study,代码行数:29,代码来源:Test02.java

示例5: 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();
}
 
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:12,代码来源:BpmModelVo.java

示例6: 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();
}
 
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:16,代码来源:ProcessDefinitionVo.java

示例7: setSecurityContext

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
 * Sets the security context per last updater of the current process instance's job definition.
 *
 * @param execution the current execution context
 */
protected void setSecurityContext(DelegateExecution execution)
{
    String processDefinitionId = execution.getProcessDefinitionId();

    // Get process definition by process definition ID from Activiti.
    ProcessDefinition processDefinition = activitiService.getProcessDefinitionById(processDefinitionId);

    // Validate that we retrieved the process definition from Activiti.
    if (processDefinition == null)
    {
        throw new ObjectNotFoundException(String.format("Failed to find Activiti process definition for processDefinitionId=\"%s\".", processDefinitionId));
    }

    // Retrieve the process definition key.
    String processDefinitionKey = processDefinition.getKey();

    // Get the job definition key.
    JobDefinitionAlternateKeyDto jobDefinitionKey = jobDefinitionHelper.getJobDefinitionKey(processDefinitionKey);

    // Get the job definition from the Herd repository and validate that it exists.
    JobDefinitionEntity jobDefinitionEntity = jobDefinitionDaoHelper.getJobDefinitionEntity(jobDefinitionKey.getNamespace(), jobDefinitionKey.getJobName());

    // Set the security context per last updater of the job definition.
    String updatedByUserId = jobDefinitionEntity.getUpdatedBy();
    ApplicationUser applicationUser = new ApplicationUser(getClass());
    applicationUser.setUserId(updatedByUserId);
    userNamespaceAuthorizationHelper.buildNamespaceAuthorizations(applicationUser);
    SecurityContextHolder.getContext().setAuthentication(new PreAuthenticatedAuthenticationToken(
        new SecurityUserWrapper(updatedByUserId, "", true, true, true, true, Collections.emptyList(), applicationUser), null));
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:36,代码来源:BaseJavaDelegate.java

示例8: getProcessDisplayName

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
protected String getProcessDisplayName(ProcessDefinition processDefinition) {
  if(processDefinition.getName() != null) {
    return processDefinition.getName();
  } else {
    return processDefinition.getKey();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:DeploymentDetailPanel.java

示例9: getProcessDisplayName

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
protected String getProcessDisplayName(ProcessDefinition processDefinition, ProcessInstance processInstance) {
  if(processDefinition.getName() != null) {
    return processDefinition.getName() + " (" + processInstance.getId() +")";
  } else {
    return processDefinition.getKey() + " (" + processInstance.getId() +")";
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:ProcessInstanceDetailPanel.java

示例10: getProcessDefinitionName

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
protected String getProcessDefinitionName(String processDefinitionId) {
  if (!cachedProcessDefinitionNames.containsKey(processDefinitionId)) {
    ProcessDefinition definition =  repositoryService.createProcessDefinitionQuery()
    .processDefinitionId(processDefinitionId).singleResult();
    
    String name =definition.getName();
    if(name != null) {
      name = definition.getKey();
    }
    cachedProcessDefinitionNames.put(processDefinitionId, name);
  }
  return cachedProcessDefinitionNames.get(processDefinitionId);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:14,代码来源:ProcessInstanceListQuery.java

示例11: getStartVariables

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public Map<String, Object> getStartVariables(String processDefId, Map<QName, Serializable> properties)
{
    ProcessDefinition procDef = activitiUtil.getProcessDefinition(processDefId);
    String startTaskTypeName = activitiUtil.getStartTaskTypeName(processDefId);
    TypeDefinition startTaskType  = factory.getTaskFullTypeDefinition(startTaskTypeName, true);
    
    // Lookup type definition for the startTask
    Map<QName, PropertyDefinition> taskProperties = startTaskType.getProperties();
    
    // Get all default values from the definitions
    Map<QName, Serializable> defaultProperties = new HashMap<QName, Serializable>();
    for (Map.Entry<QName, PropertyDefinition> entry : taskProperties.entrySet())
    {
        String defaultValue = entry.getValue().getDefaultValue();
        if (defaultValue != null)
        {
            defaultProperties.put(entry.getKey(), defaultValue);
        }
    }
    
    // Put all passed properties in map with defaults
    if(properties != null)
    {
        defaultProperties.putAll(properties);
    }
    
    // Special case for task description default value
    // Use the shared description set in the workflowinstance
    String description = (String) defaultProperties.get(WorkflowModel.PROP_DESCRIPTION);
    if(description == null)
    {
        String wfDescription = (String) defaultProperties.get(WorkflowModel.PROP_WORKFLOW_DESCRIPTION);
        String procDefKey = procDef.getKey();
        ReadOnlyProcessDefinition deployedDef = activitiUtil.getDeployedProcessDefinition(processDefId);
        String startEventName = deployedDef.getInitial().getId();
        String wfDefKey = factory.buildGlobalId(procDefKey);
        description = factory.getTaskDescription(startTaskType, wfDefKey, wfDescription, startEventName);
        defaultProperties.put(WorkflowModel.PROP_DESCRIPTION, description);
    }
    
    //Special case for workflowDueDate. 
    if(!defaultProperties.containsKey(WorkflowModel.PROP_WORKFLOW_DUE_DATE) && taskProperties.containsKey(WorkflowModel.PROP_WORKFLOW_DUE_DATE))
    {
        defaultProperties.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, null);
    }
    
    return handlerRegistry.handleVariablesToSet(defaultProperties, startTaskType, null, Void.class);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:ActivitiPropertyConverter.java

示例12: exportDiagrams

import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
 * 导出图片文件到硬盘
 */
public List<String> exportDiagrams(String exportDir) throws IOException {
	List<String> files = new ArrayList<String>();
	List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
	
	for (ProcessDefinition processDefinition : list) {
		String diagramResourceName = processDefinition.getDiagramResourceName();
		String key = processDefinition.getKey();
		int version = processDefinition.getVersion();
		String diagramPath = "";

		InputStream resourceAsStream = repositoryService.getResourceAsStream(
				processDefinition.getDeploymentId(), diagramResourceName);
		byte[] b = new byte[resourceAsStream.available()];

		@SuppressWarnings("unused")
		int len = -1;
		resourceAsStream.read(b, 0, b.length);

		// create file if not exist
		String diagramDir = exportDir + "/" + key + "/" + version;
		File diagramDirFile = new File(diagramDir);
		if (!diagramDirFile.exists()) {
			diagramDirFile.mkdirs();
		}
		diagramPath = diagramDir + "/" + diagramResourceName;
		File file = new File(diagramPath);

		// 文件存在退出
		if (file.exists()) {
			// 文件大小相同时直接返回否则重新创建文件(可能损坏)
			logger.debug("diagram exist, ignore... : {}", diagramPath);
			
			files.add(diagramPath);
		} else {
			file.createNewFile();
			logger.debug("export diagram to : {}", diagramPath);

			// wirte bytes to file
			FileUtils.writeByteArrayToFile(file, b, true);
			
			files.add(diagramPath);
		}
		
	}
	
	return files;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:51,代码来源:ActProcessService.java


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