Search in sources :

Example 1 with MultipleComponentManager

use of org.talend.designer.core.model.components.MultipleComponentManager in project tdi-studio-se by Talend.

the class AbstractStatsLogsComponent method loadMultipleComponentManager.

protected void loadMultipleComponentManager() {
    String lastComponent = null;
    if (useConsole) {
        //$NON-NLS-1$
        lastComponent = "CONSOLE";
    } else if (useDb) {
        //$NON-NLS-1$
        lastComponent = "DB";
    } else {
        //$NON-NLS-1$
        lastComponent = "FILE";
    }
    // create base items
    IMultipleComponentManager multipleComponentManager = new MultipleComponentManager(componentId, lastComponent);
    IMultipleComponentItem currentItem = multipleComponentManager.addItem(componentId, subComponent);
    if (useFile) {
        //$NON-NLS-1$ //$NON-NLS-2$
        currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "FILE"));
        //$NON-NLS-1$ //$NON-NLS-2$
        currentItem = multipleComponentManager.addItem("FILE", "tFileOutputDelimited");
    }
    if (useDb) {
        //$NON-NLS-1$ //$NON-NLS-2$
        currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "DB"));
        //$NON-NLS-1$
        currentItem = multipleComponentManager.addItem("DB", dbComponent);
    }
    if (useConsole) {
        //$NON-NLS-1$ //$NON-NLS-2$
        currentItem.getOutputConnections().add(new MultipleComponentConnection("FLOW", "CONSOLE"));
        //$NON-NLS-1$ //$NON-NLS-2$
        currentItem = multipleComponentManager.addItem("CONSOLE", "tLogRow");
    }
    multipleComponentManager.validateItems();
    multipleComponentManagers.add(multipleComponentManager);
    createMultipleComponentsParameters();
}
Also used : IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager) MultipleComponentManager(org.talend.designer.core.model.components.MultipleComponentManager) IMultipleComponentItem(org.talend.core.model.components.IMultipleComponentItem) MultipleComponentConnection(org.talend.designer.core.model.components.MultipleComponentConnection) IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager)

Example 2 with MultipleComponentManager

use of org.talend.designer.core.model.components.MultipleComponentManager 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)

Example 3 with MultipleComponentManager

use of org.talend.designer.core.model.components.MultipleComponentManager in project tdi-studio-se by Talend.

the class JobContextLoadComponent method loadMultipleComponentManager.

protected void loadMultipleComponentManager() {
    IMultipleComponentManager multipleComponentManager = null;
    // create base items
    if (isFile) {
        multipleComponentManager = new MultipleComponentManager(FILE_INPUT_REGEX, CONTEXT_LOAD);
        IMultipleComponentItem currentItem = multipleComponentManager.addItem(FILE_INPUT_REGEX, FILE_INPUT_COMPONENT);
        currentItem.getOutputConnections().add(new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(), CONTEXT_LOAD));
        currentItem = multipleComponentManager.addItem(CONTEXT_LOAD, CONTEXTLOAD_COMPONENT);
    } else {
        if (dbComponent == null) {
            return;
        }
        multipleComponentManager = new MultipleComponentManager(DB_INPUT, CONTEXT_LOAD);
        IMultipleComponentItem currentItem = multipleComponentManager.addItem(DB_INPUT, dbComponent);
        currentItem.getOutputConnections().add(new MultipleComponentConnection(EConnectionType.FLOW_MAIN.getName(), CONTEXT_LOAD));
        currentItem = multipleComponentManager.addItem(CONTEXT_LOAD, CONTEXTLOAD_COMPONENT);
    }
    multipleComponentManager.validateItems();
    multipleComponentManagers.add(multipleComponentManager);
    createMultipleComponentsParameters();
}
Also used : IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager) MultipleComponentManager(org.talend.designer.core.model.components.MultipleComponentManager) IMultipleComponentItem(org.talend.core.model.components.IMultipleComponentItem) MultipleComponentConnection(org.talend.designer.core.model.components.MultipleComponentConnection) IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager)

Aggregations

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