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


Java RowMetaInterface.size方法代碼示例

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


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

示例1: updateHierMappings

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void updateHierMappings(RowMetaInterface metaInterface) {
  List<String> actualHierList = new ArrayList<String>(CarbonCommonConstants.CONSTANT_SIZE_TEN);
  for (int j = 0; j < metaInterface.size(); j++) {
    String foreignKey = metaInterface.getValueMeta(j).getName();
    String actualHier = foreignKeyHierarchyMap.get(foreignKey);
    if (null != actualHier) {
      if (actualHier.contains(CarbonCommonConstants.COMA_SPC_CHARACTER)) {
        String[] splitHier = actualHier.split(CarbonCommonConstants.COMA_SPC_CHARACTER);
        for (String hier : splitHier) {
          actualHierList.add(hier);
        }
      } else {
        actualHierList.add(actualHier);
      }
    }
  }

  hierNames = new String[actualHierList.size()];
  hierNames = actualHierList.toArray(new String[actualHierList.size()]);
}
 
開發者ID:carbondata,項目名稱:carbondata,代碼行數:21,代碼來源:CarbonCSVBasedSeqGenMeta.java

示例2: setOutputFieldsTableFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
protected void setOutputFieldsTableFields( CPythonScriptExecutorMeta meta ) {
  RowMetaInterface outFields = meta.getOutputFields();

  if ( outFields != null && outFields.size() > 0 ) {
    for ( int i = 0; i < outFields.size(); i++ ) {
      ValueMetaInterface vm = outFields.getValueMeta( i );
      String name = vm.getName();
      String type = vm.getTypeDesc();

      TableItem item = new TableItem( wtvOutputFields.table, SWT.NONE );
      item.setText( 1, Const.NVL( name, "" ) ); //$NON-NLS-1$
      item.setText( 2, Const.NVL( type, "" ) ); //$NON-NLS-1$
    }

    wtvOutputFields.removeEmptyRows();
    wtvOutputFields.setRowNums();
    wtvOutputFields.optWidth( true );
  }
}
 
開發者ID:pentaho-labs,項目名稱:pentaho-cpython-plugin,代碼行數:20,代碼來源:CPythonScriptExecutorDialog.java

示例3: validateTestObject

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
@Override public boolean validateTestObject( RowMetaInterface testObject, Object other ) {
  if ( other == null || !( other instanceof RowMetaInterface ) ) {
    return false;
  }
  RowMetaInterface otherRow = (RowMetaInterface) other;
  if ( testObject.size() != otherRow.size() ) {
    return false;
  }
  for ( int i = 0; i < testObject.size(); i++ ) {
    ValueMetaInterface testVmi = testObject.getValueMeta( i );
    ValueMetaInterface otherVmi = otherRow.getValueMeta( i );
    if ( !testVmi.getName().equals( otherVmi.getName() ) ) {
      return false;
    }
    if ( !testVmi.getTypeDesc().equals( otherVmi.getTypeDesc() ) ) {
      return false;
    }
  }
  return true;
}
 
開發者ID:pentaho-labs,項目名稱:pentaho-cpython-plugin,代碼行數:21,代碼來源:CPythonRowMetaInterfaceValidator.java

示例4: enableMappingButton

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * Enables or disables the mapping button. We can only enable it if the
 * target steps allows a mapping to be made against it.
 * 
 * @param button
 *            The button to disable or enable
 * @param input
 *            input or output. If it's true, we keep the button enabled all
 *            the time.
 * @param sourceStepname
 *            The mapping output step
 * @param targetStepname
 *            The target step to verify
 * @throws KettleException
 */
private void enableMappingButton(final Button button, boolean input, String sourceStepname,
		String targetStepname) throws KettleException
{
	if (input)
		return; // nothing to do

	boolean enabled = false;

	if (mappingTransMeta != null)
	{
		StepMeta mappingInputStep = mappingTransMeta.findMappingInputStep(sourceStepname);
		if (mappingInputStep != null)
		{
			StepMeta mappingOutputStep = transMeta.findMappingOutputStep(targetStepname);
			RowMetaInterface requiredFields = mappingOutputStep.getStepMetaInterface().getRequiredFields(transMeta);
			if (requiredFields != null && requiredFields.size() > 0)
			{
				enabled = true;
			}
		}
	}

	button.setEnabled(enabled);
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:40,代碼來源:MappingDialog.java

示例5: addSourceFromRowFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * @param requestBuilder
 * @param rowMeta
 * @param row
 * @throws IOException
 */
private void addSourceFromRowFields(IndexRequestBuilder requestBuilder, RowMetaInterface rowMeta, Object[] row) throws IOException {
  XContentBuilder jsonBuilder = XContentFactory.jsonBuilder().startObject();

  for (int i = 0; i < rowMeta.size(); i++) {
    if(idFieldIndex != null && i == idFieldIndex){//skip id
      continue;
    }
    
    ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
    String name = hasFields ? columnsToJson.get(valueMeta.getName()) : valueMeta.getName();
    Object value = row[i];
    if(value instanceof Date && value.getClass() != Date.class){
      Date subDate = (Date) value;
      //create a genuine Date object, or jsonBuilder will not recognize it
      value = new Date(subDate.getTime());
    }
    if (StringUtils.isNotBlank(name)) {
      jsonBuilder.field(name, value);
    }
  }

  jsonBuilder.endObject();
  requestBuilder.setSource(jsonBuilder);
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:31,代碼來源:ElasticSearchBulk.java

示例6: setValues

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
    * Sets the values of the preparedStatement pstmt.
    * @param rowMeta
    * @param data
    */
   public void setValues(RowMetaInterface rowMeta, Object[] data, PreparedStatement ps, int ignoreThisValueIndex) throws KettleDatabaseException
{
	// now set the values in the row!
       int index=0;
	for (int i=0;i<rowMeta.size();i++)
	{
           if (i!=ignoreThisValueIndex)
           {
               ValueMetaInterface v = rowMeta.getValueMeta(i);
               Object object = data[i];
               
               try
   			{
   				setValue(ps, v, object, index+1);
                   index++;
   			}
   			catch(KettleDatabaseException e)
   			{
   				throw new KettleDatabaseException("offending row : "+rowMeta, e);
   			}
           }
	}
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:29,代碼來源:Database.java

示例7: getFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
    // We don't have any input fields here in "r" as they are all info fields.
    // So we just merge in the info fields.
    //
    if (info!=null)
    {
        for (int i=0;i<info.length;i++) 
        {
            if (info[i]!=null)
            {
                r.mergeRowMeta(info[i]);
            }
        }
    }
		
    for (int i=0;i<r.size();i++) r.getValueMeta(i).setOrigin(name);
    return;
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:20,代碼來源:MultiMergeJoinMeta.java

示例8: getMainSchema

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
@Override
protected Schema getMainSchema() throws MetaModelException {
    MutableSchema schema = new MutableSchema(getTransformationName());
    MutableTable table = new MutableTable(getStepName(), TableType.TABLE);
    table.setSchema(schema);
    RowMetaInterface rowMeta = getRowMeta();
    for (int i = 0; i < rowMeta.size(); i++) {
        ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
        MutableColumn column = new MutableColumn(valueMeta.getName(), getColumnType(valueMeta), table, i,
                Integer.valueOf(valueMeta.getLength()), valueMeta.getTypeDesc(), true, valueMeta.getComments(),
                false, "");
        table.addColumn(column);
    }
    schema.addTable(table);
    return schema;
}
 
開發者ID:datacleaner,項目名稱:pdi-datacleaner,代碼行數:17,代碼來源:KettleDataContext.java

示例9: initStreamFieldPosMap

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private void initStreamFieldPosMap(RowMetaInterface rowMeta) {
    streamFieldPosMap = new HashMap<String, Integer>();
    for (int i = 0; i < rowMeta.size(); i++) {
        ValueMetaInterface v = rowMeta.getValueMeta(i);
        String fieldName = v.getName();
        streamFieldPosMap.put(fieldName.toLowerCase(), i);
    }
}
 
開發者ID:aliyun,項目名稱:aliyun-maxcompute-data-collectors,代碼行數:9,代碼來源:OdpsOutput.java

示例10: setStreamFieldCombo

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private void setStreamFieldCombo() {

        Runnable fieldLoader = new Runnable() {
        	@Override
    		public void run() {
        		try {
        			StepMeta stepMeta = transMeta.findStep(stepname);
        			RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);

        			if ((row != null) && (inputFields.size() == 0)) {
        				for (int i = 0; i < row.size(); i++) {
        					inputFields.put(row.getValueMeta(i).getName(), i);
        				}
        			}
        		} catch (KettleException e) {
        			logError(BaseMessages.getString(CassandraOutputDialog.PKG, "System.Dialog.GetFieldsFailed.Message"));
        		}


        		Set<String> keySet = inputFields.keySet();
        		List<String> entries = new ArrayList<>(keySet);

        		String[] fieldNames = entries.toArray(new String[entries.size()]);

        		Const.sortStrings(fieldNames);
        		if (!fieldsList.isDisposed()) {
        			ciFields[1].setComboValues(fieldNames);
        		}
        	}
        };
        this.shell.getDisplay().asyncExec(fieldLoader);
    }
 
開發者ID:bcolas,項目名稱:pentaho-cassandra-plugin,代碼行數:33,代碼來源:CassandraOutputDialog.java

示例11: getDefaultConfigInfo

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * 
 * @see cn.benma666.kettle.steps.easyexpand.EasyExpandRunBase#getDefaultConfigInfo(org.pentaho.di.trans.TransMeta, java.lang.String)
 */
 @Override
 public String getDefaultConfigInfo(TransMeta transMeta, String stepName) throws Exception{
    //創建一個JSON對象,用於構建配置對象,避免直接拚字符串構建JSON字符串
    JSONObject params = new JSONObject();
    //設置一個參數key1
    params.put("key1", "");
    RowMetaInterface fields = transMeta.getPrevStepFields(stepName);
    if(fields.size()==0){
        throw new RuntimeException("沒有獲取到上一步驟的字段,請確認連接好上一步驟");
    }
    params.put("PrevInfoFields", fields.toString());
    //創建一個JSON數組對象,用於存放數組參數
    JSONArray arr = new JSONArray();
    arr.add("arr1");
    arr.add("arr2");
    params.put("array", arr);
    //生成的參數樣例
    //{
    //  "array":[
    //          "arr1",
    //          "arr2"
    //  ],
    //  "key1":""
    //}
    //返回格式化後的默認JSON配置參數,供使用者方便快捷的修改配置
    return JSON.toJSONString(params, true);
}
 
開發者ID:majinju,項目名稱:KettleEasyExpand,代碼行數:32,代碼來源:EasyExpandDemo.java

示例12: handleInputDataSet

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
private void handleInputDataSet(LogChannelInterface log, String inputSetName, TransUnitTest unitTest, TransMeta transMeta, StepMeta stepMeta, FactoriesHierarchy factoriesHierarchy) throws KettleException {
  TransUnitTestSetLocation inputLocation = unitTest.findInputLocation( stepMeta.getName() );
  if (inputLocation!=null) {
    inputSetName = inputLocation.getDataSetName();
  }

  if (log.isDetailed()) {
    log.logDetailed("Replacing step '"+stepMeta.getName()+"' with an Injector for dataset '"+inputSetName+"'");
  }
  
  DataSet dataSet;
  try {
    dataSet = factoriesHierarchy.getSetFactory().loadElement(inputSetName);
  } catch (MetaStoreException e) {
    throw new KettleException("Unable to load data set '"+inputSetName+"'");
  }
  
  // OK, this step needs to be replaced by an Injector step...
  // Which fields do we need to use?
  //
  final RowMetaInterface stepFields = DataSetConst.getStepOutputFields(log, transMeta, stepMeta, dataSet, inputLocation);
  
  if (log.isDetailed()) {
    log.logDetailed("Input Data Set '"+inputSetName+"' Injector fields : '"+stepFields.toString());
  }
  
  InjectorMeta injectorMeta = new InjectorMeta();
  injectorMeta.allocate( stepFields.size() );
  for (int x=0;x<stepFields.size();x++) {
    injectorMeta.getFieldname()[x] = stepFields.getValueMeta( x ).getName();
    injectorMeta.getType()[x] = stepFields.getValueMeta( x ).getType();
    injectorMeta.getLength()[x] = stepFields.getValueMeta( x ).getLength();
    injectorMeta.getPrecision()[x] = stepFields.getValueMeta( x ).getPrecision();
    
    // Only the step metadata, type...
    stepMeta.setStepMetaInterface( injectorMeta );
    stepMeta.setStepID( PluginRegistry.getInstance().getPluginId( StepPluginType.class, injectorMeta) );          
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:40,代碼來源:ChangeTransMetaPriorToExecutionExtensionPoint.java

示例13: createDataSetFromStep

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
 * Create a new data set with the output from 
 */
public void createDataSetFromStep() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  TransGraph transGraph = spoon.getActiveTransGraph();
  IMetaStore metaStore = spoon.getMetaStore();
  if ( transGraph == null ) {
    return;
  }
  StepMeta stepMeta = transGraph.getCurrentStep();
  TransMeta transMeta = spoon.getActiveTransformation();
  if ( stepMeta == null || transMeta == null ) {
    return;
  }

  try {
    MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
    List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
    groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
    List<DataSetGroup> groups = groupFactory.getElements();

    MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
    setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );

    DataSet dataSet = new DataSet();
    RowMetaInterface rowMeta = transMeta.getStepFields( stepMeta );
    for ( int i = 0; i < rowMeta.size(); i++ ) {
      ValueMetaInterface valueMeta = rowMeta.getValueMeta( i );
      DataSetField field = new DataSetField( valueMeta.getName(), "field" + i, valueMeta.getType(), valueMeta.getLength(), valueMeta.getPrecision(), valueMeta.getComments() );
      dataSet.getFields().add( field );
    }

    editDataSet( spoon, dataSet, groups, setFactory, null );

  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error creating a new data set", e );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:40,代碼來源:DataSetHelper.java

示例14: checkFields

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
void checkFields( RowMetaInterface rmi, List<SequoiaDBOutputFieldInfo> fields ) throws KettleException {
   // check if match input fields
   if ( rmi.getFieldNames().length <= 0 ) {
      throw new KettleException( BaseMessages.getString( PKG,
            "SequoiaDBOutput.Msg.Err.InputFieldsSizeError" )) ;
   }
   if( fields.size() <= 0 ){
      throw new KettleException( BaseMessages.getString( PKG,
            "SequoiaDBOutput.Msg.Err.OutputFieldsEmpty" )) ;
   }
   
   Set<String> input = new HashSet<String>( rmi.getFieldNames().length, 1 ) ;
   Set<String> output = new HashSet<String>( fields.size(), 1 ) ;
   for( int i = 0; i < rmi.size(); i++ ) {
      input.add( rmi.getValueMeta( i ).getName() );
   }
   for( int j = 0; j < fields.size(); j++ ){
      output.add( fields.get(j).getName() ) ;
   }
   
   if ( !input.containsAll( output )) {
      output.removeAll( input ) ;
      StringBuffer loseFields = new StringBuffer() ;
      for( String name : output ) {
         loseFields.append( "'" ).append( name ).append( "', ") ;
      }
      throw new KettleException( BaseMessages.getString( PKG,
            "SequoiaDBOutput.Msg.Err.FieldsNotFoundInInput", loseFields.toString() ));
   }
}
 
開發者ID:SequoiaDB,項目名稱:pentaho-sequoiadb-plugin,代碼行數:31,代碼來源:SequoiaDBOutput.java

示例15: getRow

import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public RowMetaAndData getRow(int nr)
{
	TableItem ti = table.getItem(nr);
	RowMetaInterface rowMeta = getRowWithoutValues();
	Object[] rowData = new Object[rowMeta.size()];

       rowData[0] = new Long(nr);
	for (int i=1;i<rowMeta.size();i++)
	{
		rowData[i] = ti.getText(i);
	}
	
	return new RowMetaAndData(rowMeta, rowData);
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:15,代碼來源:TableView.java


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