本文整理汇总了Java中org.activiti.engine.form.StartFormData类的典型用法代码示例。如果您正苦于以下问题:Java StartFormData类的具体用法?Java StartFormData怎么用?Java StartFormData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StartFormData类属于org.activiti.engine.form包,在下文中一共展示了StartFormData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: readStartForm
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
/**
* 读取启动流程的表单字段
*/
@RequestMapping(value = "getform/start/{processDefinitionId}")
public ModelAndView readStartForm(@PathVariable("processDefinitionId") String processDefinitionId) throws Exception {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
boolean hasStartFormKey = processDefinition.hasStartFormKey();
// 根据是否有formkey属性判断使用哪个展示层
String viewName = "chapter6/start-process-form";
ModelAndView mav = new ModelAndView(viewName);
// 判断是否有formkey属性
if (hasStartFormKey) {
Object renderedStartForm = formService.getRenderedStartForm(processDefinitionId);
mav.addObject("startFormData", renderedStartForm);
mav.addObject("processDefinition", processDefinition);
} else { // 动态表单字段
StartFormData startFormData = formService.getStartFormData(processDefinitionId);
mav.addObject("startFormData", startFormData);
}
mav.addObject("hasStartFormKey", hasStartFormKey);
mav.addObject("processDefinitionId", processDefinitionId);
return mav;
}
示例3: 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());
}
}
}
示例4: execute
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("Process Definition '" + processDefinitionId +"' not found");
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
return null;
}
FormEngine formEngine = Context
.getProcessEngineConfiguration()
.getFormEngines()
.get(formEngineName);
if (formEngine==null) {
throw new ActivitiException("No formEngine '" + formEngineName +"' defined process engine configuration");
}
StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
return formEngine.renderStartForm(startForm);
}
示例5: execute
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
public StartFormData execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id '" + processDefinitionId +"'");
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
throw new ActivitiException("No startFormHandler defined in process '" + processDefinitionId +"'");
}
return startFormHandler.createStartFormData(processDefinition);
}
示例6: processList
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected List processList(List list) {
List<ProcessDefinitionResponse> responseProcessDefinitions = new ArrayList<ProcessDefinitionResponse>();
for (Object definition : list) {
ProcessDefinitionResponse processDefinition = new ProcessDefinitionResponse((ProcessDefinitionEntity) definition);
StartFormData startFormData = ActivitiUtil.getFormService().getStartFormData(((ProcessDefinitionEntity) definition).getId());
if (startFormData != null) {
processDefinition.setStartFormResourceKey(startFormData.getFormKey());
}
processDefinition.setGraphicNotationDefined(isGraphicNotationDefined(((ProcessDefinitionEntity) definition).getId()));
responseProcessDefinitions.add(processDefinition);
}
return responseProcessDefinitions;
}
示例7: execute
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentManager()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("Process Definition '" + processDefinitionId +"' not found", ProcessDefinition.class);
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
return null;
}
FormEngine formEngine = Context
.getProcessEngineConfiguration()
.getFormEngines()
.get(formEngineName);
if (formEngine==null) {
throw new ActivitiException("No formEngine '" + formEngineName +"' defined process engine configuration");
}
StartFormData startForm = startFormHandler.createStartFormData(processDefinition);
return formEngine.renderStartForm(startForm);
}
示例8: execute
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
public StartFormData execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context
.getProcessEngineConfiguration()
.getDeploymentManager()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId +"'", ProcessDefinition.class);
}
StartFormHandler startFormHandler = processDefinition.getStartFormHandler();
if (startFormHandler == null) {
throw new ActivitiException("No startFormHandler defined in process '" + processDefinitionId +"'");
}
return startFormHandler.createStartFormData(processDefinition);
}
示例9: 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;
}
示例10: 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;
}
示例11: prepareStartProcessInstance
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
/**
* 发起流程页面(启动一个流程实例)内置流程表单方式
*
* @return
*/
@RequestMapping("workspace-prepareStartProcessInstance")
public String prepareStartProcessInstance(
@RequestParam("processDefinitionId") String processDefinitionId,
Model model) {
FormService formService = processEngine.getFormService();
StartFormData startFormData = formService
.getStartFormData(processDefinitionId);
model.addAttribute("startFormData", startFormData);
return "bpm/workspace prepareStartProcessInstance";
}
示例12: 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);
}
示例13: createProcessDefinitionRest
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
protected ProcessDefinition createProcessDefinitionRest(ProcessDefinitionEntity processDefinition)
{
ProcessDefinition processDefinitionRest = new ProcessDefinition(processDefinition);
String localKey = getLocalProcessDefinitionKey(processDefinition.getKey());
processDefinitionRest.setKey(localKey);
String displayId = localKey + ".workflow";
processDefinitionRest.setTitle(getLabel(displayId, "title"));
processDefinitionRest.setDescription(getLabel(displayId, "description"));
processDefinitionRest.setGraphicNotationDefined(processDefinition.isGraphicalNotationDefined());
if (processDefinition.hasStartFormKey())
{
try
{
StartFormData startFormData = activitiProcessEngine.getFormService().getStartFormData(processDefinition.getId());
if (startFormData != null)
{
processDefinitionRest.setStartFormResourceKey(startFormData.getFormKey());
}
}
catch (Exception e)
{
throw new ApiException("Error while retrieving start form key");
}
}
return processDefinitionRest;
}
示例14: startForm
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
@RequestMapping(value = "/bpm/proc/form/start", method = RequestMethod.GET)
public ModelAndView startForm(String id) {
StartFormData formData = formService.getStartFormData(id);
List<FormAttribute> props = convertFormData(formData);
ModelAndView mv = view("views/bpm/start-form");
mv.addObject("model", formData);
mv.addObject("props", props);
return mv;
}
示例15: testJavascriptFormType
import org.activiti.engine.form.StartFormData; //导入依赖的package包/类
@Test
@Deployment(resources = "chapter6/dynamic-form/leave.bpmn")
public void testJavascriptFormType() throws Exception {
// 验证是否部署成功
long count = repositoryService.createProcessDefinitionQuery().count();
assertEquals(1, count);
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult();
StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
List<FormProperty> formProperties = startFormData.getFormProperties();
for (FormProperty formProperty : formProperties) {
System.out.println(formProperty.getId() + ",value=" + formProperty.getValue());
}
}