Package nexj.core.meta.workflow

Examples of nexj.core.meta.workflow.Variable


         for (StringTokenizer tokenizer = new StringTokenizer(sVarList); tokenizer.hasMoreTokens();)
         {
            String sVarName = tokenizer.nextToken();

            XMLMetadataHelper.validateName(sVarName);
            workflow.addVariable(new Variable(sVarName));
         }
      }

      if (isWorkflowHandler(workflowElement))
      {
View Full Code Here


            {
               throw new MetadataException("err.meta.workflow.queueEventDup",
                  new Object[]{sEventName, assignment.getName()});
            }

            Variable var = assignment.getActivity().getFlow().findVariable(assignment.getName());

            if (var == null)
            {
               var = new Variable(assignment.getName());
               assignment.getActivity().getFlow().addVariable(var);
            }

            if (activity != null)
            {
               Object code;

               if (activity.getStep(0) instanceof ManualCompletion)
               {
                  // ((:state'bind ('<assignment>'targetFunction)) '() (:flow'getToken <step>))
                  code =
                     Pair.list(
                        Pair.list(Symbol._STATE, Pair.quote(Symbol.BIND),
                           Pair.list(Pair.quote(assignment), Pair.quote(Symbol.TARGETFUNCTION))),
                        null,
                        Pair.list(Symbol._FLOW, Pair.quote(Symbol.GETTOKEN), Pair.quote(activity.getStep(0))));
               }
               else
               {
                  code = sEventName;
               }

               Script script = new Script();

               script.setBody(Pair.list(Pair.list(Symbol.SET, var.getSymbol(), code)));
               activity.addStep(script);
               fork.addConcurrent(activity);
            }

            if (branch == null)
            {
               branch = new Branch();
               decision.addBranch(branch);
               loadActivity(child, branch);
            }

            branch.setCondition(Pair.list(Symbol.EQUAL_P, var.getSymbol(), sEventName));
         }
      });

      if (fork.getConcurrentCount() == 0)
      {
View Full Code Here

         for (StringTokenizer tokenizer = new StringTokenizer(sArgList); tokenizer.hasMoreTokens();)
         {
            String sArgName = tokenizer.nextToken();

            XMLMetadataHelper.validateName(sArgName);
            service.addArgument(new Variable(sArgName));
         }
      }

      String sVarList = XMLUtil.getStringAttr(serviceElement, "variables");

      if (sVarList != null)
      {
         for (StringTokenizer tokenizer = new StringTokenizer(sVarList); tokenizer.hasMoreTokens();)
         {
            String sVarName = tokenizer.nextToken();

            XMLMetadataHelper.validateName(sVarName);
            service.addVariable(new Variable(sVarName));
         }
      }

      service.setPrivilege(getPrivilege(serviceElement, "privilege"));
      m_flowFixupList = new ArrayList();
View Full Code Here

      {
         sCollectionExpression = XMLUtil.getReqStringAttr(element, "collection");
         sItemVariableName = XMLUtil.getReqStringAttr(element, "variable");
      }

      Variable itemVar = activity.getFlow().findVariable(sItemVariableName);

      if (itemVar == null)
      {
         itemVar = new Variable(sItemVariableName);
         activity.getFlow().addVariable(itemVar);
      }

      String sLoopName = XMLUtil.getReqStringAttr(element, "name");
      Object collectionExpression = helper.parse(sCollectionExpression,
         false, activity.getFlow().getPosMap(), null, metadata.getGlobalEnvironment()
      );
      Variable collectionVar;
      boolean bUseOldCollectionVar = (collectionExpression instanceof Symbol) && collectionExpression != Symbol.THIS;

      // If collection is already stored in a variable, do not create a new one.
      if (bUseOldCollectionVar)
      {
         collectionVar = activity.getFlow().getVariable(((Symbol)collectionExpression).getName());
      }
      else
      {
         collectionVar = new Variable(sLoopName + ":collection");
         activity.getFlow().addVariable(collectionVar);
      }

      Variable indexVar = new Variable(sLoopName + ":var");

      activity.getFlow().addVariable(indexVar);

      Symbol collectionSym = collectionVar.getSymbol();
      Symbol indexSym = indexVar.getSymbol();
      Symbol itemSym = itemVar.getSymbol();

      // Loop initializer step
      Script initializer = new Script(sLoopName + ":init");
View Full Code Here

      {
         StringBuffer tokenBuf = new StringBuffer();

         for (;;)
         {
            Variable v = (Variable)variableItr.next();

            if (varFilter == null || varFilter.accept(v))
            {
               if (tokenBuf.length() > 0)
               {
                  tokenBuf.append(" ");
               }

               tokenBuf.append(v.getName());
            }

            if (!variableItr.hasNext())
            {
               break;
View Full Code Here

               m_writer.closeElement();
               m_writer.startElement("Arguments");

               for (int nArgIndex = 0; nArgIndex < nArgCount; ++nArgIndex)
               {
                  Variable arg = binding.getService().getArgument(nArgIndex);

                  Object value = binding.getArgumentValue(arg.getName());

                  if (value != Undefined.VALUE)
                  {
                     m_writer.openElement("Argument");
                     m_writer.writeAttribute("name", arg.getName());
                     exportSExpression(value, false, false, null, "value");
                     m_writer.closeEmptyElement();
                  }
               }
View Full Code Here

    * @return The argument object.
    * @throws MetadataLookupException if the argument does not exist.
    */
   public Variable getArgument(String sName) throws MetadataLookupException
   {
      Variable arg = (Variable)m_variableMap.get(sName);

      if (arg != null && (arg.getFlags() & Variable.ARG) != 0)
      {
         return arg;
      }

      throw new MetadataLookupException("err.meta." + getPropName() + ".argLookup", sName, this);
View Full Code Here

    * @param sName The service name.
    */
   public Service(String sName)
   {
      super(sName);
      m_output = new Variable(OUTPUT);
      addVariable(m_output);
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.workflow.Variable

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.