Package org.gephi.io.importer.api

Examples of org.gephi.io.importer.api.ElementDraftFactory


    }

    private void getNodes(Connection connection) throws SQLException {

        //Factory
        ElementDraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        ResultSet rs = null;
        try {
            rs = s.executeQuery(database.getNodeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Node query", Issue.Level.SEVERE, ex));
            return;
        }

        findNodeAttributesColumns(rs);
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        int count = 0;
        while (rs.next()) {
            String id = null;
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
                if (p.equals(NodeProperties.ID)) {
                    String ide = rs.getString(i + 1);
                    if (ide != null) {
                        id = ide;
                    }
                }
            }
            NodeDraft node;
            if (id != null) {
                node = factory.newNodeDraft(id);
            } else {
                node = factory.newNodeDraft();
            }

            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                NodeProperties p = properties.getNodeProperty(columnName);
View Full Code Here


    }

    private void getEdges(Connection connection) throws SQLException {

        //Factory
        ElementDraftFactory factory = container.factory();

        //Properties
        PropertiesAssociations properties = database.getPropertiesAssociations();

        Statement s = connection.createStatement();
        ResultSet rs = null;
        try {
            rs = s.executeQuery(database.getEdgeQuery());
        } catch (SQLException ex) {
            report.logIssue(new Issue("Failed to execute Edge query", Issue.Level.SEVERE, ex));
            return;
        }
        findEdgeAttributesColumns(rs);
        ResultSetMetaData metaData = rs.getMetaData();
        int columnsCount = metaData.getColumnCount();
        int count = 0;
        while (rs.next()) {
            String id = null;
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p.equals(EdgeProperties.ID)) {
                    String ide = rs.getString(i + 1);
                    if (ide != null) {
                        id = ide;
                    }
                }
            }
            EdgeDraft edge;
            if (id != null) {
                edge = factory.newEdgeDraft(id);
            } else {
                edge = factory.newEdgeDraft();
            }
            for (int i = 0; i < columnsCount; i++) {
                String columnName = metaData.getColumnLabel(i + 1);
                EdgeProperties p = properties.getEdgeProperty(columnName);
                if (p != null) {
View Full Code Here

TOP

Related Classes of org.gephi.io.importer.api.ElementDraftFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.