Search in sources :

Example 1 with Stream

use of org.apache.hop.pipeline.transform.stream.Stream in project hop by apache.

the class JavaFilterMeta method getTransformIOMeta.

/**
 * Returns the Input/Output metadata for this transform.
 */
@Override
public ITransformIOMeta getTransformIOMeta() {
    ITransformIOMeta ioMeta = super.getTransformIOMeta(false);
    if (ioMeta == null) {
        ioMeta = new TransformIOMeta(true, true, false, false, false, false);
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "JavaFilterMeta.InfoStream.True.Description"), StreamIcon.TRUE, null));
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "JavaFilterMeta.InfoStream.False.Description"), StreamIcon.FALSE, null));
        setTransformIOMeta(ioMeta);
    }
    return ioMeta;
}
Also used : IStream(org.apache.hop.pipeline.transform.stream.IStream) Stream(org.apache.hop.pipeline.transform.stream.Stream)

Example 2 with Stream

use of org.apache.hop.pipeline.transform.stream.Stream in project hop by apache.

the class FilterRowsMeta method getTransformIOMeta.

/**
 * Returns the Input/Output metadata for this transform.
 */
@Override
public ITransformIOMeta getTransformIOMeta() {
    ITransformIOMeta ioMeta = super.getTransformIOMeta(false);
    if (ioMeta == null) {
        ioMeta = new TransformIOMeta(true, true, false, false, false, false);
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.True.Description"), StreamIcon.TRUE, null));
        ioMeta.addStream(new Stream(StreamType.TARGET, null, BaseMessages.getString(PKG, "FilterRowsMeta.InfoStream.False.Description"), StreamIcon.FALSE, null));
        setTransformIOMeta(ioMeta);
    }
    return ioMeta;
}
Also used : Stream(org.apache.hop.pipeline.transform.stream.Stream) IStream(org.apache.hop.pipeline.transform.stream.IStream)

Example 3 with Stream

use of org.apache.hop.pipeline.transform.stream.Stream in project hop by apache.

the class MultiMergeJoinDialog method open.

/*
   * (non-Javadoc)
   *
   * @see org.apache.hop.pipeline.transform.ITransformDialog#open()
   */
@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, joinMeta);
    final ModifyListener lsMod = e -> joinMeta.setChanged();
    backupChanged = joinMeta.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "MultiMergeJoinDialog.Shell.Label"));
    wlTransformName = new Label(shell, SWT.LEFT);
    wlTransformName.setText(BaseMessages.getString(PKG, "MultiMergeJoinDialog.TransformName.Label"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.right = new FormAttachment(15, -margin);
    fdlTransformName.top = new FormAttachment(0, margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    wTransformName.addModifyListener(lsMod);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(15, 0);
    fdTransformName.top = new FormAttachment(0, margin);
    fdTransformName.right = new FormAttachment(35, 0);
    wTransformName.setLayoutData(fdTransformName);
    // create widgets for input stream and join key selections
    createInputStreamWidgets(lsMod);
    // create widgets for Join type
    createJoinTypeWidget(lsMod);
    // Some buttons
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOk, wCancel }, margin, null);
    // Add listeners
    wCancel.addListener(SWT.Selection, e -> cancel());
    wOk.addListener(SWT.Selection, e -> ok());
    // get the data
    getData();
    joinMeta.setChanged(backupChanged);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : Utils(org.apache.hop.core.util.Utils) java.util(java.util) StreamIcon(org.apache.hop.pipeline.transform.stream.StreamIcon) TableView(org.apache.hop.ui.core.widget.TableView) IVariables(org.apache.hop.core.variables.IVariables) Stream(org.apache.hop.pipeline.transform.stream.Stream) HopException(org.apache.hop.core.exception.HopException) ITransformDialog(org.apache.hop.pipeline.transform.ITransformDialog) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) CCombo(org.eclipse.swt.custom.CCombo) ITransformIOMeta(org.apache.hop.pipeline.transform.ITransformIOMeta) IStream(org.apache.hop.pipeline.transform.stream.IStream) MessageDialogWithToggle(org.apache.hop.ui.core.dialog.MessageDialogWithToggle) IRowMeta(org.apache.hop.core.row.IRowMeta) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) BaseMessages(org.apache.hop.i18n.BaseMessages) GuiResource(org.apache.hop.ui.core.gui.GuiResource) FormLayout(org.eclipse.swt.layout.FormLayout) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) BaseTransformMeta(org.apache.hop.pipeline.transform.BaseTransformMeta) FormAttachment(org.eclipse.swt.layout.FormAttachment) Const(org.apache.hop.core.Const) TransformMeta(org.apache.hop.pipeline.transform.TransformMeta) List(java.util.List) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) StreamType(org.apache.hop.pipeline.transform.stream.IStream.StreamType) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ModifyListener(org.eclipse.swt.events.ModifyListener) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 4 with Stream

use of org.apache.hop.pipeline.transform.stream.Stream in project hop by apache.

the class BaseTransformMetaCloningTest method testCloneWithInfoTransforms.

@Test
public void testCloneWithInfoTransforms() throws Exception {
    final Database db1 = mock(Database.class);
    final Database db2 = mock(Database.class);
    final TransformMeta transformMeta = mock(TransformMeta.class);
    BaseTransformMeta meta = new BaseTransformMeta();
    meta.setChanged(true);
    meta.databases = new Database[] { db1, db2 };
    ITransformIOMeta ioMeta = new TransformIOMeta(true, false, false, false, false, false);
    meta.setTransformIOMeta(ioMeta);
    final String refTransformName = "referenced transform";
    final TransformMeta refTransformMeta = mock(TransformMeta.class);
    doReturn(refTransformName).when(refTransformMeta).getName();
    IStream stream = new Stream(IStream.StreamType.INFO, refTransformMeta, null, null, refTransformName);
    ioMeta.addStream(stream);
    meta.parentTransformMeta = transformMeta;
    BaseTransformMeta clone = (BaseTransformMeta) meta.clone();
    assertTrue(clone.hasChanged());
    // is it OK ?
    assertTrue(clone.databases == meta.databases);
    assertArrayEquals(meta.databases, clone.databases);
    assertEquals(meta.parentTransformMeta, clone.parentTransformMeta);
    ITransformIOMeta cloneIOMeta = clone.getTransformIOMeta();
    assertNotNull(cloneIOMeta);
    assertEquals(ioMeta.isInputAcceptor(), cloneIOMeta.isInputAcceptor());
    assertEquals(ioMeta.isInputDynamic(), cloneIOMeta.isInputDynamic());
    assertEquals(ioMeta.isInputOptional(), cloneIOMeta.isInputOptional());
    assertEquals(ioMeta.isOutputDynamic(), cloneIOMeta.isOutputDynamic());
    assertEquals(ioMeta.isOutputProducer(), cloneIOMeta.isOutputProducer());
    assertEquals(ioMeta.isSortedDataRequired(), cloneIOMeta.isSortedDataRequired());
    final List<IStream> clonedInfoStreams = cloneIOMeta.getInfoStreams();
    assertNotNull(clonedInfoStreams);
    assertEquals(1, clonedInfoStreams.size());
    final IStream clonedStream = clonedInfoStreams.get(0);
    assertNotSame(stream, clonedStream);
    assertEquals(stream.getStreamType(), clonedStream.getStreamType());
    assertEquals(refTransformName, clonedStream.getTransformName());
    assertSame(refTransformMeta, clonedStream.getTransformMeta());
}
Also used : Database(org.apache.hop.core.database.Database) IStream(org.apache.hop.pipeline.transform.stream.IStream) IStream(org.apache.hop.pipeline.transform.stream.IStream) Stream(org.apache.hop.pipeline.transform.stream.Stream) Test(org.junit.Test)

Example 5 with Stream

use of org.apache.hop.pipeline.transform.stream.Stream in project hop by apache.

the class MergeRowsMeta method getTransformIOMeta.

/**
 * Returns the Input/Output metadata for this transform.
 */
@Override
public ITransformIOMeta getTransformIOMeta() {
    ITransformIOMeta ioMeta = super.getTransformIOMeta(false);
    if (ioMeta == null) {
        ioMeta = new TransformIOMeta(true, true, false, false, false, false);
        ioMeta.addStream(new Stream(StreamType.INFO, null, BaseMessages.getString(PKG, "MergeRowsMeta.InfoStream.FirstStream.Description"), StreamIcon.INFO, null));
        ioMeta.addStream(new Stream(StreamType.INFO, null, BaseMessages.getString(PKG, "MergeRowsMeta.InfoStream.SecondStream.Description"), StreamIcon.INFO, null));
        setTransformIOMeta(ioMeta);
    }
    return ioMeta;
}
Also used : Stream(org.apache.hop.pipeline.transform.stream.Stream) IStream(org.apache.hop.pipeline.transform.stream.IStream)

Aggregations

Stream (org.apache.hop.pipeline.transform.stream.Stream)22 IStream (org.apache.hop.pipeline.transform.stream.IStream)21 List (java.util.List)2 IRowMeta (org.apache.hop.core.row.IRowMeta)2 IVariables (org.apache.hop.core.variables.IVariables)2 ITransformIOMeta (org.apache.hop.pipeline.transform.ITransformIOMeta)2 TransformMeta (org.apache.hop.pipeline.transform.TransformMeta)2 CCombo (org.eclipse.swt.custom.CCombo)2 OutputStream (java.io.OutputStream)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 Const (org.apache.hop.core.Const)1 Database (org.apache.hop.core.database.Database)1 HopException (org.apache.hop.core.exception.HopException)1 HopPluginException (org.apache.hop.core.exception.HopPluginException)1 HopTransformException (org.apache.hop.core.exception.HopTransformException)1 HopValueException (org.apache.hop.core.exception.HopValueException)1 HopXmlException (org.apache.hop.core.exception.HopXmlException)1 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)1 Utils (org.apache.hop.core.util.Utils)1