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


Java EnterMappingDialog类代码示例

本文整理汇总了Java中org.pentaho.di.ui.core.dialog.EnterMappingDialog的典型用法代码示例。如果您正苦于以下问题:Java EnterMappingDialog类的具体用法?Java EnterMappingDialog怎么用?Java EnterMappingDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EnterMappingDialog类属于org.pentaho.di.ui.core.dialog包,在下文中一共展示了EnterMappingDialog类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new field mapping between source and target steps.
 * 
 * @param shell the shell of the parent window
 * @param sourceFields the source fields
 * @param targetFields the target fields
 * @param fieldMapping the list of source to target mappings to default to (can be empty but not null)
 * 
 * @throws KettleException in case something goes wrong during the field mapping
 * 
 */
public static final void generateFieldMapping(Shell shell, RowMetaInterface sourceFields, RowMetaInterface targetFields, List<SourceToTargetMapping> fieldMapping) throws KettleException {
	// Build the mapping: let the user decide!!
	String[] source = sourceFields.getFieldNames();
	for (int i = 0; i < source.length; i++) {
		ValueMetaInterface v = sourceFields.getValueMeta(i);
		source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
	}
	String[] target = targetFields.getFieldNames();

	EnterMappingDialog dialog = new EnterMappingDialog(shell, source, target, fieldMapping);
	List<SourceToTargetMapping> newMapping = dialog.open();
	if (newMapping!=null) {
		fieldMapping.clear();
		fieldMapping.addAll(newMapping);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:28,代码来源:BaseStepDialog.java

示例2: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new field mapping between source and target steps.
 *
 * @param shell        the shell of the parent window
 * @param sourceFields the source fields
 * @param targetFields the target fields
 * @param fieldMapping the list of source to target mappings to default to (can be empty but not null)
 * @throws KettleException in case something goes wrong during the field mapping
 */
public static final void generateFieldMapping( Shell shell, RowMetaInterface sourceFields,
                                               RowMetaInterface targetFields,
                                               java.util.List<SourceToTargetMapping> fieldMapping ) throws
                                                                                                    KettleException {
  // Build the mapping: let the user decide!!
  String[] source = sourceFields.getFieldNames();
  for (int i = 0; i < source.length; i++) {
    ValueMetaInterface v = sourceFields.getValueMeta(i);
    source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
  }
  String[] target = targetFields.getFieldNames();

  EnterMappingDialog dialog = new EnterMappingDialog(shell, source, target, fieldMapping);
  java.util.List<SourceToTargetMapping> newMapping = dialog.open();
  if (newMapping != null) {
    fieldMapping.clear();
    fieldMapping.addAll(newMapping);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:29,代码来源:BaseStepXulDialog.java

示例3: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new field mapping between source and target steps.
 *
 * @param shell
 *          the shell of the parent window
 * @param sourceFields
 *          the source fields
 * @param targetFields
 *          the target fields
 * @param fieldMapping
 *          the list of source to target mappings to default to (can be empty but not null)
 * @throws KettleException
 *           in case something goes wrong during the field mapping
 */
public static final void generateFieldMapping( Shell shell, RowMetaInterface sourceFields,
  RowMetaInterface targetFields, java.util.List<SourceToTargetMapping> fieldMapping ) throws KettleException {
  // Build the mapping: let the user decide!!
  String[] source = sourceFields.getFieldNames();
  for ( int i = 0; i < source.length; i++ ) {
    ValueMetaInterface v = sourceFields.getValueMeta( i );
    source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
  }
  String[] target = targetFields.getFieldNames();

  EnterMappingDialog dialog = new EnterMappingDialog( shell, source, target, fieldMapping );
  java.util.List<SourceToTargetMapping> newMapping = dialog.open();
  if ( newMapping != null ) {
    fieldMapping.clear();
    fieldMapping.addAll( newMapping );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:BaseStepXulDialog.java

示例4: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new field mapping between source and target steps.
 *
 * @param shell        the shell of the parent window
 * @param sourceFields the source fields
 * @param targetFields the target fields
 * @param fieldMapping the list of source to target mappings to default to (can be empty but not null)
 * @throws KettleException in case something goes wrong during the field mapping
 */
public static final void generateFieldMapping( Shell shell, RowMetaInterface sourceFields,
                                               RowMetaInterface targetFields,
                                               List<SourceToTargetMapping> fieldMapping ) throws KettleException {
  // Build the mapping: let the user decide!!
  String[] source = sourceFields.getFieldNames();
  for ( int i = 0; i < source.length; i++ ) {
    ValueMetaInterface v = sourceFields.getValueMeta( i );
    source[ i ] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
  }
  String[] target = targetFields.getFieldNames();

  EnterMappingDialog dialog = new EnterMappingDialog( shell, source, target, fieldMapping );
  List<SourceToTargetMapping> newMapping = dialog.open();
  if ( newMapping != null ) {
    fieldMapping.clear();
    fieldMapping.addAll( newMapping );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:28,代码来源:BaseStepDialog.java

示例5: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new SelectValues step in between this step and the previous. If
 * the previous fields are not there, no mapping can be made, same with the
 * required fields.
 * 
 * @param stepMeta
 *            The target step to map against.
 */
@SuppressWarnings("deprecation") // retry of required fields acquisition
public void generateFieldMapping(TransMeta transMeta, StepMeta stepMeta) {
	try {
		if (stepMeta != null) {
			StepMetaInterface smi = stepMeta.getStepMetaInterface();
			RowMetaInterface targetFields = smi.getRequiredFields(transMeta);
			if (targetFields.isEmpty()) smi.getRequiredFields(); // retry, get rid of this method in 4.x
			RowMetaInterface sourceFields = transMeta.getPrevStepFields(stepMeta);

			// Build the mapping: let the user decide!!
			String[] source = sourceFields.getFieldNames();
			for (int i = 0; i < source.length; i++) {
				ValueMetaInterface v = sourceFields.getValueMeta(i);
				source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
			}
			String[] target = targetFields.getFieldNames();

			EnterMappingDialog dialog = new EnterMappingDialog(shell, source, target);
			List<SourceToTargetMapping> mappings = dialog.open();
			if (mappings != null) {
				// OK, so we now know which field maps where.
				// This allows us to generate the mapping using a
				// SelectValues Step...
				SelectValuesMeta svm = new SelectValuesMeta();
				svm.allocate(mappings.size(), 0, 0);

				for (int i = 0; i < mappings.size(); i++) {
					SourceToTargetMapping mapping = mappings.get(i);
					svm.getSelectName()[i] = sourceFields.getValueMeta(mapping.getSourcePosition()).getName();
					svm.getSelectRename()[i] = target[mapping.getTargetPosition()];
					svm.getSelectLength()[i] = -1;
					svm.getSelectPrecision()[i] = -1;
				}
				// a new comment
				// Now that we have the meta-data, create a new step info
				// object

				String stepName = stepMeta.getName() + " Mapping";
				stepName = transMeta.getAlternativeStepname(stepName); // if it's already there, rename it.

				StepMeta newStep = new StepMeta("SelectValues", stepName, svm);
				newStep.setLocation(stepMeta.getLocation().x + 20, stepMeta.getLocation().y + 20);
				newStep.setDraw(true);

				transMeta.addStep(newStep);
				addUndoNew(transMeta, new StepMeta[] { newStep }, new int[] { transMeta.indexOfStep(newStep) });

				// Redraw stuff...
				refreshTree();
				refreshGraph();
			}
		} else {
			throw new KettleException("There is no target to do a field mapping against!");
		}
	} catch (KettleException e) {
		new ErrorDialog(shell, "Error creating mapping", "There was an error when Kettle tried to generate a field mapping against the target step", e);
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:67,代码来源:Spoon.java

示例6: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new SelectValues step in between this step and the previous. If
 * the previous fields are not there, no mapping can be made, same with the
 * required fields.
 * 
 * @param stepMeta
 *            The target step to map against.
 */
// retry of required fields acquisition
public void generateFieldMapping(TransMeta transMeta, StepMeta stepMeta) {
  try {
    if (stepMeta != null) {
      StepMetaInterface smi = stepMeta.getStepMetaInterface();
      RowMetaInterface targetFields = smi.getRequiredFields(transMeta);
      RowMetaInterface sourceFields = transMeta.getPrevStepFields(stepMeta);

      // Build the mapping: let the user decide!!
      String[] source = sourceFields.getFieldNames();
      for (int i = 0; i < source.length; i++) {
        ValueMetaInterface v = sourceFields.getValueMeta(i);
        source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
      }
      String[] target = targetFields.getFieldNames();

      EnterMappingDialog dialog = new EnterMappingDialog(shell, source, target);
      List<SourceToTargetMapping> mappings = dialog.open();
      if (mappings != null) {
        // OK, so we now know which field maps where.
        // This allows us to generate the mapping using a
        // SelectValues Step...
        SelectValuesMeta svm = new SelectValuesMeta();
        svm.allocate(mappings.size(), 0, 0);

        for (int i = 0; i < mappings.size(); i++) {
          SourceToTargetMapping mapping = mappings.get(i);
          svm.getSelectName()[i] = sourceFields.getValueMeta(mapping.getSourcePosition()).getName();
          svm.getSelectRename()[i] = target[mapping.getTargetPosition()];
          svm.getSelectLength()[i] = -1;
          svm.getSelectPrecision()[i] = -1;
        }
        // a new comment
        // Now that we have the meta-data, create a new step info
        // object

        String stepName = stepMeta.getName() + " Mapping";
        stepName = transMeta.getAlternativeStepname(stepName); // if
        // it's
        // already
        // there,
        // rename
        // it.

        StepMeta newStep = new StepMeta("SelectValues", stepName, svm);
        newStep.setLocation(stepMeta.getLocation().x + 20, stepMeta.getLocation().y + 20);
        newStep.setDraw(true);

        transMeta.addStep(newStep);
        addUndoNew(transMeta, new StepMeta[] { newStep }, new int[] { transMeta.indexOfStep(newStep) });

        // Redraw stuff...
        refreshTree();
        refreshGraph();
      }
    } else {
      throw new KettleException("There is no target to do a field mapping against!");
    }
  } catch (KettleException e) {
    new ErrorDialog(shell, "Error creating mapping",
        "There was an error when Kettle tried to generate a field mapping against the target step", e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:72,代码来源:Spoon.java

示例7: generateFieldMapping

import org.pentaho.di.ui.core.dialog.EnterMappingDialog; //导入依赖的package包/类
/**
 * Create a new SelectValues step in between this step and the previous. If the previous fields are not there, no
 * mapping can be made, same with the required fields.
 *
 * @param stepMeta
 *          The target step to map against.
 */
// retry of required fields acquisition
public void generateFieldMapping( TransMeta transMeta, StepMeta stepMeta ) {
  try {
    if ( stepMeta != null ) {
      StepMetaInterface smi = stepMeta.getStepMetaInterface();
      RowMetaInterface targetFields = smi.getRequiredFields( transMeta );
      RowMetaInterface sourceFields = transMeta.getPrevStepFields( stepMeta );

      // Build the mapping: let the user decide!!
      String[] source = sourceFields.getFieldNames();
      for ( int i = 0; i < source.length; i++ ) {
        ValueMetaInterface v = sourceFields.getValueMeta( i );
        source[i] += EnterMappingDialog.STRING_ORIGIN_SEPARATOR + v.getOrigin() + ")";
      }
      String[] target = targetFields.getFieldNames();

      EnterMappingDialog dialog = new EnterMappingDialog( shell, source, target );
      List<SourceToTargetMapping> mappings = dialog.open();
      if ( mappings != null ) {
        // OK, so we now know which field maps where.
        // This allows us to generate the mapping using a
        // SelectValues Step...
        SelectValuesMeta svm = new SelectValuesMeta();
        svm.allocate( mappings.size(), 0, 0 );

        //CHECKSTYLE:Indentation:OFF
        for ( int i = 0; i < mappings.size(); i++ ) {
          SourceToTargetMapping mapping = mappings.get( i );
          svm.getSelectFields()[i].setName( sourceFields.getValueMeta( mapping.getSourcePosition() ).getName() );
          svm.getSelectFields()[i].setRename( target[mapping.getTargetPosition()] );
          svm.getSelectFields()[i].setLength( -1 );
          svm.getSelectFields()[i].setPrecision( -1 );
        }
        // a new comment. Sincerely yours CO ;)
        // Now that we have the meta-data, create a new step info object
        String stepName = stepMeta.getName() + " Mapping";
        stepName = transMeta.getAlternativeStepname( stepName ); // if
        // it's already there, rename it.

        StepMeta newStep = new StepMeta( "SelectValues", stepName, svm );
        newStep.setLocation( stepMeta.getLocation().x + 20, stepMeta.getLocation().y + 20 );
        newStep.setDraw( true );

        transMeta.addStep( newStep );
        addUndoNew( transMeta, new StepMeta[] { newStep }, new int[] { transMeta.indexOfStep( newStep ) } );

        // Redraw stuff...
        refreshTree();
        refreshGraph();
      }
    } else {
      throw new KettleException( "There is no target to do a field mapping against!" );
    }
  } catch ( KettleException e ) {
    new ErrorDialog(
      shell, "Error creating mapping",
      "There was an error when Kettle tried to generate a field mapping against the target step", e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:67,代码来源:Spoon.java


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