當前位置: 首頁>>代碼示例>>Java>>正文


Java RowMetaInterface.indexOfValue方法代碼示例

本文整理匯總了Java中org.pentaho.di.core.row.RowMetaInterface.indexOfValue方法的典型用法代碼示例。如果您正苦於以下問題:Java RowMetaInterface.indexOfValue方法的具體用法?Java RowMetaInterface.indexOfValue怎麽用?Java RowMetaInterface.indexOfValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.pentaho.di.core.row.RowMetaInterface的用法示例。


在下文中一共展示了RowMetaInterface.indexOfValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: determineInputFieldScriptFieldSplit

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * Given a fully defined output row metadata structure, determine which of the output fields are being copied from
 * the input fields and which must be the output of the script.
 *
 * @param fullOutputRowMeta    the fully defined output row metadata structure
 * @param scriptFields         row meta that will hold script only fields
 * @param inputPresentInOutput row meta that will hold input fields being copied
 * @param infos                the array of info row metas
 * @param stepName             the name of the step
 */
protected void determineInputFieldScriptFieldSplit( RowMetaInterface fullOutputRowMeta, RowMetaInterface scriptFields,
    RowMetaInterface inputPresentInOutput, RowMetaInterface[] infos, String stepName ) {

  scriptFields.clear();
  inputPresentInOutput.clear();
  RowMetaInterface consolidatedInputFields = new RowMeta();
  for ( RowMetaInterface r : infos ) {
    consolidatedInputFields.addRowMeta( r );
  }

  for ( ValueMetaInterface vm : fullOutputRowMeta.getValueMetaList() ) {
    int index = consolidatedInputFields.indexOfValue( vm.getName() );
    if ( index >= 0 ) {
      inputPresentInOutput.addValueMeta( vm );
    } else {
      // must be a script output (either a variable name field or data frame column name
      scriptFields.addValueMeta( vm );
    }
  }
}
 
開發者ID:pentaho-labs,項目名稱:pentaho-cpython-plugin,代碼行數:31,代碼來源:CPythonScriptExecutorMeta.java

示例2: getUpdater

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public BSONObject getUpdater( Object[] row, RowMetaInterface rowMeta ) throws KettleValueException {
   BSONObject updater = new BasicBSONObject() ;
   for(Map.Entry<String, List<SequoiaDBUpdateFieldInfo>> entry:m_updateFields.entrySet()) {
      BSONObject fieldsObj = new BasicBSONObject() ;
      int fieldNum = entry.getValue().size() ;
      for( int i = 0 ; i < fieldNum ; i++ ) {
         SequoiaDBUpdateFieldInfo fieldTmp = entry.getValue().get(i) ;
         int index = rowMeta.indexOfValue( fieldTmp.getName() ) ;
         ValueMetaInterface vmi = rowMeta.getValueMeta( index ) ;
         try{
            fieldsObj.put(fieldTmp.getPath(), fieldTmp.getBsonValue(row[index], vmi)) ;
         }
         catch( KettleValueException e ){
            throw new KettleValueException( BaseMessages.getString( PKG,
                  "SequoiaDBOutput.Msg.Err.FailedToGetTheFieldVal"
                  + "(" + entry.getKey() + ":" + row[index].toString() + ")" ) );
         }
      }
      updater.put( entry.getKey(), fieldsObj ) ;
   }
   if ( updater.isEmpty()) {
      return null ;
   }
   return updater ;
}
 
開發者ID:SequoiaDB,項目名稱:pentaho-sequoiadb-plugin,代碼行數:26,代碼來源:SequoiaDBUpdateRecordInfo.java

示例3: getUpdateCond

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public BSONObject getUpdateCond( Object[] row, RowMetaInterface rowMeta ) throws KettleValueException {
   BSONObject condition = new BasicBSONObject() ;
   int fieldNum = m_condFields.size() ;
   for( int i = 0 ; i < fieldNum ; i++ ) {
      SequoiaDBUpdateFieldInfo fieldTmp = m_condFields.get(i) ;
      int index = rowMeta.indexOfValue( fieldTmp.getName() ) ;
      ValueMetaInterface vmi = rowMeta.getValueMeta( index ) ;
      try{
         condition.put(fieldTmp.getPath(), fieldTmp.getBsonValue(row[index], vmi)) ;
      }
      catch( KettleValueException e ){
         throw new KettleValueException( BaseMessages.getString( PKG,
               "SequoiaDBOutput.Msg.Err.FailedToGetTheFieldVal"
               + "(" + fieldTmp.getName() + ":" + row[index].toString() + ")" ) );
      }
   }
   if ( condition.isEmpty() ) {
      return null ;
   }
   return condition ;
}
 
開發者ID:SequoiaDB,項目名稱:pentaho-sequoiadb-plugin,代碼行數:22,代碼來源:SequoiaDBUpdateRecordInfo.java

示例4: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException
{ 

	// Add new field?
	for(int i=0;i<fieldOutStream.length;i++) {
		if (!Const.isEmpty(fieldOutStream[i])){
			int index=inputRowMeta.indexOfValue(fieldInStream[i]);
			if(index>=0)
			{
				ValueMetaInterface in=inputRowMeta.getValueMeta(index);
				ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(fieldOutStream[i]), in.getType());
				v.setName(space.environmentSubstitute(fieldOutStream[i]));
				v.setLength(in.getLength());
	            v.setPrecision(in.getPrecision());
	            v.setConversionMask(in.getConversionMask());
				v.setOrigin(name);
				inputRowMeta.addValueMeta(v);
			}
		}
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:22,代碼來源:GetPreviousRowFieldMeta.java

示例5: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
    // Set the sorted properties: ascending/descending
    for (int i=0;i<fieldName.length;i++)
    {
        int idx = inputRowMeta.indexOfValue(fieldName[i]);
        if (idx>=0)
        {
            ValueMetaInterface valueMeta = inputRowMeta.getValueMeta(idx);
            valueMeta.setSortedDescending(!ascending[i]);
            
            // TODO: add case insensivity
        }
    }
    
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:17,代碼來源:SortedMergeMeta.java

示例6: getFieldsFromPrevious

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * Gets fields from previous steps and populate a ComboVar.
 * @param comboVar the comboVar to populate
 * @param TransMeta the source transformation
 * @param StepMeta the source step 
 */
public static final void getFieldsFromPrevious(ComboVar comboVar,TransMeta transMeta,StepMeta stepMeta)
{
 String selectedField=null;
 int indexField=-1;
 try{   
	 RowMetaInterface r = transMeta.getPrevStepFields(stepMeta);
	 selectedField=comboVar.getText();
	 comboVar.removeAll();
		
	 if (r!=null && !r.isEmpty()) {
            r.getFieldNames();
            comboVar.setItems(r.getFieldNames());
            indexField=r.indexOfValue(selectedField);
	 }
	 // Select value if possible...
	 if(indexField>-1) comboVar.select(indexField); else { if(selectedField!=null) comboVar.setText(selectedField);};
 }catch(KettleException ke){
		new ErrorDialog(comboVar.getShell(),Messages.getString("BaseStepDialog.FailedToGetFieldsPrevious.DialogTitle"),
				Messages.getString("BaseStepDialog.FailedToGetFieldsPrevious.DialogMessage"),ke);
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:28,代碼來源:BaseStepDialog.java

示例7: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
    // Set the sorted properties: ascending/descending
    for (int i=0;i<fieldName.length;i++)
    {
        int idx = inputRowMeta.indexOfValue(fieldName[i]);
        if (idx>=0)
        {
            ValueMetaInterface valueMeta = inputRowMeta.getValueMeta(idx);
            valueMeta.setSortedDescending(!ascending[i]);
            valueMeta.setCaseInsensitive(!caseSensitive[i]);
            
            // Also see if lazy conversion is active on these key fields.
            // If so we want to automatically convert them to the normal storage type.
            // This will improve performance, see also: PDI-346
            // 
            valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
            valueMeta.setStorageMetadata(null);
        }
    }
    
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:23,代碼來源:SortRowsMeta.java

示例8: execHttp

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private Object[] execHttp(RowMetaInterface rowMeta, Object[] row) throws KettleException
{
       if (first)
	{
		first=false;
		data.argnrs=new int[meta.getArgumentField().length];
		
		for (int i=0;i<meta.getArgumentField().length;i++)
		{
			data.argnrs[i]=rowMeta.indexOfValue(meta.getArgumentField()[i]);
			if (data.argnrs[i]<0)
			{
				logError(BaseMessages.getString(PKG, "HTTP.Log.ErrorFindingField")+meta.getArgumentField()[i]+"]"); //$NON-NLS-1$ //$NON-NLS-2$
				throw new KettleStepException(BaseMessages.getString(PKG, "HTTP.Exception.CouldnotFindField",meta.getArgumentField()[i])); //$NON-NLS-1$ //$NON-NLS-2$
			}
		}
	}

       return callHttpService(rowMeta, row);
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:21,代碼來源:HTTP.java

示例9: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
	ValueMetaInterface v=new ValueMeta(technicalKeyField, ValueMetaInterface.TYPE_INTEGER);
	v.setLength(10);
       v.setPrecision(0);
	v.setOrigin(origin);
	row.addValueMeta(v);

	if (replaceFields)
	{
		for (int i=0;i<keyField.length;i++)
		{
			int idx = row.indexOfValue(keyField[i]);
			if (idx>=0)
			{
				row.removeValueMeta(idx);
			}
		}
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:21,代碼來源:CombinationLookupMeta.java

示例10: execHttp

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private Object[] execHttp(RowMetaInterface rowMeta, Object[] row) throws KettleException
{
       if (first)
	{
		first=false;
		data.argnrs=new int[meta.getArgumentField().length];
		
		for (int i=0;i<meta.getArgumentField().length;i++)
		{
			data.argnrs[i]=rowMeta.indexOfValue(meta.getArgumentField()[i]);
			if (data.argnrs[i]<0)
			{
				logError(Messages.getString("HTTP.Log.ErrorFindingField")+meta.getArgumentField()[i]+"]"); //$NON-NLS-1$ //$NON-NLS-2$
				throw new KettleStepException(Messages.getString("HTTP.Exception.CouldnotFindField",meta.getArgumentField()[i])); //$NON-NLS-1$ //$NON-NLS-2$
			}
		}
	}

       return callHttpService(rowMeta, row);
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:21,代碼來源:HTTP.java

示例11: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep,
            VariableSpace space) throws KettleStepException
  {
	for(int i=0;i<fieldOutStream.length;i++) {
		ValueMetaInterface valueMeta = new ValueMeta(space.environmentSubstitute(fieldOutStream[i]), ValueMeta.TYPE_STRING);
		valueMeta.setLength(100, -1);
		valueMeta.setOrigin(name);
		
		if (!Const.isEmpty(fieldOutStream[i])){
			inputRowMeta.addValueMeta(valueMeta);
		} else {
			int index = inputRowMeta.indexOfValue(fieldInStream[i]);
			if (index>=0) {
				valueMeta.setName(fieldInStream[i]);
				inputRowMeta.setValueMeta(index, valueMeta);
			}
		}
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:20,代碼來源:ReplaceStringMeta.java

示例12: addInputRowInfos

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private boolean addInputRowInfos(Object[] r) throws KettleException{
	RowMetaInterface prevInfoFields = data.prevStepFields;
	if (meta.isLayerNameInField()){    	            	               
		int idx_layername = prevInfoFields.indexOfValue(meta.getLayerNameField());
           if (idx_layername<0){
               logError(Messages.getString("OGRFileInput.Log.Error.UnableToFindFilenameField", meta.getLayerNameField()));
               stopAll();
               return false;
           }                   
           data.layernames.add(prevInfoFields.getString(r, idx_layername));  
       }else
       	data.layernames.add(meta.getLayerName());  

	String source;
       if (meta.isSourceInField()){             
        	int idx_source = prevInfoFields.indexOfValue(meta.getSourceField());          
           if (idx_source<0){
                logError(Messages.getString("OGRFileInput.Log.Error.UnableToFindFilenameField", meta.getSourceField()));
    			 stopAll();
                return false;
           }
           source =prevInfoFields.getString(r, idx_source);           	           
       }else
       	source = meta.getSource();
       return addSource(source); 
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:27,代碼來源:OGRFileInput.java

示例13: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space)
{
	// re-assemble a new row of metadata
	//
   	RowMetaInterface fields = new RowMeta();
   	
   	// Add existing values
   	fields.addRowMeta(r);
       
       
       // add analytic values
       for (int i = 0 ; i < number_of_fields; i ++ ){
       	int index_of_subject = -1;
       	index_of_subject = r.indexOfValue(subjectField[i]);
       	ValueMetaInterface vmi = r.getValueMeta(index_of_subject).clone();
       	vmi.setOrigin(origin);
       	vmi.setName(aggregateField[i]);
       	fields.addValueMeta(r.size() + i, vmi);
       }
       
       r.clear();
       // Add back to Row Meta
       r.addRowMeta(fields);
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:25,代碼來源:AnalyticQueryMeta.java

示例14: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
       // change the case insensitive flag too
       for (int i=0;i<compareFields.length;i++)
       {
           int idx = row.indexOfValue(compareFields[i]);
           if (idx>=0)
           {
               row.getValueMeta(idx).setCaseInsensitive(caseInsensitive[i]);
           }
       }
	if (countRows)
	{
		ValueMetaInterface v = new ValueMeta(countField, ValueMetaInterface.TYPE_INTEGER);
		v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
		v.setOrigin(name);
		row.addValueMeta(v);
	}
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:20,代碼來源:UniqueRowsMeta.java

示例15: getDbFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * Runs a desc table to get the fields, and field types from the database.  Uses a desc table as opposed
 * to the select * from table limit 0 that Pentaho normally uses to get the fields and types, due to the need
 * to handle the Time type.  The select * method through Pentaho does not give us the ability to differentiate
 * time from timestamp.
 * @throws KettleException
 */
private void getDbFields() throws KettleException {
  data.dbFields = new ArrayList<>();
  String SQL = "desc table ";
  if ( !Const.isEmpty( environmentSubstitute( meta.getTargetSchema() ) ) ) {
    SQL += environmentSubstitute( meta.getTargetSchema() ) + ".";
  }
  SQL += environmentSubstitute( meta.getTargetTable() );
  logDetailed( "Executing SQL " + SQL );
  try {
    ResultSet resultSet = data.db.openQuery( SQL, null, null, ResultSet.FETCH_FORWARD, false );

    RowMetaInterface rowMeta = data.db.getReturnRowMeta();
    int nameField = rowMeta.indexOfValue( "NAME" );
    int typeField = rowMeta.indexOfValue( "TYPE" );
    if ( nameField < 0 || typeField < 0 ) {
      throw new KettleException( "Unable to get database fields" );
    }

    Object[] row = data.db.getRow( resultSet );
    if ( row == null ) {
      throw new KettleException( "No fields found in table" );
    }
    while ( row != null ) {
      String[] field = new String[2];
      field[0] = rowMeta.getString( row, nameField ).toUpperCase();
      field[1] = rowMeta.getString( row, typeField );
      data.dbFields.add( field );
      row = data.db.getRow( resultSet );
    }
    data.db.closeQuery( resultSet );
  } catch ( Exception ex ) {
    throw new KettleException( "Error getting database fields", ex );
  }
}
 
開發者ID:inquidia,項目名稱:PentahoSnowflakePlugin,代碼行數:42,代碼來源:SnowflakeBulkLoader.java


注:本文中的org.pentaho.di.core.row.RowMetaInterface.indexOfValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。