[ca90cb1] | 1 | /* |
---|
| 2 | * Copyright (C) 2010 Ixonos Plc. |
---|
| 3 | * |
---|
[6df32f2] | 4 | * This file is part of ConfClerk. |
---|
[ca90cb1] | 5 | * |
---|
[6df32f2] | 6 | * ConfClerk is free software: you can redistribute it and/or modify it |
---|
[ca90cb1] | 7 | * under the terms of the GNU General Public License as published by the Free |
---|
| 8 | * Software Foundation, either version 2 of the License, or (at your option) |
---|
| 9 | * any later version. |
---|
| 10 | * |
---|
[6df32f2] | 11 | * ConfClerk is distributed in the hope that it will be useful, but |
---|
[ca90cb1] | 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
| 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
| 14 | * more details. |
---|
| 15 | * |
---|
| 16 | * You should have received a copy of the GNU General Public License along with |
---|
[6df32f2] | 17 | * ConfClerk. If not, see <http://www.gnu.org/licenses/>. |
---|
[ca90cb1] | 18 | */ |
---|
[e5bc908] | 19 | #ifndef EVENT_H |
---|
| 20 | #define EVENT_H |
---|
| 21 | |
---|
| 22 | #include <QDateTime> |
---|
[5a73d27] | 23 | #include <QVector> |
---|
| 24 | #include <QStringList> |
---|
[e5bc908] | 25 | |
---|
[5a73d27] | 26 | #include <ormrecord.h> |
---|
| 27 | |
---|
[0d995ed] | 28 | class Room; |
---|
| 29 | |
---|
[5a73d27] | 30 | /** |
---|
| 31 | NoSuchEventException is thrown when required event does not exist. |
---|
| 32 | */ |
---|
| 33 | class NoSuchEventException |
---|
| 34 | { |
---|
| 35 | }; |
---|
| 36 | |
---|
[20a6010] | 37 | class Event : public OrmRecord<Event> |
---|
[e5bc908] | 38 | { |
---|
| 39 | public: |
---|
[a1755df] | 40 | Event(); |
---|
[64122f1] | 41 | static const QSqlRecord sColumns; |
---|
[7d7659d] | 42 | static QString const sTableName; |
---|
[5a73d27] | 43 | public: |
---|
[20a6010] | 44 | static Event getById(int id, int conferenceId); |
---|
[64122f1] | 45 | static QList<Event> getByDate(const QDate & date, int conferenceId, QString orderBy); |
---|
| 46 | static QList<Event> getFavByDate(const QDate & date, int conferenceId); // get Favourities by Date |
---|
[e662750] | 47 | static QList<Event> getSearchResultByDate(const QDate& date, int conferenceId, QString orderBy); |
---|
[b8a3ad1] | 48 | static QList<Event> nowEvents(int conferenceId, QString orderBy); // get events scheduled NOW |
---|
[005e2b7] | 49 | static QList<Event> getByTrack(int id); |
---|
[7620de0] | 50 | static QList<Event> getByDateAndRoom(const QDate& date, int conferenceId); |
---|
[d49254d] | 51 | static QList<Event> conflictEvents(int aEventId, int conferenceId); |
---|
[e5bc908] | 52 | public: |
---|
[46a5aba] | 53 | int id() const { return value("id").toInt(); } |
---|
| 54 | int conferenceId() const { return value("xid_conference").toInt(); } |
---|
[4693fa6] | 55 | QDateTime start() const { return value("start").toDateTime(); } |
---|
[46a5aba] | 56 | int duration() const { return value("duration").toInt(); } |
---|
[4693fa6] | 57 | int trackId() const { return value("xid_track").toInt(); } |
---|
[46a5aba] | 58 | QString type() const { return value("type").toString(); } |
---|
| 59 | QString language() const { return value("language").toString(); } |
---|
| 60 | bool isFavourite() const { return value("favourite").toBool(); } |
---|
| 61 | bool hasAlarm() const { return value("alarm").toBool(); } |
---|
[9f367eb] | 62 | bool hasTimeConflict() const; |
---|
[46a5aba] | 63 | QString tag() const { return value("tag").toString(); } |
---|
| 64 | QString title() const { return value("title").toString(); } |
---|
| 65 | QString subtitle() const { return value("subtitle").toString(); } |
---|
| 66 | QString abstract() const { return value("abstract").toString(); } |
---|
| 67 | QString description() const { return value("description").toString(); } |
---|
[f9db452] | 68 | // records from other tables associated with 'id' |
---|
[0d995ed] | 69 | Room* room(); |
---|
| 70 | QString roomName(); |
---|
[a1755df] | 71 | int roomId(); |
---|
[78e3575] | 72 | QStringList persons(); |
---|
[a1755df] | 73 | QMap<QString,QString> links(); |
---|
[20a6010] | 74 | |
---|
[46a5aba] | 75 | void setId(int id) { setValue("id", id); } |
---|
| 76 | void setConferenceId(int conferenceId) { setValue("xid_conference", conferenceId); } |
---|
[4693fa6] | 77 | void setStart(const QDateTime & start) { setValue("start", start); } |
---|
[46a5aba] | 78 | void setDuration(int duration) { setValue("duration", duration); } |
---|
[4693fa6] | 79 | void setTrackId(int trackId) { setValue("xid_track", trackId); } |
---|
[46a5aba] | 80 | void setType(const QString & type) { setValue("type", type); } |
---|
| 81 | void setLanguage(const QString & language) { setValue("language", language); } |
---|
| 82 | void setFavourite(bool favourite) { setValue("favourite", (int)((favourite))); } |
---|
| 83 | void setHasAlarm(bool alarm) { setValue("alarm", (int)((alarm))); } |
---|
[c790268] | 84 | void setTag(const QString& tag) { setValue("tag", tag); } |
---|
| 85 | void setTitle(const QString& title) { setValue("title", title); } |
---|
| 86 | void setSubtitle(const QString& subtitle) { setValue("subtitle", subtitle); } |
---|
| 87 | void setAbstract(const QString& abstract) { setValue("abstract", abstract); } |
---|
| 88 | void setDescription(const QString& description) { setValue("description", description); } |
---|
[f9db452] | 89 | // records from other tables associated with 'id' |
---|
| 90 | void setRoom(const QString& room); |
---|
[395d6d3] | 91 | void setPersons(const QStringList &persons); |
---|
[6123b48] | 92 | void setLinks(const QMap<QString,QString> &aLinks); |
---|
[20a6010] | 93 | |
---|
| 94 | friend class EventTest; |
---|
[78e3575] | 95 | |
---|
| 96 | private: |
---|
[a1755df] | 97 | QStringList mPersonsList; |
---|
| 98 | QMap<QString,QString> mLinksList; |
---|
| 99 | int mRoomId; |
---|
| 100 | QString mRoomName; |
---|
[0d995ed] | 101 | Room* room_; |
---|
[e5bc908] | 102 | }; |
---|
| 103 | |
---|
| 104 | #endif // EVENT_H |
---|
[680a4da] | 105 | |
---|