use of org.talend.components.api.component.VirtualComponentDefinition in project tdi-studio-se by Talend.
the class Component method createMultipleComponentManagers.
@Override
protected List<IMultipleComponentManager> createMultipleComponentManagers() {
List<IMultipleComponentManager> multipleComponentManagers = new ArrayList<>();
if (componentDefinition instanceof VirtualComponentDefinition) {
VirtualComponentDefinition definition = (VirtualComponentDefinition) componentDefinition;
String inputComponentName = null;
String outputComponentName = null;
ComponentDefinition inputComponentDefinition = definition.getInputComponentDefinition();
if (inputComponentDefinition != null) {
inputComponentName = inputComponentDefinition.getName();
}
ComponentDefinition outputComponentDefinition = definition.getOutputComponentDefinition();
if (outputComponentDefinition != null) {
outputComponentName = outputComponentDefinition.getName();
}
if (inputComponentName == null || outputComponentName == null) {
return multipleComponentManagers;
}
IMultipleComponentManager multipleComponentManager = new MultipleComponentManager(inputComponentName, outputComponentName);
IMultipleComponentItem inputItem = multipleComponentManager.addItem(inputComponentName, inputComponentName);
multipleComponentManager.setExistsLinkTo(true);
// FIXME: should get the connector type by other way.
String cType = EConnectionType.ON_ROWS_END.getName();
inputItem.getOutputConnections().add(new MultipleComponentConnection(cType, outputComponentName));
multipleComponentManager.addItem(outputComponentName, outputComponentName);
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
}
return multipleComponentManagers;
}
Aggregations