Package org.activiti.engine.impl.form

Examples of org.activiti.engine.impl.form.DefaultFormHandler


        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


  public String execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = commandContext
            .getProcessEngineConfiguration()
            .getDeploymentManager()
            .findDeployedProcessDefinitionById(processDefinitionId);
    DefaultFormHandler formHandler;
    if (taskDefinitionKey == null) {
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) processDefinition.getStartFormHandler();
    } else {
      TaskDefinition taskDefinition = processDefinition.getTaskDefinitions().get(taskDefinitionKey);
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) taskDefinition.getTaskFormHandler();
    }
    String formKey = null;
    if (formHandler.getFormKey() != null) {
      formKey = formHandler.getFormKey().getExpressionText();
    }
    return formKey;
  }
View Full Code Here

  public String execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = Context
            .getProcessEngineConfiguration()
            .getDeploymentCache()
            .findDeployedProcessDefinitionById(processDefinitionId);
    DefaultFormHandler formHandler;
    if (taskDefinitionKey == null) {
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) processDefinition.getStartFormHandler();
    } else {
      TaskDefinition taskDefinition = processDefinition.getTaskDefinitions().get(taskDefinitionKey);
      // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
      formHandler = (DefaultFormHandler) taskDefinition.getTaskFormHandler();
    }
    String formKey = null;
    if (formHandler.getFormKey() != null) {
      formKey = formHandler.getFormKey().getExpressionText();
    }
    return formKey;
  }
View Full Code Here

TOP

Related Classes of org.activiti.engine.impl.form.DefaultFormHandler

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.