XYDataset createThemeDataset(Integer year, String theme) {
TimeSeriesCollection dataset = new TimeSeriesCollection();
// calling the server
DQSPServer s = new DQSPServerI();
// getting a connection with database
Connection con = DBConnexion.getConnection();
for (String st : s.listOfAirports()) {
if (s.numberOfPassengers(st) != 0) {
try {
PreparedStatement ps = con
.prepareStatement("SELECT count(*) num, MONTH(r.`date`) mois, YEAR(r.`date`) annee FROM reclamation r WHERE r.`nomAeroport`=? AND YEAR(r.`date`)=? AND r.`remarque`=?");
ps.setString(1, st);
ps.setInt(2, year);
ps.setString(3, theme);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
TimeSeries serie = new TimeSeries(st);
try {
serie.add(
new Month(rs.getInt("mois"), year
.intValue()),
rs.getInt("num") / s.numberOfPassengers(st));
} catch (Exception ex) {
__app.getMainWindow().showNotification(
"Notification", "No data",
Window.Notification.TYPE_TRAY_NOTIFICATION);
}