Search in sources :

Example 1 with ValueMetaNone

use of org.apache.hop.core.row.value.ValueMetaNone in project hop by apache.

the class MemoryGroupByMeta method getFields.

@Override
public void getFields(IRowMeta r, String origin, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) {
    // Check compatibility mode
    boolean compatibilityMode = ValueMetaBase.convertStringToBoolean(variables.getVariable(Const.HOP_COMPATIBILITY_MEMORY_GROUP_BY_SUM_AVERAGE_RETURN_NUMBER_TYPE, "N"));
    // re-assemble a new row of metadata
    // 
    IRowMeta fields = new RowMeta();
    // 
    for (int i = 0; i < groupField.length; i++) {
        IValueMeta valueMeta = r.searchValueMeta(groupField[i]);
        if (valueMeta != null) {
            valueMeta.setStorageType(IValueMeta.STORAGE_TYPE_NORMAL);
            fields.addValueMeta(valueMeta);
        }
    }
    // 
    for (int i = 0; i < subjectField.length; i++) {
        IValueMeta subj = r.searchValueMeta(subjectField[i]);
        if (subj != null || aggregateType[i] == TYPE_GROUP_COUNT_ANY) {
            String valueName = aggregateField[i];
            int valueType = IValueMeta.TYPE_NONE;
            int length = -1;
            int precision = -1;
            switch(aggregateType[i]) {
                case TYPE_GROUP_FIRST:
                case TYPE_GROUP_LAST:
                case TYPE_GROUP_FIRST_INCL_NULL:
                case TYPE_GROUP_LAST_INCL_NULL:
                case TYPE_GROUP_MIN:
                case TYPE_GROUP_MAX:
                    valueType = subj.getType();
                    break;
                case TYPE_GROUP_COUNT_DISTINCT:
                case TYPE_GROUP_COUNT_ALL:
                case TYPE_GROUP_COUNT_ANY:
                    valueType = IValueMeta.TYPE_INTEGER;
                    break;
                case TYPE_GROUP_CONCAT_COMMA:
                    valueType = IValueMeta.TYPE_STRING;
                    break;
                case TYPE_GROUP_SUM:
                case TYPE_GROUP_AVERAGE:
                    if (!compatibilityMode && subj.isNumeric()) {
                        valueType = subj.getType();
                    } else {
                        valueType = IValueMeta.TYPE_NUMBER;
                    }
                    break;
                case TYPE_GROUP_MEDIAN:
                case TYPE_GROUP_PERCENTILE:
                case TYPE_GROUP_STANDARD_DEVIATION:
                    valueType = IValueMeta.TYPE_NUMBER;
                    break;
                case TYPE_GROUP_CONCAT_STRING:
                    valueType = IValueMeta.TYPE_STRING;
                    break;
                default:
                    break;
            }
            if (aggregateType[i] == TYPE_GROUP_SUM && valueType != IValueMeta.TYPE_INTEGER && valueType != IValueMeta.TYPE_NUMBER && valueType != IValueMeta.TYPE_BIGNUMBER) {
                // If it ain't numeric, we change it to Number
                // 
                valueType = IValueMeta.TYPE_NUMBER;
                precision = -1;
                length = -1;
            }
            if (valueType != IValueMeta.TYPE_NONE) {
                IValueMeta v;
                try {
                    v = ValueMetaFactory.createValueMeta(valueName, valueType);
                } catch (HopPluginException e) {
                    log.logError(BaseMessages.getString(PKG, "MemoryGroupByMeta.Exception.UnknownValueMetaType"), valueType, e);
                    v = new ValueMetaNone(valueName);
                }
                v.setOrigin(origin);
                v.setLength(length, precision);
                if (subj != null) {
                    v.setConversionMask(subj.getConversionMask());
                }
                fields.addValueMeta(v);
            }
        }
    }
    // Now that we have all the fields we want, we should clear the original row and replace the
    // values...
    // 
    r.clear();
    r.addRowMeta(fields);
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaNone(org.apache.hop.core.row.value.ValueMetaNone) RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) HopPluginException(org.apache.hop.core.exception.HopPluginException)

Example 2 with ValueMetaNone

use of org.apache.hop.core.row.value.ValueMetaNone in project hop by apache.

the class GroupByMeta method getFields.

@Override
public void getFields(IRowMeta rowMeta, String origin, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) {
    // re-assemble a new row of metadata
    // 
    IRowMeta fields = new RowMeta();
    if (!passAllRows) {
        // 
        for (int i = 0; i < groupField.length; i++) {
            IValueMeta valueMeta = rowMeta.searchValueMeta(groupField[i]);
            if (valueMeta != null) {
                fields.addValueMeta(valueMeta);
            }
        }
    } else {
        // Add all the original fields from the incoming row meta
        // 
        fields.addRowMeta(rowMeta);
    }
    // 
    for (Aggregation aggregation : aggregations) {
        int aggregationType = aggregation.getType();
        IValueMeta subj = rowMeta.searchValueMeta(aggregation.getSubject());
        if (subj != null || aggregationType == TYPE_GROUP_COUNT_ANY) {
            String valueName = aggregation.getField();
            int valueType = IValueMeta.TYPE_NONE;
            int length = -1;
            int precision = -1;
            switch(aggregationType) {
                case TYPE_GROUP_SUM:
                case TYPE_GROUP_AVERAGE:
                case TYPE_GROUP_CUMULATIVE_SUM:
                case TYPE_GROUP_CUMULATIVE_AVERAGE:
                case TYPE_GROUP_FIRST:
                case TYPE_GROUP_LAST:
                case TYPE_GROUP_FIRST_INCL_NULL:
                case TYPE_GROUP_LAST_INCL_NULL:
                case TYPE_GROUP_MIN:
                case TYPE_GROUP_MAX:
                    valueType = subj.getType();
                    break;
                case TYPE_GROUP_COUNT_DISTINCT:
                case TYPE_GROUP_COUNT_ANY:
                case TYPE_GROUP_COUNT_ALL:
                    valueType = IValueMeta.TYPE_INTEGER;
                    break;
                case TYPE_GROUP_CONCAT_COMMA:
                    valueType = IValueMeta.TYPE_STRING;
                    break;
                case TYPE_GROUP_STANDARD_DEVIATION:
                case TYPE_GROUP_MEDIAN:
                case TYPE_GROUP_STANDARD_DEVIATION_SAMPLE:
                case TYPE_GROUP_PERCENTILE:
                case TYPE_GROUP_PERCENTILE_NEAREST_RANK:
                    valueType = IValueMeta.TYPE_NUMBER;
                    break;
                case TYPE_GROUP_CONCAT_STRING:
                case TYPE_GROUP_CONCAT_STRING_CRLF:
                    valueType = IValueMeta.TYPE_STRING;
                    break;
                default:
                    break;
            }
            // 
            if (aggregationType == TYPE_GROUP_CUMULATIVE_AVERAGE && valueType == IValueMeta.TYPE_INTEGER) {
                valueType = IValueMeta.TYPE_NUMBER;
                precision = -1;
                length = -1;
            } else if (aggregationType == TYPE_GROUP_COUNT_ALL || aggregationType == TYPE_GROUP_COUNT_DISTINCT || aggregationType == TYPE_GROUP_COUNT_ANY) {
                length = IValueMeta.DEFAULT_INTEGER_LENGTH;
                precision = 0;
            } else if (aggregationType == TYPE_GROUP_SUM && valueType != IValueMeta.TYPE_INTEGER && valueType != IValueMeta.TYPE_NUMBER && valueType != IValueMeta.TYPE_BIGNUMBER) {
                // If it ain't numeric, we change it to Number
                // 
                valueType = IValueMeta.TYPE_NUMBER;
                precision = -1;
                length = -1;
            }
            if (valueType != IValueMeta.TYPE_NONE) {
                IValueMeta v;
                try {
                    v = ValueMetaFactory.createValueMeta(valueName, valueType);
                } catch (HopPluginException e) {
                    v = new ValueMetaNone(valueName);
                }
                v.setOrigin(origin);
                v.setLength(length, precision);
                if (subj != null) {
                    v.setConversionMask(subj.getConversionMask());
                }
                fields.addValueMeta(v);
            }
        }
    }
    if (passAllRows) {
        // If we pass all rows, we can add a line nr in the group...
        if (addingLineNrInGroup && !Utils.isEmpty(lineNrInGroupField)) {
            IValueMeta lineNr = new ValueMetaInteger(lineNrInGroupField);
            lineNr.setLength(IValueMeta.DEFAULT_INTEGER_LENGTH, 0);
            lineNr.setOrigin(origin);
            fields.addValueMeta(lineNr);
        }
    }
    // Now that we have all the fields we want, we should clear the original row and replace the
    // values...
    // 
    rowMeta.clear();
    rowMeta.addRowMeta(fields);
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaNone(org.apache.hop.core.row.value.ValueMetaNone) RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) HopPluginException(org.apache.hop.core.exception.HopPluginException) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger)

Example 3 with ValueMetaNone

use of org.apache.hop.core.row.value.ValueMetaNone in project hop by apache.

the class SalesforceInsertDialog method generateMappings.

/**
 * Reads in the fields from the previous transforms and from the ONE next transform and opens an
 * EnterMappingDialog with this information. After the user did the mapping, those information is
 * put into the Select/Rename table.
 */
private void generateMappings() {
    if (!checkInput()) {
        return;
    }
    // Determine the source and target fields...
    // 
    IRowMeta sourceFields;
    IRowMeta targetFields = new RowMeta();
    try {
        sourceFields = pipelineMeta.getPrevTransformFields(variables, transformMeta);
    } catch (HopException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.UnableToFindSourceFields.Title"), BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.UnableToFindSourceFields.Message"), e);
        return;
    }
    try {
        SalesforceConnection connection = getConnection();
        Field[] fields = connection.getObjectFields(variables.resolve(wModule.getText()));
        String[] fieldNames = connection.getFields(fields);
        FieldType dateType = FieldType.date;
        for (int i = 0; i < fields.length; i++) {
            if (dateType.equals(fields[i].getType())) {
                // Mark date columns as TYPE_DATE to strip time part later
                targetFields.addValueMeta(ValueMetaFactory.createValueMeta(fieldNames[i], IValueMeta.TYPE_DATE));
            } else {
                targetFields.addValueMeta(new ValueMetaNone(fieldNames[i]));
            }
        }
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.UnableToFindTargetFields.Title"), BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.UnableToFindTargetFields.Message"), e);
        return;
    }
    String[] inputNames = new String[sourceFields.size()];
    for (int i = 0; i < sourceFields.size(); i++) {
        IValueMeta value = sourceFields.getValueMeta(i);
        inputNames[i] = value.getName();
    }
    // Create the existing mapping list...
    // 
    List<SourceToTargetMapping> mappings = new ArrayList<>();
    StringBuffer missingSourceFields = new StringBuffer();
    StringBuffer missingTargetFields = new StringBuffer();
    int nrFields = wReturn.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
        TableItem item = wReturn.getNonEmpty(i);
        String source = item.getText(2);
        String target = item.getText(1);
        int sourceIndex = sourceFields.indexOfValue(source);
        if (sourceIndex < 0) {
            missingSourceFields.append(Const.CR + "   " + source + " --> " + target);
        }
        int targetIndex = targetFields.indexOfValue(target);
        if (targetIndex < 0) {
            missingTargetFields.append(Const.CR + "   " + source + " --> " + target);
        }
        if (sourceIndex < 0 || targetIndex < 0) {
            continue;
        }
        SourceToTargetMapping mapping = new SourceToTargetMapping(sourceIndex, targetIndex);
        mappings.add(mapping);
    }
    // 
    if (missingSourceFields.length() > 0 || missingTargetFields.length() > 0) {
        String message = "";
        if (missingSourceFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.SomeSourceFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        if (missingTargetFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.SomeTargetFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        message += Const.CR;
        message += BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.SomeFieldsNotFoundContinue") + Const.CR;
        int answer = BaseDialog.openMessageBox(shell, BaseMessages.getString(PKG, "SalesforceInsertDialog.DoMapping.SomeFieldsNotFoundTitle"), message, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
        boolean goOn = (answer & SWT.OK) != 0;
        if (!goOn) {
            return;
        }
    }
    EnterMappingDialog d = new EnterMappingDialog(SalesforceInsertDialog.this.shell, sourceFields.getFieldNames(), targetFields.getFieldNames(), mappings);
    mappings = d.open();
    // 
    if (mappings != null) {
        // Clear and re-populate!
        // 
        wReturn.table.removeAll();
        wReturn.table.setItemCount(mappings.size());
        for (int i = 0; i < mappings.size(); i++) {
            SourceToTargetMapping mapping = mappings.get(i);
            TableItem item = wReturn.table.getItem(i);
            item.setText(2, sourceFields.getValueMeta(mapping.getSourcePosition()).getName());
            item.setText(1, targetFields.getValueMeta(mapping.getTargetPosition()).getName());
        }
        wReturn.setRowNums();
        wReturn.optWidth(true);
    }
}
Also used : RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) HopException(org.apache.hop.core.exception.HopException) IRowMeta(org.apache.hop.core.row.IRowMeta) EnterMappingDialog(org.apache.hop.ui.core.dialog.EnterMappingDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) SalesforceConnection(org.apache.hop.pipeline.transforms.salesforce.SalesforceConnection) HopException(org.apache.hop.core.exception.HopException) FieldType(com.sforce.soap.partner.FieldType) Field(com.sforce.soap.partner.Field) IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaNone(org.apache.hop.core.row.value.ValueMetaNone) SourceToTargetMapping(org.apache.hop.core.SourceToTargetMapping)

Example 4 with ValueMetaNone

use of org.apache.hop.core.row.value.ValueMetaNone in project hop by apache.

the class SalesforceUpdateDialog method generateMappings.

/**
 * Reads in the fields from the previous transforms and from the ONE next transform and opens an
 * EnterMappingDialog with this information. After the user did the mapping, those information is
 * put into the Select/Rename table.
 */
private void generateMappings() {
    if (!checkInput()) {
        return;
    }
    // Determine the source and target fields...
    // 
    IRowMeta sourceFields;
    IRowMeta targetFields = new RowMeta();
    try {
        sourceFields = pipelineMeta.getPrevTransformFields(variables, transformMeta);
    } catch (HopException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.UnableToFindSourceFields.Title"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.UnableToFindSourceFields.Message"), e);
        return;
    }
    try {
        String[] fields = getModuleFields();
        for (int i = 0; i < fields.length; i++) {
            targetFields.addValueMeta(new ValueMetaNone(fields[i]));
        }
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.UnableToFindTargetFields.Title"), BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.UnableToFindTargetFields.Message"), e);
        return;
    }
    String[] inputNames = new String[sourceFields.size()];
    for (int i = 0; i < sourceFields.size(); i++) {
        IValueMeta value = sourceFields.getValueMeta(i);
        inputNames[i] = value.getName();
    }
    // Create the existing mapping list...
    // 
    List<SourceToTargetMapping> mappings = new ArrayList<>();
    StringBuffer missingSourceFields = new StringBuffer();
    StringBuffer missingTargetFields = new StringBuffer();
    int nrFields = wReturn.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
        TableItem item = wReturn.getNonEmpty(i);
        String source = item.getText(2);
        String target = item.getText(1);
        int sourceIndex = sourceFields.indexOfValue(source);
        if (sourceIndex < 0) {
            missingSourceFields.append(Const.CR + "   " + source + " --> " + target);
        }
        int targetIndex = targetFields.indexOfValue(target);
        if (targetIndex < 0) {
            missingTargetFields.append(Const.CR + "   " + source + " --> " + target);
        }
        if (sourceIndex < 0 || targetIndex < 0) {
            continue;
        }
        SourceToTargetMapping mapping = new SourceToTargetMapping(sourceIndex, targetIndex);
        mappings.add(mapping);
    }
    // 
    if (missingSourceFields.length() > 0 || missingTargetFields.length() > 0) {
        String message = "";
        if (missingSourceFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.SomeSourceFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        if (missingTargetFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.SomeTargetFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        message += Const.CR;
        message += BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.SomeFieldsNotFoundContinue") + Const.CR;
        int answer = BaseDialog.openMessageBox(shell, BaseMessages.getString(PKG, "SalesforceUpdateDialog.DoMapping.SomeFieldsNotFoundTitle"), message, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
        boolean goOn = (answer & SWT.OK) != 0;
        if (!goOn) {
            return;
        }
    }
    EnterMappingDialog d = new EnterMappingDialog(SalesforceUpdateDialog.this.shell, sourceFields.getFieldNames(), targetFields.getFieldNames(), mappings);
    mappings = d.open();
    // 
    if (mappings != null) {
        // Clear and re-populate!
        // 
        wReturn.table.removeAll();
        wReturn.table.setItemCount(mappings.size());
        for (int i = 0; i < mappings.size(); i++) {
            SourceToTargetMapping mapping = mappings.get(i);
            TableItem item = wReturn.table.getItem(i);
            item.setText(2, sourceFields.getValueMeta(mapping.getSourcePosition()).getName());
            item.setText(1, targetFields.getValueMeta(mapping.getTargetPosition()).getName());
        }
        wReturn.setRowNums();
        wReturn.optWidth(true);
    }
}
Also used : RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) HopException(org.apache.hop.core.exception.HopException) IRowMeta(org.apache.hop.core.row.IRowMeta) EnterMappingDialog(org.apache.hop.ui.core.dialog.EnterMappingDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaNone(org.apache.hop.core.row.value.ValueMetaNone) SourceToTargetMapping(org.apache.hop.core.SourceToTargetMapping)

Example 5 with ValueMetaNone

use of org.apache.hop.core.row.value.ValueMetaNone in project hop by apache.

the class SalesforceUpsertDialog method generateMappings.

/**
 * Reads in the fields from the previous transforms and from the ONE next transform and opens an
 * EnterMappingDialog with this information. After the user did the mapping, those information is
 * put into the Select/Rename table.
 */
private void generateMappings() {
    if (!checkInput()) {
        return;
    }
    // Determine the source and target fields...
    // 
    IRowMeta sourceFields;
    IRowMeta targetFields = new RowMeta();
    try {
        sourceFields = pipelineMeta.getPrevTransformFields(variables, transformMeta);
    } catch (HopException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.UnableToFindSourceFields.Title"), BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.UnableToFindSourceFields.Message"), e);
        return;
    }
    try {
        String[] fields = getModuleFields();
        for (int i = 0; i < fields.length; i++) {
            targetFields.addValueMeta(new ValueMetaNone(fields[i]));
        }
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.UnableToFindTargetFields.Title"), BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.UnableToFindTargetFields.Message"), e);
        return;
    }
    String[] inputNames = new String[sourceFields.size()];
    for (int i = 0; i < sourceFields.size(); i++) {
        IValueMeta value = sourceFields.getValueMeta(i);
        inputNames[i] = value.getName();
    }
    // Create the existing mapping list...
    // 
    List<SourceToTargetMapping> mappings = new ArrayList<>();
    StringBuffer missingSourceFields = new StringBuffer();
    StringBuffer missingTargetFields = new StringBuffer();
    int nrFields = wReturn.nrNonEmpty();
    for (int i = 0; i < nrFields; i++) {
        TableItem item = wReturn.getNonEmpty(i);
        String source = item.getText(2);
        String target = item.getText(1);
        int sourceIndex = sourceFields.indexOfValue(source);
        if (sourceIndex < 0) {
            missingSourceFields.append(Const.CR + "   " + source + " --> " + target);
        }
        int targetIndex = targetFields.indexOfValue(target);
        if (targetIndex < 0) {
            missingTargetFields.append(Const.CR + "   " + source + " --> " + target);
        }
        if (sourceIndex < 0 || targetIndex < 0) {
            continue;
        }
        SourceToTargetMapping mapping = new SourceToTargetMapping(sourceIndex, targetIndex);
        mappings.add(mapping);
    }
    // 
    if (missingSourceFields.length() > 0 || missingTargetFields.length() > 0) {
        String message = "";
        if (missingSourceFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.SomeSourceFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        if (missingTargetFields.length() > 0) {
            message += BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.SomeTargetFieldsNotFound", missingSourceFields.toString()) + Const.CR;
        }
        message += Const.CR;
        message += BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.SomeFieldsNotFoundContinue") + Const.CR;
        int answer = BaseDialog.openMessageBox(shell, BaseMessages.getString(PKG, "SalesforceUpsertDialog.DoMapping.SomeFieldsNotFoundTitle"), message, SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
        boolean goOn = (answer & SWT.OK) != 0;
        if (!goOn) {
            return;
        }
    }
    EnterMappingDialog d = new EnterMappingDialog(SalesforceUpsertDialog.this.shell, sourceFields.getFieldNames(), targetFields.getFieldNames(), mappings);
    mappings = d.open();
    // 
    if (mappings != null) {
        // Clear and re-populate!
        // 
        wReturn.table.removeAll();
        wReturn.table.setItemCount(mappings.size());
        for (int i = 0; i < mappings.size(); i++) {
            SourceToTargetMapping mapping = mappings.get(i);
            TableItem item = wReturn.table.getItem(i);
            item.setText(2, sourceFields.getValueMeta(mapping.getSourcePosition()).getName());
            item.setText(1, targetFields.getValueMeta(mapping.getTargetPosition()).getName());
        }
        wReturn.setRowNums();
        wReturn.optWidth(true);
    }
}
Also used : RowMeta(org.apache.hop.core.row.RowMeta) IRowMeta(org.apache.hop.core.row.IRowMeta) HopException(org.apache.hop.core.exception.HopException) IRowMeta(org.apache.hop.core.row.IRowMeta) EnterMappingDialog(org.apache.hop.ui.core.dialog.EnterMappingDialog) ErrorDialog(org.apache.hop.ui.core.dialog.ErrorDialog) HopException(org.apache.hop.core.exception.HopException) IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaNone(org.apache.hop.core.row.value.ValueMetaNone) SourceToTargetMapping(org.apache.hop.core.SourceToTargetMapping)

Aggregations

IValueMeta (org.apache.hop.core.row.IValueMeta)11 ValueMetaNone (org.apache.hop.core.row.value.ValueMetaNone)11 IRowMeta (org.apache.hop.core.row.IRowMeta)8 RowMeta (org.apache.hop.core.row.RowMeta)8 HopPluginException (org.apache.hop.core.exception.HopPluginException)5 SourceToTargetMapping (org.apache.hop.core.SourceToTargetMapping)3 HopException (org.apache.hop.core.exception.HopException)3 EnterMappingDialog (org.apache.hop.ui.core.dialog.EnterMappingDialog)3 ErrorDialog (org.apache.hop.ui.core.dialog.ErrorDialog)3 ValueMetaInteger (org.apache.hop.core.row.value.ValueMetaInteger)2 Field (com.sforce.soap.partner.Field)1 FieldType (com.sforce.soap.partner.FieldType)1 FileObject (org.apache.commons.vfs2.FileObject)1 Database (org.apache.hop.core.database.Database)1 DatabaseMeta (org.apache.hop.core.database.DatabaseMeta)1 HopDatabaseException (org.apache.hop.core.exception.HopDatabaseException)1 ValueMetaDate (org.apache.hop.core.row.value.ValueMetaDate)1 ValueMetaNumber (org.apache.hop.core.row.value.ValueMetaNumber)1 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)1 SalesforceConnection (org.apache.hop.pipeline.transforms.salesforce.SalesforceConnection)1