Package org.openbp.core.model.item.process

Examples of org.openbp.core.model.item.process.Param


   * @param socket Socket
   * @param paramName Unqualified parameter name ("paramName")
   */
  public static boolean hasParamValue(TokenContext token, NodeSocket socket, String paramName)
  {
    Param param = socket.getParamByName(paramName);
    if (param != null)
    {
      return token.hasParamValue(param.getContextName());
    }
    return false;
  }
View Full Code Here


   * @param paramName Unqualified parameter name ("paramName")
   * @return The parameter value or null if no such parameter exists
   */
  public static Object getParamValue(TokenContext token, NodeSocket socket, String paramName)
  {
    Param param = socket.getParamByName(paramName);
    if (param != null)
    {
      return token.getParamValue(param.getContextName());
    }
    return null;
  }
View Full Code Here

   * @param paramName Unqualified parameter name ("paramName")
   * @param value Param value
   */
  public static void setParamValue(TokenContext token, NodeSocket socket, String paramName, Object value)
  {
    Param param = socket.getParamByName(paramName);
    if (param != null)
    {
      setParamValue(token, param, value);
    }
  }
View Full Code Here

   * @param socket Socket
   * @param paramName Unqualified parameter name ("paramName")
   */
  public static void removeParamValue(TokenContext token, NodeSocket socket, String paramName)
  {
    Param param = socket.getParamByName(paramName);
    if (param != null)
    {
      token.removeParamValue(param.getContextName());
    }
  }
View Full Code Here

      for (Iterator itLink = global.getDataLinks(); itLink.hasNext();)
      {
        DataLink link = (DataLink) itLink.next();

        Param targetParam = link.getTargetParam();
        if (targetParam == param)
        {
          // We found a global that is connected to this parameter, execute the link
          executeDataLink(link);
          foundLink = true;
View Full Code Here

  private void transferExitSocketData(NodeSocket exitSocket)
  {
    // Iterate all parameters of the exit socket
    for (Iterator it = exitSocket.getParams(); it.hasNext();)
    {
      Param sourceParam = (Param) it.next();

      // Transfer the parameter value
      transferParamData(sourceParam);

      // After we have distributed the exit parameter, we can remove it from the context
View Full Code Here

   * @param link Data link
   * @throws OpenBPException On error, e. g. if the evaluation of a destination parameter expression fails
   */
  private void executeDataLink(DataLink link)
  {
    Param sourceParam = link.getSourceParam();
    String sourceMember = link.getSourceMemberPath();
    Param targetParam = link.getTargetParam();
    String targetMember = link.getTargetMemberPath();

    //
    // Retrieve the source value
    //
    Object value;
    if (sourceMember != null)
    {
      // We have a member path specification for the source.
      // We need an expression parser to evaluate it.
      ExpressionParser parser = EngineUtil.createExpressionParser(context, engine);

      String contextName = sourceParam.getContextName();
      String paramName = sourceParam.getName();
      int pos = contextName.lastIndexOf(paramName);
      String contextPrefix = contextName.substring(0, pos);

      parser.setContextPrefix(contextPrefix);

      // Any members that are missing in the path will cause a null value to be returned
      String expr;
      if (sourceMember.startsWith(ExpressionConstants.MEMBER_OPERATOR))
        expr = paramName + sourceMember;
      else if (sourceMember.startsWith(ExpressionConstants.REFERENCE_KEY_OPERATOR))
        expr = paramName + sourceMember;
      else
        expr = paramName + ExpressionConstants.MEMBER_OPERATOR + sourceMember;
      value = parser.getContextPathValue(expr, null, 0);
    }
    else
    {
      // Direct parameter value access, cache the parameter value for remaining data links
      value = TokenContextUtil.getParamValue(context, sourceParam);
    }

    if (value != null && link.isCloningSource())
    {
      // This link want to have the source value cloned
      try
      {
        value = CopyUtil.copyObject(value, Copyable.COPY_DEEP, context.getExecutingModel().getClassLoader());
      }
      catch (Exception e)
      {
        throw new EngineException("Clone", "Cloning of data link value failed.", e);
      }
    }

    //
    // Set the target value
    //
    if (targetMember != null)
    {
      // We have a member path specification for the target.
      // We need an expression parser to evaluate it.
      ExpressionParser parser = EngineUtil.createExpressionParser(context, engine);

      String contextName = targetParam.getContextName();
      String paramName = targetParam.getName();
      int pos = contextName.lastIndexOf(paramName);
      String contextPrefix = contextName.substring(0, pos);

      parser.setContextPrefix(contextPrefix);

      // Provide the target parameter type and the 'create all objects' flag to the parser,
      // so any members that are missing in the path will be created on the fly.
      parser.setContextPathValue(targetMember, value, targetParam.getDataType(), ExpressionParser.CREATE_ALL_OBJECTS);
    }
    else
    {
      // Add the value directly as target parameter value to the context
      TokenContextUtil.setParamValue(context, targetParam, value);
View Full Code Here

        // Create a new child context
        TokenContext childContext = getEngine().getTokenContextService().createChildContext(context);

        // Provide the collection element to it
        Param outParam = defaultOutSocket.getParamByName(CoreConstants.FORK_COLLECTION_ELEMENT_PARAM);
        if (outParam != null)
        {
          // If the exit socket contains a 'WorkflowTask' parameter, set it
          TokenContextUtil.setParamValue(childContext, outParam, collectionElement);
        }
View Full Code Here

   * {@link #chooseExitSocket} before calling this method.
   * @param value Param value
   */
  public void setResult(String paramName, Object value)
  {
    Param param = nextSocket.getParamByName(paramName);
    if (param != null)
    {
      // If the exit socket contains a 'WorkflowTask' parameter, set it
      TokenContextUtil.setParamValue(tokenContext, param, value);
    }
View Full Code Here

  public void prepareNodeSocketExecution(NodeSocket socket)
  {
    // Add all parameter values to the script namespace
    for (Iterator itParam = socket.getParams(); itParam.hasNext();)
    {
      Param param = (Param) itParam.next();

      String name = param.getName();
      String contextName = param.getContextName();
      Object value = context.getObject(contextName);

      setScriptVariable(name, value);
    }
  }
View Full Code Here

TOP

Related Classes of org.openbp.core.model.item.process.Param

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.