Search in sources :

Example 21 with Issue

use of org.gephi.io.importer.api.Issue in project gephi by gephi.

the class ImportContainerImpl method getNode.

@Override
public NodeDraftImpl getNode(String id) {
    checkId(id);
    int index = nodeMap.getInt(id);
    NodeDraftImpl node = null;
    if (index == NULL_INDEX) {
        if (parameters.isAutoNode()) {
            //Creates the missing node
            node = factory.newNodeDraft(id);
            addNode(node);
            node.setCreatedAuto(true);
            if (!reportedUnknownNode) {
                String message = NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_AutoNodeCreated");
                report.logIssue(new Issue(message, Level.INFO));
                reportedUnknownNode = true;
            }
        } else {
            String message = NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_UnknowNodeId", id);
            report.logIssue(new Issue(message, Level.SEVERE));
        }
    } else {
        node = nodeList.get(index);
    }
    return node;
}
Also used : Issue(org.gephi.io.importer.api.Issue)

Example 22 with Issue

use of org.gephi.io.importer.api.Issue in project gephi by gephi.

the class ImporterEdgeList method importData.

private void importData() throws Exception {
    //Connect database
    String url = SQLUtils.getUrl(database.getSQLDriver(), database.getHost(), database.getPort(), database.getDBName());
    try {
        report.log("Try to connect at " + url);
        connection = database.getSQLDriver().getConnection(url, database.getUsername(), database.getPasswd());
        report.log("Database connection established");
    } catch (SQLException ex) {
        if (connection != null) {
            try {
                connection.close();
                report.log("Database connection terminated");
            } catch (Exception e) {
            /* ignore close errors */
            }
        }
        report.logIssue(new Issue("Failed to connect at " + url, Issue.Level.CRITICAL, ex));
    }
    if (connection == null) {
        report.logIssue(new Issue("Failed to connect at " + url, Issue.Level.CRITICAL));
    }
    report.log(database.getPropertiesAssociations().getInfos());
    getNodes(connection);
    getEdges(connection);
    getNodesAttributes(connection);
    getEdgesAttributes(connection);
}
Also used : Issue(org.gephi.io.importer.api.Issue) SQLException(java.sql.SQLException) SQLException(java.sql.SQLException)

Example 23 with Issue

use of org.gephi.io.importer.api.Issue in project gephi by gephi.

the class ElementDraftImpl method setLabelColor.

@Override
public void setLabelColor(String color) {
    Color cl = ImportUtils.parseColor(color);
    if (cl != null) {
        setLabelColor(cl);
    } else {
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_LabelColorParse", color, id);
        container.getReport().logIssue(new Issue(message, Issue.Level.WARNING));
    }
}
Also used : Issue(org.gephi.io.importer.api.Issue) Color(java.awt.Color)

Example 24 with Issue

use of org.gephi.io.importer.api.Issue in project gephi by gephi.

the class ElementDraftImpl method addIntervals.

@Override
public void addIntervals(String intervals) {
    if (!container.getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) {
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_NotIntervalRepresentation", id);
        container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
        return;
    }
    IntervalSet s = (IntervalSet) AttributeUtils.parse(intervals, IntervalSet.class);
    if (timeSet == null) {
        timeSet = s;
    } else {
        for (Interval i : s.toArray()) {
            timeSet.add(i);
        }
    }
}
Also used : Issue(org.gephi.io.importer.api.Issue) IntervalSet(org.gephi.graph.api.types.IntervalSet) Interval(org.gephi.graph.api.Interval)

Example 25 with Issue

use of org.gephi.io.importer.api.Issue in project gephi by gephi.

the class ElementDraftImpl method addInterval.

@Override
public void addInterval(double intervalStart, double intervalEnd) {
    if (!container.getTimeRepresentation().equals(TimeRepresentation.INTERVAL)) {
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_NotIntervalRepresentation", id);
        container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
        return;
    }
    try {
        Interval interval = new Interval(intervalStart, intervalEnd);
        if (timeSet == null) {
            timeSet = new IntervalSet();
        }
        timeSet.add(interval);
    } catch (Exception e) {
        String interval = "[" + intervalStart + "," + intervalEnd + "]";
        String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_IntervalSetError", interval, id, e.getMessage());
        container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
    }
}
Also used : Issue(org.gephi.io.importer.api.Issue) IntervalSet(org.gephi.graph.api.types.IntervalSet) Interval(org.gephi.graph.api.Interval)

Aggregations

Issue (org.gephi.io.importer.api.Issue)52 NodeDraft (org.gephi.io.importer.api.NodeDraft)14 IOException (java.io.IOException)11 ColumnDraft (org.gephi.io.importer.api.ColumnDraft)10 EdgeDraft (org.gephi.io.importer.api.EdgeDraft)9 StringTokenizer (java.util.StringTokenizer)5 SQLException (java.sql.SQLException)4 ArrayList (java.util.ArrayList)4 XMLStreamException (javax.xml.stream.XMLStreamException)3 Interval (org.gephi.graph.api.Interval)3 EdgeProperties (org.gephi.io.importer.api.PropertiesAssociations.EdgeProperties)3 NodeProperties (org.gephi.io.importer.api.PropertiesAssociations.NodeProperties)3 Color (java.awt.Color)2 ResultSet (java.sql.ResultSet)2 ResultSetMetaData (java.sql.ResultSetMetaData)2 Statement (java.sql.Statement)2 Pattern (java.util.regex.Pattern)2 IntervalSet (org.gephi.graph.api.types.IntervalSet)2 TimestampSet (org.gephi.graph.api.types.TimestampSet)2 ElementDraft (org.gephi.io.importer.api.ElementDraft)2