2
* Copyright (C) 2013 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Pete Woods <pete.woods@canonical.com>
19
#ifndef USERMETRICSSERVICE_DATASET_H_
20
#define USERMETRICSSERVICE_DATASET_H_
22
#include <usermetricsservice/database/DataSource.h>
23
#include <usermetricsservice/database/UserData.h>
25
#include <QtCore/QDate>
27
#include <QDjangoModel.h>
29
namespace UserMetricsService {
31
class Q_DECL_EXPORT DataSet: public QDjangoModel {
34
Q_PROPERTY(int id READ id WRITE setId)
36
Q_PROPERTY(UserMetricsService::UserData* userData READ userData WRITE setUserData)
38
Q_PROPERTY(UserMetricsService::DataSource* dataSource READ dataSource WRITE setDataSource)
40
Q_PROPERTY(QByteArray data READ data WRITE setData)
42
Q_PROPERTY(QDate lastUpdated READ lastUpdated WRITE setLastUpdated)
44
Q_CLASSINFO("id", "primary_key=true auto_increment=true")
46
Q_CLASSINFO("userData", "on_delete=cascade db_index=true")
48
Q_CLASSINFO("dataSource", "on_delete=cascade db_index=true")
50
Q_CLASSINFO("data", "null=true")
52
Q_CLASSINFO("lastUpdated", "null=true")
55
explicit DataSet(QObject *parent = 0);
59
static void findById(int id, DataSet *dataSet);
65
UserData * userData() const;
67
void setUserData(UserData *userData);
69
DataSource * dataSource() const;
71
void setDataSource(DataSource *dataSource);
73
const QByteArray & data() const;
75
void setData(const QByteArray &data);
77
const QDate & lastUpdated() const;
79
void setLastUpdated(const QDate &data);
91
#endif // USERMETRICSSERVICE_DATASET_H_