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


Java StartFormData.getFormKey方法代码示例

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


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

示例1: convert

import org.activiti.engine.form.StartFormData; //导入方法依赖的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: buttonClick

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
public void buttonClick(ClickEvent event) {
  // Check if process-definition defines a start-form
  
  StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
  if(startFormData != null && ((startFormData.getFormProperties() != null && startFormData.getFormProperties().size() > 0) || startFormData.getFormKey() != null)) {
    parentPage.showStartForm(processDefinition, startFormData);
  } else {
    // Just start the process-instance since it has no form.
    // TODO: Error handling
    ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.getId());
    
    // Show notification of success
    notificationManager.showInformationNotification(Messages.PROCESS_STARTED_NOTIFICATION, getProcessDisplayName(processDefinition));
    
    // Switch to inbox page in case a task of this process was created
    List<Task> loggedInUsersTasks = taskService.createTaskQuery()
      .taskAssignee(ExplorerApp.get().getLoggedInUser().getId())
      .processInstanceId(processInstance.getId())
      .list();
    if (loggedInUsersTasks.size() > 0) {
      ExplorerApp.get().getViewManager().showInboxPage(loggedInUsersTasks.get(0).getId());
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:StartProcessInstanceClickListener.java

示例3: getStartTaskTypeName

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
public String getStartTaskTypeName(String processDefinitionId)
{
    String startTaskName = null;
    StartFormData startFormData = formService.getStartFormData(processDefinitionId);
    if (startFormData != null) 
    {
        startTaskName = startFormData.getFormKey();
    }
    return startTaskName;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:ActivitiUtil.java

示例4: getTaskDefinitions

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowTaskDefinition> getTaskDefinitions(String workflowDefinitionId)
{
    List<WorkflowTaskDefinition> defs = new ArrayList<WorkflowTaskDefinition>();
    String processDefinitionId = createLocalId(workflowDefinitionId);
    
    // This should return all task definitions, including the start-task
    ReadOnlyProcessDefinition processDefinition =((RepositoryServiceImpl)repoService).getDeployedProcessDefinition(processDefinitionId);

    String processName = ((ProcessDefinition)processDefinition).getKey();
    factory.checkDomain(processName);
    
    // Process start task definition
    PvmActivity startEvent = processDefinition.getInitial();
    
    String startTaskName = null;
    StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
    if(startFormData != null) 
    {
        startTaskName = startFormData.getFormKey();
    }
    
    // Add start task definition
    defs.add(typeConverter.getTaskDefinition(startEvent, startTaskName, processDefinition.getId(), true));
    
    // Now, continue through process, finding all user-tasks
    Collection<PvmActivity> taskActivities = typeConverter.findUserTasks(startEvent);
    for(PvmActivity act : taskActivities)
    {
        String formKey = typeConverter.getFormKey(act, processDefinition);
        defs.add(typeConverter.getTaskDefinition(act, formKey, processDefinition.getId(), false));
    }
    
   return defs;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:ActivitiWorkflowEngine.java

示例5: addVariables

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
protected void addVariables(Task task, Boolean includeProcessVariables, Boolean includeTaskVariables, 
        Map<String, Object> processVariables, Map<String, Object> taskVariables, Map<String, TypeDefinition> definitionTypeMap)
{
    TypeDefinition startFormTypeDefinition = null;
    if (includeProcessVariables != null && includeProcessVariables) 
    {
        if (definitionTypeMap.containsKey(task.getProcessDefinitionId()) == false)
        {
            StartFormData startFormData = activitiProcessEngine.getFormService().getStartFormData(task.getProcessDefinitionId());
            if (startFormData != null)
            {
                String formKey = startFormData.getFormKey();
                definitionTypeMap.put(task.getProcessDefinitionId(), getWorkflowFactory().getTaskFullTypeDefinition(formKey, true));
            }
        }
        
        if (definitionTypeMap.containsKey(task.getProcessDefinitionId()))
        {
            startFormTypeDefinition = definitionTypeMap.get(task.getProcessDefinitionId());
        }
    }
    
    TypeDefinition taskTypeDefinition = null;
    if (includeTaskVariables != null && includeTaskVariables) 
    {
        taskTypeDefinition = getWorkflowFactory().getTaskFullTypeDefinition(task.getFormResourceKey(), false);
    }
    
    List<TaskVariable> variables = restVariableHelper.getTaskVariables(taskVariables, processVariables, 
            startFormTypeDefinition, taskTypeDefinition);
    task.setVariables(variables);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:33,代码来源:TasksImpl.java

示例6: renderStartForm

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
public Object renderStartForm(StartFormData startForm) {
  if (startForm.getFormKey()==null) {
    return null;
  }
  String formTemplateString = getFormTemplateString(startForm);
  ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
  return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, null);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:9,代码来源:JuelFormEngine.java

示例7: renderStartForm

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
public Object renderStartForm(StartFormData startForm) {
  if (startForm.getFormKey()==null) {
    return null;
  }
  String formTemplateString = getFormTemplateString(startForm, startForm.getFormKey());
  ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
  return scriptingEngines.evaluate(formTemplateString, ScriptingEngines.DEFAULT_SCRIPTING_LANGUAGE, null);
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:9,代码来源:JuelFormEngine.java

示例8: getVirtualStartTask

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
private WorkflowTask getVirtualStartTask(ProcessInstance processInstance, boolean inProgress)
{
    String processInstanceId = processInstance.getId();

    if (!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !isCorrectTenantRuntime(processInstanceId))
    {
        return null;
    }
    
    String id = ActivitiConstants.START_TASK_PREFIX + processInstanceId;
    
    WorkflowTaskState state = null;
    if(inProgress)
    {
        state = WorkflowTaskState.IN_PROGRESS;
    }
    else
    {
        state = WorkflowTaskState.COMPLETED;
    }
    
    WorkflowPath path  = convert((Execution)processInstance);
    
    // Convert start-event to start-task Node
    String definitionId = processInstance.getProcessDefinitionId();
    ReadOnlyProcessDefinition procDef = activitiUtil.getDeployedProcessDefinition(definitionId);
    WorkflowNode startNode = convert(procDef.getInitial(), true);
    
    String key = ((ProcessDefinition)procDef).getKey();
    StartFormData startFormData = getStartFormData(definitionId, key);
    String taskDefId = null;
    if(startFormData != null) 
    {
        taskDefId = startFormData.getFormKey();
    }
    WorkflowTaskDefinition taskDef = factory.createTaskDefinition(taskDefId, startNode, taskDefId, true);
    
    // Add properties based on HistoricProcessInstance
    HistoricProcessInstance historicProcessInstance = historyService
        .createHistoricProcessInstanceQuery()
        .processInstanceId(processInstanceId)
        .singleResult();
    
    Map<QName, Serializable> properties = propertyConverter.getStartTaskProperties(historicProcessInstance, taskDefId, !inProgress);
    
    // TODO: Figure out what name/description should be used for the start-task, start event's name?
    String defaultTitle = null;
    String defaultDescription = null;
    
    return factory.createTask(id,
                taskDef, taskDef.getId(), defaultTitle, defaultDescription, state, path, properties);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:53,代码来源:ActivitiTypeConverter.java

示例9: getVariables

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
@Override
public CollectionWithPagingInfo<Variable> getVariables(String processId, Paging paging)
{
    CollectionWithPagingInfo<Variable> result = null;
    
    // Check if user is allowed to get variables
    List<HistoricVariableInstance> variableInstances = validateIfUserAllowedToWorkWithProcess(processId);
    Map<String, Object> variables = new HashMap<String, Object>();
    for (HistoricVariableInstance variable : variableInstances)
    {
        variables.put(variable.getVariableName(), variable.getValue());
    }
    
    ProcessInstance processInstance = activitiProcessEngine.getRuntimeService()
            .createProcessInstanceQuery()
            .processInstanceId(processId)
            .singleResult();
    
    String processDefinitionId = null;
    
    if (processInstance != null)
    {
        processDefinitionId = processInstance.getProcessDefinitionId();
    }
    else
    {
        // Completed process instance
        HistoricProcessInstance historicInstance = activitiProcessEngine.getHistoryService().createHistoricProcessInstanceQuery()
            .processInstanceId(processId).singleResult();
        
        if (historicInstance == null)
        {
            throw new EntityNotFoundException(processId);
        }
        
        processDefinitionId = historicInstance.getProcessDefinitionId();
    }

    // Get start-task definition for explicit typing of variables submitted at the start
    String formKey = null;
    StartFormData startFormData = activitiProcessEngine.getFormService().getStartFormData(processDefinitionId);
    if (startFormData != null)
    {
        formKey = startFormData.getFormKey();
    }
    
    TypeDefinition startTaskTypeDefinition = getWorkflowFactory().getTaskFullTypeDefinition(formKey, true);
    
    // Convert raw variables to Variable objects
    List<Variable> resultingVariables = restVariableHelper.getVariables(variables, startTaskTypeDefinition);
    result = CollectionWithPagingInfo.asPaged(paging, resultingVariables);
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:54,代码来源:ProcessesImpl.java

示例10: updateVariableInProcess

import org.activiti.engine.form.StartFormData; //导入方法依赖的package包/类
protected Variable updateVariableInProcess(String processId, String processDefinitionId, Variable variable)
{
    if (variable.getName() == null)
    {
        throw new InvalidArgumentException("Variable name is required.");
    }
    
    // Get start-task definition for explicit typing of variables submitted at the start
    String formKey = null;
    StartFormData startFormData = activitiProcessEngine.getFormService().getStartFormData(processDefinitionId);
    if (startFormData != null)
    {
        formKey = startFormData.getFormKey();
    }
    
    DataTypeDefinition dataTypeDefinition = null;
    
    TypeDefinition startTaskTypeDefinition = getWorkflowFactory().getTaskFullTypeDefinition(formKey, true);
    TypeDefinitionContext context = new TypeDefinitionContext(startTaskTypeDefinition, getQNameConverter());
    if (context.getPropertyDefinition(variable.getName()) != null) 
    {
        dataTypeDefinition = context.getPropertyDefinition(variable.getName()).getDataType();
        if (variable.getType() != null && dataTypeDefinition.getName().toPrefixString(namespaceService).equals(variable.getType()) == false) {
            throw new InvalidArgumentException("type of variable " + variable.getName() + " should be " + 
                    dataTypeDefinition.getName().toPrefixString(namespaceService));
        }
    }
    else if (context.getAssociationDefinition(variable.getName()) != null) 
    {
        dataTypeDefinition = dictionaryService.getDataType(DataTypeDefinition.NODE_REF);
    }
    
    if (dataTypeDefinition == null && variable.getType() != null)
    {
        try
        {
            QName dataType = QName.createQName(variable.getType(), namespaceService);
            dataTypeDefinition = dictionaryService.getDataType(dataType);
        }
        catch(InvalidQNameException iqne)
        {
            throw new InvalidArgumentException("Unsupported type of variable: '" + variable.getType() +"'.");
        }
    } 
    else if (dataTypeDefinition == null)
    {
        // Fallback to raw value when no type has been passed and not present in model
        dataTypeDefinition = dictionaryService.getDataType(restVariableHelper.extractTypeFromValue(variable.getValue()));
    }
    
    if (dataTypeDefinition == null)
    {
        throw new InvalidArgumentException("Unsupported type of variable: '" + variable.getType() +"'.");
    }

    Object actualValue = null;
    if ("java.util.Date".equalsIgnoreCase(dataTypeDefinition.getJavaClassName()))
    {
        // fix for different ISO 8601 Date format classes in Alfresco (org.alfresco.util and Spring Surf)
        actualValue = ISO8601DateFormat.parse((String) variable.getValue());
    }
    else
    {
        if (context.getAssociationDefinition(variable.getName()) != null)
        {
            actualValue = convertAssociationDefinitionValue(context.getAssociationDefinition(variable.getName()), 
                    variable.getName(), variable.getValue());
        }
        else
        {
            actualValue = DefaultTypeConverter.INSTANCE.convert(dataTypeDefinition, variable.getValue());
        }
    }
    variable.setValue(actualValue);
    
    activitiProcessEngine.getRuntimeService().setVariable(processId, variable.getName(), actualValue);
    
    // Set actual used type before returning
    variable.setType(dataTypeDefinition.getName().toPrefixString(namespaceService));
    return variable;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:82,代码来源:ProcessesImpl.java


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