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


Java TextFileInputField.setFormat方法代码示例

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


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

示例1: getTestObject

import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; //导入方法依赖的package包/类
@Override
public TextFileInputField getTestObject() {
  TextFileInputField rtn = new TextFileInputField();
  rtn.setCurrencySymbol( UUID.randomUUID().toString() );
  rtn.setDecimalSymbol( UUID.randomUUID().toString() );
  rtn.setFormat( UUID.randomUUID().toString() );
  rtn.setGroupSymbol( UUID.randomUUID().toString() );
  rtn.setName( UUID.randomUUID().toString() );
  rtn.setTrimType( rand.nextInt( 4 ) );
  rtn.setPrecision( rand.nextInt( 9 ) );
  rtn.setLength( rand.nextInt( 50 ) );
  rtn.setType( rand.nextInt( 7 ) );
  // Note - these fields aren't serialized by the meta class ... cannot test for them
  // rtn.setRepeated( rand.nextBoolean() );
  // rtn.setSamples( new String[] { UUID.randomUUID().toString(), UUID.randomUUID().toString(),
  // UUID.randomUUID().toString() } );
  // rtn.setNullString( UUID.randomUUID().toString() );
  // rtn.setIfNullValue( UUID.randomUUID().toString() );
  // rtn.setIgnored( rand.nextBoolean() );
  // rtn.setPosition( rand.nextInt( 10 ) );
  return rtn;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:23,代码来源:ParGzipCsvInputMetaTest.java

示例2: getTestObject

import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; //导入方法依赖的package包/类
@Override public TextFileInputField getTestObject() {
  TextFileInputField rtn = new TextFileInputField( UUID.randomUUID().toString(), rand.nextInt(), rand.nextInt() );
  rtn.setType( rand.nextInt( 7 ) );
  rtn.setCurrencySymbol( UUID.randomUUID().toString() );
  rtn.setDecimalSymbol( UUID.randomUUID().toString() );
  rtn.setFormat( UUID.randomUUID().toString() );
  rtn.setGroupSymbol( UUID.randomUUID().toString() );
  rtn.setIfNullValue( UUID.randomUUID().toString() );
  rtn.setIgnored( rand.nextBoolean() );
  rtn.setNullString( UUID.randomUUID().toString() );
  rtn.setPrecision( rand.nextInt( 9 ) );
  rtn.setRepeated( rand.nextBoolean() );
  rtn.setTrimType( rand.nextInt( ValueMetaString.trimTypeDesc.length ) );
  return rtn;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:16,代码来源:TextFileInputFieldValidator.java

示例3: injectStepMetadataEntries

import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; //导入方法依赖的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

示例4: injectStepMetadataEntries

import org.pentaho.di.trans.steps.textfileinput.TextFileInputField; //导入方法依赖的package包/类
@Override
public void injectStepMetadataEntries(List<StepInjectionMetaEntry> all) throws KettleException {
  
  List<TextFileInputField> fields = new ArrayList<TextFileInputField>();
      
  // Parse the fields, inject into the meta class..
  //
  for (StepInjectionMetaEntry lookFields : all) {
    Entry fieldsEntry = Entry.findEntry(lookFields.getKey());
    if (fieldsEntry==null) continue;

    String lookValue = (String)lookFields.getValue();
    switch(fieldsEntry) {
    case FIELDS:
    {
      for (StepInjectionMetaEntry lookField : lookFields.getDetails()) {
        Entry fieldEntry = Entry.findEntry(lookField.getKey());
        if (fieldEntry == Entry.FIELD) {
          
          TextFileInputField field = new TextFileInputField();
          
          List<StepInjectionMetaEntry> entries = lookField.getDetails();
          for (StepInjectionMetaEntry entry : entries) {
            Entry metaEntry = Entry.findEntry(entry.getKey());
            if (metaEntry!=null) {
              String value = (String)entry.getValue();
              switch(metaEntry) {
              case FIELD_NAME: field.setName(value); break;
              case FIELD_POSITION: field.setPosition(Const.toInt(value, -1)); break;
              case FIELD_LENGTH: field.setLength(Const.toInt(value, -1)); break;
              case FIELD_TYPE: field.setType(ValueMeta.getType(value)); break;
              case FIELD_IGNORE: field.setIgnored("Y".equalsIgnoreCase(value)); break;
              case FIELD_FORMAT: field.setFormat(value); break;
              case FIELD_TRIM_TYPE: field.setTrimType(ValueMeta.getTrimTypeByCode(value)); break;
              case FIELD_PRECISION: field.setPrecision(Const.toInt(value, -1)); break;
              case FIELD_DECIMAL: field.setDecimalSymbol(value); break;
              case FIELD_GROUP: field.setGroupSymbol(value); break;
              case FIELD_CURRENCY: field.setCurrencySymbol(value); break;
              case FIELD_REPEAT: field.setRepeated("Y".equalsIgnoreCase(value)); break;
              case FIELD_NULL_STRING: field.setNullString(value); break;
              case FIELD_IF_NULL: field.setIfNullValue(value); break;
              }
            }
          }
          fields.add(field);
        }
      }
    }
    break;

      
    case FILENAME: meta.setFilename(lookValue); break;
    case FILENAME_FIELD : meta.setFilenameField(lookValue); break;
    case ROW_NUMBER_FIELD : meta.setRowNumField(lookValue); break;
    case INCLUDING_FILENAMES: meta.setIncludingFilename("Y".equalsIgnoreCase(lookValue)); break;
    case DELIMITER: meta.setDelimiter(lookValue); break;
    case ENCLOSURE: meta.setEnclosure(lookValue); break;
    case HEADER_PRESENT: meta.setHeaderPresent("Y".equalsIgnoreCase(lookValue)); break;
    case BUFFER_SIZE: meta.setBufferSize(lookValue); break;
    case LAZY_CONVERSION: meta.setLazyConversionActive("Y".equalsIgnoreCase(lookValue)); break;
    case ADD_FILES_TO_RESULT: meta.setAddResultFile("Y".equalsIgnoreCase(lookValue)); break;
    case RUN_IN_PARALLEL: meta.setRunningInParallel("Y".equalsIgnoreCase(lookValue)); break;
    case ENCODING: meta.setEncoding(lookValue); break;

    }
  }
  
  // If we got fields, use them, otherwise leave the defaults alone.
  //
  if (fields.size()>0) {
    meta.setInputFields(fields.toArray(new TextFileInputField[fields.size()]));
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:74,代码来源:ParGzipCsvInputMetaInjection.java


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