Java Code Examples for org.pentaho.di.core.xml.XMLHandler#addTagValue()

The following examples show how to use org.pentaho.di.core.xml.XMLHandler#addTagValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RelationshipMeta.java    From pentaho-metadata with GNU Lesser General Public License v2.1 6 votes vote down vote up
public String getXML() {
  String retval = ""; //$NON-NLS-1$

  retval += "      <relationship>" + Const.CR; //$NON-NLS-1$
  retval += "        " + XMLHandler.addTagValue( "table_from", table_from.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "table_to", table_to.getId() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "field_from", field_from != null ? field_from.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  retval += "        " + XMLHandler.addTagValue( "field_to", field_to != null ? field_to.getId() : "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "complex", complex ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "complex_join", complex_join ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "join_order_key", joinOrderKey ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "        " + XMLHandler.addTagValue( "description", description ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "      </relationship>" + Const.CR; //$NON-NLS-1$

  return retval;
}
 
Example 2
Source File: FormulaMetaFunction.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String xml = "";

  xml += "<" + XML_TAG + ">";

  xml += XMLHandler.addTagValue( "field_name", fieldName );
  xml += XMLHandler.addTagValue( "formula_string", formula );
  xml += XMLHandler.addTagValue( "value_type", ValueMetaFactory.getValueMetaName( valueType ) );
  xml += XMLHandler.addTagValue( "value_length", valueLength );
  xml += XMLHandler.addTagValue( "value_precision", valuePrecision );
  xml += XMLHandler.addTagValue( "replace_field", replaceField );

  xml += "</" + XML_TAG + ">";

  return xml;
}
 
Example 3
Source File: UnivariateStatsMetaFunction.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Return a String containing XML describing this UnivariateStatsMetaFunction
 *
 * @return an XML description of this UnivarateStatsMetaFunction
 */
public String getXML() {
  String xml = ( "<" + XML_TAG + ">" );

  xml += XMLHandler.addTagValue( "source_field_name", m_sourceFieldName );
  xml += XMLHandler.addTagValue( "N", m_n );
  xml += XMLHandler.addTagValue( "mean", m_mean );
  xml += XMLHandler.addTagValue( "stdDev", m_stdDev );
  xml += XMLHandler.addTagValue( "min", m_min );
  xml += XMLHandler.addTagValue( "max", m_max );
  xml += XMLHandler.addTagValue( "median", m_median );
  xml += XMLHandler.addTagValue( "percentile", "" + m_arbitraryPercentile );
  xml += XMLHandler.addTagValue( "interpolate", m_interpolatePercentile );

  xml += ( "</" + XML_TAG + ">" );

  return xml;
}
 
Example 4
Source File: LoadFileInputField.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "      <field>" + Const.CR;
  retval += "        " + XMLHandler.addTagValue( "name", getName() );
  retval += "        " + XMLHandler.addTagValue( "element_type", getElementTypeCode() );
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "format", getFormat() );
  retval += "        " + XMLHandler.addTagValue( "currency", getCurrencySymbol() );
  retval += "        " + XMLHandler.addTagValue( "decimal", getDecimalSymbol() );
  retval += "        " + XMLHandler.addTagValue( "group", getGroupSymbol() );
  retval += "        " + XMLHandler.addTagValue( "length", getLength() );
  retval += "        " + XMLHandler.addTagValue( "precision", getPrecision() );
  retval += "        " + XMLHandler.addTagValue( "trim_type", getTrimTypeCode() );
  retval += "        " + XMLHandler.addTagValue( "repeat", isRepeated() );

  retval += "        </field>" + Const.CR;

  return retval;
}
 
Example 5
Source File: LDIFInputField.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "      <field>" + Const.CR;
  retval += "        " + XMLHandler.addTagValue( "name", getName() );
  retval += "        " + XMLHandler.addTagValue( "attribut", getAttribut() );
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "format", getFormat() );
  retval += "        " + XMLHandler.addTagValue( "currency", getCurrencySymbol() );
  retval += "        " + XMLHandler.addTagValue( "decimal", getDecimalSymbol() );
  retval += "        " + XMLHandler.addTagValue( "group", getGroupSymbol() );
  retval += "        " + XMLHandler.addTagValue( "length", getLength() );
  retval += "        " + XMLHandler.addTagValue( "precision", getPrecision() );
  retval += "        " + XMLHandler.addTagValue( "trim_type", getTrimTypeCode() );
  retval += "        " + XMLHandler.addTagValue( "repeat", isRepeated() );

  retval += "        </field>" + Const.CR;

  return retval;
}
 
Example 6
Source File: RssInputField.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "      <field>" + Const.CR;
  retval += "        " + XMLHandler.addTagValue( "name", getName() );
  retval += "        " + XMLHandler.addTagValue( "column", getColumnCode() );
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "format", getFormat() );
  retval += "        " + XMLHandler.addTagValue( "currency", getCurrencySymbol() );
  retval += "        " + XMLHandler.addTagValue( "decimal", getDecimalSymbol() );
  retval += "        " + XMLHandler.addTagValue( "group", getGroupSymbol() );
  retval += "        " + XMLHandler.addTagValue( "length", getLength() );
  retval += "        " + XMLHandler.addTagValue( "precision", getPrecision() );
  retval += "        " + XMLHandler.addTagValue( "trim_type", getTrimTypeCode() );
  retval += "        " + XMLHandler.addTagValue( "repeat", isRepeated() );

  retval += "      </field>" + Const.CR;

  return retval;
}
 
Example 7
Source File: XMLInputSaxField.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "      <field>" + Const.CR;
  retval += "        " + XMLHandler.addTagValue( "name", getName() );
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "format", getFormat() );
  retval += "        " + XMLHandler.addTagValue( "currency", getCurrencySymbol() );
  retval += "        " + XMLHandler.addTagValue( "decimal", getDecimalSymbol() );
  retval += "        " + XMLHandler.addTagValue( "group", getGroupSymbol() );
  retval += "        " + XMLHandler.addTagValue( "length", getLength() );
  retval += "        " + XMLHandler.addTagValue( "precision", getPrecision() );
  retval += "        " + XMLHandler.addTagValue( "trim_type", getTrimTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "repeat", isRepeated() );

  retval += "        <positions>";
  for ( int i = 0; i < fieldPosition.length; i++ ) {
    retval += XMLHandler.addTagValue( "position", fieldPosition[i].toString(), false );
  }
  retval += "        </positions>" + Const.CR;

  retval += "        </field>" + Const.CR;

  return retval;
}
 
Example 8
Source File: XMLInputField.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "      <field>" + Const.CR;
  retval += "        " + XMLHandler.addTagValue( "name", getName() );
  retval += "        " + XMLHandler.addTagValue( "type", getTypeDesc() );
  retval += "        " + XMLHandler.addTagValue( "format", getFormat() );
  retval += "        " + XMLHandler.addTagValue( "currency", getCurrencySymbol() );
  retval += "        " + XMLHandler.addTagValue( "decimal", getDecimalSymbol() );
  retval += "        " + XMLHandler.addTagValue( "group", getGroupSymbol() );
  retval += "        " + XMLHandler.addTagValue( "length", getLength() );
  retval += "        " + XMLHandler.addTagValue( "precision", getPrecision() );
  retval += "        " + XMLHandler.addTagValue( "trim_type", getTrimTypeCode() );
  retval += "        " + XMLHandler.addTagValue( "repeat", isRepeated() );

  retval += "        <positions>";
  for ( int i = 0; i < fieldPosition.length; i++ ) {
    retval += XMLHandler.addTagValue( "position", fieldPosition[i].toString(), false );
  }
  retval += "        </positions>" + Const.CR;

  retval += "        </field>" + Const.CR;

  return retval;
}
 
Example 9
Source File: InfobrightLoaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String getXML() {
  String ret = super.getXML();
  ret = ret + new String( "    " + XMLHandler.addTagValue( TAG_DATA_FORMAT, dataFormat.toString() ) );
  ret = ret + new String( "    " + XMLHandler.addTagValue( TAG_AGENT_PORT, agentPort ) );
  ret = ret + new String( "    " + XMLHandler.addTagValue( TAG_CHARSET, charset.name() ) );
  ret = ret + new String( "    " + XMLHandler.addTagValue( TAG_DEBUG_FILE, debugFile ) );
  return ret;
}
 
Example 10
Source File: ShapeFileReaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "    " + XMLHandler.addTagValue( "shapefilename", shapeFilename );
  retval += "    " + XMLHandler.addTagValue( "dbffilename", dbfFilename );
  retval += "    " + XMLHandler.addTagValue( "encoding", encoding );

  return retval;
}
 
Example 11
Source File: XMLInputSaxMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public String getXML() {
  String retval = "";

  retval += "    " + XMLHandler.addTagValue( "include", includeFilename );
  retval += "    " + XMLHandler.addTagValue( "include_field", filenameField );
  retval += "    " + XMLHandler.addTagValue( "rownum", includeRowNumber );
  retval += "    " + XMLHandler.addTagValue( "rownum_field", rowNumberField );

  retval += "    <file>" + Const.CR;
  for ( int i = 0; i < fileName.length; i++ ) {
    retval += "      " + XMLHandler.addTagValue( "name", fileName[i] );
    retval += "      " + XMLHandler.addTagValue( "filemask", fileMask[i] );
  }
  retval += "      </file>" + Const.CR;

  retval += "    <def_attributes>" + Const.CR;
  for ( int i = 0; i < definitionElement.size(); i++ ) {
    retval += "      " + XMLHandler.addTagValue( "def_element", getDefiningElement( i ) );
    retval += "      " + XMLHandler.addTagValue( "def_attribute", getDefiningAttribute( i ) );
  }
  retval += "      </def_attributes>" + Const.CR;

  retval += "    <fields>" + Const.CR;
  for ( int i = 0; i < inputFields.length; i++ ) {
    XMLInputSaxField field = inputFields[i];
    retval += field.getXML();
  }
  retval += "      </fields>" + Const.CR;

  retval += "    <positions>" + Const.CR;
  for ( int i = 0; i < inputPosition.length; i++ ) {
    retval += "      " + XMLHandler.addTagValue( "position", inputPosition[i].toString() );
  }

  retval += "      </positions>" + Const.CR;

  retval += "    " + XMLHandler.addTagValue( "limit", rowLimit );

  return retval;
}
 
Example 12
Source File: ConcatFieldsMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String getXML() {
  // PDI-18028: Avoid fileName handling!
  super.setFileName( StringUtil.EMPTY_STRING );
  super.setFileNameInField( false );

  String retval = super.getXML();
  retval = retval + "    <" + ConcatFieldsNodeNameSpace + ">" + Const.CR;
  retval = retval + XMLHandler.addTagValue( "targetFieldName", targetFieldName );
  retval = retval + XMLHandler.addTagValue( "targetFieldLength", targetFieldLength );
  retval = retval + XMLHandler.addTagValue( "removeSelectedFields", removeSelectedFields );
  retval = retval + "    </" + ConcatFieldsNodeNameSpace + ">" + Const.CR;
  return retval;
}
 
Example 13
Source File: SlaveServerConfig.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public String getXML() {

    StringBuilder xml = new StringBuilder();

    xml.append( XMLHandler.openTag( XML_TAG ) );

    for ( SlaveServer slaveServer : masters ) {
      xml.append( slaveServer.getXML() );
    }

    XMLHandler.addTagValue( "report_to_masters", reportingToMasters );

    if ( slaveServer != null ) {
      xml.append( slaveServer.getXML() );
    }

    XMLHandler.addTagValue( "joining", joining );
    XMLHandler.addTagValue( "max_log_lines", maxLogLines );
    XMLHandler.addTagValue( "max_log_timeout_minutes", maxLogTimeoutMinutes );
    XMLHandler.addTagValue( "object_timeout_minutes", objectTimeoutMinutes );

    xml.append( XMLHandler.openTag( XML_TAG_SEQUENCES ) );
    for ( SlaveSequence slaveSequence : slaveSequences ) {
      xml.append( XMLHandler.openTag( SlaveSequence.XML_TAG ) );
      xml.append( slaveSequence.getXML() );
      xml.append( XMLHandler.closeTag( SlaveSequence.XML_TAG ) );
    }
    xml.append( XMLHandler.closeTag( XML_TAG_SEQUENCES ) );

    if ( autoSequence != null ) {
      xml.append( XMLHandler.openTag( XML_TAG_AUTOSEQUENCE ) );
      xml.append( autoSequence.getXML() );
      xml.append( XMLHandler.addTagValue( XML_TAG_AUTO_CREATE, automaticCreationAllowed ) );
      xml.append( XMLHandler.closeTag( XML_TAG_AUTOSEQUENCE ) );
    }

    if ( repositoryMeta != null ) {
      xml.append( XMLHandler.openTag( XML_TAG_REPOSITORY ) );
      xml.append( "  " ).append( XMLHandler.addTagValue( "id", repositoryMeta.getId() ) );
      xml.append( "  " ).append( XMLHandler.addTagValue( "username", repositoryUsername ) );
      xml.append( "  " ).append(
        XMLHandler.addTagValue( "password", Encr.encryptPasswordIfNotUsingVariables( repositoryPassword ) ) );
      xml.append( XMLHandler.closeTag( XML_TAG_REPOSITORY ) );
    }

    xml.append( XMLHandler.closeTag( XML_TAG ) );

    return xml.toString();
  }
 
Example 14
Source File: HL7InputMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Override
public String getXML() throws KettleException {
  return XMLHandler.addTagValue( "message_field", messageField );
}
 
Example 15
Source File: BusinessTable.java    From pentaho-metadata with GNU Lesser General Public License v2.1 3 votes vote down vote up
public String getXML() {
  String retval = "<business-table>"; //$NON-NLS-1$

  retval += "      " + XMLHandler.addTagValue( "xloc", location.x ); //$NON-NLS-1$ //$NON-NLS-2$
  retval += "      " + XMLHandler.addTagValue( "yloc", location.y ); //$NON-NLS-1$ //$NON-NLS-2$

  retval += "      " + XMLHandler.addTagValue( "draw_table", drawn ); //$NON-NLS-1$ //$NON-NLS-2$

  retval += "</business-table>"; //$NON-NLS-1$

  return retval;
}