Пример #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);
    }
  }
Пример #2
0
  @Override
  public void loadXML(Node node, List<DatabaseMeta> list, List<SlaveServer> list1, Repository rpstr)
      throws KettleXMLException {
    try {
      super.loadXML(node, list, list1);

      this.setRecordSetName(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")));
      this.setRecordSet(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset")));
      this.setBreakCriteria(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "breakCriteria")));
      this.setIsAllString(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "isAll")));
      this.setRunLocalString(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "runLocal")));

    } catch (Exception e) {
      throw new KettleXMLException(
          "ECL Group Job Plugin is unable to read step info from XML node", e);
    }
  }
  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);
    }
  }
  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);
    }
  }
Пример #5
0
  @Override
  public void loadXML(Node node, List<DatabaseMeta> list, List<SlaveServer> list1, Repository rpstr)
      throws KettleXMLException {
    try {
      super.loadXML(node, list, list1);

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "fields")) != null)
        setFields(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "fields")));
      // setRecordName(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "record_name")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "dataset_name")) != null)
        setDatasetName(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "dataset_name")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")) != null)
        setRecordsetName(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")));

    } catch (Exception e) {
      throw new KettleXMLException("ECL Sort Job Plugin Unable to read step info from XML node", e);
    }
  }
  @Override
  public void loadXML(Node node, List<DatabaseMeta> list, List<SlaveServer> list1, Repository rpstr)
      throws KettleXMLException {
    try {
      super.loadXML(node, list, list1);

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")) != null)
        this.setRecordsetName(
            XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "model")) != null)
        this.setModel(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "model")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "independentVar")) != null)
        this.setIndependentVar(
            XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "independentVar")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "classifyType")) != null)
        this.setClassifyType(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "classifyType")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "dataType")) != null)
        this.setDataType(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "dataType")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "alpha")) != null)
        this.setAlpha(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "alpha")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "passes")) != null)
        this.setPasses(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "passes")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "ridge")) != null)
        this.setRidge(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "ridge")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "epsilon")) != null)
        this.setEpsilon(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "epsilon")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "maxIter")) != null)
        this.setMaxIter(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "maxIter")));
    } catch (Exception e) {
      throw new KettleXMLException(
          "ECL Distribute Job Plugin Unable to read step info from XML node", e);
    }
  }
Пример #7
0
  @Override
  public void loadXML(Node node, List<DatabaseMeta> list, List<SlaveServer> list1, Repository rpstr)
      throws KettleXMLException {
    try {
      super.loadXML(node, list, list1);
      // this.setName(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "name")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")) != null)
        this.setRecordsetName(
            XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset_name")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset")) != null)
        this.setRecordset(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "recordset")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "condition")) != null)
        this.setCondition(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "condition")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "transformName")) != null)
        this.setTransformName(
            XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "transformName")));
      // if(XMLHandler.getNodeValue(XMLHandler.getSubNode(node,"transform")) != null)
      //    this.setTransform(XMLHandler.getNodeValue(XMLHandler.getSubNode(node,"transform")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "fieldlist")) != null)
        this.setFieldlist(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "fieldlist")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "group")) != null)
        this.setGroup(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "group")));
      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "runLocal")) != null)
        this.setRunLocalString(XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "runLocal")));

      if (XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "mapperRecList")) != null)
        openRecordListForMapper(
            XMLHandler.getNodeValue(XMLHandler.getSubNode(node, "mapperRecList")));

      // recordFormat
      // if(XMLHandler.getNodeValue(XMLHandler.getSubNode(node,"recordFormat")) != null)
      //
      // this.setRecordFormat(XMLHandler.getNodeValue(XMLHandler.getSubNode(node,"recordFormat")));

    } catch (Exception e) {
      throw new KettleXMLException(
          "ECL Distribute Job Plugin Unable to read step info from XML node", e);
    }
  }
Пример #8
0
  private void readData(Node stepnode) throws KettleXMLException {
    try {
      fileType = XMLHandler.getTagValue(stepnode, "file_type");
      encoding = XMLHandler.getTagValue(stepnode, "encoding");
      includeFilename = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "include"));
      filenameField = XMLHandler.getTagValue(stepnode, "include_field");
      includeRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "rownum"));

      String addresult = XMLHandler.getTagValue(stepnode, "isaddresult");
      if (Utils.isEmpty(addresult)) {
        isaddresult = true;
      } else {
        isaddresult = "Y".equalsIgnoreCase(addresult);
      }
      section = XMLHandler.getTagValue(stepnode, "section");
      iniSectionField = XMLHandler.getTagValue(stepnode, "ini_section_field");
      includeIniSection = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "ini_section"));
      filefield = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "filefield"));
      rowNumberField = XMLHandler.getTagValue(stepnode, "rownum_field");
      dynamicFilenameField = XMLHandler.getTagValue(stepnode, "filename_Field");
      resetRowNumber = "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "resetrownumber"));
      resolvevaluevariable =
          "Y".equalsIgnoreCase(XMLHandler.getTagValue(stepnode, "resolvevaluevariable"));
      Node filenode = XMLHandler.getSubNode(stepnode, "file");
      Node fields = XMLHandler.getSubNode(stepnode, "fields");
      int nrFiles = XMLHandler.countNodes(filenode, "name");
      int nrFields = XMLHandler.countNodes(fields, "field");

      allocate(nrFiles, nrFields);

      for (int i = 0; i < nrFiles; i++) {
        Node filenamenode = XMLHandler.getSubNodeByNr(filenode, "name", i);
        Node filemasknode = XMLHandler.getSubNodeByNr(filenode, "filemask", i);
        Node excludefilemasknode = XMLHandler.getSubNodeByNr(filenode, "exclude_filemask", i);
        Node fileRequirednode = XMLHandler.getSubNodeByNr(filenode, "file_required", i);
        Node includeSubFoldersnode = XMLHandler.getSubNodeByNr(filenode, "include_subfolders", i);
        fileName[i] = XMLHandler.getNodeValue(filenamenode);
        fileMask[i] = XMLHandler.getNodeValue(filemasknode);
        excludeFileMask[i] = XMLHandler.getNodeValue(excludefilemasknode);
        fileRequired[i] = XMLHandler.getNodeValue(fileRequirednode);
        includeSubFolders[i] = XMLHandler.getNodeValue(includeSubFoldersnode);
      }

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

        inputFields[i].setName(XMLHandler.getTagValue(fnode, "name"));
        inputFields[i].setColumn(getColumnByCode(XMLHandler.getTagValue(fnode, "column")));
        inputFields[i].setType(
            ValueMetaFactory.getIdForValueMeta(XMLHandler.getTagValue(fnode, "type")));
        inputFields[i].setLength(Const.toInt(XMLHandler.getTagValue(fnode, "length"), -1));
        inputFields[i].setPrecision(Const.toInt(XMLHandler.getTagValue(fnode, "precision"), -1));
        String srepeat = XMLHandler.getTagValue(fnode, "repeat");
        inputFields[i].setTrimType(getTrimTypeByCode(XMLHandler.getTagValue(fnode, "trim_type")));

        if (srepeat != null) {
          inputFields[i].setRepeated(YES.equalsIgnoreCase(srepeat));
        } else {
          inputFields[i].setRepeated(false);
        }

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

      // Is there a limit on the number of rows we process?
      rowLimit = Const.toLong(XMLHandler.getTagValue(stepnode, "limit"), 0L);
      shortFileFieldName = XMLHandler.getTagValue(stepnode, "shortFileFieldName");
      pathFieldName = XMLHandler.getTagValue(stepnode, "pathFieldName");
      hiddenFieldName = XMLHandler.getTagValue(stepnode, "hiddenFieldName");
      lastModificationTimeFieldName =
          XMLHandler.getTagValue(stepnode, "lastModificationTimeFieldName");
      uriNameFieldName = XMLHandler.getTagValue(stepnode, "uriNameFieldName");
      rootUriNameFieldName = XMLHandler.getTagValue(stepnode, "rootUriNameFieldName");
      extensionFieldName = XMLHandler.getTagValue(stepnode, "extensionFieldName");
      sizeFieldName = XMLHandler.getTagValue(stepnode, "sizeFieldName");

    } catch (Exception e) {
      throw new KettleXMLException("Unable to load step info from XML", e);
    }
  }