本文整理匯總了Java中org.pentaho.di.core.row.RowMetaInterface.getValueMeta方法的典型用法代碼示例。如果您正苦於以下問題:Java RowMetaInterface.getValueMeta方法的具體用法?Java RowMetaInterface.getValueMeta怎麽用?Java RowMetaInterface.getValueMeta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.core.row.RowMetaInterface
的用法示例。
在下文中一共展示了RowMetaInterface.getValueMeta方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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 );
}
}
示例2: 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;
}
示例3: 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 ;
}
示例4: 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 ;
}
示例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]);
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);
}
}
}
示例6: transformSpatialReferenceSystem
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
* Transforms a row's geometry objects to a new spatial reference system.
*
* INVARIANT:
* - The RowMeta remains the same.
* PRECONDITION:
* - The row contains at least one geometry.
* - The type of is Geometry.
* POSTCONDITION:
* - The spatial reference system is correctly transformed.
*
* @param rowMeta The metadata of the row.
* @param row The actual objects in the row.
* @return The row-objects with the transformed geometry-value.
* @throws KettleStepException
*/
private synchronized Object[] transformSpatialReferenceSystem(RowMetaInterface rowMeta, Object[] row) throws KettleStepException {
final int LENGTH = row.length;
Object[] result = new Object[LENGTH];
for (int i=0; i < LENGTH; i++) {
if (row[i] != null) {
// Transform geometry-values from the selected field...
ValueMetaInterface vm = rowMeta.getValueMeta(i);
if (vm.getName().equals(meta.getFieldName()) && vm.isGeometry()) {
// Read geometry, transform, write back to result-row
result[i] = transformator.transform( (Geometry) row[i] );
} else {
result[i] = row[i];
}
} else {
result[i] = null;
}
}
return result;
}
示例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
{
// 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);
}
}
}
}
示例8: getSourceSRS
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
* Get the source-SRS from the metadata.
*
* @param inputRowMeta The {@link RowMetaInterface} that may contain a SRS.
* @return The {@link SRS} from the {@link RowMetaInterface} if there is
* one. If there is no, return the {@link SRS} from this
* {@link SRSTransformationMeta} and if there is no, return a
* {@link SRS}.UNKNOWN.
*/
public SRS getSourceSRS(RowMetaInterface inputRowMeta) {
// Return the SRS from the RowMetaInterface, if possible.
// TODO: GeoKettle: check this
if (/*!sourceSRS.equals(SRS.UNKNOWN) && */!Const.isEmpty(fieldName) && sourceGUIStatus == STATUS_AUTO) {
int idx = inputRowMeta.indexOfValue(fieldName);
if (idx >= 0) {
ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
if (!v.getGeometrySRS().equals(SRS.UNKNOWN)) {
return v.getGeometrySRS();
}
}
}
return (sourceSRS != null) ? sourceSRS : SRS.UNKNOWN;
}
示例9: setValues
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void setValues(RowMetaInterface rowMeta, Object[] data, PreparedStatement ps) throws KettleDatabaseException
{
// now set the values in the row!
for (int i=0;i<rowMeta.size();i++)
{
ValueMetaInterface v = rowMeta.getValueMeta(i);
Object object = data[i];
try
{
setValue(ps, v, object, i+1);
}
catch(KettleDatabaseException e)
{
throw new KettleDatabaseException("offending row : "+rowMeta, e);
}
}
}
示例10: 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;
}
示例11: 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);
}
}
示例12: 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 );
}
}
示例13: toBson
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public BSONObject toBson( Object[] row, RowMetaInterface rowMeta ) throws KettleValueException {
if ( null == m_fieldsInfo || m_fieldsInfo.size() == 0 ){
return null ;
}
for( Map.Entry<String, SequoiaDBInsertFieldInfo> entry : m_fieldsInfo.entrySet() ){
int index = rowMeta.indexOfValue( entry.getKey() ) ;
ValueMetaInterface vmi = rowMeta.getValueMeta( index ) ;
try{
entry.getValue().setVal( row[index], vmi ) ;
}
catch( KettleValueException e ){
throw new KettleValueException( BaseMessages.getString( PKG,
"SequoiaDBOutput.Msg.Err.FailedToGetTheFieldVal"
+ "(" + entry.getKey() + ":" + row[index].toString() + ")" ) );
}
}
BSONObject result = new BasicBSONObject() ;
boolean hasField = false ;
int fieldsNum = m_fields.size() ;
for( int i = 0 ; i < fieldsNum ; i++ ){
Object tmpObj = m_fields.get(i).toObj( m_fieldsInfo ) ;
if ( tmpObj != null ){
result.put( m_fields.get(i).getFieldName(), tmpObj ) ;
hasField = true ;
}
}
if ( hasField ){
return result ;
}
return null ;
}
示例14: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// Clear the sortedDescending flag on fields used within the condition - otherwise the comparisons will be inverted!!
String conditionField[] = condition.getUsedFields();
for (int i=0;i<conditionField.length;i++)
{
int idx = rowMeta.indexOfValue(conditionField[i]);
if (idx>=0)
{
ValueMetaInterface valueMeta = rowMeta.getValueMeta(idx);
valueMeta.setSortedDescending(false);
}
}
}
示例15: quoteReservedWords
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
* Changes the names of the fields to their quoted equivalent if this is needed
* @param fields The row of fields to change
*/
public void quoteReservedWords(RowMetaInterface fields)
{
for (int i=0;i<fields.size();i++)
{
ValueMetaInterface v = fields.getValueMeta(i);
v.setName( quoteField(v.getName()) );
}
}