public static StepInjectionMetaEntry findEntry( List<StepInjectionMetaEntry> entries, StepMetaInjectionEntryInterface match ) { return findEntry( entries, match.name() ); }
public static StepInjectionMetaEntry getEntry( StepMetaInjectionEntryInterface entryInterface ) { return getEntry( entryInterface, null ); }
StepInjectionMetaEntry cmpEntry = cmpEntries.get( i ); if ( cmpEntry.getValueType() == ValueMetaInteger.TYPE_NONE ) { compareEntryValues( refEntry.getDetails(), cmpEntry.getDetails() ); } else { Object ref = refEntry.getValue();
all.add( StepInjectionUtil.getEntry( topEntry ) ); StepInjectionMetaEntry filesEntry = StepInjectionUtil.getEntry( Entry.FILENAME_LINES ); all.add( filesEntry ); StepInjectionMetaEntry fileEntry = StepInjectionUtil.getEntry( Entry.FILENAME_LINE ); filesEntry.getDetails().add( fileEntry ); List<StepInjectionMetaEntry> fileEntryDetails = fileEntry.getDetails(); for ( Entry entry : fileFieldsEntries ) { StepInjectionMetaEntry metaEntry = StepInjectionUtil.getEntry( entry ); fileEntryDetails.add( metaEntry ); StepInjectionMetaEntry fieldsEntry = StepInjectionUtil.getEntry( Entry.FIELDS ); all.add( fieldsEntry ); StepInjectionMetaEntry fieldEntry = StepInjectionUtil.getEntry( Entry.FIELD ); fieldsEntry.getDetails().add( fieldEntry ); List<StepInjectionMetaEntry> fieldEntryDetails = fieldEntry.getDetails(); for ( Entry entry : aggEntries ) { StepInjectionMetaEntry metaEntry = StepInjectionUtil.getEntry( entry ); fieldEntryDetails.add( metaEntry );
@Test public void extractingAll() throws Exception { TextFileInputMetaInjection injection = new TextFileInputMetaInjection( new TextFileInputMeta() ); List<StepInjectionMetaEntry> metadata = injection.getStepInjectionMetadataEntries(); List<StepInjectionMetaEntry> extracted = injection.extractStepMetadataEntries(); assertEquals( metadata.size(), extracted.size() ); for ( StepInjectionMetaEntry metaEntry : metadata ) { assertNotNull( metaEntry.getKey(), StepInjectionUtil.findEntry( extracted, metaEntry.getKey() ) ); } }
public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException { List<StepInjectionMetaEntry> list = new ArrayList<StepInjectionMetaEntry>(); StepInjectionMetaEntry fieldsEntry = StepInjectionUtil.getEntry( Entry.EXPRESSION_FIELDS ); list.add( fieldsEntry ); for ( int i = 0; i < meta.getFormula().length; i++ ) { StepInjectionMetaEntry fieldEntry = StepInjectionUtil.getEntry( Entry.EXPRESSION_FIELD ); List<StepInjectionMetaEntry> details = fieldEntry.getDetails(); details.add( StepInjectionUtil.getEntry( Entry.NEW_FIELDNAME, meta.getFormula()[i].getFieldName() ) ); details.add( StepInjectionUtil.getEntry( Entry.JAVA_EXPRESSION, meta.getFormula()[i].getFormula() ) ); details.add( StepInjectionUtil.getEntry( Entry.VALUE_TYPE, ValueMetaFactory.getValueMetaName( meta.getFormula()[i].getValueType() ) ) ); details.add( StepInjectionUtil.getEntry( Entry.LENGTH, meta.getFormula()[i].getValueLength() ) ); details.add( StepInjectionUtil.getEntry( Entry.PRECISION, meta.getFormula()[i].getValuePrecision() ) ); details.add( StepInjectionUtil.getEntry( Entry.REPLACE_VALUE, meta.getFormula()[i].getReplaceField() ) ); fieldsEntry.getDetails().add( fieldEntry ); } return list; }
public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException { List<StepInjectionMetaEntry> list = new ArrayList<StepInjectionMetaEntry>(); list.add( StepInjectionUtil.getEntry( Entry.TARGET_SCHEMA, meta.getSchemaName() ) ); list.add( StepInjectionUtil.getEntry( Entry.TARGET_TABLE, meta.getTableName() ) ); list.add( StepInjectionUtil.getEntry( Entry.COMMIT_SIZE, meta.getCommitSize() ) ); list.add( StepInjectionUtil.getEntry( Entry.TRUNCATE_TABLE, meta.truncateTable() ) ); list.add( StepInjectionUtil.getEntry( Entry.SPECIFY_DATABASE_FIELDS, meta.specifyFields() ) ); list.add( StepInjectionUtil.getEntry( Entry.IGNORE_INSERT_ERRORS, meta.ignoreErrors() ) ); list.add( StepInjectionUtil.getEntry( Entry.USE_BATCH_UPDATE, meta.useBatchUpdate() ) ); list.add( StepInjectionUtil.getEntry( Entry.PARTITION_OVER_TABLES, meta.isPartitioningEnabled() ) ); list.add( StepInjectionUtil.getEntry( Entry.PARTITIONING_FIELD, meta.getPartitioningField() ) ); list.add( StepInjectionUtil.getEntry( Entry.PARTITION_DATA_PER, meta.isPartitioningDaily() ? "DAY" : meta.isPartitioningMonthly() ? "MONTH" : "" ) ); list.add( StepInjectionUtil.getEntry( Entry.TABLE_NAME_DEFINED_IN_FIELD, meta.isTableNameInField() ) ); list.add( StepInjectionUtil.getEntry( Entry.TABLE_NAME_FIELD, meta.getTableNameField() ) ); list.add( StepInjectionUtil.getEntry( Entry.STORE_TABLE_NAME, meta.isTableNameInTable() ) ); list.add( StepInjectionUtil.getEntry( Entry.RETURN_AUTO_GENERATED_KEY, meta.isReturningGeneratedKeys() ) ); list.add( StepInjectionUtil.getEntry( Entry.AUTO_GENERATED_KEY_FIELD, meta.getGeneratedKeyField() ) ); StepInjectionMetaEntry fieldsEntry = StepInjectionUtil.getEntry( Entry.DATABASE_FIELDS ); list.add( fieldsEntry ); for ( int i = 0; i < meta.getFieldDatabase().length; i++ ) { StepInjectionMetaEntry fieldEntry = StepInjectionUtil.getEntry( Entry.DATABASE_FIELD ); List<StepInjectionMetaEntry> details = fieldEntry.getDetails(); details.add( StepInjectionUtil.getEntry( Entry.DATABASE_FIELDNAME, meta.getFieldDatabase()[i] ) ); details.add( StepInjectionUtil.getEntry( Entry.STREAM_FIELDNAME, meta.getFieldStream()[i] ) ); fieldsEntry.getDetails().add( fieldEntry ); } return list; }
@Override public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException { List<StepInjectionMetaEntry> result = new ArrayList<StepInjectionMetaEntry>(); result.add( StepInjectionUtil.getEntry( Entry.FILE_TYPE, meta.getFileType() ) ); result.add( StepInjectionUtil.getEntry( Entry.SEPARATOR, meta.getSeparator() ) ); result.add( StepInjectionUtil.getEntry( Entry.ENCLOSURE, meta.getEnclosure() ) ); result.add( StepInjectionUtil.getEntry( Entry.ESCAPE_CHAR, meta.getEscapeCharacter() ) ); result.add( StepInjectionUtil.getEntry( Entry.BREAK_IN_ENCLOSURE, meta.isBreakInEnclosureAllowed() ) ); result.add( StepInjectionUtil.getEntry( Entry.HEADER_PRESENT, meta.hasHeader() ) ); result.add( StepInjectionUtil.getEntry( Entry.NR_HEADER_LINES, meta.getNrHeaderLines() ) ); result.add( StepInjectionUtil.getEntry( Entry.HAS_FOOTER, meta.hasFooter() ) ); result.add( StepInjectionUtil.getEntry( Entry.NR_FOOTER_LINES, meta.getNrFooterLines() ) ); result.add( StepInjectionUtil.getEntry( Entry.HAS_WRAPPED_LINES, meta.isLineWrapped() ) ); result.add( StepInjectionUtil.getEntry( Entry.NR_WRAPS, meta.getNrWraps() ) ); result.add( StepInjectionUtil.getEntry( Entry.HAS_PAGED_LAYOUT, meta.isLayoutPaged() ) ); result.add( StepInjectionUtil.getEntry( Entry.NR_DOC_HEADER_LINES, meta.getNrLinesDocHeader() ) ); result.add( StepInjectionUtil.getEntry( Entry.NR_LINES_PER_PAGE, meta.getNrLinesPerPage() ) ); result.add( StepInjectionUtil.getEntry( Entry.COMPRESSION_TYPE, meta.getFileCompression() ) ); result.add( StepInjectionUtil.getEntry( Entry.NO_EMPTY_LINES, meta.noEmptyLines() ) ); result.add( StepInjectionUtil.getEntry( Entry.INCLUDE_FILENAME, meta.includeFilename() ) ); result.add( StepInjectionUtil.getEntry( Entry.FILENAME_FIELD, meta.getFilenameField() ) ); result.add( StepInjectionUtil.getEntry( Entry.INCLUDE_ROW_NUMBER, meta.includeRowNumber() ) ); result.add( StepInjectionUtil.getEntry( Entry.ROW_NUMBER_BY_FILE, meta.isRowNumberByFile() ) ); result.add( StepInjectionUtil.getEntry( Entry.ROW_NUMBER_FIELD, meta.getRowNumberField() ) ); result.add( StepInjectionUtil.getEntry( Entry.FILE_FORMAT, meta.getFileFormat() ) ); result.add( StepInjectionUtil.getEntry( Entry.ENCODING, meta.getEncoding() ) ); result.add( StepInjectionUtil.getEntry( Entry.ROW_LIMIT, meta.getRowLimit() ) ); result.add( StepInjectionUtil.getEntry( Entry.DATE_FORMAT_LENIENT, meta.isDateFormatLenient() ) ); result.add( StepInjectionUtil.getEntry( Entry.DATE_FORMAT_LOCALE, meta.getDateFormatLocale() ) ); result.add( StepInjectionUtil.getEntry( Entry.ACCEPT_FILE_NAMES, meta.isAcceptingFilenames() ) );
private static List<StepInjectionMetaEntry> createInjectionValues( TextFileInputMetaInjection.Entry[] entries ) { Map<TextFileInputMetaInjection.Entry, Generator<?>> generators = createGeneratorsMapping(); List<StepInjectionMetaEntry> result = new ArrayList<StepInjectionMetaEntry>( entries.length ); for ( TextFileInputMetaInjection.Entry entry : entries ) { StepInjectionMetaEntry injectionEntry = StepInjectionUtil.getEntry( entry ); if ( entry.getValueType() != ValueMetaInterface.TYPE_NONE ) { injectionEntry.setValue( generators.get( entry ).generateValue() ); } result.add( injectionEntry ); } return result; }