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

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


    VariablesContainer container = (VariablesContainer) editedObject;

    for (Iterator it = container.getProcessVariables(); it.hasNext();)
    {
      ProcessVariable param = (ProcessVariable) it.next();
      param.maintainReferences(ModelObject.VALIDATE_BASIC | ModelObject.RESOLVE_GLOBAL_REFS);
    }

    checkNameUniqueness(container);

    // Print errors and return if any have been found
View Full Code Here


  {
    List invalidNames = new ArrayList();

    for (Iterator it = container.getProcessVariables(); it.hasNext();)
    {
      ProcessVariable param = (ProcessVariable) it.next();

      String name = param.getName();
      if (name != null && ! invalidNames.contains(name) && countNamedParams(container, name) > 1)
      {
        invalidNames.add(name);
        param.getModelMgr().getMsgContainer().addMsg(param, "An element with this name already exists.");
      }
    }
  }
View Full Code Here

  {
    int count = 0;

    for (Iterator it = container.getProcessVariables(); it.hasNext();)
    {
      ProcessVariable param = (ProcessVariable) it.next();

      if (name.equals(param.getName()))
        ++count;
    }

    return count;
  }
View Full Code Here

      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

  {
    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

  {
    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

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

      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

      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

      {
        // 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

TOP

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

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.