public static final int getFileType( String fileTypeCode ) { int t = Const.indexOfString( fileTypeCode, FixedInputMeta.fileTypeCode ); if ( t >= 0 ) { return t; } t = Const.indexOfString( fileTypeCode, FixedInputMeta.fileTypeDesc ); if ( t >= 0 ) { return t; } return FILE_TYPE_NONE; }
@Override public boolean matches( String id ) { return Const.indexOfString( id, ids ) >= 0; }
public static boolean isSystemVariable( String aString ) { return Const.indexOfString( aString, SYSTEM_PROPERTIES ) >= 0; }
/** * Search for strings in an array of strings and return the indexes. * * @param lookup * The strings to search for * @param array * The array of strings to look in * @return The indexes of strings in an array of strings. -1 if not found. */ public static int[] indexsOfStrings( String[] lookup, String[] array ) { int[] indexes = new int[lookup.length]; for ( int i = 0; i < indexes.length; i++ ) { indexes[i] = indexOfString( lookup[i], array ); } return indexes; }
public void addToDestination( String string ) { int idxInput = Const.indexOfString( string, input ); selection.put( Integer.valueOf( idxInput ), string ); getData(); }
public void addToDestination( String string ) { int idxInput = Const.indexOfString( string, input ); selection.put( Integer.valueOf( idxInput ), string ); getData(); }
public void delFromDestination( String string ) { int idxInput = Const.indexOfString( string, input ); selection.remove( Integer.valueOf( idxInput ) ); getData(); }
public void delFromDestination( String string ) { int idxInput = Const.indexOfString( string, input ); selection.remove( Integer.valueOf( idxInput ) ); getData(); }
/** * Returns true if the string specified is a reserved word on this database type. * * @param word * The word to check * @return true if word is a reserved word on this database. */ public boolean isReservedWord( String word ) { String[] reserved = getReservedWords(); if ( Const.indexOfString( word, reserved ) >= 0 ) { return true; } return false; }
private Optional<CheckResult> checkTarget( StepMeta stepMeta, String target, String targetStepName, String[] output ) { if ( targetStepName != null ) { int trueTargetIdx = Const.indexOfString( targetStepName, output ); if ( trueTargetIdx < 0 ) { return Optional.of( new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "FilterRowsMeta.CheckResult.TargetStepInvalid", target, targetStepName ), stepMeta ) ); } } return Optional.empty(); }
private void add() { if ( wSource.getSelectionCount() == 1 && wTarget.getSelectionCount() == 1 ) { String sourceString = wSource.getSelection()[0]; String targetString = wTarget.getSelection()[0]; int srcIndex = Const.indexOfString( sourceString, sourceList ); int tgtIndex = Const.indexOfString( targetString, targetList ); if ( srcIndex >= 0 && tgtIndex >= 0 ) { // New mapping: add it to the list... SourceToTargetMapping mapping = new SourceToTargetMapping( srcIndex, tgtIndex ); mappings.add( mapping ); refreshMappings(); } } }
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( int i = 0; i < values.size(); i++ ) { Charset charSet = values.get( i ); wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( int i = 0; i < values.size(); i++ ) { Charset charSet = values.get( i ); wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( int i = 0; i < values.size(); i++ ) { Charset charSet = values.get( i ); wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
public int getDefaultSelectedSchemaIndex() { List<String> schemaNames; try { schemaNames = schemasProvider.getPartitionSchemasNames( transMeta ); } catch ( KettleException e ) { schemaNames = Collections.emptyList(); } PartitionSchema partitioningSchema = stepMeta.getStepPartitioningMeta().getPartitionSchema(); int defaultSelectedSchemaIndex = 0; if ( partitioningSchema != null && partitioningSchema.getName() != null && !schemaNames.isEmpty() ) { defaultSelectedSchemaIndex = Const.indexOfString( partitioningSchema.getName(), schemaNames ); } return defaultSelectedSchemaIndex != -1 ? defaultSelectedSchemaIndex : 0; }
public void processForKnownSchema( String schemaName, PartitionSettings settings ) throws KettlePluginException { if ( schemaName != null ) { int idx = Const.indexOfString( schemaName, settings.getSchemaNames() ); settings.updateSchema( settings.getSchemas().get( idx ) ); } else { settings.rollback( settings.getBefore() ); } }
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); List<Charset> values = new ArrayList<>( Charset.availableCharsets().values() ); for ( Charset charSet : values ) { wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
private void setEncodings( ComboVar var ) { // Encoding of the text file: String encoding = Const.NVL( var.getText(), Const.getEnvironmentVariable( "file.encoding", "UTF-8" ) ); var.removeAll(); ArrayList<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( int i = 0; i < values.size(); i++ ) { Charset charSet = values.get( i ); var.add( charSet.displayName() ); } // Now select the default! int idx = Const.indexOfString( encoding, var.getItems() ); if ( idx >= 0 ) { var.select( idx ); } } }
private void setEncodings() { // Encoding of the text file: if ( !gotEncodings ) { gotEncodings = true; wEncoding.removeAll(); List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() ); for ( Charset charSet : values ) { wEncoding.add( charSet.displayName() ); } // Now select the default! String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" ); int idx = Const.indexOfString( defEncoding, wEncoding.getItems() ); if ( idx >= 0 ) { wEncoding.select( idx ); } } }
private void getVariablesData() { wVariables.clearAll( false ); List<String> variableNames = new ArrayList<String>( configuration.getVariables().keySet() ); Collections.sort( variableNames ); for ( int i = 0; i < variableNames.size(); i++ ) { String variableName = variableNames.get( i ); String variableValue = configuration.getVariables().get( variableName ); if ( Const.indexOfString( variableName, abstractMeta.listParameters() ) < 0 ) { TableItem tableItem = new TableItem( wVariables.table, SWT.NONE ); tableItem.setText( 1, variableName ); tableItem.setText( 2, Const.NVL( variableValue, "" ) ); } } wVariables.removeEmptyRows(); wVariables.setRowNums(); wVariables.optWidth( true ); }