private void ok() { if (Utils.isEmpty(wStepname.getText())) { return; } input.setMainStreamField(wMainStreamField.getText()); input.setLookupField(wLookupField.getText()); input.setAlgorithmType(FuzzyMatchMeta.getAlgorithmTypeByDesc(wAlgorithm.getText())); input.setCaseSensitive(wcaseSensitive.getSelection()); input.setGetCloserValue(wgetCloserValue.getSelection()); input.setMaximalValue(wmaxValue.getText()); input.setMinimalValue(wminValue.getText()); input.setOutputMatchField(wmatchField.getText()); input.setOutputValueField(wvalueField.getText()); input.setSeparator(wseparator.getText()); int nrvalues = wReturn.nrNonEmpty(); input.allocate(nrvalues); if (isDebug()) { logDebug(BaseMessages.getString(PKG, "FuzzyMatchDialog.Log.FoundFields", nrvalues + "")); } // CHECKSTYLE:Indentation:OFF for (int i = 0; i < nrvalues; i++) { TableItem item = wReturn.getNonEmpty(i); input.getValue()[i] = item.getText(1); input.getValueName()[i] = item.getText(2); if (input.getValueName()[i] == null || input.getValueName()[i].length() == 0) { input.getValueName()[i] = input.getValue()[i]; } } StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0); infoStream.setStepMeta(transMeta.findStep(wStep.getText())); if (infoStream.getStepMeta() == null) { MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); if (Utils.isEmpty(wStep.getText())) { mb.setMessage( BaseMessages.getString( PKG, "FuzzyMatchDialog.NotStepSpecified.DialogMessage", wStep.getText())); } else { mb.setMessage( BaseMessages.getString( PKG, "FuzzyMatchDialog.StepCanNotFound.DialogMessage", wStep.getText())); } mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepCanNotFound.DialogTitle")); mb.open(); } stepname = wStepname.getText(); // return value dispose(); }
/** * Get the meta data * * @param meta */ private void getMeta(MultiMergeJoinMeta meta) { StepIOMetaInterface stepIOMeta = meta.getStepIOMeta(); List<StreamInterface> infoStreams = stepIOMeta.getInfoStreams(); StreamInterface stream; String streamDescription; ArrayList<String> inputStepNameList = new ArrayList<String>(); ArrayList<String> keyList = new ArrayList<String>(); CCombo wInputStep; String inputStepName; for (int i = 0; i < wInputStepArray.length; i++) { wInputStep = wInputStepArray[i]; inputStepName = wInputStep.getText(); if (Const.isEmpty(inputStepName)) { continue; } inputStepNameList.add(inputStepName); keyList.add(keyValTextBox[i].getText()); if (infoStreams.size() < inputStepNameList.size()) { streamDescription = BaseMessages.getString(PKG, "MultiMergeJoin.InfoStream.Description"); stream = new Stream(StreamType.INFO, null, streamDescription, StreamIcon.INFO, null); stepIOMeta.addStream(stream); } } int inputStepCount = inputStepNameList.size(); meta.allocateInputSteps(inputStepCount); meta.allocateKeys(inputStepCount); String[] inputSteps = meta.getInputSteps(); String[] keyFields = meta.getKeyFields(); infoStreams = stepIOMeta.getInfoStreams(); for (int i = 0; i < inputStepCount; i++) { inputStepName = inputStepNameList.get(i); inputSteps[i] = inputStepName; stream = infoStreams.get(i); stream.setStepMeta(transMeta.findStep(inputStepName)); keyFields[i] = keyList.get(i); } meta.setJoinType(joinTypeCombo.getText()); }
@Override public void searchInfoAndTargetSteps(List<StepMeta> steps) { for (StreamInterface stream : getStepIOMeta().getInfoStreams()) { stream.setStepMeta(StepMeta.findStep(steps, (String) stream.getSubject())); } }