Package com.mossle.bpm

Examples of com.mossle.bpm.FormInfo


        if (processDefinitionEntity == null) {
            throw new IllegalArgumentException(
                    "cannot find processDefinition : " + processDefinitionId);
        }

        FormInfo formInfo = new FormInfo();
        formInfo.setProcessDefinitionId(processDefinitionId);

        if (processDefinitionEntity.hasStartFormKey()) {
            formInfo.setAutoCompleteFirstTask(false);

            DefaultFormHandler formHandler = (DefaultFormHandler) processDefinitionEntity
                    .getStartFormHandler();

            if (formHandler.getFormKey() != null) {
                String formKey = formHandler.getFormKey().getExpressionText();
                formInfo.setFormKey(formKey);
                formInfo.setActivityId(processDefinitionEntity.getInitial()
                        .getId());
            }
        } else {
            formInfo.setAutoCompleteFirstTask(true);

            ActivityImpl startActivity = processDefinitionEntity.getInitial();

            if (startActivity.getOutgoingTransitions().size() != 1) {
                throw new IllegalStateException(
                        "start activity outgoing transitions cannot more than 1, now is : "
                                + startActivity.getOutgoingTransitions().size());
            }

            PvmTransition pvmTransition = startActivity
                    .getOutgoingTransitions().get(0);
            PvmActivity targetActivity = pvmTransition.getDestination();

            if (!"userTask".equals(targetActivity.getProperty("type"))) {
                logger.info("first activity is not userTask, just skip");
            } else {
                String taskDefinitionKey = targetActivity.getId();
                logger.debug("activityId : {}", targetActivity.getId());

                TaskDefinition taskDefinition = processDefinitionEntity
                        .getTaskDefinitions().get(taskDefinitionKey);

                Expression expression = taskDefinition.getAssigneeExpression();

                if (expression != null) {
                    String expressionText = expression.getExpressionText();
                    logger.debug("{}", expressionText);
                    logger.debug("{}", startActivity.getProperties());
                    logger.debug("{}", processDefinitionEntity.getProperties());

                    String initiatorVariableName = (String) processDefinitionEntity
                            .getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);

                    if (("${" + initiatorVariableName + "}")
                            .equals(expressionText)) {
                        DefaultFormHandler formHandler = (DefaultFormHandler) taskDefinition
                                .getTaskFormHandler();

                        if (formHandler.getFormKey() != null) {
                            String formKey = formHandler.getFormKey()
                                    .getExpressionText();
                            formInfo.setFormKey(formKey);
                        }

                        formInfo.setActivityId(taskDefinitionKey);
                    }
                }
            }
        }
View Full Code Here


        }

        FormService formService = processEngine.getFormService();
        String taskFormKey = formService.getTaskFormKey(
                task.getProcessDefinitionId(), task.getTaskDefinitionKey());
        FormInfo formInfo = new FormInfo();
        formInfo.setTaskId(taskId);
        formInfo.setFormKey(taskFormKey);

        // 尝试根据表单里字段的类型,进行转换
        Map<String, String> formTypeMap = new HashMap<String, String>();

        if (formInfo.isFormExists()) {
            FormTemplate formTemplate = formTemplateManager.findUniqueBy(
                    "code", formInfo.getFormKey());

            String content = formTemplate.getContent();
            formTypeMap = this.fetchFormTypeMap(content);
        }
View Full Code Here

        IdentityService identityService = processEngine.getIdentityService();
        identityService.setAuthenticatedUserId(SpringSecurityUtils
                .getCurrentUserId());

        // 获得form的信息
        FormInfo formInfo = new FindStartFormCmd(processDefinitionId)
                .execute(commandContext);

        // 尝试根据表单里字段的类型,进行转换
        Map<String, String> formTypeMap = new HashMap<String, String>();

        if (formInfo.isFormExists()) {
            FormTemplate formTemplate = formTemplateManager.findUniqueBy(
                    "code", formInfo.getFormKey());

            String content = formTemplate.getContent();
            formTypeMap = this.fetchFormTypeMap(content);
        }
View Full Code Here

        BpmProcess bpmProcess = bpmProcessManager.get(bpmProcessId);
        String processDefinitionId = bpmProcess.getBpmConfBase()
                .getProcessDefinitionId();

        FormInfo formInfo = processEngine.getManagementService()
                .executeCommand(new FindStartFormCmd(processDefinitionId));
        model.addAttribute("formInfo", formInfo);

        String nextStep = null;

        if (formInfo.isFormExists()) {
            // 如果找到了form,就显示表单
            if (Integer.valueOf(1).equals(bpmProcess.getUseTaskConf())) {
                // 如果需要配置负责人
                nextStep = "taskConf";
            } else {
                nextStep = "confirmStartProcess";
            }

            model.addAttribute("nextStep", nextStep);

            List<BpmConfForm> bpmConfForms = bpmConfFormManager
                    .find("from BpmConfForm where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                            formInfo.getProcessDefinitionId(),
                            formInfo.getActivityId());

            if (!bpmConfForms.isEmpty()) {
                if (Integer.valueOf(1).equals(bpmConfForms.get(0).getType())) {
                    String redirectUrl = bpmConfForms.get(0).getValue()
                            + "?processDefinitionId="
                            + formInfo.getProcessDefinitionId();

                    return "redirect:" + redirectUrl;
                }
            }

            FormTemplate formTemplate = formTemplateManager.findUniqueBy(
                    "code", formInfo.getFormKey());

            if (Integer.valueOf(1).equals(formTemplate.getType())) {
                String redirectUrl = formTemplate.getContent()
                        + "?processDefinitionId="
                        + formInfo.getProcessDefinitionId();
                ;

                return "redirect:" + redirectUrl;
            }
View Full Code Here

        FormTemplate formTemplate = formTemplateManager.findUniqueBy("code",
                taskFormKey);
        model.addAttribute("formTemplate", formTemplate);

        FormInfo formInfo = new FormInfo();
        formInfo.setTaskId(taskId);
        model.addAttribute("formInfo", formInfo);

        List<BpmConfOperation> bpmConfOperations = bpmConfOperationManager
                .find("from BpmConfOperation where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                        task.getProcessDefinitionId(),
                        task.getTaskDefinitionKey());

        for (BpmConfOperation bpmConfOperation : bpmConfOperations) {
            formInfo.getButtons().add(bpmConfOperation.getValue());
        }

        String processDefinitionId = task.getProcessDefinitionId();
        String activityId = task.getTaskDefinitionKey();
        formInfo.setProcessDefinitionId(processDefinitionId);
        formInfo.setActivityId(activityId);

        List<BpmConfForm> bpmConfForms = bpmConfFormManager
                .find("from BpmConfForm where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
                        processDefinitionId, activityId);
View Full Code Here

TOP

Related Classes of com.mossle.bpm.FormInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.