Examples of ProcessVariable


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

      ArrayList toDelete = null;

      // Update existing ones and remove deleted ones
      for (Iterator itVar = oldVars.iterator(); itVar.hasNext();)
      {
        ProcessVariable oldVar = (ProcessVariable) itVar.next();

        ProcessVariable newVar = findVariable(newVars, oldVar);
        if (newVar != null)
        {
          // DEBUG System.out.println ("Updating " + oldVar.getName () + " to " + newVar.getName ());
          try
          {
            // Existing one
            oldVar.copyFrom(newVar, Copyable.COPY_FIRST_LEVEL);
          }
          catch (CloneNotSupportedException e)
          {
            e.printStackTrace();
          }
        }
        else
        {
          // This variable has been deleted

          // DEBUG System.out.println ("Deleting " + oldVar.getName ());

          List dataLinks = null;
          try
          {
            // Make a copy of the data link list, it might get modified during the iteration
            dataLinks = (List) CopyUtil.copyCollection(currentProcess.getDataLinkList(), CopyUtil.CLONE_NONE);

            // Delete each data link from/to it by releasing the associated figure
            for (Iterator itLinks = dataLinks.iterator(); itLinks.hasNext();)
            {
              DataLink link = (DataLink) itLinks.next();

              if (link.getSourceParam() == oldVar || link.getTargetParam() == oldVar)
              {
                // DEBUG System.out.println ("Removing data link " + link.getName () + " from " + link.getSourceParam ().getPath () + " to " + link.getTargetParam ().getPath ());
                ProcessVariableConnection con = (ProcessVariableConnection) link.getRepresentation();
                con.release();

                // Remove the link itself
                currentProcess.removeDataLink(link);
              }
            }
          }
          catch (CloneNotSupportedException e)
          {
            // Doesn't happen
            e.printStackTrace();
          }

          // Save the variable to delete in order to prevent ConcurrentModificationException
          if (toDelete == null)
            toDelete = new ArrayList();
          toDelete.add(oldVar);
        }
      }

      if (toDelete != null)
      {
        for (Iterator it = toDelete.iterator(); it.hasNext();)
        {
          ProcessVariable oldVar = (ProcessVariable) it.next();

          // Remove the process variable itself
          currentProcess.removeProcessVariable(oldVar);
        }
      }
    }

    // Add new ones
    if (newVars != null)
    {
      for (Iterator itVar = newVars.iterator(); itVar.hasNext();)
      {
        ProcessVariable newVar = (ProcessVariable) itVar.next();

        ProcessVariable oldVar = findVariable(oldVars, newVar);
        if (oldVar == null)
        {
          // DEBUG System.out.println ("Adding " + newVar.getName ());

          // Add new one
          try
          {
            ProcessVariable toAdd = (ProcessVariable) newVar.clone();

            // Create a temporary reference id in order to prevent match by CommonUtil.equalsNull, see below
            toAdd.setTmpReference("!");

            currentProcess.addProcessVariable(toAdd);
          }
          catch (CloneNotSupportedException e)
          {
View Full Code Here

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

  {
    if (list != null)
    {
      for (Iterator it = list.iterator(); it.hasNext();)
      {
        ProcessVariable var = (ProcessVariable) it.next();

        if (CommonUtil.equalsNull(var.getTmpReference(), reference.getTmpReference()))
          return var;
      }
    }
    return null;
  }
View Full Code Here

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

  {
    if (vars != null)
    {
      for (Iterator it = vars.iterator(); it.hasNext();)
      {
        ProcessVariable var = (ProcessVariable) it.next();

        if (set)
          var.setTmpReference(var.getName());
        else
          var.setTmpReference(null);
      }
    }
  }
View Full Code Here

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

  protected void printProcessVariables()
    throws Exception
  {
    for (Iterator it = process.getProcessVariables(); it.hasNext();)
    {
      ProcessVariable param = (ProcessVariable) it.next();
      printGlobal(param);
    }
  }
View Full Code Here

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

      return;

    currentModeler.startUndo("Add Process Variable");

    // Create a new parameter
    ProcessVariable param = new ProcessVariableImpl();

    // Provide the data type and ensure the type name gets updated
    param.setDataType(type);

    // Pick a unique name based on the type name
    List paramList = currentProcess.getProcessVariableList();
    if (name == null)
      name = type.getName();
    name = NamedObjectCollectionUtil.createUniqueId(paramList, name);
    param.setName(name);

    // Add the new parameter to the process
    currentProcess.addProcessVariable(param);
    param.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES | ModelObject.SYNC_LOCAL_REFNAMES);

    // Redisplay the param list
    showParams();

    // We modified the current object by adding a parameter
View Full Code Here

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

      if (odn != null && odn.getObject() instanceof ProcessVariable)
      {
        if (!propertyBrowser.saveObject())
          return null;

        ProcessVariable param = (ProcessVariable) odn.getObject();

        dragImage = ItemIconMgr.getMultiIcon(ItemIconMgr.getInstance().getTypeIcon(param.getDataType(), FlexibleSize.MEDIUM));

        return new BasicTransferable(param);
      }
    }
View Full Code Here

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

      {
        // Add all parameters that do not have data links connected.
        if (param.getDataLinks().hasNext())
          continue;

        ProcessVariable pVar = modeler.getProcess().getProcessVariableByName(param.getName());
        if (pVar != null)
        {
          if (pVar.isAutoAssign())
            continue;
        }

        if (ret == null)
        {
View Full Code Here

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

      else
      {
        String regionStr = (String) regionId;
        String paramName = null;
        DataTypeItem paramType = null;
        ProcessVariable processVariable = null;

        if (regionStr.startsWith(REGION_PARAM_BY_TYPE))
        {
          paramType = (DataTypeItem) data.getTransferData(ClientFlavors.TYPE_ITEM);
          paramName = paramType.getName();
        }
        else if (regionStr.startsWith(REGION_PARAM_BY_VARIABLE))
        {
          processVariable = (ProcessVariable) data.getTransferData(ClientFlavors.PROCESS_VARIABLE);
          paramType = processVariable.getDataType();
          paramName = processVariable.getName();
          if (socket.getParamByName(paramName) != null)
          {
            String msg = "The socket already has a parameter named '" + paramName
              + "'.\nPlease connect the process variable to the existing parameter.";
            JMsgBox.show(null, msg, JMsgBox.ICON_ERROR);
View Full Code Here

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

    if (variables != null)
    {
      int n = variables.size();
      for (int i = 0; i < n; ++i)
      {
        ProcessVariable param = (ProcessVariable) variables.get(i);

        boolean isPersistent = param.isPersistentVariable();
        context.createProcessVariable(param.getName(), isPersistent);
      }
    }
  }
View Full Code Here

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

    if (variables != null)
    {
      int n = variables.size();
      for (int i = 0; i < n; ++i)
      {
        ProcessVariable param = (ProcessVariable) variables.get(i);

        int paramScope = param.getScope();
        if (scope == ProcessVariable.SCOPE_PROCESS && paramScope == ProcessVariable.SCOPE_PROCESS)
        {
          // We found a process-local parameter, remove it from the token context
          context.removeProcessVariableValue(param.getName());
        }
      }
    }
  }
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.