org.pentaho.di.core.Const.indexOfString()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.pentaho.di.core.Const.indexOfString()方法的一些代码示例,展示了Const.indexOfString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Const.indexOfString()方法的具体详情如下:
包路径:org.pentaho.di.core.Const
类名称:Const
方法名:indexOfString

Const.indexOfString介绍

[英]Search for a string in a list of strings and return the index.
[中]在字符串列表中搜索字符串并返回索引。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

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;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public boolean matches( String id ) {
 return Const.indexOfString( id, ids ) >= 0;
}

代码示例来源:origin: pentaho/pentaho-kettle

public static boolean isSystemVariable( String aString ) {
 return Const.indexOfString( aString, SYSTEM_PROPERTIES ) >= 0;
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * 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;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void addToDestination( String string ) {
 int idxInput = Const.indexOfString( string, input );
 selection.put( Integer.valueOf( idxInput ), string );
 getData();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void addToDestination( String string ) {
 int idxInput = Const.indexOfString( string, input );
 selection.put( Integer.valueOf( idxInput ), string );
 getData();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void delFromDestination( String string ) {
 int idxInput = Const.indexOfString( string, input );
 selection.remove( Integer.valueOf( idxInput ) );
 getData();
}

代码示例来源:origin: pentaho/pentaho-kettle

public void delFromDestination( String string ) {
 int idxInput = Const.indexOfString( string, input );
 selection.remove( Integer.valueOf( idxInput ) );
 getData();
}

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * 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;
}

代码示例来源:origin: pentaho/pentaho-kettle

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();
}

代码示例来源:origin: pentaho/pentaho-kettle

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();
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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;
}

代码示例来源:origin: pentaho/pentaho-kettle

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() );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
  }
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

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 );
}

相关文章

微信公众号

最新文章

更多