2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011-2013 Philipp Spitzer, gregor herrmann, Stefan Stahl
5 * This file is part of ConfClerk.
7 * ConfClerk is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
12 * ConfClerk is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * ConfClerk. If not, see <http://www.gnu.org/licenses/>.
25 #include <QStringList>
27 #include "ormrecord.h"
32 NoSuchEventException is thrown when required event does not exist.
34 class NoSuchEventException
38 class Event : public OrmRecord<Event>
42 static const QSqlRecord sColumns;
43 static QString const sTableName;
45 static Event getById(int id, int conferenceId);
46 static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy);
47 static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date
48 static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy);
49 static QList<Event> getByTrack(int id);
50 static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId);
51 static QList<Event> conflictEvents(int aEventId, int conferenceId);
52 static QList<Event> getImminentAlarmEvents(int maxSecToAlarm, int conferenceId);
54 int id() const { return value("id").toInt(); }
55 int conferenceId() const { return value("xid_conference").toInt(); }
56 QDateTime start() const { return value("start").toDateTime(); }
57 /// duration of the event in seconds
58 int duration() const { return value("duration").toInt(); }
59 int trackId() const { return value("xid_track").toInt(); }
60 QString type() const { return value("type").toString(); }
61 QString language() const { return value("language").toString(); }
62 bool isFavourite() const { return value("favourite").toBool(); }
63 bool hasAlarm() const { return value("alarm").toBool(); }
64 bool hasTimeConflict() const;
65 QString tag() const { return value("tag").toString(); }
66 QString title() const { return value("title").toString(); }
67 QString subtitle() const { return value("subtitle").toString(); }
68 QString abstract() const { return value("abstract").toString(); }
69 QString description() const { return value("description").toString(); }
70 // records from other tables associated with 'id'
74 QStringList persons();
75 QMap<QString,QString> links();
77 void setId(int id) { setValue("id", id); }
78 void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); }
79 void setStart(const QDateTime & start) { setValue("start", start); }
80 void setDuration(int duration) { setValue("duration", duration); }
81 void setTrackId(int trackId) { setValue("xid_track", trackId); }
82 void setType(const QString & type) { setValue("type", type); }
83 void setLanguage(const QString & language) { setValue("language", language); }
84 void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); }
85 void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); }
86 void setTag(const QString& tag) { setValue("tag", tag); }
87 void setTitle(const QString& title) { setValue("title", title); }
88 void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); }
89 void setAbstract(const QString& abstract) { setValue("abstract", abstract); }
90 void setDescription(const QString& description) { setValue("description", description); }
91 // records from other tables associated with 'id'
92 void setRoom(const QString& room);
93 void setPersons(const QStringList &persons);
94 void setLinks(const QMap<QString,QString> &aLinks);
96 friend class EventTest;
99 QStringList mPersonsList;
100 QMap<QString,QString> mLinksList;