Package org.camunda.bpm.engine.delegate

Examples of org.camunda.bpm.engine.delegate.Expression


  }

  protected ExecutableScript parseScriptResource(String resource, String language, CmmnHandlerContext context) {
    if (StringUtil.isExpression(resource)) {
      ExpressionManager expressionManager = context.getExpressionManager();
      Expression scriptResourceExpression = expressionManager.createExpression(resource);
      return new DynamicResourceExecutableScript(scriptResourceExpression, language);
    }
    else {
      DeploymentEntity deployment = (DeploymentEntity) context.getDeployment();
      String scriptSource = ResourceUtil.loadResourceContent(resource, deployment);
View Full Code Here


  public void initializeFormKey() {
    isFormKeyInitialized = true;
    if(taskDefinitionKey != null) {
      TaskDefinition taskDefinition = getTaskDefinition();
      if(taskDefinition != null) {
        Expression formKey = taskDefinition.getFormKey();
        if(formKey != null) {
          this.formKey = (String) formKey.getValue(this);
        }
      }
    }
  }
View Full Code Here

    }

    // parse name
    String name = formField.attribute("label");
    if (name != null) {
      Expression nameExpression = expressionManager.createExpression(name);
      formFieldHandler.setLabel(nameExpression);
    }

    // parse properties
    parseProperties(formField, formFieldHandler, bpmnParse, expressionManager);

    // parse validation
    parseValidation(formField, formFieldHandler, bpmnParse, expressionManager);

    // parse type
    FormTypes formTypes = getFormTypes();
    AbstractFormFieldType formType = formTypes.parseFormPropertyType(formField, bpmnParse);
    formFieldHandler.setType(formType);

    // parse default value
    String defaultValue = formField.attribute("defaultValue");
    if(defaultValue != null) {
      Expression defaultValueExpression = expressionManager.createExpression(defaultValue);
      formFieldHandler.setDefaultValueExpression(defaultValueExpression);
    }

    formFieldHandlers.add(formFieldHandler);
View Full Code Here

      String variableName = formPropertyElement.attribute("variable");
      formPropertyHandler.setVariableName(variableName);

      String expressionText = formPropertyElement.attribute("expression");
      if (expressionText!=null) {
        Expression expression = expressionManager.createExpression(expressionText);
        formPropertyHandler.setVariableExpression(expression);
      }

      String defaultExpressionText = formPropertyElement.attribute("default");
      if (defaultExpressionText!=null) {
        Expression defaultExpression = expressionManager.createExpression(defaultExpressionText);
        formPropertyHandler.setDefaultExpression(defaultExpression);
      }

      formPropertyHandlers.add(formPropertyHandler);
    }
View Full Code Here

   * @param language the script language
   * @return the corresponding {@link ScriptTaskActivityBehavior}
   */
  protected ExecutableScript parseScriptSource(String scriptSource, String language) {
    if (StringUtil.isExpression(scriptSource) && !JuelScriptEngineFactory.names.contains(language)) {
      Expression scriptExpression = expressionManager.createExpression(scriptSource.trim());
      return new DynamicSourceExecutableScript(scriptExpression, language);
    }
    else {
      return parseScript(scriptSource, language);
    }
View Full Code Here

   * @param scriptLanguage the script language
   * @return the corresponding {@link ScriptTaskActivityBehavior}
   */
  protected ExecutableScript parseScriptResource(String scriptResource, String scriptLanguage) {
    if (StringUtil.isExpression(scriptResource)) {
      Expression scriptResourceExpression = expressionManager.createExpression(scriptResource);
      return new DynamicResourceExecutableScript(scriptResourceExpression, scriptLanguage);
    }
    else {
      String scriptSource = ResourceUtil.loadResourceContent(scriptResource, deployment);
      return parseScript(scriptSource, scriptLanguage);
View Full Code Here

  }

  protected TimerDeclarationImpl parseTimer(Element timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) {
    // TimeDate
    TimerDeclarationType type = TimerDeclarationType.DATE;
    Expression expression = parseExpression(timerEventDefinition, "timeDate");
    // TimeCycle
    if (expression == null) {
      type = TimerDeclarationType.CYCLE;
      expression = parseExpression(timerEventDefinition, "timeCycle");
    }
    // TimeDuration
    if (expression == null) {
      type = TimerDeclarationType.DURATION;
      expression = parseExpression(timerEventDefinition, "timeDuration");
    }
    // neither date, cycle or duration configured!
    if (expression==null) {
      addError("Timer needs configuration (either timeDate, timeCycle or timeDuration is needed).", timerEventDefinition);
    }

    // Parse the timer declaration
    // TODO move the timer declaration into the bpmn activity or next to the
    // TimerSession
    TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType);
    timerDeclaration.setJobHandlerConfiguration(timerActivity.getId());
    timerDeclaration.setExclusive("true".equals(timerEventDefinition.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "exclusive", String.valueOf(JobEntity.DEFAULT_EXCLUSIVE))));
    if(timerActivity.getId() == null) {
      addError("Attribute \"id\" is required!",timerEventDefinition);
    }
    timerDeclaration.setActivityId(timerActivity.getId());
    timerDeclaration.setJobConfiguration(type.toString() + ": " +expression.getExpressionText());
    addJobDeclarationToProcessDefinition(timerDeclaration, timerActivity.getProcessDefinition());

    return timerDeclaration;
  }
View Full Code Here

        String businessKeyExpression = inElement.attribute("businessKey");
        if ((source != null || sourceExpression != null) && target == null) {
          addError("Missing attribute 'target' when attribute source or sourceExpression is set", inElement);
        }
        else if (sourceExpression != null) {
          Expression expression = expressionManager.createExpression(sourceExpression.trim());
          callActivityBehaviour.addDataInputAssociation(new DataAssociation(expression, target));
        } else if (variables != null && ("all").equals(variables)) {
          callActivityBehaviour.addDataInputAssociation(new DataAssociation(variables));
        } else if (businessKeyExpression != null) {
          Expression expression = expressionManager.createExpression(businessKeyExpression.trim());
          callActivityBehaviour.addDataInputAssociation(new DataAssociation(expression));
        } else {
          callActivityBehaviour.addDataInputAssociation(new DataAssociation(source, target));
        }
      }
      // output data elements
      for (Element outElement : extensionsElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "out")) {
        String source = outElement.attribute("source");
        String sourceExpression = outElement.attribute("sourceExpression");
        String target = outElement.attribute("target");
        String variables = outElement.attribute("variables");
        if ((source != null || sourceExpression != null) && target == null) {
          addError("Missing attribute 'target' when attribute source or sourceExpression is set", outElement);
        }
        else if (sourceExpression != null) {
          Expression expression = expressionManager.createExpression(sourceExpression.trim());
          callActivityBehaviour.addDataOutputAssociation(new DataAssociation(expression, target));
        } else if (variables != null && ("all").equals(variables)) {
          callActivityBehaviour.addDataOutputAssociation(new DataAssociation(variables));
        } else {
          callActivityBehaviour.addDataOutputAssociation(new DataAssociation(source, target));
View Full Code Here

      variableDeclaration.setSourceVariableName(src);
    }

    String srcExpr = propertyElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "srcExpr");
    if (srcExpr != null) {
      Expression sourceExpression = expressionManager.createExpression(srcExpr);
      variableDeclaration.setSourceExpression(sourceExpression);
    }

    String dst = propertyElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "dst");
    if (dst != null) {
      variableDeclaration.setDestinationVariableName(dst);
    }

    String destExpr = propertyElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "dstExpr");
    if (destExpr != null) {
      Expression destinationExpression = expressionManager.createExpression(destExpr);
      variableDeclaration.setDestinationExpression(destinationExpression);
    }

    String link = propertyElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "link");
    if (link != null) {
      variableDeclaration.setLink(link);
    }

    String linkExpr = propertyElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "linkExpr");
    if (linkExpr != null) {
      Expression linkExpression = expressionManager.createExpression(linkExpr);
      variableDeclaration.setLinkExpression(linkExpression);
    }

    for (BpmnParseListener parseListener : parseListeners) {
      parseListener.parseProperty(propertyElement, variableDeclaration, activity);
View Full Code Here

    // assignments
    initializeTaskAssignments(task, variableScope);
  }

  protected void initializeTaskName(TaskEntity task, VariableScope<?> variableScope) {
    Expression nameExpression = taskDefinition.getNameExpression();
    if (nameExpression != null) {
      String name = (String) nameExpression.getValue(variableScope);
      task.setName(name);
    }
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.delegate.Expression

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.