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;
}
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;
}
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;
}
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());
}
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;
}
Aggregations