Esempio n. 1
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {

      urlInField = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "url_in_field"));
      urlFieldname = XMLHandler.getTagValue(stepnode, "url_field_name");
      includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));
      rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
      includeUrl = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include_url"));
      urlField = XMLHandler.getTagValue(stepnode, "url_Field");
      readfrom = XMLHandler.getTagValue(stepnode, "read_from");
      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrFields = XMLHandler.countNodes(fields, "field");
      Node urlnode = XMLHandler.getSubNode(stepnode, "urls");
      int nrUrls = XMLHandler.countNodes(urlnode, "url");
      allocate(nrUrls, nrFields);
      for (int i = 0; i < nrUrls; i++) {
        Node urlnamenode = XMLHandler.getSubNodeByNr(urlnode, "url", i);
        url[i] = XMLHandler.getNodeValue(urlnamenode);
      }

      for (int i = 0; i < nrFields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
        RssInputField field = new RssInputField(fnode);
        inputFields[i] = field;
      }

      // Is there a limit on the number of rows we process?
      rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, "limit"), 0L);
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
Esempio n. 2
0
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String csize;
      int nrkeys, nrvalues;

      String con = XMLHandler.getTagValue(stepnode, "connection");
      databaseMeta = DatabaseMeta.findDatabase(databases, con);
      csize = XMLHandler.getTagValue(stepnode, "commit");
      commitSize = (csize != null) ? csize : "0";
      schemaName = XMLHandler.getTagValue(stepnode, "lookup", "schema");
      tableName = XMLHandler.getTagValue(stepnode, "lookup", "table");
      updateBypassed = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "update_bypassed"));

      Node lookup = XMLHandler.getSubNode(stepnode, "lookup");
      nrkeys = XMLHandler.countNodes(lookup, "key");
      nrvalues = XMLHandler.countNodes(lookup, "value");

      allocate(nrkeys, nrvalues);

      for (int i = 0; i < nrkeys; i++) {
        Node knode = XMLHandler.getSubNodeByNr(lookup, "key", i);

        keyStream[i] = XMLHandler.getTagValue(knode, "name");
        keyLookup[i] = XMLHandler.getTagValue(knode, "field");
        keyCondition[i] = XMLHandler.getTagValue(knode, "condition");
        if (keyCondition[i] == null) {
          keyCondition[i] = "=";
        }
        keyStream2[i] = XMLHandler.getTagValue(knode, "name2");
      }

      for (int i = 0; i < nrvalues; i++) {
        Node vnode = XMLHandler.getSubNodeByNr(lookup, "value", i);

        updateLookup[i] = XMLHandler.getTagValue(vnode, "name");
        updateStream[i] = XMLHandler.getTagValue(vnode, "rename");
        if (updateStream[i] == null) {
          updateStream[i] = updateLookup[i]; // default: the same name!
        }
        String updateValue = XMLHandler.getTagValue(vnode, "update");
        if (updateValue == null) {
          // default TRUE
          update[i] = Boolean.TRUE;
        } else {
          if (updateValue.equalsIgnoreCase("Y")) {
            update[i] = Boolean.TRUE;
          } else {
            update[i] = Boolean.FALSE;
          }
        }
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "InsertUpdateMeta.Exception.UnableToReadStepInfoFromXML"), e);
    }
  }
Esempio n. 3
0
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      databaseMeta =
          DatabaseMeta.findDatabase(databases, XMLHandler.getTagValue(stepnode, "connection"));

      String functionName = XMLHandler.getTagValue(stepnode, XML_TAG_FUNCTION, "name");
      String functionDescription =
          XMLHandler.getTagValue(stepnode, XML_TAG_FUNCTION, "description");
      String functionGroup = XMLHandler.getTagValue(stepnode, XML_TAG_FUNCTION, "group");
      String functionApplication =
          XMLHandler.getTagValue(stepnode, XML_TAG_FUNCTION, "application");
      String functionHost = XMLHandler.getTagValue(stepnode, XML_TAG_FUNCTION, "host");

      if (!Const.isEmpty(functionName)) {
        function =
            new SAPFunction(
                functionName,
                functionDescription,
                functionGroup,
                functionApplication,
                functionHost);
      } else {
        function = null;
      }

      Node paramsNode = XMLHandler.getSubNode(stepnode, XML_TAG_PARAMETERS);
      int nrParameters = XMLHandler.countNodes(paramsNode, XML_TAG_PARAMETER);
      for (int i = 0; i < nrParameters; i++) {
        Node paramNode = XMLHandler.getSubNodeByNr(paramsNode, XML_TAG_PARAMETER, i);
        String fieldName = XMLHandler.getTagValue(paramNode, "field_name");
        SapType sapType = SapType.findTypeForCode(XMLHandler.getTagValue(paramNode, "sap_type"));
        String tableName = XMLHandler.getTagValue(paramNode, "table_name");
        int targetType = ValueMeta.getType(XMLHandler.getTagValue(paramNode, "target_type"));
        String parameterName = XMLHandler.getTagValue(paramNode, "parameter_name");
        parameters.add(new SapParameter(fieldName, sapType, tableName, parameterName, targetType));
      }

      Node fieldsNode = XMLHandler.getSubNode(stepnode, XML_TAG_FIELDS);
      int nrFields = XMLHandler.countNodes(fieldsNode, XML_TAG_FIELD);
      for (int i = 0; i < nrFields; i++) {
        Node fieldNode = XMLHandler.getSubNodeByNr(fieldsNode, XML_TAG_FIELD, i);
        String sapFieldName = XMLHandler.getTagValue(fieldNode, "field_name");
        SapType sapType = SapType.findTypeForCode(XMLHandler.getTagValue(fieldNode, "sap_type"));
        String tableName = XMLHandler.getTagValue(fieldNode, "table_name");
        int targetType = ValueMeta.getType(XMLHandler.getTagValue(fieldNode, "target_type"));
        String newName = XMLHandler.getTagValue(fieldNode, "new_name");
        outputFields.add(new SapOutputField(sapFieldName, sapType, tableName, newName, targetType));
      }

    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
Esempio n. 4
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      passAllRows = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "all_rows"));
      aggregateIgnored = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignore_aggregate"));
      aggregateIgnoredField = XMLHandler.getTagValue(stepnode, "field_ignore");

      directory = XMLHandler.getTagValue(stepnode, "directory");
      prefix = XMLHandler.getTagValue(stepnode, "prefix");

      addingLineNrInGroup = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "add_linenr"));
      lineNrInGroupField = XMLHandler.getTagValue(stepnode, "linenr_fieldname");

      Node groupn = XMLHandler.getSubNode(stepnode, "group");
      Node fields = XMLHandler.getSubNode(stepnode, "fields");

      int sizegroup = XMLHandler.countNodes(groupn, "field");
      int nrfields = XMLHandler.countNodes(fields, "field");

      allocate(sizegroup, nrfields);

      for (int i = 0; i < sizegroup; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(groupn, "field", i);
        groupField[i] = XMLHandler.getTagValue(fnode, "name");
      }

      boolean hasNumberOfValues = false;
      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
        aggregateField[i] = XMLHandler.getTagValue(fnode, "aggregate");
        subjectField[i] = XMLHandler.getTagValue(fnode, "subject");
        aggregateType[i] = getType(XMLHandler.getTagValue(fnode, "type"));

        if (aggregateType[i] == TYPE_GROUP_COUNT_ALL
            || aggregateType[i] == TYPE_GROUP_COUNT_DISTINCT
            || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
          hasNumberOfValues = true;
        }

        valueField[i] = XMLHandler.getTagValue(fnode, "valuefield");
      }

      String giveBackRow = XMLHandler.getTagValue(stepnode, "give_back_row");
      if (Utils.isEmpty(giveBackRow)) {
        alwaysGivingBackOneRow = hasNumberOfValues;
      } else {
        alwaysGivingBackOneRow = "Y".equalsIgnoreCase(giveBackRow);
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "GroupByMeta.Exception.UnableToLoadStepInfoFromXML"), e);
    }
  }
Esempio n. 5
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      keyField = XMLHandler.getTagValue(stepnode, "key_field"); // $NON-NLS-1$

      Node groupn = XMLHandler.getSubNode(stepnode, "group"); // $NON-NLS-1$
      Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$

      int sizegroup = XMLHandler.countNodes(groupn, "field"); // $NON-NLS-1$
      int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$

      allocate(sizegroup, nrfields);

      for (int i = 0; i < sizegroup; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(groupn, "field", i); // $NON-NLS-1$
        groupField[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$
      }

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$
        denormaliserTargetField[i] = new DenormaliserTargetField();
        denormaliserTargetField[i].setFieldName(
            XMLHandler.getTagValue(fnode, "field_name")); // $NON-NLS-1$
        denormaliserTargetField[i].setKeyValue(
            XMLHandler.getTagValue(fnode, "key_value")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetName(
            XMLHandler.getTagValue(fnode, "target_name")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetType(
            XMLHandler.getTagValue(fnode, "target_type")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetFormat(
            XMLHandler.getTagValue(fnode, "target_format")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetLength(
            Const.toInt(XMLHandler.getTagValue(fnode, "target_length"), -1)); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetPrecision(
            Const.toInt(XMLHandler.getTagValue(fnode, "target_precision"), -1)); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetDecimalSymbol(
            XMLHandler.getTagValue(fnode, "target_decimal_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetGroupingSymbol(
            XMLHandler.getTagValue(fnode, "target_grouping_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetCurrencySymbol(
            XMLHandler.getTagValue(fnode, "target_currency_symbol")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetNullString(
            XMLHandler.getTagValue(fnode, "target_null_string")); // $NON-NLS-1$
        denormaliserTargetField[i].setTargetAggregationType(
            XMLHandler.getTagValue(fnode, "target_aggregation_type")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "DenormaliserMeta.Exception.UnableToLoadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
  public void loadXML(
      Node entrynode,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers,
      Repository rep,
      IMetaStore metaStore)
      throws KettleXMLException {
    try {
      super.loadXML(entrynode, databases, slaveServers);
      replaceVars = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "replacevars"));

      filename = XMLHandler.getTagValue(entrynode, "filename");
      fileVariableType = getVariableType(XMLHandler.getTagValue(entrynode, "file_variable_type"));

      Node fields = XMLHandler.getSubNode(entrynode, "fields");
      // How many field variableName?
      int nrFields = XMLHandler.countNodes(fields, "field");
      variableName = new String[nrFields];
      variableValue = new String[nrFields];
      variableType = new int[nrFields];

      // Read them all...
      for (int i = 0; i < nrFields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        variableName[i] = XMLHandler.getTagValue(fnode, "variable_name");
        variableValue[i] = XMLHandler.getTagValue(fnode, "variable_value");
        variableType[i] = getVariableType(XMLHandler.getTagValue(fnode, "variable_type"));
      }
    } catch (KettleXMLException xe) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "JobEntrySetVariables.Meta.UnableLoadXML", xe.getMessage()),
          xe);
    }
  }
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      directory = XMLHandler.getTagValue(stepnode, "directory");
      prefix = XMLHandler.getTagValue(stepnode, "prefix");
      sortSize = XMLHandler.getTagValue(stepnode, "sort_size");
      freeMemoryLimit = XMLHandler.getTagValue(stepnode, "free_memory");
      compressFiles = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "compress"));
      compressFilesVariable = XMLHandler.getTagValue(stepnode, "compress_variable");
      onlyPassingUniqueRows = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "unique_rows"));

      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrfields = XMLHandler.countNodes(fields, "field");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        fieldName[i] = XMLHandler.getTagValue(fnode, "name");
        String asc = XMLHandler.getTagValue(fnode, "ascending");
        ascending[i] = "Y".equalsIgnoreCase(asc);
        String sens = XMLHandler.getTagValue(fnode, "case_sensitive");
        String coll = XMLHandler.getTagValue(fnode, "collator_enabled");
        caseSensitive[i] = Const.isEmpty(sens) || "Y".equalsIgnoreCase(sens);
        collatorEnabled[i] = Const.isEmpty(coll) || "Y".equalsIgnoreCase(coll);
        collatorStrength[i] = Integer.parseInt(XMLHandler.getTagValue(fnode, "collator_strength"));
        String presorted = XMLHandler.getTagValue(fnode, "presorted");
        preSortedField[i] = "Y".equalsIgnoreCase(presorted);
      }
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
  public void loadXML(
      Node entrynode,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers,
      Repository rep,
      IMetaStore metaStore)
      throws KettleXMLException {
    try {
      super.loadXML(entrynode, databases, slaveServers);
      argFromPrevious =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "arg_from_previous"));
      includeSubfolders =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "include_subfolders"));

      Node fields = XMLHandler.getSubNode(entrynode, "fields");

      // How many field arguments?
      int nrFields = XMLHandler.countNodes(fields, "field");
      allocate(nrFields);

      // Read them all...
      for (int i = 0; i < nrFields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        arguments[i] = XMLHandler.getTagValue(fnode, "name");
        filemasks[i] = XMLHandler.getTagValue(fnode, "filemask");
      }
    } catch (KettleXMLException xe) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "JobEntryCheckFilesLocked.UnableToLoadFromXml"), xe);
    }
  }
Esempio n. 9
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrfields = XMLHandler.countNodes(fields, "field");

      allocate(nrfields);

      String slength, sprecision;

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        fieldName[i] = XMLHandler.getTagValue(fnode, "name");
        fieldType[i] = XMLHandler.getTagValue(fnode, "type");
        fieldFormat[i] = XMLHandler.getTagValue(fnode, "format");
        currency[i] = XMLHandler.getTagValue(fnode, "currency");
        decimal[i] = XMLHandler.getTagValue(fnode, "decimal");
        group[i] = XMLHandler.getTagValue(fnode, "group");
        value[i] = XMLHandler.getTagValue(fnode, "nullif");
        slength = XMLHandler.getTagValue(fnode, "length");
        sprecision = XMLHandler.getTagValue(fnode, "precision");

        fieldLength[i] = Const.toInt(slength, -1);
        fieldPrecision[i] = Const.toInt(sprecision, -1);
        String emptyString = XMLHandler.getTagValue(fnode, "set_empty_string");
        setEmptyString[i] = !Const.isEmpty(emptyString) && "Y".equalsIgnoreCase(emptyString);
      }

      // Is there a limit on the number of rows we process?
      rowLimit = XMLHandler.getTagValue(stepnode, "limit");
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
Esempio n. 10
0
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String csize;
      int nrkeys;

      String con = XMLHandler.getTagValue(stepnode, "connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, con);
      csize = XMLHandler.getTagValue(stepnode, "commit"); // $NON-NLS-1$
      commitSize = Const.toInt(csize, 0);
      schemaName =
          XMLHandler.getTagValue(stepnode, "lookup", "schema"); // $NON-NLS-1$ //$NON-NLS-2$
      tableName = XMLHandler.getTagValue(stepnode, "lookup", "table"); // $NON-NLS-1$ //$NON-NLS-2$

      Node lookup = XMLHandler.getSubNode(stepnode, "lookup"); // $NON-NLS-1$
      nrkeys = XMLHandler.countNodes(lookup, "key"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        Node knode = XMLHandler.getSubNodeByNr(lookup, "key", i); // $NON-NLS-1$

        keyStream[i] = XMLHandler.getTagValue(knode, "name"); // $NON-NLS-1$
        keyLookup[i] = XMLHandler.getTagValue(knode, "field"); // $NON-NLS-1$
        keyCondition[i] = XMLHandler.getTagValue(knode, "condition"); // $NON-NLS-1$
        if (keyCondition[i] == null) keyCondition[i] = "="; // $NON-NLS-1$
        keyStream2[i] = XMLHandler.getTagValue(knode, "name2"); // $NON-NLS-1$
      }

    } catch (Exception e) {
      throw new KettleXMLException(
          Messages.getString("DeleteMeta.Exception.UnableToReadStepInfoFromXML"), e); // $NON-NLS-1$
    }
  }
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$

        fieldName[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$
        fieldType[i] = ValueMeta.getType(XMLHandler.getTagValue(fnode, "type")); // $NON-NLS-1$
        String slength = XMLHandler.getTagValue(fnode, "length"); // $NON-NLS-1$
        String sprecision = XMLHandler.getTagValue(fnode, "precision"); // $NON-NLS-1$

        fieldLength[i] = Const.toInt(slength, -1);
        fieldPrecision[i] = Const.toInt(sprecision, -1);
      }

      selectingAndSortingUnspecifiedFields =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(fields, "select_unspecified"));
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "MappingInputMeta.Exception.UnableToLoadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String commit, csize;

      schemaName = XMLHandler.getTagValue(stepnode, "schema"); // $NON-NLS-1$
      tablename = XMLHandler.getTagValue(stepnode, "table"); // $NON-NLS-1$
      String con = XMLHandler.getTagValue(stepnode, "connectionRead"); // $NON-NLS-1$
      databaseReadMeta = DatabaseMeta.findDatabase(databases, con);
      con = XMLHandler.getTagValue(stepnode, "connectionWrite"); // $NON-NLS-1$
      databaseWriteMeta = DatabaseMeta.findDatabase(databases, con);
      commit = XMLHandler.getTagValue(stepnode, "commit"); // $NON-NLS-1$
      commitSize = Const.toInt(commit, 0);
      csize = XMLHandler.getTagValue(stepnode, "cache_size"); // $NON-NLS-1$
      cacheSize = Const.toInt(csize, 0);

      replaceFields =
          "Y"
              .equalsIgnoreCase(
                  XMLHandler.getTagValue(stepnode, "replace")); // $NON-NLS-1$ //$NON-NLS-2$
      useHash =
          "Y"
              .equalsIgnoreCase(
                  XMLHandler.getTagValue(stepnode, "crc")); // $NON-NLS-1$ //$NON-NLS-2$

      hashField = XMLHandler.getTagValue(stepnode, "crcfield"); // $NON-NLS-1$

      Node keys = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      int nrkeys = XMLHandler.countNodes(keys, "key"); // $NON-NLS-1$

      allocate(nrkeys);

      // Read keys to dimension
      for (int i = 0; i < nrkeys; i++) {
        Node knode = XMLHandler.getSubNodeByNr(keys, "key", i); // $NON-NLS-1$
        keyField[i] = XMLHandler.getTagValue(knode, "name"); // $NON-NLS-1$
        keyLookup[i] = XMLHandler.getTagValue(knode, "lookup"); // $NON-NLS-1$
      }

      // If this is empty: use auto-increment field!
      sequenceFrom = XMLHandler.getTagValue(stepnode, "sequence"); // $NON-NLS-1$

      Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      Node retkey = XMLHandler.getSubNode(fields, "return"); // $NON-NLS-1$
      technicalKeyField = XMLHandler.getTagValue(retkey, "name"); // $NON-NLS-1$
      useAutoinc =
          !"N"
              .equalsIgnoreCase(
                  XMLHandler.getTagValue(retkey, "use_autoinc")); // $NON-NLS-1$ //$NON-NLS-2$
      lastUpdateField = XMLHandler.getTagValue(stepnode, "last_update_field"); // $NON-NLS-1$

      setTechKeyCreation(XMLHandler.getTagValue(retkey, "creation_method")); // $NON-NLS-1$
    } catch (Exception e) {
      throw new KettleXMLException(
          Messages.getString("ConcurrentCombinationLookupMeta.Exception.UnableToLoadStepInfo"),
          e); //$NON-NLS-1$
    }
  }
 public void loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters)
     throws KettleXMLException {
   int nrCalcs = XMLHandler.countNodes(stepnode, CalculatorMetaFunction.XML_TAG);
   allocate(nrCalcs);
   for (int i = 0; i < nrCalcs; i++) {
     Node calcnode = XMLHandler.getSubNodeByNr(stepnode, CalculatorMetaFunction.XML_TAG, i);
     calculation[i] = new CalculatorMetaFunction(calcnode);
   }
 }
  public void loadXML(
      Node entrynode,
      List<DatabaseMeta> databases,
      List<SlaveServer> slaveServers,
      Repository rep,
      IMetaStore metaStore)
      throws KettleXMLException {
    try {
      super.loadXML(entrynode, databases, slaveServers);
      xmlfilename = XMLHandler.getTagValue(entrynode, "xmlfilename");
      xslfilename = XMLHandler.getTagValue(entrynode, "xslfilename");
      outputfilename = XMLHandler.getTagValue(entrynode, "outputfilename");
      iffileexists = Const.toInt(XMLHandler.getTagValue(entrynode, "iffileexists"), -1);
      addfiletoresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "addfiletoresult"));
      filenamesfromprevious =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(entrynode, "filenamesfromprevious"));
      xsltfactory = XMLHandler.getTagValue(entrynode, "xsltfactory");
      if (xsltfactory == null) {
        xsltfactory = FACTORY_JAXP;
      }
      Node parametersNode = XMLHandler.getSubNode(entrynode, "parameters");
      int nrparams = XMLHandler.countNodes(parametersNode, "parameter");

      Node parametersOutputProps = XMLHandler.getSubNode(entrynode, "outputproperties");
      int nroutputprops = XMLHandler.countNodes(parametersOutputProps, "outputproperty");
      allocate(nrparams, nroutputprops);

      for (int i = 0; i < nrparams; i++) {
        Node anode = XMLHandler.getSubNodeByNr(parametersNode, "parameter", i);
        parameterField[i] = XMLHandler.getTagValue(anode, "field");
        parameterName[i] = XMLHandler.getTagValue(anode, "name");
      }
      for (int i = 0; i < nroutputprops; i++) {
        Node anode = XMLHandler.getSubNodeByNr(parametersOutputProps, "outputproperty", i);
        outputPropertyName[i] = XMLHandler.getTagValue(anode, "name");
        outputPropertyValue[i] = XMLHandler.getTagValue(anode, "value");
      }

    } catch (KettleXMLException xe) {
      throw new KettleXMLException("Unable to load job entry of type 'xslt' from XML node", xe);
    }
  }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue(stepnode, "connection"); // $NON-NLS-1$
      databaseMeta = DatabaseMeta.findDatabase(databases, con);

      String serror = XMLHandler.getTagValue(stepnode, "errors"); // $NON-NLS-1$
      maxErrors = Const.toInt(serror, 50); // default to 50.

      schemaName = XMLHandler.getTagValue(stepnode, "schema"); // $NON-NLS-1$
      tableName = XMLHandler.getTagValue(stepnode, "table"); // $NON-NLS-1$

      loadMethod = XMLHandler.getTagValue(stepnode, "load_method"); // $NON-NLS-1$
      loadAction = XMLHandler.getTagValue(stepnode, "load_action"); // $NON-NLS-1$		
      PsqlPath = XMLHandler.getTagValue(stepnode, "PsqlPath"); // $NON-NLS-1$
      controlFile = XMLHandler.getTagValue(stepnode, "control_file"); // $NON-NLS-1$
      dataFile = XMLHandler.getTagValue(stepnode, "data_file"); // $NON-NLS-1$
      logFile = XMLHandler.getTagValue(stepnode, "log_file"); // $NON-NLS-1$
      eraseFiles =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "erase_files")); // $NON-NLS-1$
      encoding = XMLHandler.getTagValue(stepnode, "encoding"); // $NON-NLS-1$
      dbNameOverride = XMLHandler.getTagValue(stepnode, "dbname_override"); // $NON-NLS-1$

      int nrvalues = XMLHandler.countNodes(stepnode, "mapping"); // $NON-NLS-1$
      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        Node vnode = XMLHandler.getSubNodeByNr(stepnode, "mapping", i); // $NON-NLS-1$

        fieldTable[i] = XMLHandler.getTagValue(vnode, "stream_name"); // $NON-NLS-1$
        fieldStream[i] = XMLHandler.getTagValue(vnode, "field_name"); // $NON-NLS-1$
        if (fieldStream[i] == null) fieldStream[i] = fieldTable[i]; // default: the same name!
        String locDateMask = XMLHandler.getTagValue(vnode, "date_mask"); // $NON-NLS-1$
        if (locDateMask == null) {
          dateMask[i] = "";
        } else {
          if (GPBulkLoaderMeta.DATE_MASK_DATE.equals(locDateMask)
              || GPBulkLoaderMeta.DATE_MASK_DATETIME.equals(locDateMask)) {
            dateMask[i] = locDateMask;
          } else {
            dateMask[i] = "";
          }
        }
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "GPBulkLoaderMeta.Exception.UnableToReadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
  public Validation(Node calcnode) throws KettleXMLException {
    this();

    fieldName = XMLHandler.getTagValue(calcnode, "name");
    name = XMLHandler.getTagValue(calcnode, "validation_name");
    if (Const.isEmpty(name)) {
      name = fieldName; // remain backward compatible
    }

    maximumLength = XMLHandler.getTagValue(calcnode, "max_length");
    minimumLength = XMLHandler.getTagValue(calcnode, "min_length");

    nullAllowed = "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "null_allowed"));
    onlyNullAllowed = "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "only_null_allowed"));
    onlyNumericAllowed =
        "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "only_numeric_allowed"));

    dataType = ValueMeta.getType(XMLHandler.getTagValue(calcnode, "data_type"));
    dataTypeVerified = "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "data_type_verified"));
    conversionMask = XMLHandler.getTagValue(calcnode, "conversion_mask");
    decimalSymbol = XMLHandler.getTagValue(calcnode, "decimal_symbol");
    groupingSymbol = XMLHandler.getTagValue(calcnode, "grouping_symbol");

    minimumValue = XMLHandler.getTagValue(calcnode, "min_value");
    maximumValue = XMLHandler.getTagValue(calcnode, "max_value");

    startString = XMLHandler.getTagValue(calcnode, "start_string");
    endString = XMLHandler.getTagValue(calcnode, "end_string");
    startStringNotAllowed = XMLHandler.getTagValue(calcnode, "start_string_not_allowed");
    endStringNotAllowed = XMLHandler.getTagValue(calcnode, "end_string_not_allowed");

    regularExpression = XMLHandler.getTagValue(calcnode, "regular_expression");
    regularExpressionNotAllowed =
        XMLHandler.getTagValue(calcnode, "regular_expression_not_allowed");

    errorCode = XMLHandler.getTagValue(calcnode, "error_code");
    errorDescription = XMLHandler.getTagValue(calcnode, "error_description");

    sourcingValues = "Y".equalsIgnoreCase(XMLHandler.getTagValue(calcnode, "is_sourcing_values"));
    sourcingStepName = XMLHandler.getTagValue(calcnode, "sourcing_step");
    sourcingField = XMLHandler.getTagValue(calcnode, "sourcing_field");

    Node allowedValuesNode = XMLHandler.getSubNode(calcnode, XML_TAG_ALLOWED);
    int nrValues = XMLHandler.countNodes(allowedValuesNode, "value");
    allowedValues = new String[nrValues];
    for (int i = 0; i < nrValues; i++) {
      Node allowedNode = XMLHandler.getSubNodeByNr(allowedValuesNode, "value", i);
      allowedValues[i] = XMLHandler.getNodeValue(allowedNode);
    }
  }
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      encoding = XMLHandler.getTagValue(stepnode, "encoding"); // $NON-NLS-1$
      valueName = XMLHandler.getTagValue(stepnode, "valueName"); // $NON-NLS-1$
      rootNode = XMLHandler.getTagValue(stepnode, "xml_repeat_element"); // $NON-NLS-1$

      omitXMLheader =
          "Y"
              .equalsIgnoreCase(
                  XMLHandler.getTagValue(
                      stepnode, "file", "omitXMLheader")); // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
      omitNullValues =
          "Y"
              .equalsIgnoreCase(
                  XMLHandler.getTagValue(
                      stepnode, "file", "omitNullValues")); // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$

      Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$

        outputFields[i] = new XMLField();
        outputFields[i].setFieldName(XMLHandler.getTagValue(fnode, "name")); // $NON-NLS-1$
        outputFields[i].setElementName(XMLHandler.getTagValue(fnode, "element")); // $NON-NLS-1$
        outputFields[i].setType(XMLHandler.getTagValue(fnode, "type")); // $NON-NLS-1$
        outputFields[i].setFormat(XMLHandler.getTagValue(fnode, "format")); // $NON-NLS-1$
        outputFields[i].setCurrencySymbol(XMLHandler.getTagValue(fnode, "currency")); // $NON-NLS-1$
        outputFields[i].setDecimalSymbol(XMLHandler.getTagValue(fnode, "decimal")); // $NON-NLS-1$
        outputFields[i].setGroupingSymbol(XMLHandler.getTagValue(fnode, "group")); // $NON-NLS-1$
        outputFields[i].setNullString(XMLHandler.getTagValue(fnode, "nullif")); // $NON-NLS-1$
        outputFields[i].setLength(
            Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1)); // $NON-NLS-1$
        outputFields[i].setPrecision(
            Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1)); // $NON-NLS-1$
        outputFields[i].setAttribute(
            "Y"
                .equalsIgnoreCase(
                    XMLHandler.getTagValue(fnode, "attribute"))); // $NON-NLS-1$ //$NON-NLS-2$
        outputFields[i].setAttributeParentName(
            XMLHandler.getTagValue(fnode, "attributeParentName")); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e); // $NON-NLS-1$
    }
  }
 public void loadFieldsXML(Node node) {
   int nr = XMLHandler.countNodes(node, BaseLogTable.XML_TAG);
   for (int i = 0; i < nr; i++) {
     Node fieldNode = XMLHandler.getSubNodeByNr(node, BaseLogTable.XML_TAG, i);
     String id = XMLHandler.getTagValue(fieldNode, "id");
     LogTableField field = findField(id);
     if (field == null && i < fields.size()) {
       field = fields.get(i); // backward compatible until we go GA
     }
     if (field != null) {
       field.setFieldName(XMLHandler.getTagValue(fieldNode, "name"));
       field.setEnabled("Y".equalsIgnoreCase(XMLHandler.getTagValue(fieldNode, "enabled")));
     }
   }
 }
 public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore)
     throws KettleXMLException {
   try {
     acceptingField = XMLHandler.getTagValue(stepnode, "accept_field");
     int nrFields = XMLHandler.countNodes(stepnode, XML_TAG_FIELD);
     outputFields = new ArrayList<SasInputField>();
     for (int i = 0; i < nrFields; i++) {
       Node fieldNode = XMLHandler.getSubNodeByNr(stepnode, XML_TAG_FIELD, i);
       outputFields.add(new SasInputField(fieldNode));
     }
   } catch (Exception e) {
     throw new KettleXMLException(
         BaseMessages.getString(PKG, "SASInputMeta.Exception.UnableToReadStepInformationFromXML"),
         e);
   }
 }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue(stepnode, "connection");
      databaseMeta = DatabaseMeta.findDatabase(databases, con);

      schemaName = XMLHandler.getTagValue(stepnode, "schema");
      tableName = XMLHandler.getTagValue(stepnode, "table");

      enclosure = XMLHandler.getTagValue(stepnode, "enclosure");
      delimiter = XMLHandler.getTagValue(stepnode, "delimiter");

      loadAction = XMLHandler.getTagValue(stepnode, "load_action");
      PsqlPath = XMLHandler.getTagValue(stepnode, "PsqlPath");
      dbNameOverride = XMLHandler.getTagValue(stepnode, "dbname_override");
      stopOnError = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "stop_on_error"));

      int nrvalues = XMLHandler.countNodes(stepnode, "mapping");
      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        Node vnode = XMLHandler.getSubNodeByNr(stepnode, "mapping", i);

        fieldTable[i] = XMLHandler.getTagValue(vnode, "stream_name");
        fieldStream[i] = XMLHandler.getTagValue(vnode, "field_name");
        if (fieldStream[i] == null) {
          fieldStream[i] = fieldTable[i]; // default: the same name!
        }
        String locDateMask = XMLHandler.getTagValue(vnode, "date_mask");
        if (locDateMask == null) {
          dateMask[i] = "";
        } else {
          if (PGBulkLoaderMeta.DATE_MASK_DATE.equals(locDateMask)
              || PGBulkLoaderMeta.DATE_MASK_PASS_THROUGH.equals(locDateMask)
              || PGBulkLoaderMeta.DATE_MASK_DATETIME.equals(locDateMask)) {
            dateMask[i] = locDateMask;
          } else {
            dateMask[i] = "";
          }
        }
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "GPBulkLoaderMeta.Exception.UnableToReadStepInfoFromXML"), e);
    }
  }
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      filename = XMLHandler.getTagValue(stepnode, "filename");
      filenameField = XMLHandler.getTagValue(stepnode, "filename_field");
      rowNumField = XMLHandler.getTagValue(stepnode, "rownum_field");
      includingFilename =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include_filename"));
      delimiter = XMLHandler.getTagValue(stepnode, "separator");
      enclosure = XMLHandler.getTagValue(stepnode, "enclosure");
      bufferSize = XMLHandler.getTagValue(stepnode, "buffer_size");
      headerPresent = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "header"));
      lazyConversionActive =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "lazy_conversion"));
      isaddresult = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "add_filename_result"));
      runningInParallel = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "parallel"));
      encoding = XMLHandler.getTagValue(stepnode, "encoding");

      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrfields = XMLHandler.countNodes(fields, "field");

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        inputFields[i] = new TextFileInputField();

        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        inputFields[i].setName(XMLHandler.getTagValue(fnode, "name"));
        inputFields[i].setType(ValueMeta.getType(XMLHandler.getTagValue(fnode, "type")));
        inputFields[i].setFormat(XMLHandler.getTagValue(fnode, "format"));
        inputFields[i].setCurrencySymbol(XMLHandler.getTagValue(fnode, "currency"));
        inputFields[i].setDecimalSymbol(XMLHandler.getTagValue(fnode, "decimal"));
        inputFields[i].setGroupSymbol(XMLHandler.getTagValue(fnode, "group"));
        inputFields[i].setLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
        inputFields[i].setPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
        inputFields[i].setTrimType(
            ValueMeta.getTrimTypeByCode(XMLHandler.getTagValue(fnode, "trim_type")));
      }
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue(stepnode, "connection");
      databaseMeta = DatabaseMeta.findDatabase(databases, con);

      schemaName = XMLHandler.getTagValue(stepnode, "schema");
      tableName = XMLHandler.getTagValue(stepnode, "table");

      fifoFileName = XMLHandler.getTagValue(stepnode, "fifo_file_name");

      encoding = XMLHandler.getTagValue(stepnode, "encoding");
      enclosure = XMLHandler.getTagValue(stepnode, "enclosure");
      delimiter = XMLHandler.getTagValue(stepnode, "delimiter");
      escapeChar = XMLHandler.getTagValue(stepnode, "escape_char");

      bulkSize = XMLHandler.getTagValue(stepnode, "bulk_size");

      replacingData = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "replace"));
      ignoringErrors = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ignore"));
      localFile = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "local"));

      int nrvalues = XMLHandler.countNodes(stepnode, "mapping");
      allocate(nrvalues);

      for (int i = 0; i < nrvalues; i++) {
        Node vnode = XMLHandler.getSubNodeByNr(stepnode, "mapping", i);

        fieldTable[i] = XMLHandler.getTagValue(vnode, "stream_name");
        fieldStream[i] = XMLHandler.getTagValue(vnode, "field_name");
        if (fieldStream[i] == null) {
          fieldStream[i] = fieldTable[i]; // default: the same name!
        }
        fieldFormatType[i] = getFieldFormatType(XMLHandler.getTagValue(vnode, "field_format_ok"));
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "MySQLBulkLoaderMeta.Exception.UnableToReadStepInfoFromXML"),
          e);
    }
  }
  @Override
  public void loadXML(Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore)
      throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue(stepnode, "connection");
      databaseMeta = DatabaseMeta.findDatabase(databases, con);
      tablename = XMLHandler.getTagValue(stepnode, "table");
      fifoFileName = XMLHandler.getTagValue(stepnode, "fifo_file_name");
      sqlPath = XMLHandler.getTagValue(stepnode, "sql_path");
      encoding = XMLHandler.getTagValue(stepnode, "encoding");
      delimiter = XMLHandler.getTagValue(stepnode, "delimiter");
      continueOnError = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "continue_on_error"));
      errorFileName = XMLHandler.getTagValue(stepnode, "error_file_name");
      useStandardConversion =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_standard_conversion"));
      useAuthentication =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_authentication"));
      useDynamicVNode = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_dynamic_vnode"));
      useSSV = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_SSV_delimiter"));
      String escape = XMLHandler.getTagValue(stepnode, "escape_special_characters");
      escapingSpecialCharacters = Const.isEmpty(escape) ? true : "Y".equalsIgnoreCase(escape);
      usingVwload = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "use_vwload"));
      maxNrErrors = XMLHandler.getTagValue(stepnode, "max_errors");
      truncatingTable = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "truncate_table"));
      bufferSize = XMLHandler.getTagValue(stepnode, "buffer_size");

      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrRows = XMLHandler.countNodes(fields, "field");

      allocate(nrRows);

      for (int i = 0; i < nrRows; i++) {
        Node knode = XMLHandler.getSubNodeByNr(fields, "field", i);

        fieldDatabase[i] = XMLHandler.getTagValue(knode, "column_name");
        fieldStream[i] = XMLHandler.getTagValue(knode, "stream_name");
      }
    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
  private void readData(Node stepnode, List<? extends SharedObjectInterface> databases)
      throws KettleXMLException {
    try {
      usevar = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "usevar"));
      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrfields = XMLHandler.countNodes(fields, "field");
      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);
        fieldName[i] = XMLHandler.getTagValue(fnode, "name");
        replaceValue[i] = XMLHandler.getTagValue(fnode, "value");
        replaceMask[i] = XMLHandler.getTagValue(fnode, "mask");
        String emptyString = XMLHandler.getTagValue(fnode, "set_empty_string");
        setEmptyString[i] = !Const.isEmpty(emptyString) && "Y".equalsIgnoreCase(emptyString);
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          "It was not possible to load the metadata for this step from XML", e);
    }
  }
Esempio n. 25
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      splitField = XMLHandler.getTagValue(stepnode, "splitfield"); // $NON-NLS-1$
      delimiter = XMLHandler.getTagValue(stepnode, "delimiter"); // $NON-NLS-1$

      final Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      final int nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$

      allocate(nrfields);

      for (int i = 0; i < nrfields; i++) {
        final Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$

        fieldName[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$
        fieldID[i] = XMLHandler.getTagValue(fnode, "id"); // $NON-NLS-1$
        final String sidrem = XMLHandler.getTagValue(fnode, "idrem"); // $NON-NLS-1$
        final String stype = XMLHandler.getTagValue(fnode, "type"); // $NON-NLS-1$
        fieldFormat[i] = XMLHandler.getTagValue(fnode, "format"); // $NON-NLS-1$
        fieldGroup[i] = XMLHandler.getTagValue(fnode, "group"); // $NON-NLS-1$
        fieldDecimal[i] = XMLHandler.getTagValue(fnode, "decimal"); // $NON-NLS-1$
        fieldCurrency[i] = XMLHandler.getTagValue(fnode, "currency"); // $NON-NLS-1$
        final String slen = XMLHandler.getTagValue(fnode, "length"); // $NON-NLS-1$
        final String sprc = XMLHandler.getTagValue(fnode, "precision"); // $NON-NLS-1$
        fieldNullIf[i] = XMLHandler.getTagValue(fnode, "nullif"); // $NON-NLS-1$
        fieldIfNull[i] = XMLHandler.getTagValue(fnode, "ifnull"); // $NON-NLS-1$
        final String trim = XMLHandler.getTagValue(fnode, "trimtype"); // $NON-NLS-1$

        fieldRemoveID[i] = "Y".equalsIgnoreCase(sidrem); // $NON-NLS-1$
        fieldType[i] = ValueMeta.getType(stype);
        fieldLength[i] = Const.toInt(slen, -1);
        fieldPrecision[i] = Const.toInt(sprc, -1);
        fieldTrimType[i] = ValueMeta.getTrimTypeByCode(trim);
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "FieldSplitterMeta.Exception.UnableToLoadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
  public XMLInputSaxField(Node fnode) throws KettleValueException {
    setName(XMLHandler.getTagValue(fnode, "name"));
    setType(ValueMeta.getType(XMLHandler.getTagValue(fnode, "type")));
    setFormat(XMLHandler.getTagValue(fnode, "format"));
    setCurrencySymbol(XMLHandler.getTagValue(fnode, "currency"));
    setDecimalSymbol(XMLHandler.getTagValue(fnode, "decimal"));
    setGroupSymbol(XMLHandler.getTagValue(fnode, "group"));
    setLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
    setPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
    setTrimType(getTrimType(XMLHandler.getTagValue(fnode, "trim_type")));
    setRepeated(!"N".equalsIgnoreCase(XMLHandler.getTagValue(fnode, "repeat")));

    Node positions = XMLHandler.getSubNode(fnode, "positions");
    int nrPositions = XMLHandler.countNodes(positions, "position");

    fieldPosition = new XMLInputSaxFieldPosition[nrPositions];

    for (int i = 0; i < nrPositions; i++) {
      Node positionnode = XMLHandler.getSubNodeByNr(positions, "position", i);
      String encoded = XMLHandler.getNodeValue(positionnode);
      fieldPosition[i] = new XMLInputSaxFieldPosition(encoded);
    }
  }
Esempio n. 27
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      int i, nrfields;
      String type;

      Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      nrfields = XMLHandler.countNodes(fields, "field"); // $NON-NLS-1$

      allocate(nrfields);

      for (i = 0; i < nrfields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i); // $NON-NLS-1$
        fieldName[i] = XMLHandler.getTagValue(fnode, "name"); // $NON-NLS-1$
        fieldNewName[i] = XMLHandler.getTagValue(fnode, "rename"); // $NON-NLS-1$
        type = XMLHandler.getTagValue(fnode, "type"); // $NON-NLS-1$
        aggregateType[i] = getType(type);
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "AggregateRowsMeta.Exception.UnableToLoadStepInfo"),
          e); //$NON-NLS-1$
    }
  }
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      setBatchSize(XMLHandler.getTagValue(stepnode, "batchSize"));
      setSalesforceIDFieldName(XMLHandler.getTagValue(stepnode, "salesforceIDFieldName"));

      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrFields = XMLHandler.countNodes(fields, "field");

      allocate(nrFields);

      for (int i = 0; i < nrFields; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(fields, "field", i);

        updateLookup[i] = XMLHandler.getTagValue(fnode, "name");
        updateStream[i] = XMLHandler.getTagValue(fnode, "field");
        if (updateStream[i] == null) {
          updateStream[i] = updateLookup[i]; // default: the same name!
        }
        String updateValue = XMLHandler.getTagValue(fnode, "useExternalId");
        if (updateValue == null) {
          // default FALSE
          useExternalId[i] = Boolean.FALSE;
        } else {
          if (updateValue.equalsIgnoreCase("Y")) {
            useExternalId[i] = Boolean.TRUE;
          } else {
            useExternalId[i] = Boolean.FALSE;
          }
        }
      }
      setRollbackAllChangesOnError(
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rollbackAllChangesOnError")));

    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }
Esempio n. 29
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      int nrkeys;

      Node lookup = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$
      nrkeys = XMLHandler.countNodes(lookup, "field"); // $NON-NLS-1$

      allocate(nrkeys);

      for (int i = 0; i < nrkeys; i++) {
        Node fnode = XMLHandler.getSubNodeByNr(lookup, "field", i); // $NON-NLS-1$
        fieldInStream[i] =
            Const.NVL(XMLHandler.getTagValue(fnode, "in_stream_name"), ""); // $NON-NLS-1$
        fieldOutStream[i] =
            Const.NVL(XMLHandler.getTagValue(fnode, "out_stream_name"), ""); // $NON-NLS-1$
        cutFrom[i] = Const.NVL(XMLHandler.getTagValue(fnode, "cut_from"), ""); // $NON-NLS-1$
        cutTo[i] = Const.NVL(XMLHandler.getTagValue(fnode, "cut_to"), ""); // $NON-NLS-1$
      }
    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(PKG, "StringCutMeta.Exception.UnableToReadStepInfoFromXML"),
          e); //$NON-NLS-1$
    }
  }
Esempio n. 30
0
  public void loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters)
      throws KettleXMLException {
    try {
      String method = XMLHandler.getTagValue(stepnode, "specification_method");
      specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
      String transId = XMLHandler.getTagValue(stepnode, "trans_object_id");
      transObjectId = Const.isEmpty(transId) ? null : new StringObjectId(transId);

      transName = XMLHandler.getTagValue(stepnode, "trans_name"); // $NON-NLS-1$
      fileName = XMLHandler.getTagValue(stepnode, "filename"); // $NON-NLS-1$
      directoryPath = XMLHandler.getTagValue(stepnode, "directory_path"); // $NON-NLS-1$

      // Backward compatibility check for object specification
      //
      checkObjectLocationSpecificationMethod();

      Node mappingsNode = XMLHandler.getSubNode(stepnode, "mappings"); // $NON-NLS-1$
      inputMappings.clear();
      outputMappings.clear();

      if (mappingsNode != null) {
        // Read all the input mapping definitions...
        //
        Node inputNode = XMLHandler.getSubNode(mappingsNode, "input"); // $NON-NLS-1$
        int nrInputMappings =
            XMLHandler.countNodes(inputNode, MappingIODefinition.XML_TAG); // $NON-NLS-1$
        for (int i = 0; i < nrInputMappings; i++) {
          Node mappingNode = XMLHandler.getSubNodeByNr(inputNode, MappingIODefinition.XML_TAG, i);
          MappingIODefinition inputMappingDefinition = new MappingIODefinition(mappingNode);
          inputMappings.add(inputMappingDefinition);
        }
        Node outputNode = XMLHandler.getSubNode(mappingsNode, "output"); // $NON-NLS-1$
        int nrOutputMappings =
            XMLHandler.countNodes(outputNode, MappingIODefinition.XML_TAG); // $NON-NLS-1$
        for (int i = 0; i < nrOutputMappings; i++) {
          Node mappingNode = XMLHandler.getSubNodeByNr(outputNode, MappingIODefinition.XML_TAG, i);
          MappingIODefinition outputMappingDefinition = new MappingIODefinition(mappingNode);
          outputMappings.add(outputMappingDefinition);
        }

        // Load the mapping parameters too..
        //
        Node mappingParametersNode = XMLHandler.getSubNode(mappingsNode, MappingParameters.XML_TAG);
        mappingParameters = new MappingParameters(mappingParametersNode);
      } else {
        // backward compatibility...
        //
        Node inputNode = XMLHandler.getSubNode(stepnode, "input"); // $NON-NLS-1$
        Node outputNode = XMLHandler.getSubNode(stepnode, "output"); // $NON-NLS-1$

        int nrInput = XMLHandler.countNodes(inputNode, "connector"); // $NON-NLS-1$
        int nrOutput = XMLHandler.countNodes(outputNode, "connector"); // $NON-NLS-1$

        // null means: auto-detect
        //
        MappingIODefinition inputMappingDefinition = new MappingIODefinition();
        inputMappingDefinition.setMainDataPath(true);

        for (int i = 0; i < nrInput; i++) {
          Node inputConnector = XMLHandler.getSubNodeByNr(inputNode, "connector", i); // $NON-NLS-1$
          String inputField = XMLHandler.getTagValue(inputConnector, "field"); // $NON-NLS-1$
          String inputMapping = XMLHandler.getTagValue(inputConnector, "mapping"); // $NON-NLS-1$
          inputMappingDefinition
              .getValueRenames()
              .add(new MappingValueRename(inputField, inputMapping));
        }

        // null means: auto-detect
        //
        MappingIODefinition outputMappingDefinition = new MappingIODefinition();
        outputMappingDefinition.setMainDataPath(true);

        for (int i = 0; i < nrOutput; i++) {
          Node outputConnector =
              XMLHandler.getSubNodeByNr(outputNode, "connector", i); // $NON-NLS-1$
          String outputField = XMLHandler.getTagValue(outputConnector, "field"); // $NON-NLS-1$
          String outputMapping = XMLHandler.getTagValue(outputConnector, "mapping"); // $NON-NLS-1$
          outputMappingDefinition
              .getValueRenames()
              .add(new MappingValueRename(outputMapping, outputField));
        }

        // Don't forget to add these to the input and output mapping
        // definitions...
        //
        inputMappings.add(inputMappingDefinition);
        outputMappings.add(outputMappingDefinition);

        // The default is to have no mapping parameters: the concept didn't
        // exist before.
        //
        mappingParameters = new MappingParameters();
      }

      String multiInput = XMLHandler.getTagValue(stepnode, "allow_multiple_input");
      allowingMultipleInputs =
          Const.isEmpty(multiInput) ? inputMappings.size() > 1 : "Y".equalsIgnoreCase(multiInput);
      String multiOutput = XMLHandler.getTagValue(stepnode, "allow_multiple_output");
      allowingMultipleOutputs =
          Const.isEmpty(multiOutput)
              ? outputMappings.size() > 1
              : "Y".equalsIgnoreCase(multiOutput);

    } catch (Exception e) {
      throw new KettleXMLException(
          BaseMessages.getString(
              PKG, "MappingMeta.Exception.ErrorLoadingTransformationStepFromXML"),
          e); //$NON-NLS-1$
    }
  }