Search in sources :

Example 26 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class UIManager method getNewIndexesList.

private List<Map<String, Object>> getNewIndexesList() {
    List<Map<String, Object>> map = new ArrayList<Map<String, Object>>();
    MetadataTable table = (MetadataTable) neo4jManager.getNeo4jComponent().getMetadataList().get(0);
    neo4jManager.convert(neo4jManager.getNeo4jComponent(), table);
    for (IMetadataColumn col : table.getListColumns()) {
        MetadataColumnExt ext = (MetadataColumnExt) col;
        for (Index index : ext.getData().getIndexes()) {
            Map<String, Object> value = new HashMap<String, Object>();
            value.put(Neo4jComponent.SCHEMA_COLUMN, ext.getLabel());
            value.put(Neo4jComponent.INDEX_NAME, index.getName());
            value.put(Neo4jComponent.KEY, index.getKey());
            value.put(Neo4jComponent.VALUE, index.getValue());
            value.put(Neo4jComponent.UNIQUE, String.valueOf(index.isUnique()));
            map.add(value);
        }
    }
    return map;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MetadataTable(org.talend.core.model.metadata.MetadataTable) Index(org.talend.designer.neo4j.data.Index) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) HashMap(java.util.HashMap) Map(java.util.Map) MetadataColumnExt(org.talend.designer.neo4j.ui.editor.MetadataColumnExt)

Example 27 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class RetrieveConfigurationProcess method getLogRowNode.

private Node getLogRowNode(MetadataTable metadataTable) {
    // $NON-NLS-1$
    String componentName = "tLogRow";
    IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, ComponentCategory.CATEGORY_4_DI.getName());
    Node node = new Node(component, this);
    // $NON-NLS-1$
    node.getElementParameter("UNIQUE_NAME").setValue(logUniqueId);
    // $NON-NLS-1$
    node.getElementParameter("FIELDSEPARATOR").setValue(getWrapedStringValue(fieldSeparetor));
    // $NON-NLS-1$
    node.getElementParameter("PRINT_HEADER").setValue(Boolean.TRUE.toString());
    // $NON-NLS-1$
    node.getElementParameter("PRINT_UNIQUE_NAME").setValue(Boolean.TRUE.toString());
    // $NON-NLS-1$
    node.getElementParameter("PRINT_CONTENT_WITH_LOG4J").setValue(Boolean.FALSE.toString());
    // set the schema
    List<IMetadataTable> metadatas = new ArrayList<IMetadataTable>();
    MetadataTable metadata = new MetadataTable();
    metadata.setTableName(logUniqueId);
    metadata.setAttachedConnector(metadataTable.getAttachedConnector());
    List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
    columns.addAll(metadataTable.getListColumns());
    metadata.setListColumns(columns);
    metadatas.add(metadata);
    node.setMetadataList(metadatas);
    setActivate(true);
    return node;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) 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 28 with MetadataTable

use of org.talend.core.model.metadata.MetadataTable in project tbd-studio-se by Talend.

the class RetrieveConfigurationProcess method initNodesAndConnections.

protected void initNodesAndConnections() {
    Node inputNode = getInputNode();
    // $NON-NLS-1$
    inputNode.getElementParameter("clusterManagerType").setValue(clusterManagerType);
    // $NON-NLS-1$
    inputNode.getElementParameter("url").setValue(getWrapedStringValue(host));
    // $NON-NLS-1$
    addPropertyChangeListener(inputNode.getElementParameter("basicAuth.useAuth"));
    // $NON-NLS-1$
    inputNode.getElementParameter("basicAuth.useAuth").setValue(useAuthentication);
    if (useAuthentication) {
        // $NON-NLS-1$
        inputNode.getElementParameter("basicAuth.userId").setValue(getWrapedStringValue(userId));
        // $NON-NLS-1$
        inputNode.getElementParameter("basicAuth.password").setValue(getWrapedStringValue(password));
    }
    // $NON-NLS-1$
    addPropertyChangeListener(inputNode.getElementParameter("ssl.useSsl"));
    // $NON-NLS-1$
    inputNode.getElementParameter("ssl.useSsl").setValue(useSSL);
    if (useSSL) {
        // $NON-NLS-1$
        inputNode.getElementParameter("ssl.trustStoreType").setValue(trustStoreType);
        // $NON-NLS-1$
        inputNode.getElementParameter("ssl.trustStorePassword").setValue(getWrapedStringValue(trustStorePassword));
        // $NON-NLS-1$
        inputNode.getElementParameter("ssl.trustStorePath").setValue(getWrapedStringValue(trustStorePath));
    }
    MetadataTable targetTable = getMetadataTable();
    Node outputNode = getLogRowNode(targetTable);
    Node javaNode = getTJavaNode();
    List<IConnection> inputConns = new ArrayList<IConnection>();
    List<IConnection> logConns = new ArrayList<IConnection>();
    List<IConnection> javaConns = new ArrayList<IConnection>();
    // $NON-NLS-1$
    Connection mainConn = new Connection(inputNode, outputNode, EConnectionType.FLOW_MAIN, "MAIN", "MAIN", "row1", "MAIN", false);
    // $NON-NLS-1$
    Connection subConn = new Connection(inputNode, javaNode, EConnectionType.ON_SUBJOB_OK, "SUBJOB_OK", "HadoopClusterConfigurationInput_1", "SUBJOB_OK", "SUBJOB_OK", false);
    inputConns.add(mainConn);
    inputConns.add(subConn);
    logConns.add(mainConn);
    javaConns.add(subConn);
    inputNode.setOutgoingConnections(inputConns);
    outputNode.setIncomingConnections(logConns);
    javaNode.setIncomingConnections(javaConns);
    inputNode.setProcess(this);
    outputNode.setProcess(this);
    javaNode.setProcess(this);
    NodeContainer inputContainer = new NodeContainer(inputNode);
    this.addNodeContainer(inputContainer);
    NodeContainer outputContainer = new NodeContainer(outputNode);
    this.addNodeContainer(outputContainer);
    NodeContainer javaContainer = new NodeContainer(javaNode);
    this.addNodeContainer(javaContainer);
    // 
    initTLibraryLoadNode(inputNode);
}
Also used : Node(org.talend.designer.core.ui.editor.nodes.Node) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) IConnection(org.talend.core.model.process.IConnection) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)

Example 29 with MetadataTable

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

the class CreateComponentOnLinkHelper method getTargetArgs.

public static List<Object> getTargetArgs(Connection connection, Node node) {
    List<Object> connArgs = new ArrayList<Object>();
    IMetadataTable meta = null;
    String connectName = null;
    INodeConnector connector = node.getConnectorFromType(EConnectionType.FLOW_MAIN);
    for (INodeConnector tconnector : node.getConnectorsFromType(EConnectionType.FLOW_MAIN)) {
        if (connector.getMaxLinkOutput() != 0) {
            connector = tconnector;
            break;
        }
    }
    EConnectionType connectType = node.getConnectorFromName(connector.getName()).getDefaultConnectionType();
    if (connectType.hasConnectionCategory(EConnectionType.FLOW)) {
        // String name = "*New Output*" + " (" + connector.getMenuName() + ")";
        if (node.getConnectorFromName(connector.getName()).isMultiSchema()) {
            String tableName = connection.getMetaName();
            meta = connection.getSource().getMetadataTable(tableName);
            if (connector.isMultiSchema()) {
                if (connection.getTarget().getConnectorFromName(node.getConnectorFromName(connector.getName()).getName()).isMultiSchema()) {
                // Connection conn = (Connection) connection.getTarget().getIncomingConnections().get(0);
                // node.getMetadataList().add(conn.getMetadataTable());
                } else {
                    MetadataTable table = (MetadataTable) connection.getTarget().getMetadataList().get(0).clone();
                    table.setLabel(tableName);
                    node.getMetadataList().add(table);
                }
            }
        } else {
            if (node.getMetadataList().size() == 0) {
                meta = null;
            } else {
                meta = node.getMetadataFromConnector(connector.getName());
            }
            connectName = node.getProcess().generateUniqueConnectionName(Process.DEFAULT_ROW_CONNECTION_NAME);
        }
        if (connectType.equals(EConnectionType.FLOW_MAIN) || connectType.equals(EConnectionType.FLOW_REF)) {
            if (meta == null) {
                connArgs.add(null);
            } else {
                connArgs.add(meta.getTableName());
            }
        } else {
            connArgs.add(node.getUniqueName());
        }
        String baseName = node.getConnectionName();
        String fromConnectionName = null;
        if (node.getProcess().checkValidConnectionName(baseName)) {
            fromConnectionName = node.getProcess().generateUniqueConnectionName(baseName);
        }
        if (fromConnectionName != null && connectType.hasConnectionCategory(IConnectionCategory.FLOW) && node.getProcess().checkValidConnectionName(fromConnectionName, false) && !connector.isMultiSchema()) {
            connArgs.add(fromConnectionName);
        } else {
            connArgs.add(connectName);
        }
        connArgs.add(null);
    }
    return connArgs;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ArrayList(java.util.ArrayList) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) EConnectionType(org.talend.core.model.process.EConnectionType) INodeConnector(org.talend.core.model.process.INodeConnector)

Example 30 with MetadataTable

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

the class OracleGenerationManagerTest method createMetadataTable.

private IMetadataTable createMetadataTable(String... columnLabels) {
    IMetadataTable metadataTable = new MetadataTable();
    // will be error, strange
    // List<IMetadataColumn> columns = mock(List.class);
    List<IMetadataColumn> columns = new ArrayList<IMetadataColumn>();
    if (columnLabels != null) {
        for (String columnlabel : columnLabels) {
            columns.add(createColumn(columnlabel));
        }
    }
    // when(metadataTable.getListColumns()).thenReturn(columns);
    metadataTable.setListColumns(columns);
    return metadataTable;
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn)

Aggregations

MetadataTable (org.talend.core.model.metadata.MetadataTable)61 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)46 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)29 ArrayList (java.util.ArrayList)23 HashMap (java.util.HashMap)15 Map (java.util.Map)14 IElementParameter (org.talend.core.model.process.IElementParameter)14 Item (org.talend.core.model.properties.Item)14 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)13 IConnection (org.talend.core.model.process.IConnection)13 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 Node (org.talend.designer.core.ui.editor.nodes.Node)11 List (java.util.List)9 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)9 Command (org.eclipse.gef.commands.Command)8 Point (org.eclipse.swt.graphics.Point)8 INode (org.talend.core.model.process.INode)8 ChangeMetadataCommand (org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand)8 PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)8 Connection (org.talend.designer.core.ui.editor.connections.Connection)8