当前位置: 首页>>代码示例>>Java>>正文


Java ValueMetaInterface.isNumeric方法代码示例

本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.isNumeric方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.isNumeric方法的具体用法?Java ValueMetaInterface.isNumeric怎么用?Java ValueMetaInterface.isNumeric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.core.row.ValueMetaInterface的用法示例。


在下文中一共展示了ValueMetaInterface.isNumeric方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTableView

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void addTableView() {
  int margin = Const.MARGIN;
  ColumnInfo[] colinf = new ColumnInfo[rowMeta.size()];
  for ( int i = 0; i < rowMeta.size(); i++ ) {
    ValueMetaInterface v = rowMeta.getValueMeta( i );
    colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() );
    colinf[i].setToolTip( v.toStringMeta() );
    colinf[i].setValueMeta( v );
  }

  wSeriesTable =
      new TableView( variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, props );
  wSeriesTable.setShowingBlueNullValues( true ); //// TODO: 25/05/16 wat?

  fdSeriesTable = new FormData();
  fdSeriesTable.left = new FormAttachment( 0, 0 );
  fdSeriesTable.top = new FormAttachment( 0, margin );
  fdSeriesTable.right = new FormAttachment( 100, 0 );
  fdSeriesTable.bottom = new FormAttachment( 100, -50 );
  wSeriesTable.setLayoutData( fdSeriesTable );

  fillTableView();
}
 
开发者ID:andtorg,项目名称:sdmx-kettle,代码行数:24,代码来源:PreviewTimeSeriesDialog.java

示例2: getData

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getData()
{
	for (int i=0;i<buffer.size();i++)
	{
		Object[] row = buffer.get(i);

		wFields.table.getItem(i).setText(0, ""+(position-scroll_size+i));
		
		for (int c=0;c<rowMeta.size();c++)
		{
			ValueMetaInterface v=rowMeta.getValueMeta(c);
			String show;
               try
               {
   				if (v.isNumeric()) show = v.getString(row[c]); // TODO add support for padding
   				else               show = v.getString(row[c]);
   				wFields.table.getItem(i).setText(c+1, show);
               }
               catch(KettleValueException e)
               {
                   LogWriter.getInstance().logError(toString(), Const.getStackTracker(e));
               }
		}
	}
	
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:27,代码来源:EditDatabaseTable.java

示例3: getData

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
 * Copy information from the input buffer to the dialog fields.
 */ 
private void getData()
{
	for (int i=0;i<buffer.size();i++)
	{
		RowMetaAndData rowMetaAndData = buffer.get(i);
           RowMetaInterface rowMeta = rowMetaAndData.getRowMeta();
           Object[] rowData = rowMetaAndData.getData();
		
		for (int c=0;c<rowMeta.size();c++)
		{
			ValueMetaInterface v=rowMeta.getValueMeta(c);
			String show;
			
                   try
                   {
                       if (v.isNumeric()) 
                       {
                           show = v.getString(rowData[c]);
                       }
                       else
                       {
                           show = v.getString(rowData[c]);
                       }
                   }
                   catch (KettleValueException e)
                   {
                       show = "<conversion error>";
                   }
			if (show!=null)
				wFields.table.getItem(i).setText(c+1, show);
		}
	}
	wFields.optWidth(true);
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:38,代码来源:SelectRowDialog.java

示例4: get

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void get() {
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null) {
            TableItemInsertListener listener = new TableItemInsertListener() {
                @Override
                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {

                    if (v.isNumeric()) {
                        // currency symbol
                        tableItem.setText(6, Const.NVL(v.getCurrencySymbol(), ""));

                        // decimal and grouping
                        tableItem.setText(7, Const.NVL(v.getDecimalSymbol(), ""));
                        tableItem.setText(8, Const.NVL(v.getGroupingSymbol(), ""));
                    }

                    // trim type
                    tableItem.setText(9, Const.NVL(ValueMeta.getTrimTypeDesc(v.getTrimType()), ""));

                    // conversion mask
                    if (!Const.isEmpty(v.getConversionMask())) {
                        tableItem.setText(3, v.getConversionMask());
                    } else {
                        if (v.isNumber()) {
                            if (v.getLength() > 0) {
                                int le = v.getLength();
                                int pr = v.getPrecision();

                                if (v.getPrecision() <= 0) {
                                    pr = 0;
                                }

                                String mask = "";
                                for (int m = 0; m < le - pr; m++) {
                                    mask += "0";
                                }
                                if (pr > 0) {
                                    mask += ".";
                                }
                                for (int m = 0; m < pr; m++) {
                                    mask += "0";
                                }
                                tableItem.setText(3, mask);
                            }
                        }
                    }
                    return true;
                }
            };
            BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] {1}, new int[] {2}, 4, 5, listener);
        }
    } catch(KettleException e) {
        new ErrorDialog(shell, Messages.getString("System.Dialog.GetFieldsFailed.Title"),
                Messages.getString("System.Dialog.GetFieldsFailed.Message"), e);
    }
}
 
开发者ID:socrata,项目名称:socrata-kettle,代码行数:58,代码来源:SocrataPluginDialog.java

示例5: processRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
	meta=(MySQLBulkLoaderMeta)smi;
	data=(MySQLBulkLoaderData)sdi;

	try
	{
		Object[] r=getRow();  // Get row from input rowset & set row busy!
		if (r==null)          // no more input to be expected...
		{
			setOutputDone();
			
			closeOutput();
            
			return false;
		}
		
		if (first)
		{
			first=false;
			
			// Cache field indexes.
			//
			data.keynrs = new int[meta.getFieldStream().length];
			for (int i=0;i<data.keynrs.length;i++) {
				data.keynrs[i] = getInputRowMeta().indexOfValue(meta.getFieldStream()[i]);
			}
			
			data.bulkFormatMeta = new ValueMetaInterface[data.keynrs.length];
			for (int i=0;i<data.keynrs.length;i++) {
				ValueMetaInterface sourceMeta = getInputRowMeta().getValueMeta(data.keynrs[i]);
				if (sourceMeta.isDate()) {
					if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_DATE) {
						data.bulkFormatMeta[i] = data.bulkDateMeta.clone();
					} else if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_TIMESTAMP) {
						data.bulkFormatMeta[i] = data.bulkTimestampMeta.clone(); // default to timestamp
					}
				} else if (sourceMeta.isNumeric() && meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_NUMBER) {
					data.bulkFormatMeta[i] = data.bulkNumberMeta.clone();
				} 
				
				if (data.bulkFormatMeta[i]==null && !sourceMeta.isStorageBinaryString()) {
					data.bulkFormatMeta[i] = sourceMeta.clone();
				}
			}

			// execute the client statement...
			//
			execute(meta);
		}

		// Every nr of rows we re-start the bulk load process to allow indexes etc to fit into the MySQL server memory
		// Performance could degrade if we don't do this.
		//
		if (data.bulkSize>0 && getLinesOutput()>0 && (getLinesOutput()%data.bulkSize)==0) {
			closeOutput();
			executeLoadCommand();
		}

		writeRowToBulk(getInputRowMeta(), r);
		putRow(getInputRowMeta(), r);
		incrementLinesOutput();

		return true;
	}
	catch(Exception e)
	{
		logError(Messages.getString("MySQLBulkLoader.Log.ErrorInStep"), e); //$NON-NLS-1$
		setErrors(1);
		stopAll();
		setOutputDone();  // signal end to receiver(s)
		return false;
	} 
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:75,代码来源:MySQLBulkLoader.java

示例6: processRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
	meta=(MySQLBulkLoaderMeta)smi;
	data=(MySQLBulkLoaderData)sdi;

	try
	{
		Object[] r=getRow();  // Get row from input rowset & set row busy!
		if (r==null)          // no more input to be expected...
		{
			setOutputDone();
			
			closeOutput();
            
			return false;
		}
		
		if (first)
		{
			first=false;
			
			// Cache field indexes.
			//
			data.keynrs = new int[meta.getFieldStream().length];
			for (int i=0;i<data.keynrs.length;i++) {
				data.keynrs[i] = getInputRowMeta().indexOfValue(meta.getFieldStream()[i]);
			}
			
			data.bulkFormatMeta = new ValueMetaInterface[data.keynrs.length];
			for (int i=0;i<data.keynrs.length;i++) {
				ValueMetaInterface sourceMeta = getInputRowMeta().getValueMeta(data.keynrs[i]);
				if (sourceMeta.isDate()) {
					if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_DATE) {
						data.bulkFormatMeta[i] = data.bulkDateMeta.clone();
					} else if (meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_TIMESTAMP) {
						data.bulkFormatMeta[i] = data.bulkTimestampMeta.clone(); // default to timestamp
					}
				} else if (sourceMeta.isNumeric() && meta.getFieldFormatType()[i]==MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_NUMBER) {
					data.bulkFormatMeta[i] = data.bulkNumberMeta.clone();
				} 
				
				if (data.bulkFormatMeta[i]==null && !sourceMeta.isStorageBinaryString()) {
					data.bulkFormatMeta[i] = sourceMeta.clone();
				}
			}

			// execute the client statement...
			//
			execute(meta);
		}

		// Every nr of rows we re-start the bulk load process to allow indexes etc to fit into the MySQL server memory
		// Performance could degrade if we don't do this.
		//
		if (data.bulkSize>0 && getLinesOutput()>0 && (getLinesOutput()%data.bulkSize)==0) {
			closeOutput();
			executeLoadCommand();
		}

		writeRowToBulk(getInputRowMeta(), r);
		putRow(getInputRowMeta(), r);
		incrementLinesOutput();

		return true;
	}
	catch(Exception e)
	{
		logError(BaseMessages.getString(PKG, "MySQLBulkLoader.Log.ErrorInStep"), e); //$NON-NLS-1$
		setErrors(1);
		stopAll();
		setOutputDone();  // signal end to receiver(s)
		return false;
	} 
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:75,代码来源:MySQLBulkLoader.java


注:本文中的org.pentaho.di.core.row.ValueMetaInterface.isNumeric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。