Search in sources :

Example 6 with IMultipleComponentManager

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

the class JobContextLoadComponent method createMultipleComponentsParameters.

protected void createMultipleComponentsParameters() {
    //$NON-NLS-1$
    final String self = "self.";
    // create parameters
    if ((multipleComponentManagers != null) && (multipleComponentManagers.size() > 0)) {
        IMultipleComponentManager multipleComponentManager = multipleComponentManagers.get(0);
        if (isFile) {
            String source = self + EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName();
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".FILENAME");
            source = self + JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX;
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".REGEX");
            //$NON-NLS-1$
            source = self + "IGNORE_ERROR_MESSAGE";
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".IGNORE_ERROR_MESSAGE");
        } else {
            String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
            multipleComponentManager.addParam(source, DB_INPUT + ".URL");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_JAR.getName());
            multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_JAR");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DRIVER_CLASS.getName());
            multipleComponentManager.addParam(source, DB_INPUT + ".DRIVER_CLASS");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".HOST");
            //$NON-NLS-1$
            multipleComponentManager.addParam(source, DB_INPUT + ".SERVER");
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".DSN");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".PORT");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".DBNAME");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".DB_VERSION");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".PROPERTIES");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".SCHEMA_DB");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".USER");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".PASS");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".DBTABLE");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".DB_TYPE");
            source = self + JobSettingsConstants.getExtraParameterName(EParameterName.CONNECTION_TYPE.getName());
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + ".CONNECTION_TYPE");
            source = self + JobSettingsConstants.QUERY;
            //$NON-NLS-1$ 
            multipleComponentManager.addParam(source, DB_INPUT + "." + JobSettingsConstants.QUERY);
        }
        // context parameter
        //$NON-NLS-1$  
        final String context = CONTEXT_LOAD + ".";
        String source = self + EParameterName.LOAD_NEW_VARIABLE.getName();
        String target = context + EParameterName.LOAD_NEW_VARIABLE.getName();
        multipleComponentManager.addParam(source, target);
        source = self + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
        target = context + EParameterName.NOT_LOAD_OLD_VARIABLE.getName();
        multipleComponentManager.addParam(source, target);
        source = self + EParameterName.PRINT_OPERATIONS.getName();
        target = context + EParameterName.PRINT_OPERATIONS.getName();
        multipleComponentManager.addParam(source, target);
        source = self + EParameterName.DISABLE_ERROR.getName();
        target = context + EParameterName.DISABLE_ERROR.getName();
        multipleComponentManager.addParam(source, target);
        source = self + EParameterName.DISABLE_INFO.getName();
        target = context + EParameterName.DISABLE_INFO.getName();
        multipleComponentManager.addParam(source, target);
        source = self + EParameterName.DISABLE_WARNINGS.getName();
        target = context + EParameterName.DISABLE_WARNINGS.getName();
        multipleComponentManager.addParam(source, target);
    }
}
Also used : IMultipleComponentManager(org.talend.core.model.components.IMultipleComponentManager)

Example 7 with IMultipleComponentManager

use of org.talend.core.model.components.IMultipleComponentManager 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 8 with IMultipleComponentManager

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

IMultipleComponentManager (org.talend.core.model.components.IMultipleComponentManager)8 IMultipleComponentItem (org.talend.core.model.components.IMultipleComponentItem)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 IElementParameter (org.talend.core.model.process.IElementParameter)1 INode (org.talend.core.model.process.INode)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1