private void next(mxCell cell, List<String> task) {
    if (cell == null
        || StringUtils.equals(cell.getAttribute(ActivityGraphConverter.GRAPH_TYPE), "UserTask")) {

      return;
    }
    int count = cell.getEdgeCount();
    for (int i = 0; i < count; i++) {
      mxCell edge = (mxCell) cell.getEdgeAt(i);
      mxCell source = (mxCell) edge.getSource();
      mxCell target = (mxCell) edge.getTarget();
      mxCell next = null;
      if (target != null && target.getId().equals(cell.getId())) {
        continue;
      }
      if (target == null) {

        return;
      }
      if (StringUtils.equals(target.getAttribute(ActivityGraphConverter.GRAPH_TYPE), "UserTask")) {
        next(target, task);
      }
      task.add(ActivityGraphConverter.EDITOR_SHAPE_ID_PREFIX + target.getId());
    }
  }
Example #2
0
  /**
   * This method is called when the user has created manually an edge in the graph, by dragging a
   * link between two spot cells. It checks whether the matching edge in the model exists, and tune
   * what should be done accordingly.
   *
   * @param cell the mxCell of the edge that has been manually created.
   */
  protected void addEdgeManually(mxCell cell) {
    if (cell.isEdge()) {
      final mxIGraphModel graphModel = graph.getModel();
      cell.setValue("New");
      model.beginUpdate();
      graphModel.beginUpdate();
      try {

        Spot source = graph.getSpotFor(cell.getSource());
        Spot target = graph.getSpotFor(cell.getTarget());

        if (DEBUG) {
          System.out.println(
              "[TrackScheme] #addEdgeManually: edge is between 2 spots belonging to the same frame. Removing it.");
          System.out.println(
              "[TrackScheme] #addEdgeManually: adding edge between source "
                  + source
                  + " at frame "
                  + source.getFeature(Spot.FRAME).intValue()
                  + " and target "
                  + target
                  + " at frame "
                  + target.getFeature(Spot.FRAME).intValue());
        }

        if (Spot.frameComparator.compare(source, target) == 0) {
          // Prevent adding edges between spots that belong to the same frame

          if (DEBUG) {
            System.out.println(
                "[TrackScheme] addEdgeManually: edge is between 2 spots belonging to the same frame. Removing it.");
          }
          graph.removeCells(new Object[] {cell});

        } else {
          // We can add it to the model

          // Put them right in order: since we use a oriented graph,
          // we want the source spot to precede in time.
          if (Spot.frameComparator.compare(source, target) > 0) {

            if (DEBUG) {
              System.out.println(
                  "[TrackScheme] #addEdgeManually: Source "
                      + source
                      + " succeed target "
                      + target
                      + ". Inverting edge direction.");
            }

            Spot tmp = source;
            source = target;
            target = tmp;
          }
          // We add a new jGraphT edge to the underlying model, if it does not exist yet.
          DefaultWeightedEdge edge = model.getTrackModel().getEdge(source, target);
          if (null == edge) {
            edge = model.addEdge(source, target, -1);
            if (DEBUG) {
              System.out.println(
                  "[TrackScheme] #addEdgeManually: Creating new edge: " + edge + ".");
            }
          } else {
            // Ah. There was an existing edge in the model we were trying to re-add there, from the
            // graph.
            // We remove the graph edge we have added,
            if (DEBUG) {
              System.out.println("[TrackScheme] #addEdgeManually: Edge pre-existed. Retrieve it.");
            }
            graph.removeCells(new Object[] {cell});
            // And re-create a graph edge from the model edge.
            cell = graph.addJGraphTEdge(edge);
            cell.setValue(String.format("%.1f", model.getTrackModel().getEdgeWeight(edge)));
            // We also need now to check if the edge belonged to a visible track. If not,
            // we make it visible.
            int ID = model.getTrackModel().trackIDOf(edge);
            // This will work, because track indices will be reprocessed only after the
            // graphModel.endUpdate()
            // reaches 0. So now, it's like we are dealing with the track indices priori to
            // modification.
            if (model.getTrackModel().isVisible(ID)) {
              if (DEBUG) {
                System.out.println(
                    "[TrackScheme] #addEdgeManually: Track was visible. Do nothing.");
              }
            } else {
              if (DEBUG) {
                System.out.println(
                    "[TrackScheme] #addEdgeManually: Track was invisible. Make it visible.");
              }
              importTrack(ID);
            }
          }
          graph.mapEdgeToCell(edge, cell);
        }

      } finally {
        graphModel.endUpdate();
        model.endUpdate();
        selectionModel.clearEdgeSelection();
      }
    }
  }
  @Override
  public void propertyChange(PropertyChangeEvent event) {
    System.out.println("ktos mnie zawolal: " + event);
    tabbedPane.removeAll();

    if (event.getNewValue() instanceof XmlDocument) {
      final XmlDocument xmlDocument = (XmlDocument) event.getNewValue();

      JPanel generalPanel = new JPanel();

      GridBagLayout gridBagLayout = new GridBagLayout();
      generalPanel.setAlignmentY(Component.TOP_ALIGNMENT);
      generalPanel.setLayout(gridBagLayout);

      GridBagConstraints c = new GridBagConstraints();
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.LINE_START;
      c.gridx = 0;
      c.gridy = 0;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(new JLabel("Root element name: "), c);

      final JTextField rootElementName =
          new JTextField(
              xmlDocument.getRootElement() != null ? xmlDocument.getRootElement().getName() : "");
      rootElementName.addFocusListener(
          new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {}

            @Override
            public void focusLost(FocusEvent e) {
              xmlDocument.getRootElement().setName(rootElementName.getText());
            }
          });

      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(rootElementName, c);

      c.gridx = 0;
      c.gridy = 1;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(new JLabel("Encoding: "), c);

      final JTextField encoding =
          new JTextField(xmlDocument.getEncoding() != null ? xmlDocument.getEncoding() : "");
      encoding.addFocusListener(
          new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {}

            @Override
            public void focusLost(FocusEvent e) {
              xmlDocument.setEncoding(encoding.getText());
            }
          });

      c.gridx = 1;
      c.gridy = 1;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(encoding, c);

      c.gridx = 0;
      c.gridy = 2;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(new JLabel("Version: "), c);

      final JTextField version =
          new JTextField(xmlDocument.getVersion() != null ? xmlDocument.getVersion() : "");
      version.addFocusListener(
          new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {}

            @Override
            public void focusLost(FocusEvent e) {
              xmlDocument.setVersion(version.getText());
            }
          });

      c.gridx = 1;
      c.gridy = 2;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(version, c);

      c.gridx = 0;
      c.gridy = 3;
      c.gridwidth = 1;
      c.weighty = 1;
      generalPanel.add(new JPanel(), c);

      tabbedPane.addTab("General", null, generalPanel, "General options");

    } else if (event.getNewValue() instanceof XmlTag) {
      final XmlTag xmlTag = (XmlTag) event.getNewValue();
      JPanel generalPanel = new JPanel();

      GridBagLayout gridBagLayout = new GridBagLayout();
      generalPanel.setAlignmentY(Component.TOP_ALIGNMENT);
      generalPanel.setLayout(gridBagLayout);

      GridBagConstraints c = new GridBagConstraints();
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.LINE_START;
      c.gridx = 0;
      c.gridy = 0;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(new JLabel("Tag name: "), c);

      final JTextField tagName = new JTextField(xmlTag.getName());
      tagName.addFocusListener(
          new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {}

            @Override
            public void focusLost(FocusEvent e) {
              xmlTag.setName(tagName.getText());
            }
          });

      c.gridx = 1;
      c.gridy = 0;
      c.weightx = 1;
      c.weighty = 0.3;
      generalPanel.add(tagName, c);

      c.gridx = 0;
      c.gridy = 1;
      c.gridwidth = 2;
      c.weighty = 1;
      generalPanel.add(new JPanel(), c);

      tabbedPane.addTab("General", null, generalPanel, "General options");

      AttributesModel attributesModel = new AttributesModel(xmlTag);

      JTable attributesTable = new JTable(attributesModel);
      TableColumn columnName = attributesTable.getColumn("Name");
      columnName.setWidth(140);
      TableColumn columnValue = attributesTable.getColumn("Value");
      columnValue.setWidth(140);
      JPanel attrPanel = new JPanel(new BorderLayout());
      attrPanel.add(attributesTable.getTableHeader(), BorderLayout.PAGE_START);
      JScrollPane scrollPane = new JScrollPane(attributesTable);
      attrPanel.add(scrollPane, BorderLayout.CENTER);

      Schema schema = xmlTag.getSchema();
      String path = xmlTag.getPath();

      AvailableAttributesFinder aaf = new AvailableAttributesFinder(schema.getContent());
      Map<String, Boolean> availableAttributes = aaf.getAvailableAttributesForNode(path);

      attributesTable.addMouseListener(
          new AttributeTableClickListener(
              attributesTable, true, xmlTag.getSchemaType(), availableAttributes));
      scrollPane.addMouseListener(
          new AttributeTableClickListener(
              attributesTable, false, xmlTag.getSchemaType(), availableAttributes));

      tabbedPane.addTab("Attributes", null, attrPanel, "Attributes of this element");
      String text = ((XmlTag) event.getNewValue()).toString(0);

      JPanel textPanel = new JPanel();
      textPanel.setLayout(new GridLayout(0, 1));
      JTextArea textArea = new JTextArea(text);
      textArea.setEditable(false);
      textPanel.add(textArea);

      tabbedPane.addTab("Text", null, textPanel, "The text in the element");
    } else if (event.getNewValue() instanceof mxCell && ((mxCell) event.getNewValue()).isEdge()) {
      mxCell cell = (mxCell) event.getNewValue();
      mxICell source = cell.getSource();
      mxICell target = cell.getTarget();
      if (source != null
          && target != null
          && source.getParent() != null
          && target.getParent() != null) {
        XmlTag sourceTag = (XmlTag) source.getParent().getValue();
        XmlTag targetTag = (XmlTag) target.getParent().getValue();

        System.out.println(sourceTag + " -> " + targetTag);

        JPanel generalPanel = new JPanel();

        GridBagLayout gridBagLayout = new GridBagLayout();
        generalPanel.setAlignmentY(Component.TOP_ALIGNMENT);
        generalPanel.setLayout(gridBagLayout);

        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.HORIZONTAL;
        c.anchor = GridBagConstraints.LINE_START;
        c.gridx = 0;
        c.gridy = 0;
        c.weightx = 1;
        c.weighty = 0.3;
        generalPanel.add(new JLabel("Source tag name: "), c);

        final JTextField sourceTagName =
            new JTextField(sourceTag.getName() != null ? sourceTag.getName() : "");
        sourceTagName.setEditable(false);

        c.gridx = 1;
        c.gridy = 0;
        c.weightx = 1;
        c.weighty = 0.3;
        generalPanel.add(sourceTagName, c);

        c.gridx = 0;
        c.gridy = 1;
        c.weightx = 1;
        c.weighty = 0.3;
        generalPanel.add(new JLabel("Target tag name: "), c);

        final JTextField targetTagName =
            new JTextField(targetTag.getName() != null ? targetTag.getName() : "");
        targetTagName.setEditable(false);

        c.gridx = 1;
        c.gridy = 1;
        c.weightx = 1;
        c.weighty = 0.3;
        generalPanel.add(targetTagName, c);

        c.gridx = 0;
        c.gridy = 2;
        c.gridwidth = 1;
        c.weighty = 1;
        generalPanel.add(new JPanel(), c);

        tabbedPane.addTab("General", null, generalPanel, "General options");
      }
    }
  }
  private void getPreNextTask(mxCell cell, List<String> task, boolean next) {
    if (cell == null || cell.isEdge()) return;
    int count = cell.getEdgeCount();
    for (int i = 0; i < count; i++) {
      mxCell edge = (mxCell) cell.getEdgeAt(i);
      mxCell source = (mxCell) edge.getSource();
      mxCell target = (mxCell) edge.getTarget();
      mxCell preNext = null;
      if (next) {
        if (target != null && target.getId().equals(cell.getId())) {
          continue;
        }
        preNext = target;
      } else {
        if (source != null && source.getId().equals(cell.getId())) {
          mxCell sourceParent = (mxCell) source.getParent();
          if (!StringUtils.equals(
              sourceParent.getAttribute(ActivityGraphConverter.GRAPH_TYPE),
              ActivityGraphConverter.GRAPH_SUBPROCESS)) {
            continue;
          }
        }
        preNext = source;
        mxCell sourceParent = (mxCell) source.getParent();
        if (source != null
            && StringUtils.equals(
                source.getAttribute(ActivityGraphConverter.GRAPH_TYPE), "startEvent")
            && StringUtils.equals(
                sourceParent.getAttribute(ActivityGraphConverter.GRAPH_TYPE),
                ActivityGraphConverter.GRAPH_SUBPROCESS)) {
          preNext = sourceParent;
        }

        if (source == null
            && StringUtils.equals(
                cell.getAttribute(ActivityGraphConverter.GRAPH_TYPE), "startEvent")) {
          preNext = (mxCell) cell.getParent();
        }
      }
      if (preNext == null) return;

      //
      // if(StringUtils.equals(preNext.getAttribute(ActivityGraphConverter.GRAPH_TYPE),ActivityGraphConverter.GRAPH_SUBPROCESS)){
      //                int childCount=cell.getChildCount();
      //                for(int j=0;j<childCount;j++){
      //                    mxCell child=(mxCell)cell.getChildAt(j);
      //                    getPreNextTask(child,task,next);
      //                }
      //            }

      if (StringUtils.equals(
              preNext.getAttribute(ActivityGraphConverter.GRAPH_TYPE),
              ActivityGraphConverter.GRAPH_GATEWAY)
          || StringUtils.equals(
              preNext.getAttribute(ActivityGraphConverter.GRAPH_TYPE),
              ActivityGraphConverter.GRAPH_SUBPROCESS)) {
        getPreNextTask(preNext, task, next);
      } else {
        task.add(ActivityGraphConverter.EDITOR_SHAPE_ID_PREFIX + preNext.getId());
      }
    }
  }
  @Override
  public AbstractMeta decode(String graphXml) throws Exception {
    mxGraph graph = new mxGraph();
    mxCodec codec = new mxCodec();
    Document doc = mxUtils.parseXml(graphXml);
    codec.decode(doc.getDocumentElement(), graph.getModel());
    mxCell root = (mxCell) graph.getDefaultParent();

    TransMeta transMeta = new TransMeta();
    decodeCommRootAttr(root, transMeta);
    transMeta.setTransstatus(Const.toInt(root.getAttribute("trans_status"), -1));
    transMeta.setTransversion(root.getAttribute("trans_version"));

    if (transMeta.getRepository() != null)
      transMeta.setSharedObjects(transMeta.getRepository().readTransSharedObjects(transMeta));
    else transMeta.setSharedObjects(transMeta.readSharedObjects());

    transMeta.importFromMetaStore();

    decodeDatabases(root, transMeta);
    decodeNote(graph, transMeta);

    int count = graph.getModel().getChildCount(root);
    for (int i = 0; i < count; i++) {
      mxCell cell = (mxCell) graph.getModel().getChildAt(root, i);
      if (cell.isVertex()) {
        Element e = (Element) cell.getValue();
        if (PropsUI.TRANS_STEP_NAME.equals(e.getTagName())) {
          StepDecoder stepDecoder = (StepDecoder) PluginFactory.getBean(cell.getAttribute("ctype"));
          StepMeta stepMeta =
              stepDecoder.decodeStep(cell, transMeta.getDatabases(), transMeta.getMetaStore());
          stepMeta.setParentTransMeta(transMeta);
          if (stepMeta.isMissing()) {
            transMeta.addMissingTrans((MissingTrans) stepMeta.getStepMetaInterface());
          }

          StepMeta check = transMeta.findStep(stepMeta.getName());
          if (check != null) {
            if (!check.isShared()) {
              // Don't overwrite shared objects
              transMeta.addOrReplaceStep(stepMeta);
            } else {
              check.setDraw(stepMeta.isDrawn()); // Just keep the  drawn flag  and location
              check.setLocation(stepMeta.getLocation());
            }
          } else {
            transMeta.addStep(stepMeta); // simply add it.
          }
        }
      }
    }

    // Have all StreamValueLookups, etc. reference the correct source steps...
    //
    for (int i = 0; i < transMeta.nrSteps(); i++) {
      StepMeta stepMeta = transMeta.getStep(i);
      StepMetaInterface sii = stepMeta.getStepMetaInterface();
      if (sii != null) {
        sii.searchInfoAndTargetSteps(transMeta.getSteps());
      }
    }

    count = graph.getModel().getChildCount(root);
    for (int i = 0; i < count; i++) {
      mxCell cell = (mxCell) graph.getModel().getChildAt(root, i);
      if (cell.isEdge()) {
        mxCell source = (mxCell) cell.getSource();
        mxCell target = (mxCell) cell.getTarget();

        TransHopMeta hopinf = new TransHopMeta(null, null, true);
        String[] stepNames = transMeta.getStepNames();
        for (int j = 0; j < stepNames.length; j++) {
          if (stepNames[j].equalsIgnoreCase(source.getAttribute("label")))
            hopinf.setFromStep(transMeta.getStep(j));
          if (stepNames[j].equalsIgnoreCase(target.getAttribute("label")))
            hopinf.setToStep(transMeta.getStep(j));
        }
        transMeta.addTransHop(hopinf);
      }
    }

    JSONObject jsonObject = JSONObject.fromObject(root.getAttribute("transLogTable"));
    TransLogTable transLogTable = transMeta.getTransLogTable();
    transLogTable.setConnectionName(jsonObject.optString("connection"));
    transLogTable.setSchemaName(jsonObject.optString("schema"));
    transLogTable.setTableName(jsonObject.optString("table"));
    transLogTable.setLogSizeLimit(jsonObject.optString("size_limit_lines"));
    transLogTable.setLogInterval(jsonObject.optString("interval"));
    transLogTable.setTimeoutInDays(jsonObject.optString("timeout_days"));
    JSONArray jsonArray = jsonObject.optJSONArray("fields");
    if (jsonArray != null) {
      for (int i = 0; i < jsonArray.size(); i++) {
        JSONObject fieldJson = jsonArray.getJSONObject(i);
        String id = fieldJson.optString("id");
        LogTableField field = transLogTable.findField(id);
        if (field == null) {
          field = transLogTable.getFields().get(i);
        }
        if (field != null) {
          field.setFieldName(fieldJson.optString("name"));
          field.setEnabled(fieldJson.optBoolean("enabled"));
          field.setSubject(StepMeta.findStep(transMeta.getSteps(), fieldJson.optString("subject")));
        }
      }
    }

    jsonObject = JSONObject.fromObject(root.getAttribute("stepLogTable"));
    StepLogTable stepLogTable = transMeta.getStepLogTable();
    stepLogTable.setConnectionName(jsonObject.optString("connection"));
    stepLogTable.setSchemaName(jsonObject.optString("schema"));
    stepLogTable.setTableName(jsonObject.optString("table"));
    stepLogTable.setTimeoutInDays(jsonObject.optString("timeout_days"));
    jsonArray = jsonObject.optJSONArray("fields");
    if (jsonArray != null) {
      for (int i = 0; i < jsonArray.size(); i++) {
        JSONObject fieldJson = jsonArray.getJSONObject(i);
        String id = fieldJson.optString("id");
        LogTableField field = stepLogTable.findField(id);
        if (field == null && i < stepLogTable.getFields().size()) {
          field = stepLogTable.getFields().get(i);
        }
        if (field != null) {
          field.setFieldName(fieldJson.optString("name"));
          field.setEnabled(fieldJson.optBoolean("enabled"));
        }
      }
    }

    jsonObject = JSONObject.fromObject(root.getAttribute("performanceLogTable"));
    PerformanceLogTable performanceLogTable = transMeta.getPerformanceLogTable();
    performanceLogTable.setConnectionName(jsonObject.optString("connection"));
    performanceLogTable.setSchemaName(jsonObject.optString("schema"));
    performanceLogTable.setTableName(jsonObject.optString("table"));
    performanceLogTable.setLogInterval(jsonObject.optString("interval"));
    performanceLogTable.setTimeoutInDays(jsonObject.optString("timeout_days"));
    jsonArray = jsonObject.optJSONArray("fields");
    if (jsonArray != null) {
      for (int i = 0; i < jsonArray.size(); i++) {
        JSONObject fieldJson = jsonArray.getJSONObject(i);
        String id = fieldJson.optString("id");
        LogTableField field = performanceLogTable.findField(id);
        if (field == null && i < performanceLogTable.getFields().size()) {
          field = performanceLogTable.getFields().get(i);
        }
        if (field != null) {
          field.setFieldName(fieldJson.optString("name"));
          field.setEnabled(fieldJson.optBoolean("enabled"));
        }
      }
    }

    jsonObject = JSONObject.fromObject(root.getAttribute("metricsLogTable"));
    MetricsLogTable metricsLogTable = transMeta.getMetricsLogTable();
    metricsLogTable.setConnectionName(jsonObject.optString("connection"));
    metricsLogTable.setSchemaName(jsonObject.optString("schema"));
    metricsLogTable.setTableName(jsonObject.optString("table"));
    metricsLogTable.setTimeoutInDays(jsonObject.optString("timeout_days"));
    jsonArray = jsonObject.optJSONArray("fields");
    if (jsonArray != null) {
      for (int i = 0; i < jsonArray.size(); i++) {
        JSONObject fieldJson = jsonArray.getJSONObject(i);
        String id = fieldJson.optString("id");
        LogTableField field = metricsLogTable.findField(id);
        if (field == null && i < metricsLogTable.getFields().size()) {
          field = metricsLogTable.getFields().get(i);
        }
        if (field != null) {
          field.setFieldName(fieldJson.optString("name"));
          field.setEnabled(fieldJson.optBoolean("enabled"));
        }
      }
    }

    jsonArray = JSONArray.fromObject(root.getAttribute("partitionschemas"));
    for (int i = 0; i < jsonArray.size(); i++) {
      jsonObject = jsonArray.getJSONObject(i);
      PartitionSchema partitionSchema = decodePartitionSchema(jsonObject);
      PartitionSchema check = transMeta.findPartitionSchema(partitionSchema.getName());
      if (check != null) {
        if (!check.isShared()) {
          transMeta.addOrReplacePartitionSchema(partitionSchema);
        }
      } else {
        transMeta.getPartitionSchemas().add(partitionSchema);
      }
    }

    decodeSlaveServers(root, transMeta);

    jsonArray = JSONArray.fromObject(root.getAttribute("clusterSchemas"));
    for (int i = 0; i < jsonArray.size(); i++) {
      jsonObject = jsonArray.getJSONObject(i);
      ClusterSchema clusterSchema = decodeClusterSchema(jsonObject, transMeta.getSlaveServers());
      clusterSchema.shareVariablesWith(transMeta);

      ClusterSchema check = transMeta.findClusterSchema(clusterSchema.getName());
      if (check != null) {
        if (!check.isShared()) {
          transMeta.addOrReplaceClusterSchema(clusterSchema);
        }
      } else {
        transMeta.getClusterSchemas().add(clusterSchema);
      }
    }

    for (int i = 0; i < transMeta.nrSteps(); i++) {
      transMeta.getStep(i).setClusterSchemaAfterLoading(transMeta.getClusterSchemas());
    }

    transMeta.setSizeRowset(Const.toInt(root.getAttribute("size_rowset"), Const.ROWS_IN_ROWSET));
    transMeta.setSleepTimeEmpty(
        Const.toInt(root.getAttribute("sleep_time_empty"), Const.TIMEOUT_GET_MILLIS));
    transMeta.setSleepTimeFull(
        Const.toInt(root.getAttribute("sleep_time_full"), Const.TIMEOUT_PUT_MILLIS));
    transMeta.setUsingUniqueConnections(
        "Y".equalsIgnoreCase(root.getAttribute("unique_connections")));

    transMeta.setFeedbackShown(!"N".equalsIgnoreCase(root.getAttribute("feedback_shown")));
    transMeta.setFeedbackSize(Const.toInt(root.getAttribute("feedback_size"), Const.ROWS_UPDATE));
    transMeta.setUsingThreadPriorityManagment(
        !"N".equalsIgnoreCase(root.getAttribute("using_thread_priorities")));

    transMeta.setCapturingStepPerformanceSnapShots(
        "Y".equalsIgnoreCase(root.getAttribute("capture_step_performance")));
    transMeta.setStepPerformanceCapturingDelay(
        Const.toLong(root.getAttribute("step_performance_capturing_delay"), 1000));
    transMeta.setStepPerformanceCapturingSizeLimit(
        root.getAttribute("step_performance_capturing_size_limit"));

    transMeta.setKey(XMLHandler.stringToBinary(root.getAttribute("key_for_session_key")));
    transMeta.setPrivateKey("Y".equals(root.getAttribute("is_key_private")));

    return transMeta;
  }