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;
}
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);
}
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));
}
}
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);
}
}
}
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));
}
}
Aggregations