Skip to content

Commit

Permalink
kafka consumer child pipeline can not be same as parent pipeline. apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
bamaer committed Sep 19, 2024
1 parent 59eadc6 commit 13e24fa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.gui.Point;
import org.apache.hop.core.row.value.ValueMetaFactory;
import org.apache.hop.core.util.Utils;
import org.apache.hop.core.variables.IVariables;
import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.pipeline.PipelineMeta;
Expand All @@ -43,6 +44,7 @@
import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.dialog.MessageBox;
import org.apache.hop.ui.core.gui.GuiResource;
import org.apache.hop.ui.core.gui.WindowProperty;
import org.apache.hop.ui.core.widget.ColumnInfo;
Expand Down Expand Up @@ -268,6 +270,22 @@ public void widgetSelected(SelectionEvent e) {

private void ok() {
transformName = wTransformName.getText();
if (Utils.isEmpty(wFilename.getText())) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setText(BaseMessages.getString(PKG, "KafkaConsumerInputDialog.FilenameMissing.Header"));
mb.setMessage(
BaseMessages.getString(PKG, "KafkaConsumerInputDialog.FilenameMissing.Message"));
mb.open();
return;
}
if (isSelfReferencing()) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setText(BaseMessages.getString(PKG, "KafkaConsumerInputDialog.SelfReference.Header"));
mb.setMessage(BaseMessages.getString(PKG, "KafkaConsumerInputDialog.SelfReference.Message"));
mb.open();
return;
}

updateMeta(meta);
dispose();
}
Expand Down Expand Up @@ -948,4 +966,13 @@ protected void populateSubTransforms(Event event) {
log.logError("Error getting transform names from Kafka pipeline", e);
}
}

private boolean isSelfReferencing() {
if (variables
.resolve(wFilename.getText())
.equals(variables.resolve(pipelineMeta.getFilename()))) {
return true;
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ KafkaConsumerInputMeta.Injection.TRANSFORMATION_PATH=The path to the sub-pipelin
KafkaConsumerInputMeta.Injection.VALUES=The value(s) of the Kafka consumer configuration properties.
KafkaConsumerInputMeta.keyword=kafka,consumer,input
KafkaConsumerInputMeta.UnableToCreateValueType=Unable to create output field value for {0}
KafkaConsumerInputDialog.FilenameMissing.Header=Warning
KafkaConsumerInputDialog.FilenameMissing.Message=The Kafka pipeline filename is missing.
KafkaConsumerInputDialog.SelfReference.Header=Warning
KafkaConsumerInputDialog.SelfReference.Message=This pipeline can''t be used as the Kafka pipeline. Please choose another Kafka pipeline.

0 comments on commit 13e24fa

Please sign in to comment.