~ubuntu-branches/ubuntu/trusty/libusermetrics/trusty-proposed

« back to all changes in this revision

Viewing changes to src/usermetricsservice/database/DataSet.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Pete Woods, Ubuntu daily release
  • Date: 2013-07-02 02:02:52 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130702020252-53yuhnlabsq1cq8x
Tags: 1.0.1+13.10.20130702-0ubuntu1
[ Pete Woods ]
* Implement most of storage service and wire up input API.
* Wire up the output API to the storage service.

[ Ubuntu daily release ]
* Automatic snapshot from revision 80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Author: Pete Woods <pete.woods@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef USERMETRICSSERVICE_DATASET_H_
 
20
#define USERMETRICSSERVICE_DATASET_H_
 
21
 
 
22
#include <usermetricsservice/database/DataSource.h>
 
23
#include <usermetricsservice/database/UserData.h>
 
24
 
 
25
#include <QtCore/QDate>
 
26
 
 
27
#include <QDjangoModel.h>
 
28
 
 
29
namespace UserMetricsService {
 
30
 
 
31
class Q_DECL_EXPORT DataSet: public QDjangoModel {
 
32
Q_OBJECT
 
33
 
 
34
Q_PROPERTY(int id READ id WRITE setId)
 
35
 
 
36
Q_PROPERTY(UserMetricsService::UserData* userData READ userData WRITE setUserData)
 
37
 
 
38
Q_PROPERTY(UserMetricsService::DataSource* dataSource READ dataSource WRITE setDataSource)
 
39
 
 
40
Q_PROPERTY(QByteArray data READ data WRITE setData)
 
41
 
 
42
Q_PROPERTY(QDate lastUpdated READ lastUpdated WRITE setLastUpdated)
 
43
 
 
44
Q_CLASSINFO("id", "primary_key=true auto_increment=true")
 
45
 
 
46
Q_CLASSINFO("userData", "on_delete=cascade db_index=true")
 
47
 
 
48
Q_CLASSINFO("dataSource", "on_delete=cascade db_index=true")
 
49
 
 
50
Q_CLASSINFO("data", "null=true")
 
51
 
 
52
Q_CLASSINFO("lastUpdated", "null=true")
 
53
 
 
54
public:
 
55
        explicit DataSet(QObject *parent = 0);
 
56
 
 
57
        virtual ~DataSet();
 
58
 
 
59
        static void findById(int id, DataSet *dataSet);
 
60
 
 
61
        int id() const;
 
62
 
 
63
        void setId(int id);
 
64
 
 
65
        UserData * userData() const;
 
66
 
 
67
        void setUserData(UserData *userData);
 
68
 
 
69
        DataSource * dataSource() const;
 
70
 
 
71
        void setDataSource(DataSource *dataSource);
 
72
 
 
73
        const QByteArray & data() const;
 
74
 
 
75
        void setData(const QByteArray &data);
 
76
 
 
77
        const QDate & lastUpdated() const;
 
78
 
 
79
        void setLastUpdated(const QDate &data);
 
80
 
 
81
protected:
 
82
        int m_id;
 
83
 
 
84
        QByteArray m_data;
 
85
 
 
86
        QDate m_lastUpdated;
 
87
};
 
88
 
 
89
}
 
90
 
 
91
#endif // USERMETRICSSERVICE_DATASET_H_