当前位置: 首页>>代码示例>>Java>>正文


Java KettleAttributeInterface.toString方法代码示例

本文整理汇总了Java中org.pentaho.di.core.KettleAttributeInterface.toString方法的典型用法代码示例。如果您正苦于以下问题:Java KettleAttributeInterface.toString方法的具体用法?Java KettleAttributeInterface.toString怎么用?Java KettleAttributeInterface.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.KettleAttributeInterface的用法示例。


在下文中一共展示了KettleAttributeInterface.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入方法依赖的package包/类
public void injectStepMetadataEntries(List<StepInjectionMetaEntry> metadata) {
  for (StepInjectionMetaEntry entry : metadata) {
    KettleAttributeInterface attr = findAttribute(entry.getKey());
    
    // Set top level attributes...
    //
    if (entry.getValueType()!=ValueMetaInterface.TYPE_NONE) {
      if (attr.getKey().equals("FILENAME")) { filename = (String) entry.getValue(); } else
      if (attr.getKey().equals("FILENAME_FIELD")) { filenameField = (String) entry.getValue(); } else
      if (attr.getKey().equals("ROW_NUM_FIELD")) { rowNumField = (String) entry.getValue(); } else
      if (attr.getKey().equals("HEADER_PRESENT")) { headerPresent = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("DELIMITER")) { delimiter = (String) entry.getValue(); } else
      if (attr.getKey().equals("ENCLOSURE")) { enclosure = (String) entry.getValue(); } else
      if (attr.getKey().equals("BUFFERSIZE")) { bufferSize = (String) entry.getValue(); } else
      if (attr.getKey().equals("LAZY_CONVERSION")) { lazyConversionActive = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("PARALLEL")) { runningInParallel = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("NEWLINE_POSSIBLE")) { newlinePossibleInFields = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("ADD_FILENAME_RESULT")) { isaddresult = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("ENCODING")) { encoding = (String) entry.getValue(); } else
      { 
        throw new RuntimeException("Unhandled metadata injection of attribute: "+attr.toString()+" - "+attr.getDescription());
      }
    } else {
      if (attr.getKey().equals("FIELDS")) {
        // This entry contains a list of lists...
        // Each list contains a single CSV input field definition (one line in the dialog)
        //
        List<StepInjectionMetaEntry> inputFieldEntries = entry.getDetails();
        inputFields = new TextFileInputField[inputFieldEntries.size()];
        for (int row=0;row<inputFieldEntries.size();row++) {
          StepInjectionMetaEntry inputFieldEntry = inputFieldEntries.get(row);
          TextFileInputField inputField = new TextFileInputField();

          List<StepInjectionMetaEntry> fieldAttributes = inputFieldEntry.getDetails();
          for (int i=0;i<fieldAttributes.size();i++) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get(i);
            KettleAttributeInterface fieldAttr = findAttribute(fieldAttribute.getKey());

            String attributeValue = (String)fieldAttribute.getValue();
            if (fieldAttr.getKey().equals("FIELD_NAME")) { inputField.setName(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_TYPE")) { inputField.setType(ValueMeta.getType(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_FORMAT")) { inputField.setFormat(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_LENGTH")) { inputField.setLength(attributeValue==null ? -1 : Integer.parseInt(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_PRECISION")) { inputField.setPrecision(attributeValue==null ? -1 : Integer.parseInt(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_CURRENCY")) { inputField.setCurrencySymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_DECIMAL")) { inputField.setDecimalSymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_GROUP")) { inputField.setGroupSymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_TRIM_TYPE")) { inputField.setTrimType(ValueMeta.getTrimTypeByCode(attributeValue)); } else
            {
              throw new RuntimeException("Unhandled metadata injection of attribute: "+fieldAttr.toString()+" - "+fieldAttr.getDescription());
            }
          }
          
          inputFields[row] = inputField;
        }
      }
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:CsvInputMeta.java

示例2: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入方法依赖的package包/类
public void injectStepMetadataEntries( List<StepInjectionMetaEntry> metadata ) {
  for ( StepInjectionMetaEntry entry : metadata ) {
    KettleAttributeInterface attr = findAttribute( entry.getKey() );

    // Set top level attributes...
    //
    if ( entry.getValueType() != ValueMetaInterface.TYPE_NONE ) {

      if ( entry.getKey().equals( "SCHEMA" ) ) {
        schemaName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TABLE" ) ) {
        tableName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "LOADACTION" ) ) {
        loadAction = (String) entry.getValue();
      } else if ( entry.getKey().equals( "DBNAMEOVERRIDE" ) ) {
        dbNameOverride = (String) entry.getValue();
      } else if ( entry.getKey().equals( "ENCLOSURE" ) ) {
        enclosure = (String) entry.getValue();
      } else if ( entry.getKey().equals( "DELIMITER" ) ) {
        delimiter = (String) entry.getValue();
      } else if ( entry.getKey().equals( "STOPONERROR" ) ) {
        stopOnError = (Boolean) entry.getValue();
      } else {
        throw new RuntimeException( "Unhandled metadata injection of attribute: "
          + attr.toString() + " - " + attr.getDescription() );
      }
    } else {
      // The data sets...
      //
      if ( attr.getKey().equals( "MAPPINGS" ) ) {
        List<StepInjectionMetaEntry> selectMappings = entry.getDetails();

        fieldTable = new String[selectMappings.size()];
        fieldStream = new String[selectMappings.size()];
        dateMask = new String[selectMappings.size()];

        for ( int row = 0; row < selectMappings.size(); row++ ) {
          StepInjectionMetaEntry selectField = selectMappings.get( row );

          List<StepInjectionMetaEntry> fieldAttributes = selectField.getDetails();
          //CHECKSTYLE:Indentation:OFF
          for ( int i = 0; i < fieldAttributes.size(); i++ ) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get( i );
            KettleAttributeInterface fieldAttr = findAttribute( fieldAttribute.getKey() );

            String attributeValue = (String) fieldAttribute.getValue();
            if ( fieldAttr.getKey().equals( "STREAMNAME" ) ) {
              getFieldStream()[row] = attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELDNAME" ) ) {
              getFieldTable()[row] = attributeValue;
            } else if ( fieldAttr.getKey().equals( "DATEMASK" ) ) {
              getDateMask()[row] = attributeValue;
            } else {
              throw new RuntimeException( "Unhandled metadata injection of attribute: "
                + fieldAttr.toString() + " - " + fieldAttr.getDescription() );
            }
          }
        }
      }
      if ( !Utils.isEmpty( getFieldStream() ) ) {
        for ( int i = 0; i < getFieldStream().length; i++ ) {
          logDetailed( "row " + Integer.toString( i ) + ": stream=" + getFieldStream()[i]
            + " : table=" + getFieldTable()[i] );
        }
      }

    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:70,代码来源:PGBulkLoaderMeta.java

示例3: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入方法依赖的package包/类
public void injectStepMetadataEntries( List<StepInjectionMetaEntry> metadata ) {
  for ( StepInjectionMetaEntry entry : metadata ) {
    KettleAttributeInterface attr = findAttribute( entry.getKey() );

    // Set top level attributes...
    //
    if ( entry.getValueType() != ValueMetaInterface.TYPE_NONE ) {

      if ( entry.getKey().equals( "SCHEMA" ) ) {
        schemaName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TABLE" ) ) {
        tableName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "LOGFILE" ) ) {
        logFile = (String) entry.getValue();
      } else if ( entry.getKey().equals( "FIELD_SEPARATOR" ) ) {
        fieldSeparator = (String) entry.getValue();
      } else if ( entry.getKey().equals( "FIELD_ENCLOSURE" ) ) {
        fieldEnclosure = (String) entry.getValue();
      } else if ( entry.getKey().equals( "NULL_REPRESENTATION" ) ) {
        setNULLrepresentation( (String) entry.getValue() );
      } else if ( entry.getKey().equals( "ENCODING" ) ) {
        encoding = (String) entry.getValue();
      } else if ( entry.getKey().equals( "BUFFER_SIZE" ) ) {
        bufferSize = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TRUNCATE" ) ) {
        truncate = (Boolean) entry.getValue();
      } else if ( entry.getKey().equals( "FULLY_QUOTE_SQL" ) ) {
        fullyQuoteSQL = (Boolean) entry.getValue();
      } else {
        throw new RuntimeException( "Unhandled metadata injection of attribute: "
            + attr.toString() + " - " + attr.getDescription() );
      }
    } else {
      // The data sets...
      //
      if ( attr.getKey().equals( "MAPPINGS" ) ) {
        List<StepInjectionMetaEntry> selectMappings = entry.getDetails();

        fieldTable = new String[selectMappings.size()];
        fieldStream = new String[selectMappings.size()];
        fieldFormatOk = new boolean[selectMappings.size()];

        for ( int row = 0; row < selectMappings.size(); row++ ) {
          StepInjectionMetaEntry selectField = selectMappings.get( row );

          List<StepInjectionMetaEntry> fieldAttributes = selectField.getDetails();
          //CHECKSTYLE:Indentation:OFF
          for ( int i = 0; i < fieldAttributes.size(); i++ ) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get( i );
            KettleAttributeInterface fieldAttr = findAttribute( fieldAttribute.getKey() );

            Object attributeValue = fieldAttribute.getValue();

            if ( attributeValue == null ) {
              continue;
            }

            if ( fieldAttr.getKey().equals( "STREAMNAME" ) ) {
              getFieldStream()[row] = (String) attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELDNAME" ) ) {
              getFieldTable()[row] = (String) attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELD_FORMAT_OK" ) ) {
              getFieldFormatOk()[row] = (Boolean) attributeValue;
            } else {
              throw new RuntimeException( "Unhandled metadata injection of attribute: "
                  + fieldAttr.toString() + " - " + fieldAttr.getDescription() );
            }
          }
        }
      }
      if ( !Utils.isEmpty( getFieldStream() ) ) {
        for ( int i = 0; i < getFieldStream().length; i++ ) {
          logDetailed( "row " + Integer.toString( i ) + ": stream=" + getFieldStream()[i]
              + " : table=" + getFieldTable()[i] );
        }
      }

    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:81,代码来源:MonetDBBulkLoaderMeta.java


注:本文中的org.pentaho.di.core.KettleAttributeInterface.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。