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


Java ValueMetaInterface.setName方法代码示例

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


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

示例1: getModifyColumnStatement

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
 * Generates the SQL statement to modify a column in the specified table
 * @param tablename The table to add
 * @param v The column defined as a value
 * @param tk the name of the technical key field
 * @param use_autoinc whether or not this field uses auto increment
 * @param pk the name of the primary key field
 * @param semicolon whether or not to add a semi-colon behind the statement.
 * @return the SQL statement to modify a column in the specified table
 */
public String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
{
       ValueMetaInterface tmpColumn = v.clone(); 
       int threeoh = v.getName().length()>=30 ? 30 : v.getName().length();
       
       tmpColumn.setName(v.getName().substring(0,threeoh)+"_KTL"); // should always be less then 35
       
       String sql="";
       
       // Create a new tmp column
       sql+=getAddColumnStatement(tablename, tmpColumn, tk, use_autoinc, pk, semicolon)+";"+Const.CR;
       // copy the old data over to the tmp column
       sql+="UPDATE "+tablename+" SET "+tmpColumn.getName()+"="+v.getName()+";"+Const.CR;
       // drop the old column
       sql+=getDropColumnStatement(tablename, v, tk, use_autoinc, pk, semicolon)+";"+Const.CR;
       // create the wanted column
       sql+=getAddColumnStatement(tablename, v, tk, use_autoinc, pk, semicolon)+";"+Const.CR;
       // copy the data from the tmp column to the wanted column (again)  
       // All this to avoid the rename clause as this is not supported on all Oracle versions
       sql+="UPDATE "+tablename+" SET "+v.getName()+"="+tmpColumn.getName()+";"+Const.CR;
       // drop the temp column
       sql+=getDropColumnStatement(tablename, tmpColumn, tk, use_autoinc, pk, semicolon);
       
       return sql;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:36,代码来源:OracleDatabaseMeta.java

示例2: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的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

示例3: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的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

示例4: addField

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* 添加字段 <br/>
* @author jingma
* @param r 行
* @param name 字段名称
* @param type 类型
* @param trimType 去除空白规则
* @param origin 宿主
* @param comments 描述
* @param length 长度
*/
@SuppressWarnings("deprecation")
protected void addField(RowMetaInterface r, String name, int type,
        int trimType, String origin, String comments, int length) {
    ValueMetaInterface v = new ValueMeta();
    v.setName(name.toUpperCase());
    v.setType(type);
    v.setTrimType(trimType);
    v.setOrigin(origin);
    v.setComments(comments);
    if(length>0){
        v.setLength(length);
    }
    r.addValueMeta(v);
}
 
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:26,代码来源:EasyExpandRunBase.java

示例5: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
 * Gets the fields.
 *
 * @param inputRowMeta the input row meta that is modified in this method to reflect the output row metadata of the step
 * @param name         Name of the step to use as input for the origin field in the values
 * @param info         Fields used as extra lookup information
 * @param nextStep     the next step that is targeted
 * @param space        the space The variable space to use to replace variables
 * @param repository   the repository to use to load Kettle metadata objects impacting the output fields
 * @param metaStore    the MetaStore to use to load additional external data or metadata impacting the output fields
 * @throws org.pentaho.di.core.exception.KettleStepException the kettle step exception
 */
@Override
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
                       VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {

  if ( fields != null ) {
    // Add the fields
    // TODO overwrite existing fields?
    for ( ZooKeeperField field : fields ) {
      ValueMetaInterface type = field.getType();
      type.setName( field.getFieldName() );
      inputRowMeta.addValueMeta( type );
    }
  }
}
 
开发者ID:mattyb149,项目名称:pdi-zookeeper,代码行数:27,代码来源:ZooKeeperInputMeta.java

示例6: replaceReservedWords

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
 * Checks the fields specified for reserved words and quotes them.
 * @param fields the list of fields to check
 * @return true if one or more values have a name that is a reserved word on this database type.
 */
public boolean replaceReservedWords(RowMetaInterface fields)
{
	boolean hasReservedWords=false;
	for (int i=0;i<fields.size();i++)
	{
		ValueMetaInterface v = fields.getValueMeta(i);
		if (isReservedWord(v.getName()))
		{
			hasReservedWords = true;
			v.setName( quoteField(v.getName()) );
		}
	}
	return hasReservedWords;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:20,代码来源:DatabaseMeta.java

示例7: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException {

    // Remove the key value (there will be different entries for each output row)
    //
    if (fieldName != null && fieldName.length() > 0)
    {
        int idx = row.indexOfValue(fieldName);
        if (idx < 0) { 
        	throw new KettleStepException(BaseMessages.getString(PKG, "FlattenerMeta.Exception.UnableToLocateFieldInInputFields", fieldName )); //$NON-NLS-1$ //$NON-NLS-2$ 
        } 
        
        ValueMetaInterface v = row.getValueMeta(idx);
        row.removeValueMeta(idx);
        
        for (int i=0;i<targetField.length;i++)
        {
            ValueMetaInterface value = v.clone();
            value.setName(targetField[i]);
            value.setOrigin(name);
            
            row.addValueMeta(value);
        }
    }
    else
    {
        throw new KettleStepException(BaseMessages.getString(PKG, "FlattenerMeta.Exception.FlattenFieldRequired")); //$NON-NLS-1$
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:30,代码来源:FlattenerMeta.java

示例8: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException {

    // Remove the key value (there will be different entries for each output row)
    //
    if (fieldName != null && fieldName.length() > 0)
    {
        int idx = row.indexOfValue(fieldName);
        if (idx < 0) { 
        	throw new KettleStepException(Messages.getString("FlattenerMeta.Exception.UnableToLocateFieldInInputFields", fieldName )); //$NON-NLS-1$ //$NON-NLS-2$ 
        } 
        
        ValueMetaInterface v = row.getValueMeta(idx);
        row.removeValueMeta(idx);
        
        for (int i=0;i<targetField.length;i++)
        {
            ValueMetaInterface value = v.clone();
            value.setName(targetField[i]);
            value.setOrigin(name);
            
            row.addValueMeta(value);
        }
    }
    else
    {
        throw new KettleStepException(Messages.getString("FlattenerMeta.Exception.FlattenFieldRequired")); //$NON-NLS-1$
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:30,代码来源:FlattenerMeta.java

示例9: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields( RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repo, IMetaStore metaStore ) throws KettleStepException {

  // Add new fields
  List<FieldMetadataBean> newFields = getNewFields();
  if ( newFields != null ) {
    for ( FieldMetadataBean fieldBean : newFields ) {
      ValueMetaInterface v = fieldBean.getValueMeta();
      v.setOrigin( name );
      v.setName( fieldBean.getName() );
      rowMeta.addValueMeta( v );
    }
  }
}
 
开发者ID:mattyb149,项目名称:pdi-pojo,代码行数:15,代码来源:StepPluginPOJO.java

示例10: quoteReservedWords

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的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()) );
    }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:DatabaseMeta.java

示例11: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
	// 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]);

       	//  if we found the subjectField in the RowMetaInterface, and we should....
       	if (index_of_subject > -1) {
          	ValueMetaInterface vmi = r.getValueMeta(index_of_subject).clone();
          	vmi.setOrigin(origin);
          	vmi.setName(aggregateField[i]);
          	fields.addValueMeta(r.size() + i, vmi);
       	}
       	else {
       	   //  we have a condition where the subjectField can't be found from the rowMetaInterface
       	   StringBuilder sbfieldNames = new StringBuilder();
       	   String[] fieldNames = r.getFieldNames();
       	   for (int j=0; j < fieldNames.length; j++) {
       	    sbfieldNames.append("["+fieldNames[j]+"]"+(j<fieldNames.length-1?", ":""));
           }
           throw new KettleStepException(BaseMessages.getString(PKG, "AnalyticQueryMeta.Exception.SubjectFieldNotFound", getParentStepMeta().getName(), subjectField[i], sbfieldNames.toString()));
       	}
     }
       
     r.clear();
     // Add back to Row Meta
     r.addRowMeta(fields);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:AnalyticQueryMeta.java

示例12: getSQLStatements

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, Repository repository) throws KettleStepException
{
	SQLStatement retval = new SQLStatement(stepMeta.getName(), databaseMeta, null); // default: nothing to do!

	if (databaseMeta!=null)
	{
		if (prev!=null && prev.size()>0)
		{
               // Copy the row
               RowMetaInterface tableFields = new RowMeta();

               // Now change the field names
               for (int i=0;i<fieldTable.length;i++)
               {
                   ValueMetaInterface v = prev.searchValueMeta(fieldStream[i]);
                   if (v!=null)
                   {
                       ValueMetaInterface tableField = v.clone();
                       tableField.setName(fieldTable[i]);
                       tableFields.addValueMeta(tableField);
                   }
                   else
                   {
                       throw new KettleStepException("Unable to find field ["+fieldStream[i]+"] in the input rows");
                   }
               }

			if (!Const.isEmpty(tableName))
			{
                   Database db = new Database(loggingObject, databaseMeta);
                   db.shareVariablesWith(transMeta);
				try
				{
					db.connect();

                       String schemaTable = databaseMeta.getQuotedSchemaTableCombination(transMeta.environmentSubstitute(schemaName), 
                       		                                                          transMeta.environmentSubstitute(tableName));                        
					String cr_table = db.getDDL(schemaTable,
												tableFields,
												null,
												false,
												null,
												true
												);

					String sql = cr_table;
					if (sql.length()==0) retval.setSQL(null); else retval.setSQL(sql);
				}
				catch(KettleException e)
				{
					retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.ErrorOccurred")+e.getMessage()); 
				}
			}
			else
			{
				retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection")); 
			}
		}
		else
		{
			retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NotReceivingAnyFields")); 
		}
	}
	else
	{
		retval.setError(BaseMessages.getString(PKG, "TeraDataBulkLoaderMeta.GetSQL.NoConnectionDefined")); 
	}

	return retval;
}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:71,代码来源:TeraDataBulkLoaderMeta.java

示例13: getFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep,
		VariableSpace space) throws KettleStepException {

	// Get a unique list of the occurrences of the type
	//
	List<String> norm_occ = new ArrayList<String>();
	List<String> field_occ  = new ArrayList<String>();
	int maxlen=0;
	for (int i=0;i<fieldNorm.length;i++)
	{
		if (!norm_occ.contains(fieldNorm[i])) 
		{
			norm_occ.add(fieldNorm[i]);
			field_occ.add(fieldName[i]);
		} 
		
		if (fieldValue[i].length()>maxlen) maxlen=fieldValue[i].length();
	}

	// Then add the type field!
	//
	ValueMetaInterface typefield_value = new ValueMeta(typeField, ValueMetaInterface.TYPE_STRING);
	typefield_value.setOrigin(name);
	typefield_value.setLength(maxlen);
	row.addValueMeta(typefield_value);

	// Loop over the distinct list of fieldNorm[i]
	// Add the new fields that need to be created. 
	// Use the same data type as the original fieldname...
	//
	for (int i=0;i<norm_occ.size();i++)
	{
		String normname = (String)norm_occ.get(i);
		String fieldname =(String)field_occ.get(i);
		ValueMetaInterface v = row.searchValueMeta(fieldname).clone();
		v.setName(normname);
		v.setOrigin(name);
		row.addValueMeta(v);
	}
	
	// Now remove all the normalized fields...
	//
	for (int i=0;i<fieldName.length;i++) {
		int idx = row.indexOfValue(fieldName[i]);
		if (idx>=0) row.removeValueMeta(idx);
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:49,代码来源:NormaliserMeta.java

示例14: getMetadataFields

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getMetadataFields(RowMetaInterface inputRowMeta, String name)
{
	if (meta!=null && meta.length>0) // METADATA mode: change the meta-data of the values mentioned...
	{
		for (int i=0;i<meta.length;i++)
		{
			SelectMetadataChange metaChange = meta[i];
			
			int idx = inputRowMeta.indexOfValue(metaChange.getName());
			if (idx>=0)  // We found the value
			{
				// This is the value we need to change:
				ValueMetaInterface v = inputRowMeta.getValueMeta(idx);
				
				// Do we need to rename ?
				if (!v.getName().equals(metaChange.getRename()) && !Const.isEmpty(metaChange.getRename()))
				{
					v.setName(metaChange.getRename());
					v.setOrigin(name);
				}
				// Change the type?
				if (metaChange.getType()!=ValueMetaInterface.TYPE_NONE && v.getType()!=metaChange.getType())
				{
					v.setType(metaChange.getType());
					
					// This also moves the data to normal storage type
					//
					v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
				}
				if (metaChange.getLength()     != -2) { v.setLength(metaChange.getLength());       v.setOrigin(name); } 
				if (metaChange.getPrecision()  != -2) { v.setPrecision(metaChange.getPrecision()); v.setOrigin(name); }
				if (metaChange.getStorageType() >= 0) { v.setStorageType(metaChange.getStorageType()); v.setOrigin(name); }
				if (!Const.isEmpty(metaChange.getConversionMask())) 
				{ 
					v.setConversionMask(metaChange.getConversionMask());
					v.setOrigin(name);
				}
				if (!Const.isEmpty(metaChange.getDecimalSymbol())) 
				{ 
					v.setDecimalSymbol(metaChange.getDecimalSymbol());
					v.setOrigin(name);
				}
				if (!Const.isEmpty(metaChange.getGroupingSymbol())) 
				{ 
					v.setGroupingSymbol(metaChange.getGroupingSymbol());
					v.setOrigin(name);
				}
				if (!Const.isEmpty(metaChange.getCurrencySymbol())) 
				{ 
					v.setCurrencySymbol(metaChange.getCurrencySymbol());
					v.setOrigin(name);
				}
			}
		}
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:57,代码来源:SelectValuesMeta.java

示例15: processRow

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

	Object[] r=getRow();    // this also waits for a previous step to be finished.
	if (r==null)  // no more input to be expected...
	{
		return false;
	}
       
       if (first)
       {
           first=false;
           data.outputRowMeta = getInputRowMeta().clone();
           meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
             
           if ( ! meta.specifyFields() )  {
           	// Just take the input row
           	data.insertRowMeta = getInputRowMeta().clone();
           }
           else  {
           	
           	data.insertRowMeta = new RowMeta();
           	
           	// 
           	// Cache the position of the compare fields in Row row
           	//
           	data.valuenrs = new int[meta.getFieldDatabase().length];
           	for (int i=0;i<meta.getFieldDatabase().length;i++)
           	{
           		data.valuenrs[i]=getInputRowMeta().indexOfValue(meta.getFieldStream()[i]);
           		if (data.valuenrs[i]<0)
           		{
           			throw new KettleStepException(Messages.getString("TableOutput.Exception.FieldRequired",meta.getFieldStream()[i])); //$NON-NLS-1$
           		}
           	}

       	    for (int i=0;i<meta.getFieldDatabase().length;i++) 
       	    {
       	 	    ValueMetaInterface insValue = getInputRowMeta().searchValueMeta( meta.getFieldStream()[i]); 
       		    if ( insValue != null )
       		    {
       			    ValueMetaInterface insertValue = insValue.clone();
       			    insertValue.setName(meta.getFieldDatabase()[i]);
       			    data.insertRowMeta.addValueMeta( insertValue );
       		    }
       		    else  {
       			    throw new KettleStepException(Messages.getString("TableOutput.Exception.FailedToFindField", meta.getFieldStream()[i])); //$NON-NLS-1$ 
       			}
       	    }            	
           }
       }
       
	try
	{
		Object[] outputRowData = writeToTable(getInputRowMeta(), r);
           if (outputRowData!=null)
           {
               putRow(data.outputRowMeta, outputRowData); // in case we want it go further...
               incrementLinesOutput();
           }
           
           if (checkFeedback(getLinesRead())) 
           {
           	if(log.isBasic()) logBasic("linenr "+getLinesRead()); //$NON-NLS-1$
           }
	}
	catch(KettleException e)
	{
		logError("Because of an error, this step can't continue: ", e);
		setErrors(1);
		stopAll();
		setOutputDone();  // signal end to receiver(s)
		return false;
	}		
	
	return true;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:80,代码来源:TableOutput.java


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