use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class MergeJoinDialog method getMeta.
private void getMeta(MergeJoinMeta meta) {
List<StreamInterface> infoStreams = meta.getStepIOMeta().getInfoStreams();
infoStreams.get(0).setStepMeta(transMeta.findStep(wStep1.getText()));
infoStreams.get(1).setStepMeta(transMeta.findStep(wStep2.getText()));
meta.setJoinType(wType.getText());
int nrKeys1 = wKeys1.nrNonEmpty();
int nrKeys2 = wKeys2.nrNonEmpty();
meta.allocate(nrKeys1, nrKeys2);
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrKeys1; i++) {
TableItem item = wKeys1.getNonEmpty(i);
meta.getKeyFields1()[i] = item.getText(1);
}
// CHECKSTYLE:Indentation:OFF
for (int i = 0; i < nrKeys2; i++) {
TableItem item = wKeys2.getNonEmpty(i);
meta.getKeyFields2()[i] = item.getText(1);
}
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class MergeJoinDialog method getKeys2.
private void getKeys2() {
MergeJoinMeta joinMeta = new MergeJoinMeta();
getMeta(joinMeta);
try {
List<StreamInterface> infoStreams = joinMeta.getStepIOMeta().getInfoStreams();
StepMeta stepMeta = infoStreams.get(1).getStepMeta();
if (stepMeta != null) {
RowMetaInterface prev = transMeta.getStepFields(stepMeta);
if (prev != null) {
BaseStepDialog.getFieldsFromPrevious(prev, wKeys2, 1, new int[] { 1 }, new int[] {}, -1, -1, null);
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogTitle"), BaseMessages.getString(PKG, "MergeJoinDialog.ErrorGettingFields.DialogMessage"), e);
}
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class FuzzyMatchDialog method ok.
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();
}
// return value
stepname = wStepname.getText();
dispose();
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class TransMeta method realClone.
/**
* Perform a real clone of the transformation meta-data object, including cloning all lists and copying all values. If
* the doClear parameter is true, the clone will be cleared of ALL values before the copy. If false, only the copied
* fields will be cleared.
*
* @param doClear
* Whether to clear all of the clone's data before copying from the source object
* @return a real clone of the calling object
*/
public Object realClone(boolean doClear) {
try {
TransMeta transMeta = (TransMeta) super.clone();
if (doClear) {
transMeta.clear();
} else {
// Clear out the things we're replacing below
transMeta.databases = new ArrayList<>();
transMeta.steps = new ArrayList<>();
transMeta.hops = new ArrayList<>();
transMeta.notes = new ArrayList<>();
transMeta.dependencies = new ArrayList<>();
transMeta.partitionSchemas = new ArrayList<>();
transMeta.slaveServers = new ArrayList<>();
transMeta.clusterSchemas = new ArrayList<>();
transMeta.namedParams = new NamedParamsDefault();
transMeta.stepChangeListeners = new ArrayList<>();
}
for (DatabaseMeta db : databases) {
transMeta.addDatabase((DatabaseMeta) db.clone());
}
for (StepMeta step : steps) {
transMeta.addStep((StepMeta) step.clone());
}
// PDI-15799: Step references are original yet. Set them to the clones.
for (StepMeta step : transMeta.getSteps()) {
final StepMetaInterface stepMetaInterface = step.getStepMetaInterface();
if (stepMetaInterface != null) {
final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta();
if (stepIOMeta != null) {
for (StreamInterface stream : stepIOMeta.getInfoStreams()) {
String streamStepName = stream.getStepname();
if (streamStepName != null) {
StepMeta streamStepMeta = transMeta.findStep(streamStepName);
stream.setStepMeta(streamStepMeta);
}
}
}
}
}
for (TransHopMeta hop : hops) {
transMeta.addTransHop((TransHopMeta) hop.clone());
}
for (NotePadMeta note : notes) {
transMeta.addNote((NotePadMeta) note.clone());
}
for (TransDependency dep : dependencies) {
transMeta.addDependency((TransDependency) dep.clone());
}
for (SlaveServer slave : slaveServers) {
transMeta.getSlaveServers().add((SlaveServer) slave.clone());
}
for (ClusterSchema schema : clusterSchemas) {
transMeta.getClusterSchemas().add(schema.clone());
}
for (PartitionSchema schema : partitionSchemas) {
transMeta.getPartitionSchemas().add((PartitionSchema) schema.clone());
}
for (String key : listParameters()) {
transMeta.addParameterDefinition(key, getParameterDefault(key), getParameterDescription(key));
}
return transMeta;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
use of org.pentaho.di.trans.step.errorhandling.StreamInterface in project pentaho-kettle by pentaho.
the class TransPainter method drawLine.
private void drawLine(StepMeta fs, StepMeta ts, TransHopMeta hi, boolean is_candidate) {
int[] line = getLine(fs, ts);
EColor col;
ELineStyle linestyle = ELineStyle.SOLID;
int activeLinewidth = linewidth;
EImage arrow;
if (is_candidate) {
col = EColor.BLUE;
arrow = EImage.ARROW_CANDIDATE;
} else {
if (hi.isEnabled()) {
if (fs.isSendingErrorRowsToStep(ts)) {
col = EColor.RED;
linestyle = ELineStyle.DASH;
activeLinewidth = linewidth + 1;
arrow = EImage.ARROW_ERROR;
} else {
col = EColor.HOP_DEFAULT;
arrow = EImage.ARROW_DEFAULT;
}
} else {
col = EColor.GRAY;
arrow = EImage.ARROW_DISABLED;
}
}
if (hi.split) {
activeLinewidth = linewidth + 2;
}
// Check to see if the source step is an info step for the target step.
//
StepIOMetaInterface ioMeta = ts.getStepMetaInterface().getStepIOMeta();
List<StreamInterface> infoStreams = ioMeta.getInfoStreams();
if (!infoStreams.isEmpty()) {
//
for (StreamInterface stream : infoStreams) {
if (fs.getName().equalsIgnoreCase(stream.getStepname())) {
//
if (fs.getCopies() > 1) {
// This is not a desirable situation, it will always end in error.
// As such, it's better not to give feedback on it.
// We do this by drawing an error icon over the hop...
//
col = EColor.RED;
arrow = EImage.ARROW_ERROR;
}
}
}
}
gc.setForeground(col);
gc.setLineStyle(linestyle);
gc.setLineWidth(activeLinewidth);
drawArrow(arrow, line, hi, fs, ts);
if (hi.split) {
gc.setLineWidth(linewidth);
}
gc.setForeground(EColor.BLACK);
gc.setBackground(EColor.BACKGROUND);
gc.setLineStyle(ELineStyle.SOLID);
}
Aggregations