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

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


   * @param node Node to copy the properties to
   * @param patternSocket Pattern socket
   */
  private static void copySocketPropertiesToNode(SingleSocketNode node, NodeSocket patternSocket)
  {
    ProcessItem process = patternSocket.getProcess();

    // Copy name etc. from the given socket
    node.setName(patternSocket.getName());
    node.setDisplayName(patternSocket.getDisplayName());
    node.setDescription(patternSocket.getDescription());

    // Make sure it has a name unique among all nodes of the process
    NamedObjectCollectionUtil.createUniqueName(node, process.getNodeList());

    NodeSocket socket = node.getSocket();

    // Copy the parameters of the given socket to the socket of the node
    for (Iterator it = patternSocket.getParams(); it.hasNext();)
View Full Code Here


        }

        if (o instanceof ProcessItem)
        {
          // Open the process
          ProcessItem process = (ProcessItem) o;
          addModelerView(process, oe.isReadonly());

          if (qualifier != null && qualifier.getObjectPath() != null)
          {
            ModelerPage.this.fireEvent(new QualifierEvent(ModelerPage.this, "modeler.view.select", qualifier));
View Full Code Here

        }

        if (! success && content.isDataFlavorSupported(ClientFlavors.PROCESS_ITEM))
        {
          // We need to copy the process from the clipboard, since we are about to modify it.
          ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.PROCESS_ITEM);
          success = pasteProcess(source);
        }
      }

      if (! success && content.isDataFlavorSupported(ClientFlavors.NODE_SOCKETS))
      {
        // The clipboard contains node sockets
        ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.NODE_SOCKETS);
        success = pasteSockets(source);
      }

      if (! success && content.isDataFlavorSupported(ClientFlavors.NODE_PARAMS))
      {
        // The clipboard contains node socket parameters
        ProcessItem source = (ProcessItem) content.getTransferData(ClientFlavors.NODE_PARAMS);
        success = pasteParams(source);
      }

      workspaceView.repairDamage();
View Full Code Here

    // Repair any references of the clone
    source.maintainReferences(ModelObject.RESOLVE_GLOBAL_REFS | ModelObject.RESOLVE_LOCAL_REFS);

    // We will copy to our target process
    ProcessDrawing drawing = (ProcessDrawing) workspaceView.drawing();
    ProcessItem target = drawing.getProcess();

    // Make sure the references names of the target are up to date
    target.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES | ModelObject.SYNC_GLOBAL_REFNAMES);

    // We need to make the names in the source process unique with respect to our target process
    NamedObjectCollectionUtil.createUniqueNames(source.getNodeList(), target.getNodeList());
    NamedObjectCollectionUtil.createUniqueNames(source.getTextElementList(), target.getTextElementList());
    NamedObjectCollectionUtil.createUniqueNames(source.getDataLinkList(), target.getDataLinkList());
    NamedObjectCollectionUtil.createUniqueNames(source.getControlLinkList(), target.getControlLinkList());

    // Update the reference names according to the changed object names
    source.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

    Figure firstFigure = null;

    // Add the nodes to the target process
    for (Iterator it = source.getNodes(); it.hasNext();)
    {
      Node node = (Node) it.next();

      target.addNode(node);

      // Rebuild the references after adding the object to the target
      node.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES);

      NodeFigure nodeFigure = drawing.createNodeFigure(node);
      if (nodeFigure == null)
      {
        target.removeNode(node);
        continue;
      }

      if (firstFigure == null)
        firstFigure = nodeFigure;

      workspaceView.add(nodeFigure);
      workspaceView.addToSelection(nodeFigure);

      // Position the new node within the process drawing so that it doesn't hide an existing figure
      ModelerUtil.preventOverlap(drawing, nodeFigure);
    }

    // Add the text elements to the target process
    for (Iterator it = source.getTextElements(); it.hasNext();)
    {
      TextElement textElement = (TextElement) it.next();

      target.addTextElement(textElement);

      // Rebuild the references after adding the object to the target
      textElement.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES);

      TextElementFigure textElementFigure = drawing.createTextElementFigure(textElement);
      if (textElementFigure == null)
      {
        target.removeTextElement(textElement);
        continue;
      }

      if (firstFigure == null)
        firstFigure = textElementFigure;

      workspaceView.add(textElementFigure);
      workspaceView.addToSelection(textElementFigure);

      // Position the new element within the process drawing so that it doesn't hide an existing figure
      ModelerUtil.preventOverlap(drawing, textElementFigure);
    }

    // Add the control links
    for (Iterator it = source.getControlLinks(); it.hasNext();)
    {
      ControlLink link = (ControlLink) it.next();

      target.addControlLink(link);

      // Determine the reference names after adding the object to the target
      link.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

      FlowConnection flowConnection = drawing.createFlowConnection(link);
      if (flowConnection == null)
      {
        target.removeControlLink(link);
        continue;
      }

      workspaceView.add(flowConnection);
      workspaceView.addToSelection(flowConnection);
    }

    // Add the data links
    for (Iterator it = source.getDataLinks(); it.hasNext();)
    {
      DataLink link = (DataLink) it.next();

      target.addDataLink(link);

      // Determine the reference names after adding the object to the target
      link.maintainReferences(ModelObject.SYNC_LOCAL_REFNAMES);

      ParamConnection paramConnection = drawing.createParamConnection(link);
      if (paramConnection == null)
      {
        target.removeDataLink(link);
        continue;
      }

      workspaceView.add(paramConnection);
      workspaceView.addToSelection(paramConnection);
View Full Code Here

    }

    // Copy title and description from the WF processs to the new task
    if (entrySocket != null)
    {
      ProcessItem workflowProcess = entrySocket.getProcess();
      task.setDisplayName(workflowProcess.getDisplayName());
      task.setDescription(workflowProcess.getDescription());

      // Inspect the parameters of the given initial node if we should assign
      // any of these to properties of the new workflow task object.
      if (context != null)
      {
View Full Code Here

    {
      qualifier.setItemType(ItemTypes.PROCESS);

      try
      {
        ProcessItem process = (ProcessItem) modelMgr.getItemByQualifier(qualifier, true);

        String objectPath = qualifier.getObjectPath();
        if (objectPath != null)
        {
          String nodeName = null;
          String socketName = null;

          int i = objectPath.indexOf(ModelQualifier.OBJECT_DELIMITER_CHAR);
          if (i >= 0)
          {
            nodeName = objectPath.substring(0, i);
            socketName = objectPath.substring(i + 1);

            Node node = process.getNodeByName(nodeName);

            return node != null ? node.getSocketByName(socketName) : null;
          }
        }
      }
View Full Code Here

  // TODO Feature 6 Method currently not used, should be private then, is protected to prevent compiler warning
  protected void substitutePlaceholderNode(Node newNode, boolean newNodeFlag)
  {
    // TODO Feature 6: Placeholder substitution: Implement
    ProcessDrawing drawing = getDrawing();
    ProcessItem process = drawing.getProcess();

    // Save any geometry changes
    drawing.encodeGeometry();

    drawing.getEditor().startUndo("Replace placeholder");

    // Add the new node to the process
    process.addNode(node);
    node.maintainReferences(ModelObject.SYNC_GLOBAL_REFNAMES | ModelObject.SYNC_LOCAL_REFNAMES);

    // Try to connect the control and data links from/to the placeholder to the new node

    // If the orientation of the new node figure and the drawing don't match,
View Full Code Here

        nextSocket = nextNode.getDefaultExitSocket();
      }

      if (nextSocket == null)
      {
        ProcessItem process = exitSocket.getNode().getProcess();
        String msg = LogUtil.error(getClass(),
          "Unconnected socket encountered and no $0 initial node present in process $1 (current position: $2). [{3}]", new Object[]
          {
            nextName, process.getQualifier(), exitSocket.getQualifier(), context
          });
        throw new EngineException("UnconnectedSocket", msg);
      }

      // Copy the data of the current exit socket to the newly determined exit socket
View Full Code Here

   */
  private void checkGlobalLinks(NodeParam param)
  {
    boolean foundLink = false;

    ProcessItem process = param.getProcess();

    for (Iterator itVar = process.getProcessVariables(); itVar.hasNext();)
    {
      ProcessVariable global = (ProcessVariable) itVar.next();

      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;
        }
      }
    }

    if (! foundLink)
    {
      // Try process variable auto-assignment
      ProcessVariable var = process.getProcessVariableByName(param.getName());
      if (var != null)
      {
        if (var.isAutoAssign())
        {
          Object value = context.getProcessVariableValue(param.getName());
View Full Code Here

{
  public List findModelObjectInModel(ModelObject mo, Model model)
  {
    List foundReferences = new ArrayList();
    InitialNode entry = (InitialNode) mo;
    ProcessItem process = entry.getProcess();
    Iterator modelProcess = model.getItems(ItemTypes.PROCESS);
    while (modelProcess.hasNext())
    {
      ProcessItem pi = (ProcessItem) modelProcess.next();
      foundReferences.addAll(findInProcess(process, entry, pi));
    }
    return foundReferences;
  }
View Full Code Here

TOP

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

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.