@Override public boolean writeTimeline(Timeline timeline) { String tlName = timeline.getName(); open(); try { statement.executeUpdate( "CREATE TABLE " + tlName + " (" + ID + ",eventName TEXT, type TEXT, startDate DATETIME, endDate DATETIME, category TEXT);"); writeAxisLabel(tlName, timeline.getAxisLabel()); } catch (SQLException e) { if (e.getMessage().contains("already exists")) { System.out.println("A timeline with that name already exists!"); return false; } e.printStackTrace(); } if (timeline.getEvents() == null) return false; for (TLEvent event : timeline.getEvents()) { try { if (event instanceof Atomic) { writeEvent((Atomic) event, tlName); } else if (event instanceof Duration) { writeEvent((Duration) event, tlName); } } catch (SQLException e) { e.printStackTrace(); } catch (NullPointerException e) { System.out.println("Nothing!"); } } close(); return true; }