Search in sources :

Example 1 with VirtualComponentDefinition

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;
}
Also used : VirtualComponentDefinition(org.talend.components.api.component.VirtualComponentDefinition) MultipleComponentManager(org.talend.designer.core.model.components.MultipleComponentManager) IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager) IMultipleComponentItem(org.talend.core.model.components.IMultipleComponentItem) MultipleComponentConnection(org.talend.designer.core.model.components.MultipleComponentConnection) ArrayList(java.util.ArrayList) IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager) VirtualComponentDefinition(org.talend.components.api.component.VirtualComponentDefinition) ComponentDefinition(org.talend.components.api.component.ComponentDefinition)

Aggregations

ArrayList (java.util.ArrayList)1 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)1 VirtualComponentDefinition (org.talend.components.api.component.VirtualComponentDefinition)1 IMultipleComponentItem (org.talend.core.model.components.IMultipleComponentItem)1 IMultipleComponentManager (org.talend.core.model.components.IMultipleComponentManager)1 MultipleComponentConnection (org.talend.designer.core.model.components.MultipleComponentConnection)1 MultipleComponentManager (org.talend.designer.core.model.components.MultipleComponentManager)1