Java Code Examples for org.activiti.engine.repository.ProcessDefinition#hasStartFormKey()

The following examples show how to use org.activiti.engine.repository.ProcessDefinition#hasStartFormKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 2
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 3
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 4
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 5
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 6
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 7
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@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;
}
 
Example 8
Source File: ProcessDefinitionRepresentation.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
public ProcessDefinitionRepresentation(ProcessDefinition processDefinition) {
    this.id = processDefinition.getId();
    this.name = processDefinition.getName();
    this.description = processDefinition.getDescription();
    this.key = processDefinition.getKey();
    this.category = processDefinition.getCategory();
    this.version = processDefinition.getVersion();
    this.deploymentId = processDefinition.getDeploymentId();
    this.tenantId = processDefinition.getTenantId();
    this.hasStartForm = processDefinition.hasStartFormKey();
}
 
Example 9
Source File: ProcessDefinitionInfo.java    From hsweb-framework with Apache License 2.0 5 votes vote down vote up
public static ProcessDefinitionInfo of(ProcessDefinition definition) {
    ProcessDefinitionInfo info = new ProcessDefinitionInfo();
    info.copyFrom(definition);

    info.hasGraphicalNotation = definition.hasGraphicalNotation();
    info.hasStartFormKey = definition.hasStartFormKey();
    return info;
}
 
Example 10
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "getform/start/{processDefinitionId}")
public ModelAndView readStartForm(@PathVariable("processDefinitionId") String processDefinitionId,
                                  HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionId(processDefinitionId).singleResult();

    User user = UserUtil.getUserFromSession(request.getSession());
    List<Group> groupList = (List<Group>) request.getSession().getAttribute("groups");

    // 权限拦截
    boolean startable = false;
    List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
    if (identityLinks == null || identityLinks.isEmpty()) {
        startable = true;
    } else {
        for (IdentityLink identityLink : identityLinks) {
            if (StringUtils.isNotBlank(identityLink.getUserId()) && identityLink.getUserId().equals(user.getId())) {
                startable = true;
                break;
            }

            if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                for (Group group : groupList) {
                    if (group.getName().equals(identityLink.getGroupId())) {
                        startable = true;
                        break;
                    }
                }
            }
        }
    }

    if (!startable) {
        redirectAttributes.addFlashAttribute("error", "您无权启动【" + processDefinition.getName() + "】流程!");
        return new ModelAndView("redirect:/chapter5/process-list-view");
    }

    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;
}
 
Example 11
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "getform/start/{processDefinitionId}")
public ModelAndView readStartForm(@PathVariable("processDefinitionId") String processDefinitionId,
                                  HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionId(processDefinitionId).singleResult();

    User user = UserUtil.getUserFromSession(request.getSession());
    List<Group> groupList = (List<Group>) request.getSession().getAttribute("groups");

    // 权限拦截
    boolean startable = false;
    List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
    if (identityLinks == null || identityLinks.isEmpty()) {
        startable = true;
    } else {
        for (IdentityLink identityLink : identityLinks) {
            if (StringUtils.isNotBlank(identityLink.getUserId()) && identityLink.getUserId().equals(user.getId())) {
                startable = true;
                break;
            }

            if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                for (Group group : groupList) {
                    if (group.getName().equals(identityLink.getGroupId())) {
                        startable = true;
                        break;
                    }
                }
            }
        }
    }

    if (!startable) {
        redirectAttributes.addFlashAttribute("error", "您无权启动【" + processDefinition.getName() + "】流程!");
        return new ModelAndView("redirect:/chapter5/process-list-view");
    }

    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;
}
 
Example 12
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "getform/start/{processDefinitionId}")
public ModelAndView readStartForm(@PathVariable("processDefinitionId") String processDefinitionId,
                                  HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionId(processDefinitionId).singleResult();

    User user = UserUtil.getUserFromSession(request.getSession());
    List<Group> groupList = (List<Group>) request.getSession().getAttribute("groups");

    // 权限拦截
    boolean startable = false;
    List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
    if (identityLinks == null || identityLinks.isEmpty()) {
        startable = true;
    } else {
        for (IdentityLink identityLink : identityLinks) {
            if (StringUtils.isNotBlank(identityLink.getUserId()) && identityLink.getUserId().equals(user.getId())) {
                startable = true;
                break;
            }

            if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                for (Group group : groupList) {
                    if (group.getName().equals(identityLink.getGroupId())) {
                        startable = true;
                        break;
                    }
                }
            }
        }
    }

    if (!startable) {
        redirectAttributes.addFlashAttribute("error", "您无权启动【" + processDefinition.getName() + "】流程!");
        return new ModelAndView("redirect:/chapter5/process-list-view");
    }

    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;
}
 
Example 13
Source File: ProcessDefinitionController.java    From activiti-in-action-codes with Apache License 2.0 4 votes vote down vote up
/**
 * 读取启动流程的表单字段
 */
@RequestMapping(value = "getform/start/{processDefinitionId}")
public ModelAndView readStartForm(@PathVariable("processDefinitionId") String processDefinitionId,
                                  HttpServletRequest request, RedirectAttributes redirectAttributes) throws Exception {
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
            .processDefinitionId(processDefinitionId).singleResult();

    User user = UserUtil.getUserFromSession(request.getSession());
    List<Group> groupList = (List<Group>) request.getSession().getAttribute("groups");

    // 权限拦截
    boolean startable = false;
    List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
    if (identityLinks == null || identityLinks.isEmpty()) {
        startable = true;
    } else {
        for (IdentityLink identityLink : identityLinks) {
            if (StringUtils.isNotBlank(identityLink.getUserId()) && identityLink.getUserId().equals(user.getId())) {
                startable = true;
                break;
            }

            if (StringUtils.isNotBlank(identityLink.getGroupId())) {
                for (Group group : groupList) {
                    if (group.getName().equals(identityLink.getGroupId())) {
                        startable = true;
                        break;
                    }
                }
            }
        }
    }

    if (!startable) {
        redirectAttributes.addFlashAttribute("error", "您无权启动【" + processDefinition.getName() + "】流程!");
        return new ModelAndView("redirect:/chapter5/process-list-view");
    }

    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;
}