Search in sources :

Example 41 with IMetadataTable

use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.

the class ShadowNode method getMetadataList.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.model.process.INode#getMetaDataList()
     */
@Override
public List<IMetadataTable> getMetadataList() {
    List<IMetadataTable> metadataList = super.getMetadataList();
    if (metadataList != null) {
        return metadataList;
    }
    List<IMetadataTable> metadatas = new ArrayList<IMetadataTable>();
    MetadataTable metadata = new MetadataTable();
    metadata.setTableName(this.getUniqueName());
    List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
    for (int i = 0; i < columnNumber; i++) {
        MetadataColumn col = new MetadataColumn();
        //$NON-NLS-1$
        col.setLabel("row" + i);
        //$NON-NLS-1$
        col.setTalendType("id_String");
        //$NON-NLS-1$
        col.setType("String");
        columns.add(col);
    }
    metadata.setListColumns(columns);
    metadatas.add(metadata);
    return metadatas;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) ArrayList(java.util.ArrayList) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 42 with IMetadataTable

use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.

the class InsertNewColumnCommand method createInputMetadataColumn.

private void createInputMetadataColumn(String sourceTreeName, String targetTreeName, TreeNode sourceNode, String targetNodeName, int index) {
    String sourceNodeName = sourceNode.getName();
    IMetadataTable metadataTarget = null;
    List<IODataComponent> inputs = manager.getMapperComponent().getIODataComponents().getInputs();
    for (IODataComponent incoming : inputs) {
        if (targetTreeName != null && targetTreeName.equals(incoming.getConnection().getName())) {
            metadataTarget = incoming.getTable();
        }
    }
    if (metadataTarget != null) {
        IMetadataColumn columnSource = null;
        if (sourceTreeName != null) {
            columnSource = getSourceColumn(sourceTreeName, sourceNodeName);
        }
        creatMeatadataColumn(columnSource, targetNodeName, sourceNode, metadataTarget, index);
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IODataComponent(org.talend.core.model.components.IODataComponent) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 43 with IMetadataTable

use of org.talend.core.model.metadata.IMetadataTable in project tdi-studio-se by Talend.

the class InsertNewColumnCommand method createOutputMetadataColumn.

private void createOutputMetadataColumn(String sourceTreeName, String targetTreeName, AbstractNode sourceNode, String targetNodeName, int index) {
    String sourceNodeName = sourceNode.getName();
    IMetadataTable metadataTarget = null;
    List<IMetadataTable> metadataTargets = manager.getMapperComponent().getMetadataList();
    if (metadataTargets != null) {
        for (IMetadataTable target : metadataTargets) {
            if (target.getTableName().equals(targetTreeName)) {
                metadataTarget = target;
            }
        }
    }
    if (metadataTarget != null) {
        IMetadataColumn columnSource = null;
        if (sourceTreeName != null) {
            columnSource = getSourceColumn(sourceTreeName, sourceNodeName);
        }
        creatMeatadataColumn(columnSource, targetNodeName, sourceNode, metadataTarget, index);
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Example 44 with IMetadataTable

use of org.talend.core.model.metadata.IMetadataTable 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 45 with IMetadataTable

use of org.talend.core.model.metadata.IMetadataTable 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)

Aggregations

IMetadataTable (org.talend.core.model.metadata.IMetadataTable)212 ArrayList (java.util.ArrayList)102 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)81 IElementParameter (org.talend.core.model.process.IElementParameter)67 IConnection (org.talend.core.model.process.IConnection)66 List (java.util.List)56 INode (org.talend.core.model.process.INode)54 Node (org.talend.designer.core.ui.editor.nodes.Node)50 HashMap (java.util.HashMap)48 Map (java.util.Map)39 MetadataTable (org.talend.core.model.metadata.MetadataTable)34 INodeConnector (org.talend.core.model.process.INodeConnector)32 Connection (org.talend.designer.core.ui.editor.connections.Connection)28 Process (org.talend.designer.core.ui.editor.process.Process)25 IComponent (org.talend.core.model.components.IComponent)22 ConnectionItem (org.talend.core.model.properties.ConnectionItem)20 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)18 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)17 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 Point (org.eclipse.swt.graphics.Point)15