Examples of VariableScopeInstance


Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        }
        return variableScopeInstance.getVariables();
  }
 
  public void setVariable(String name, Object value) {
    VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
      getContextInstance(VariableScope.VARIABLE_SCOPE);
    if (variableScopeInstance == null) {
      throw new IllegalArgumentException("No variable scope found.");
    }
    variableScopeInstance.setVariable(name, value);
  }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

    private static final long serialVersionUID = 510l;

    public void signalEvent(String type, Object event) {
      String variableName = getEventNode().getVariableName();
      if (variableName != null) {
        VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
          resolveContextInstance(VariableScope.VARIABLE_SCOPE, variableName);
        if (variableScopeInstance == null) {
          throw new IllegalArgumentException(
          "Could not find variable for event node: " + variableName);
        }
        EventTransformer transformer = getEventNode().getEventTransformer();
        if (transformer != null) {
          event = transformer.transformEvent(event);
        }
        variableScopeInstance.setVariable(variableName, event);
      }
      triggerCompleted();
    }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        Map<String, String> replacements = new HashMap<String, String>();
        Matcher matcher = PARAMETER_MATCHER.matcher(s);
            while (matcher.find()) {
              String paramName = matcher.group(1);
              if (replacements.get(paramName) == null) {
                  VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                      resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName);
                    if (variableScopeInstance != null) {
                        Object variableValue = variableScopeInstance.getVariable(paramName);
                      String variableValueString = variableValue == null ? "" : variableValue.toString();
                      replacements.put(paramName, variableValueString);
                    } else {
                      try {
                        Object variableValue = MVEL.eval(paramName, new NodeInstanceResolverFactory(this));
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        ((WorkItem) workItem).setParameters(new HashMap<String, Object>(work.getParameters()));
        for (Iterator<DataAssociation> iterator = workItemNode.getInAssociations().iterator(); iterator.hasNext(); ) {
            DataAssociation association = iterator.next();
            if (association.getAssignments() == null || association.getAssignments().isEmpty()) {
                Object parameterValue = null;
                VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                resolveContextInstance(VariableScope.VARIABLE_SCOPE, association.getSources().get(0));
                if (variableScopeInstance != null) {
                    parameterValue = variableScopeInstance.getVariable(association.getSources().get(0));
                } else {
                    try {
                        parameterValue = MVEL.eval(association.getSources().get(0), new NodeInstanceResolverFactory(this));
                    } catch (Throwable t) {
                        System.err.println("Could not find variable scope for variable " + association.getSources().get(0));
                        System.err.println("when trying to execute Work Item " + work.getName());
                        System.err.println("Continuing without setting parameter.");
                    }
                }
                if (parameterValue != null) {
                    ((WorkItem) workItem).setParameter(association.getTarget(), parameterValue);
                }
            } else {
                for(Iterator<Assignment> it = association.getAssignments().iterator(); it.hasNext(); ) {
                    handleAssignment(it.next());
                }
            }
        }
       
        for (Map.Entry<String, Object> entry: workItem.getParameters().entrySet()) {
            if (entry.getValue() instanceof String) {
                String s = (String) entry.getValue();
                Map<String, String> replacements = new HashMap<String, String>();
                Matcher matcher = PARAMETER_MATCHER.matcher(s);
                while (matcher.find()) {
                    String paramName = matcher.group(1);
                    if (replacements.get(paramName) == null) {
                        VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                            resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName);
                        if (variableScopeInstance != null) {
                            Object variableValue = variableScopeInstance.getVariable(paramName);
                            String variableValueString = variableValue == null ? "" : variableValue.toString();
                            replacements.put(paramName, variableValueString);
                        } else {
                            try {
                                Object variableValue = MVEL.eval(paramName, new NodeInstanceResolverFactory(this));
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        WorkItemNode workItemNode = getWorkItemNode();
        if (workItemNode != null) {
            for (Iterator<DataAssociation> iterator = getWorkItemNode().getOutAssociations().iterator(); iterator.hasNext(); ) {
                DataAssociation association = iterator.next();
                if (association.getAssignments() == null || association.getAssignments().isEmpty()) {
                    VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                    resolveContextInstance(VariableScope.VARIABLE_SCOPE, association.getTarget());
                    if (variableScopeInstance != null) {
                        Object value = workItem.getResult(association.getSources().get(0));
                        if (value == null) {
                            try {
                                value = MVEL.eval(association.getSources().get(0), new WorkItemResolverFactory(workItem));
                            } catch (Throwable t) {
                                // do nothing
                            }
                        }
                        variableScopeInstance.setVariable(association.getTarget(), value);
                    } else {
                        System.out.println("Could not find variable scope for variable " + association.getTarget());
                        System.out.println("when trying to complete Work Item " + workItem.getName());
                        System.out.println("Continuing without setting variable.");
                    }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        .addProcessInstance( processInstance );

        // set variable default values
        // TODO: should be part of processInstanceImpl?
        VariableScope variableScope = (VariableScope) ((ContextContainer) process).getDefaultContext( VariableScope.VARIABLE_SCOPE );
        VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
        // set input parameters
        if ( parameters != null ) {
            if ( variableScope != null ) {
                for ( Map.Entry<String, Object> entry : parameters.entrySet() ) {
                    variableScopeInstance.setVariable( entry.getKey(),
                                                       entry.getValue() );
                }
            } else {
                throw new IllegalArgumentException( "This process does not support parameters!" );
            }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

   
    protected Object getFaultData() {
      Object value = null;
      String faultVariable = getFaultNode().getFaultVariable();
      if (faultVariable != null) {
        VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
              resolveContextInstance(VariableScope.VARIABLE_SCOPE, faultVariable);
            if (variableScopeInstance != null) {
                value = variableScopeInstance.getVariable(faultVariable);
            } else {
                System.err.println("Could not find variable scope for variable " + faultVariable);
                System.err.println("when trying to execute fault node " + getFaultNode().getName());
                System.err.println("Continuing without setting value.");
            }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        }
        Map<String, Object> parameters = new HashMap<String, Object>();
        for (Iterator<DataAssociation> iterator =  getSubProcessNode().getInAssociations().iterator(); iterator.hasNext(); ) {
          DataAssociation mapping = iterator.next();
          Object parameterValue = null;
            VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                resolveContextInstance(VariableScope.VARIABLE_SCOPE, mapping.getSources().get(0));
            if (variableScopeInstance != null) {
                parameterValue = variableScopeInstance.getVariable(mapping.getSources().get(0));
            } else {
              try {
                parameterValue = MVEL.eval(mapping.getSources().get(0), new NodeInstanceResolverFactory(this));
              } catch (Throwable t) {
                System.err.println("Could not find variable scope for variable " + mapping.getSources().get(0));
                    System.err.println("when trying to execute SubProcess node " + getSubProcessNode().getName());
                    System.err.println("Continuing without setting parameter.");
              }
            }
            if (parameterValue != null) {
              parameters.put(mapping.getTarget(),parameterValue);
            }
        }
        String processId = getSubProcessNode().getProcessId();
        // resolve processId if necessary
        Map<String, String> replacements = new HashMap<String, String>();
    Matcher matcher = PARAMETER_MATCHER.matcher(processId);
        while (matcher.find()) {
          String paramName = matcher.group(1);
          if (replacements.get(paramName) == null) {
              VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                  resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName);
                if (variableScopeInstance != null) {
                    Object variableValue = variableScopeInstance.getVariable(paramName);
                  String variableValueString = variableValue == null ? "" : variableValue.toString();
                  replacements.put(paramName, variableValueString);
                } else {
                  try {
                    Object variableValue = MVEL.eval(paramName, new NodeInstanceResolverFactory(this));
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        handleOutMappings(processInstance);
        triggerCompleted();
    }
   
    private void handleOutMappings(ProcessInstance processInstance) {
        VariableScopeInstance subProcessVariableScopeInstance = (VariableScopeInstance)
          processInstance.getContextInstance(VariableScope.VARIABLE_SCOPE);
      for (Iterator<org.jbpm.workflow.core.node.DataAssociation> iterator= getSubProcessNode().getOutAssociations().iterator(); iterator.hasNext(); ) {
        org.jbpm.workflow.core.node.DataAssociation mapping = iterator.next();
          VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
              resolveContextInstance(VariableScope.VARIABLE_SCOPE, mapping.getTarget());
          if (variableScopeInstance != null) {
            Object value = subProcessVariableScopeInstance.getVariable(mapping.getSources().get(0));
            if (value == null) {
              try {
                  value = MVEL.eval(mapping.getSources().get(0), new VariableScopeResolverFactory(subProcessVariableScopeInstance));
                } catch (Throwable t) {
                  // do nothing
                }
            }
              variableScopeInstance.setVariable(mapping.getTarget(), value);
          } else {
              System.err.println("Could not find variable scope for variable " + mapping.getTarget());
              System.err.println("when trying to complete SubProcess node " + getSubProcessNode().getName());
              System.err.println("Continuing without setting variable.");
          }
View Full Code Here

Examples of org.jbpm.process.instance.context.variable.VariableScopeInstance

        Map<String, String> replacements = new HashMap<String, String>();
        Matcher matcher = PARAMETER_MATCHER.matcher(s);
            while (matcher.find()) {
              String paramName = matcher.group(1);
              if (replacements.get(paramName) == null) {
                  VariableScopeInstance variableScopeInstance = (VariableScopeInstance)
                      resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName);
                    if (variableScopeInstance != null) {
                        Object variableValue = variableScopeInstance.getVariable(paramName);
                      String variableValueString = variableValue == null ? "" : variableValue.toString();
                      replacements.put(paramName, variableValueString);
                    } else {
                      try {
                        Object variableValue = MVEL.eval(paramName, new NodeInstanceResolverFactory(this));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.