Search in sources :

Example 1 with DataNode

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

the class DesignerCoreService method getRefrenceNode.

@Override
public INode getRefrenceNode(String componentName, String paletteType) {
    if (componentName == null) {
        return null;
    }
    IComponentsFactory compFac = CorePlugin.getDefault().getRepositoryService().getComponentsFactory();
    IComponent component = compFac.get(componentName, paletteType);
    if (component == null) {
        return null;
    }
    return new DataNode(component, componentName);
}
Also used : IComponentsFactory(org.talend.core.model.components.IComponentsFactory) IComponent(org.talend.core.model.components.IComponent) DataNode(org.talend.designer.core.model.process.DataNode)

Example 2 with DataNode

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

the class StatsAndLogsManager method createLogsNode.

private static DataNode createLogsNode(boolean useFile, boolean console, String dbOutput) {
    JobLogsComponent logsComponent = new JobLogsComponent(useFile, console, dbOutput);
    DataNode logsNode = new DataNode(logsComponent, LOG_UNIQUE_NAME);
    logsNode.setStart(true);
    logsNode.setSubProcessStart(true);
    logsNode.setActivate(true);
    logsNode.getMetadataList().clear();
    // load the tLogCatcher to get the schema.
    IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tLogCatcher", //$NON-NLS-1$
    ComponentCategory.CATEGORY_4_DI.getName());
    //$NON-NLS-1$
    DataNode tmpNode = new DataNode(tmpComponent, "tmp");
    boolean found = false;
    for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
        IElementParameter currentParam = tmpNode.getElementParameters().get(k);
        if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
            Object value = currentParam.getValue();
            if (value instanceof IMetadataTable) {
                IMetadataTable table = ((IMetadataTable) value).clone();
                table.setTableName(LOG_UNIQUE_NAME);
                table.setAttachedConnector(currentParam.getContext());
                logsNode.getMetadataList().add(table);
            }
            found = true;
        }
    }
    return logsNode;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) DataNode(org.talend.designer.core.model.process.DataNode) IComponent(org.talend.core.model.components.IComponent) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 3 with DataNode

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

the class StatsAndLogsManager method createStatsNode.

private static DataNode createStatsNode(boolean useFile, boolean console, String dbOutput) {
    JobStatsComponent statsComponent = new JobStatsComponent(useFile, console, dbOutput);
    DataNode statsNode = new DataNode(statsComponent, STAT_UNIQUE_NAME);
    statsNode.setStart(true);
    statsNode.setSubProcessStart(true);
    statsNode.setActivate(true);
    statsNode.getMetadataList().clear();
    // load the tStatCatcher to get the schema.
    IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get("tStatCatcher", //$NON-NLS-1$
    ComponentCategory.CATEGORY_4_DI.getName());
    //$NON-NLS-1$
    DataNode tmpNode = new DataNode(tmpComponent, "tmp");
    boolean found = false;
    for (int k = 0; k < tmpNode.getElementParameters().size() && !found; k++) {
        IElementParameter currentParam = tmpNode.getElementParameters().get(k);
        if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
            Object value = currentParam.getValue();
            if (value instanceof IMetadataTable) {
                IMetadataTable table = ((IMetadataTable) value).clone();
                table.setTableName(STAT_UNIQUE_NAME);
                table.setAttachedConnector(currentParam.getContext());
                statsNode.getMetadataList().add(table);
            }
            found = true;
        }
    }
    return statsNode;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) DataNode(org.talend.designer.core.model.process.DataNode) IComponent(org.talend.core.model.components.IComponent) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 4 with DataNode

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

the class Connection method createParallelizeParameters.

private void createParallelizeParameters() {
    // flag for start the parlization or not for the inputs
    ElementParameter tmpParam = new ElementParameter(this);
    tmpParam.setName(EParameterName.PARTITIONER.getName());
    tmpParam.setValue(Boolean.FALSE);
    tmpParam.setDisplayName(EParameterName.PARTITIONER.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.RADIO);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setNumRow(1);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    //$NON-NLS-1$
    tmpParam.setGroup("TYPE");
    tmpParam.setGroupDisplayName("Type");
    tmpParam.setShowIf("(#NODE@OUT.END_OF_FLOW == 'false' OR #NODE@IN.SUBTREE_START == 'true')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = new ElementParameter(this);
    tmpParam.setName(EParameterName.DEPARTITIONER.getName());
    tmpParam.setValue(Boolean.FALSE);
    tmpParam.setDisplayName(EParameterName.DEPARTITIONER.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.RADIO);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setNumRow(2);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    tmpParam.setShowIf("#NODE@IN.SUBTREE_START == 'false'");
    //$NON-NLS-1$
    tmpParam.setGroup("TYPE");
    tmpParam.setGroupDisplayName("Type");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = new ElementParameter(this);
    tmpParam.setName(EParameterName.REPARTITIONER.getName());
    tmpParam.setValue(Boolean.FALSE);
    tmpParam.setDisplayName(EParameterName.REPARTITIONER.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.RADIO);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setNumRow(3);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    tmpParam.setShowIf("(#NODE@IN.SUBTREE_START == 'false' AND #NODE@OUT.END_OF_FLOW == 'false')");
    //$NON-NLS-1$
    tmpParam.setGroup("TYPE");
    tmpParam.setGroupDisplayName("Type");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = new ElementParameter(this);
    tmpParam.setName(EParameterName.NONE.getName());
    tmpParam.setValue(Boolean.TRUE);
    tmpParam.setDisplayName(EParameterName.NONE.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.RADIO);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setNumRow(4);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    tmpParam.setShow(true);
    //$NON-NLS-1$
    tmpParam.setGroup("TYPE");
    tmpParam.setGroupDisplayName("Type");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    IComponent componentPar = ComponentsFactoryProvider.getInstance().get("tPartitioner", ComponentCategory.CATEGORY_4_DI.getName());
    INode tmpNode = new DataNode(componentPar, source.getUniqueName());
    tmpParam = (ElementParameter) tmpNode.getElementParameter("NUM_PARTITIONS");
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = new ElementParameter(this);
    tmpParam.setName("PART_QUEUE_SIZE");
    tmpParam.setValue("1000");
    tmpParam.setDisplayName(EParameterName.QUEUE_SIZE.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.TEXT);
    tmpParam.setNumRow(45);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true') and (DEPARTITIONER=='false')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = (ElementParameter) tmpNode.getElementParameter("HASH_PARTITION");
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = (ElementParameter) tmpNode.getElementParameter("HASH_KEYS");
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setShowIf("(PARTITIONER == 'true' or REPARTITIONER=='true') and (HASH_PARTITION=='true')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    tmpParam = new ElementParameter(this);
    tmpParam.setName("DEPART_QUEUE_SIZE");
    tmpParam.setValue("1000");
    tmpParam.setDisplayName(EParameterName.QUEUE_SIZE.getDisplayName());
    tmpParam.setFieldType(EParameterFieldType.TEXT);
    tmpParam.setNumRow(45);
    tmpParam.setReadOnly(false);
    tmpParam.setRequired(false);
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    // "(DEPARTITIONER == 'true' or REPARTITIONER=='true')"
    tmpParam.setShowIf("(DEPARTITIONER == 'true' or REPARTITIONER=='true') and (PARTITIONER=='false')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
    IComponent componentCol = ComponentsFactoryProvider.getInstance().get("tRecollector", ComponentCategory.CATEGORY_4_DI.getName());
    INode tmpNode1 = new DataNode(componentCol, source.getUniqueName());
    tmpParam = (ElementParameter) tmpNode1.getElementParameter("IS_SORTING");
    tmpParam.setCategory(EComponentCategory.PARALLELIZATION);
    tmpParam.setShowIf("(DEPARTITIONER == 'true' or REPARTITIONER=='true')");
    tmpParam.setDefaultValue(tmpParam.getValue());
    addElementParameter(tmpParam);
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) ElementParameter(org.talend.designer.core.model.components.ElementParameter) INode(org.talend.core.model.process.INode) IComponent(org.talend.core.model.components.IComponent) DataNode(org.talend.designer.core.model.process.DataNode)

Example 5 with DataNode

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

the class JobSettingsManager method getSchemaTablefromComponent.

private static IMetadataTable getSchemaTablefromComponent(final String componentName, final String tableName) {
    IComponent tmpComponent = ComponentsFactoryProvider.getInstance().get(componentName, ComponentCategory.CATEGORY_4_DI.getName());
    //$NON-NLS-1$
    DataNode tmpNode = new DataNode(tmpComponent, "tmp");
    for (int k = 0; k < tmpNode.getElementParameters().size(); k++) {
        IElementParameter currentParam = tmpNode.getElementParameters().get(k);
        if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
            Object value = currentParam.getValue();
            if (value instanceof IMetadataTable) {
                IMetadataTable table = null;
                if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
                    table = ((IMetadataTable) value).clone(true);
                } else {
                    table = ((IMetadataTable) value).clone();
                }
                table.setTableName(tableName);
                table.setAttachedConnector(currentParam.getContext());
                // fix for TUP-3972: set defult value
                for (IMetadataColumn column : table.getListColumns()) {
                    column.setDefault("\"\"");
                }
                return table;
            }
        }
    }
    return null;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IComponent(org.talend.core.model.components.IComponent) DataNode(org.talend.designer.core.model.process.DataNode) IElementParameter(org.talend.core.model.process.IElementParameter) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Aggregations

DataNode (org.talend.designer.core.model.process.DataNode)13 IComponent (org.talend.core.model.components.IComponent)9 IElementParameter (org.talend.core.model.process.IElementParameter)9 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)6 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 INode (org.talend.core.model.process.INode)4 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)3 DummyComponent (org.talend.designer.core.model.components.DummyComponent)3 ElementParameter (org.talend.designer.core.model.components.ElementParameter)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 EDatabaseTypeName (org.talend.core.database.EDatabaseTypeName)1 IComponentsFactory (org.talend.core.model.components.IComponentsFactory)1 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)1 DummyMetadataTalendTypeFilter (org.talend.core.model.metadata.DummyMetadataTalendTypeFilter)1 MetadataTalendTypeFilter (org.talend.core.model.metadata.MetadataTalendTypeFilter)1 MrMetadataTalendTypeFilter (org.talend.core.model.metadata.MrMetadataTalendTypeFilter)1 SparkMetadataTalendTypeFilter (org.talend.core.model.metadata.SparkMetadataTalendTypeFilter)1