diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-20 15:25:05 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:50 +0200 |
commit | 9a03eb1a54c6289773bc1b8eb96181ed01553927 (patch) | |
tree | d820cd37e774f7b4404bd4994b627a02f8652a44 | |
parent | da0c37dbad121252effa85941de4d49222176179 (diff) | |
download | sink-9a03eb1a54c6289773bc1b8eb96181ed01553927.tar.gz sink-9a03eb1a54c6289773bc1b8eb96181ed01553927.zip |
TypeImplementation cleanup
-rw-r--r-- | common/domain/event.cpp | 38 | ||||
-rw-r--r-- | common/domain/event.h | 15 | ||||
-rw-r--r-- | common/domain/folder.cpp | 40 | ||||
-rw-r--r-- | common/domain/folder.h | 15 | ||||
-rw-r--r-- | common/domain/mail.cpp | 94 | ||||
-rw-r--r-- | common/domain/mail.h | 14 | ||||
-rw-r--r-- | common/domainadaptor.h | 10 | ||||
-rw-r--r-- | common/storage/entitystore.cpp | 8 | ||||
-rw-r--r-- | common/synchronizer.h | 1 | ||||
-rw-r--r-- | tests/domainadaptortest.cpp | 6 |
10 files changed, 80 insertions, 161 deletions
diff --git a/common/domain/event.cpp b/common/domain/event.cpp index 41ec625..a8098b7 100644 --- a/common/domain/event.cpp +++ b/common/domain/event.cpp | |||
@@ -21,48 +21,32 @@ | |||
21 | #include <QVector> | 21 | #include <QVector> |
22 | #include <QByteArray> | 22 | #include <QByteArray> |
23 | #include <QString> | 23 | #include <QString> |
24 | #include <QMutex> | ||
25 | #include <QMutexLocker> | ||
26 | 24 | ||
27 | #include "../resultset.h" | ||
28 | #include "../index.h" | ||
29 | #include "../storage.h" | ||
30 | #include "../log.h" | ||
31 | #include "../propertymapper.h" | 25 | #include "../propertymapper.h" |
32 | #include "../query.h" | ||
33 | #include "../definitions.h" | ||
34 | #include "../typeindex.h" | 26 | #include "../typeindex.h" |
35 | #include "entitybuffer.h" | ||
36 | #include "datastorequery.h" | ||
37 | #include "entity_generated.h" | 27 | #include "entity_generated.h" |
38 | 28 | ||
39 | #include "event_generated.h" | 29 | #include "event_generated.h" |
40 | 30 | ||
41 | static QMutex sMutex; | ||
42 | |||
43 | using namespace Sink::ApplicationDomain; | 31 | using namespace Sink::ApplicationDomain; |
44 | 32 | ||
45 | void TypeImplementation<Event>::configureIndex(TypeIndex &index) | 33 | void TypeImplementation<Event>::configure(TypeIndex &index) |
46 | { | 34 | { |
47 | index.addProperty<QByteArray>(Event::Uid::name); | 35 | index.addProperty<QByteArray>(Event::Uid::name); |
48 | } | 36 | } |
49 | 37 | ||
50 | QSharedPointer<ReadPropertyMapper<TypeImplementation<Event>::Buffer> > TypeImplementation<Event>::initializeReadPropertyMapper() | 38 | void TypeImplementation<Event>::configure(ReadPropertyMapper<Buffer> &propertyMapper) |
51 | { | 39 | { |
52 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Buffer> >::create(); | 40 | propertyMapper.addMapping<Event::Summary, Buffer>(&Buffer::summary); |
53 | propertyMapper->addMapping<Event::Summary, Buffer>(&Buffer::summary); | 41 | propertyMapper.addMapping<Event::Description, Buffer>(&Buffer::description); |
54 | propertyMapper->addMapping<Event::Description, Buffer>(&Buffer::description); | 42 | propertyMapper.addMapping<Event::Uid, Buffer>(&Buffer::uid); |
55 | propertyMapper->addMapping<Event::Uid, Buffer>(&Buffer::uid); | 43 | propertyMapper.addMapping<Event::Attachment, Buffer>(&Buffer::attachment); |
56 | propertyMapper->addMapping<Event::Attachment, Buffer>(&Buffer::attachment); | ||
57 | return propertyMapper; | ||
58 | } | 44 | } |
59 | 45 | ||
60 | QSharedPointer<WritePropertyMapper<TypeImplementation<Event>::BufferBuilder> > TypeImplementation<Event>::initializeWritePropertyMapper() | 46 | void TypeImplementation<Event>::configure(WritePropertyMapper<BufferBuilder> &propertyMapper) |
61 | { | 47 | { |
62 | auto propertyMapper = QSharedPointer<WritePropertyMapper<BufferBuilder> >::create(); | 48 | propertyMapper.addMapping<Event::Summary>(&BufferBuilder::add_summary); |
63 | propertyMapper->addMapping<Event::Summary>(&BufferBuilder::add_summary); | 49 | propertyMapper.addMapping<Event::Description>(&BufferBuilder::add_description); |
64 | propertyMapper->addMapping<Event::Description>(&BufferBuilder::add_description); | 50 | propertyMapper.addMapping<Event::Uid>(&BufferBuilder::add_uid); |
65 | propertyMapper->addMapping<Event::Uid>(&BufferBuilder::add_uid); | 51 | propertyMapper.addMapping<Event::Attachment>(&BufferBuilder::add_attachment); |
66 | propertyMapper->addMapping<Event::Attachment>(&BufferBuilder::add_attachment); | ||
67 | return propertyMapper; | ||
68 | } | 52 | } |
diff --git a/common/domain/event.h b/common/domain/event.h index fbaf4ed..d85b9b3 100644 --- a/common/domain/event.h +++ b/common/domain/event.h | |||
@@ -20,10 +20,6 @@ | |||
20 | 20 | ||
21 | #include "applicationdomaintype.h" | 21 | #include "applicationdomaintype.h" |
22 | 22 | ||
23 | #include "storage.h" | ||
24 | #include "storage/entitystore.h" | ||
25 | |||
26 | class ResultSet; | ||
27 | class QByteArray; | 23 | class QByteArray; |
28 | 24 | ||
29 | template<typename T> | 25 | template<typename T> |
@@ -31,13 +27,9 @@ class ReadPropertyMapper; | |||
31 | template<typename T> | 27 | template<typename T> |
32 | class WritePropertyMapper; | 28 | class WritePropertyMapper; |
33 | 29 | ||
34 | class DataStoreQuery; | ||
35 | |||
36 | class TypeIndex; | 30 | class TypeIndex; |
37 | 31 | ||
38 | namespace Sink { | 32 | namespace Sink { |
39 | class Query; | ||
40 | |||
41 | namespace ApplicationDomain { | 33 | namespace ApplicationDomain { |
42 | namespace Buffer { | 34 | namespace Buffer { |
43 | struct Event; | 35 | struct Event; |
@@ -54,10 +46,9 @@ class TypeImplementation<Sink::ApplicationDomain::Event> { | |||
54 | public: | 46 | public: |
55 | typedef Sink::ApplicationDomain::Buffer::Event Buffer; | 47 | typedef Sink::ApplicationDomain::Buffer::Event Buffer; |
56 | typedef Sink::ApplicationDomain::Buffer::EventBuilder BufferBuilder; | 48 | typedef Sink::ApplicationDomain::Buffer::EventBuilder BufferBuilder; |
57 | static void configureIndex(TypeIndex &index); | 49 | static void configure(TypeIndex &); |
58 | static QSet<QByteArray> indexedProperties(); | 50 | static void configure(ReadPropertyMapper<Buffer> &); |
59 | static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper(); | 51 | static void configure(WritePropertyMapper<BufferBuilder> &); |
60 | static QSharedPointer<WritePropertyMapper<BufferBuilder> > initializeWritePropertyMapper(); | ||
61 | }; | 52 | }; |
62 | 53 | ||
63 | } | 54 | } |
diff --git a/common/domain/folder.cpp b/common/domain/folder.cpp index 058035a..e6701ac 100644 --- a/common/domain/folder.cpp +++ b/common/domain/folder.cpp | |||
@@ -18,54 +18,36 @@ | |||
18 | */ | 18 | */ |
19 | #include "folder.h" | 19 | #include "folder.h" |
20 | 20 | ||
21 | #include <QVector> | ||
22 | #include <QByteArray> | 21 | #include <QByteArray> |
23 | #include <QString> | 22 | #include <QString> |
24 | #include <QMutex> | ||
25 | #include <QMutexLocker> | ||
26 | 23 | ||
27 | #include "../resultset.h" | ||
28 | #include "../index.h" | ||
29 | #include "../storage.h" | ||
30 | #include "../log.h" | ||
31 | #include "../propertymapper.h" | 24 | #include "../propertymapper.h" |
32 | #include "../query.h" | ||
33 | #include "../definitions.h" | ||
34 | #include "../typeindex.h" | 25 | #include "../typeindex.h" |
35 | #include "entitybuffer.h" | 26 | #include "entitybuffer.h" |
36 | #include "datastorequery.h" | ||
37 | #include "entity_generated.h" | 27 | #include "entity_generated.h" |
38 | 28 | ||
39 | #include "folder_generated.h" | 29 | #include "folder_generated.h" |
40 | 30 | ||
41 | SINK_DEBUG_AREA("folder"); | ||
42 | |||
43 | static QMutex sMutex; | ||
44 | |||
45 | using namespace Sink::ApplicationDomain; | 31 | using namespace Sink::ApplicationDomain; |
46 | 32 | ||
47 | void TypeImplementation<Folder>::configureIndex(TypeIndex &index) | 33 | void TypeImplementation<Folder>::configure(TypeIndex &index) |
48 | { | 34 | { |
49 | index.addProperty<QByteArray>(Folder::Parent::name); | 35 | index.addProperty<QByteArray>(Folder::Parent::name); |
50 | index.addProperty<QString>(Folder::Name::name); | 36 | index.addProperty<QString>(Folder::Name::name); |
51 | } | 37 | } |
52 | 38 | ||
53 | QSharedPointer<ReadPropertyMapper<TypeImplementation<Folder>::Buffer> > TypeImplementation<Folder>::initializeReadPropertyMapper() | 39 | void TypeImplementation<Folder>::configure(ReadPropertyMapper<Buffer> &propertyMapper) |
54 | { | 40 | { |
55 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Buffer> >::create(); | 41 | propertyMapper.addMapping<Folder::Parent, Buffer>(&Buffer::parent); |
56 | propertyMapper->addMapping<Folder::Parent, Buffer>(&Buffer::parent); | 42 | propertyMapper.addMapping<Folder::Name, Buffer>(&Buffer::name); |
57 | propertyMapper->addMapping<Folder::Name, Buffer>(&Buffer::name); | 43 | propertyMapper.addMapping<Folder::Icon, Buffer>(&Buffer::icon); |
58 | propertyMapper->addMapping<Folder::Icon, Buffer>(&Buffer::icon); | 44 | propertyMapper.addMapping<Folder::SpecialPurpose, Buffer>(&Buffer::specialpurpose); |
59 | propertyMapper->addMapping<Folder::SpecialPurpose, Buffer>(&Buffer::specialpurpose); | ||
60 | return propertyMapper; | ||
61 | } | 45 | } |
62 | 46 | ||
63 | QSharedPointer<WritePropertyMapper<TypeImplementation<Folder>::BufferBuilder> > TypeImplementation<Folder>::initializeWritePropertyMapper() | 47 | void TypeImplementation<Folder>::configure(WritePropertyMapper<BufferBuilder> &propertyMapper) |
64 | { | 48 | { |
65 | auto propertyMapper = QSharedPointer<WritePropertyMapper<BufferBuilder> >::create(); | 49 | propertyMapper.addMapping<Folder::Parent>(&BufferBuilder::add_parent); |
66 | propertyMapper->addMapping<Folder::Parent>(&BufferBuilder::add_parent); | 50 | propertyMapper.addMapping<Folder::Name>(&BufferBuilder::add_name); |
67 | propertyMapper->addMapping<Folder::Name>(&BufferBuilder::add_name); | 51 | propertyMapper.addMapping<Folder::Icon>(&BufferBuilder::add_icon); |
68 | propertyMapper->addMapping<Folder::Icon>(&BufferBuilder::add_icon); | 52 | propertyMapper.addMapping<Folder::SpecialPurpose>(&BufferBuilder::add_specialpurpose); |
69 | propertyMapper->addMapping<Folder::SpecialPurpose>(&BufferBuilder::add_specialpurpose); | ||
70 | return propertyMapper; | ||
71 | } | 53 | } |
diff --git a/common/domain/folder.h b/common/domain/folder.h index 47a544b..3c83794 100644 --- a/common/domain/folder.h +++ b/common/domain/folder.h | |||
@@ -20,13 +20,6 @@ | |||
20 | 20 | ||
21 | #include "applicationdomaintype.h" | 21 | #include "applicationdomaintype.h" |
22 | 22 | ||
23 | #include "storage.h" | ||
24 | #include "storage/entitystore.h" | ||
25 | |||
26 | class ResultSet; | ||
27 | class QByteArray; | ||
28 | class DataStoreQuery; | ||
29 | |||
30 | template<typename T> | 23 | template<typename T> |
31 | class ReadPropertyMapper; | 24 | class ReadPropertyMapper; |
32 | template<typename T> | 25 | template<typename T> |
@@ -35,7 +28,6 @@ class WritePropertyMapper; | |||
35 | class TypeIndex; | 28 | class TypeIndex; |
36 | 29 | ||
37 | namespace Sink { | 30 | namespace Sink { |
38 | class Query; | ||
39 | 31 | ||
40 | namespace ApplicationDomain { | 32 | namespace ApplicationDomain { |
41 | namespace Buffer { | 33 | namespace Buffer { |
@@ -48,10 +40,9 @@ class TypeImplementation<Sink::ApplicationDomain::Folder> { | |||
48 | public: | 40 | public: |
49 | typedef Sink::ApplicationDomain::Buffer::Folder Buffer; | 41 | typedef Sink::ApplicationDomain::Buffer::Folder Buffer; |
50 | typedef Sink::ApplicationDomain::Buffer::FolderBuilder BufferBuilder; | 42 | typedef Sink::ApplicationDomain::Buffer::FolderBuilder BufferBuilder; |
51 | static void configureIndex(TypeIndex &index); | 43 | static void configure(TypeIndex &); |
52 | static QSet<QByteArray> indexedProperties(); | 44 | static void configure(ReadPropertyMapper<Buffer> &); |
53 | static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper(); | 45 | static void configure(WritePropertyMapper<BufferBuilder> &); |
54 | static QSharedPointer<WritePropertyMapper<BufferBuilder> > initializeWritePropertyMapper(); | ||
55 | }; | 46 | }; |
56 | 47 | ||
57 | } | 48 | } |
diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index 4b33f06..8abe259 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp | |||
@@ -21,32 +21,19 @@ | |||
21 | #include <QVector> | 21 | #include <QVector> |
22 | #include <QByteArray> | 22 | #include <QByteArray> |
23 | #include <QString> | 23 | #include <QString> |
24 | #include <QMutex> | ||
25 | #include <QMutexLocker> | ||
26 | 24 | ||
27 | #include "../resultset.h" | ||
28 | #include "../index.h" | ||
29 | #include "../storage.h" | ||
30 | #include "../log.h" | ||
31 | #include "../propertymapper.h" | 25 | #include "../propertymapper.h" |
32 | #include "../query.h" | ||
33 | #include "../definitions.h" | ||
34 | #include "../typeindex.h" | 26 | #include "../typeindex.h" |
35 | #include "entitybuffer.h" | 27 | #include "entitybuffer.h" |
36 | #include "datastorequery.h" | ||
37 | #include "entity_generated.h" | 28 | #include "entity_generated.h" |
38 | #include "mail/threadindexer.h" | 29 | #include "mail/threadindexer.h" |
39 | 30 | ||
40 | #include "mail_generated.h" | 31 | #include "mail_generated.h" |
41 | 32 | ||
42 | SINK_DEBUG_AREA("mail"); | ||
43 | |||
44 | static QMutex sMutex; | ||
45 | |||
46 | using namespace Sink; | 33 | using namespace Sink; |
47 | using namespace Sink::ApplicationDomain; | 34 | using namespace Sink::ApplicationDomain; |
48 | 35 | ||
49 | void TypeImplementation<Mail>::configureIndex(TypeIndex &index) | 36 | void TypeImplementation<Mail>::configure(TypeIndex &index) |
50 | { | 37 | { |
51 | index.addProperty<QByteArray>(Mail::Uid::name); | 38 | index.addProperty<QByteArray>(Mail::Uid::name); |
52 | index.addProperty<QByteArray>(Mail::Sender::name); | 39 | index.addProperty<QByteArray>(Mail::Sender::name); |
@@ -66,56 +53,41 @@ void TypeImplementation<Mail>::configureIndex(TypeIndex &index) | |||
66 | index.addSecondaryProperty<Mail::ThreadId, Mail::MessageId>(); | 53 | index.addSecondaryProperty<Mail::ThreadId, Mail::MessageId>(); |
67 | } | 54 | } |
68 | 55 | ||
69 | static TypeIndex &getIndex() | ||
70 | { | ||
71 | QMutexLocker locker(&sMutex); | ||
72 | static TypeIndex *index = 0; | ||
73 | if (!index) { | ||
74 | index = new TypeIndex("mail"); | ||
75 | TypeImplementation<Mail>::configureIndex(*index); | ||
76 | } | ||
77 | return *index; | ||
78 | } | ||
79 | 56 | ||
80 | QSharedPointer<ReadPropertyMapper<TypeImplementation<Mail>::Buffer> > TypeImplementation<Mail>::initializeReadPropertyMapper() | 57 | void TypeImplementation<Mail>::configure(ReadPropertyMapper<Buffer> &propertyMapper) |
81 | { | 58 | { |
82 | auto propertyMapper = QSharedPointer<ReadPropertyMapper<Buffer> >::create(); | ||
83 | propertyMapper->addMapping<Mail::Uid, Buffer>(&Buffer::uid); | ||
84 | propertyMapper->addMapping<Mail::Sender, Buffer>(&Buffer::sender); | ||
85 | propertyMapper->addMapping<Mail::SenderName, Buffer>(&Buffer::senderName); | ||
86 | propertyMapper->addMapping<Mail::Subject, Buffer>(&Buffer::subject); | ||
87 | propertyMapper->addMapping<Mail::Date, Buffer>(&Buffer::date); | ||
88 | propertyMapper->addMapping<Mail::Unread, Buffer>(&Buffer::unread); | ||
89 | propertyMapper->addMapping<Mail::Important, Buffer>(&Buffer::important); | ||
90 | propertyMapper->addMapping<Mail::Folder, Buffer>(&Buffer::folder); | ||
91 | propertyMapper->addMapping<Mail::MimeMessage, Buffer>(&Buffer::mimeMessage); | ||
92 | propertyMapper->addMapping<Mail::Draft, Buffer>(&Buffer::draft); | ||
93 | propertyMapper->addMapping<Mail::Trash, Buffer>(&Buffer::trash); | ||
94 | propertyMapper->addMapping<Mail::Sent, Buffer>(&Buffer::sent); | ||
95 | propertyMapper->addMapping<Mail::MessageId, Buffer>(&Buffer::messageId); | ||
96 | propertyMapper->addMapping<Mail::ParentMessageId, Buffer>(&Buffer::parentMessageId); | ||
97 | return propertyMapper; | ||
98 | } | ||
99 | 59 | ||
100 | QSharedPointer<WritePropertyMapper<TypeImplementation<Mail>::BufferBuilder> > TypeImplementation<Mail>::initializeWritePropertyMapper() | ||
101 | { | ||
102 | auto propertyMapper = QSharedPointer<WritePropertyMapper<BufferBuilder> >::create(); | ||
103 | 60 | ||
104 | propertyMapper->addMapping<Mail::Uid>(&BufferBuilder::add_uid); | 61 | propertyMapper.addMapping<Mail::Uid, Buffer>(&Buffer::uid); |
105 | propertyMapper->addMapping<Mail::Sender>(&BufferBuilder::add_sender); | 62 | propertyMapper.addMapping<Mail::Sender, Buffer>(&Buffer::sender); |
106 | propertyMapper->addMapping<Mail::SenderName>(&BufferBuilder::add_senderName); | 63 | propertyMapper.addMapping<Mail::SenderName, Buffer>(&Buffer::senderName); |
107 | propertyMapper->addMapping<Mail::Subject>(&BufferBuilder::add_subject); | 64 | propertyMapper.addMapping<Mail::Subject, Buffer>(&Buffer::subject); |
108 | propertyMapper->addMapping<Mail::Date>(&BufferBuilder::add_date); | 65 | propertyMapper.addMapping<Mail::Date, Buffer>(&Buffer::date); |
109 | propertyMapper->addMapping<Mail::Unread>(&BufferBuilder::add_unread); | 66 | propertyMapper.addMapping<Mail::Unread, Buffer>(&Buffer::unread); |
110 | propertyMapper->addMapping<Mail::Important>(&BufferBuilder::add_important); | 67 | propertyMapper.addMapping<Mail::Important, Buffer>(&Buffer::important); |
111 | propertyMapper->addMapping<Mail::Folder>(&BufferBuilder::add_folder); | 68 | propertyMapper.addMapping<Mail::Folder, Buffer>(&Buffer::folder); |
112 | propertyMapper->addMapping<Mail::MimeMessage>(&BufferBuilder::add_mimeMessage); | 69 | propertyMapper.addMapping<Mail::MimeMessage, Buffer>(&Buffer::mimeMessage); |
113 | propertyMapper->addMapping<Mail::Draft>(&BufferBuilder::add_draft); | 70 | propertyMapper.addMapping<Mail::Draft, Buffer>(&Buffer::draft); |
114 | propertyMapper->addMapping<Mail::Trash>(&BufferBuilder::add_trash); | 71 | propertyMapper.addMapping<Mail::Trash, Buffer>(&Buffer::trash); |
115 | propertyMapper->addMapping<Mail::Sent>(&BufferBuilder::add_sent); | 72 | propertyMapper.addMapping<Mail::Sent, Buffer>(&Buffer::sent); |
116 | propertyMapper->addMapping<Mail::MessageId>(&BufferBuilder::add_messageId); | 73 | propertyMapper.addMapping<Mail::MessageId, Buffer>(&Buffer::messageId); |
117 | propertyMapper->addMapping<Mail::ParentMessageId>(&BufferBuilder::add_parentMessageId); | 74 | propertyMapper.addMapping<Mail::ParentMessageId, Buffer>(&Buffer::parentMessageId); |
118 | return propertyMapper; | ||
119 | } | 75 | } |
120 | 76 | ||
121 | 77 | void TypeImplementation<Mail>::configure(WritePropertyMapper<BufferBuilder> &propertyMapper) | |
78 | { | ||
79 | propertyMapper.addMapping<Mail::Uid>(&BufferBuilder::add_uid); | ||
80 | propertyMapper.addMapping<Mail::Sender>(&BufferBuilder::add_sender); | ||
81 | propertyMapper.addMapping<Mail::SenderName>(&BufferBuilder::add_senderName); | ||
82 | propertyMapper.addMapping<Mail::Subject>(&BufferBuilder::add_subject); | ||
83 | propertyMapper.addMapping<Mail::Date>(&BufferBuilder::add_date); | ||
84 | propertyMapper.addMapping<Mail::Unread>(&BufferBuilder::add_unread); | ||
85 | propertyMapper.addMapping<Mail::Important>(&BufferBuilder::add_important); | ||
86 | propertyMapper.addMapping<Mail::Folder>(&BufferBuilder::add_folder); | ||
87 | propertyMapper.addMapping<Mail::MimeMessage>(&BufferBuilder::add_mimeMessage); | ||
88 | propertyMapper.addMapping<Mail::Draft>(&BufferBuilder::add_draft); | ||
89 | propertyMapper.addMapping<Mail::Trash>(&BufferBuilder::add_trash); | ||
90 | propertyMapper.addMapping<Mail::Sent>(&BufferBuilder::add_sent); | ||
91 | propertyMapper.addMapping<Mail::MessageId>(&BufferBuilder::add_messageId); | ||
92 | propertyMapper.addMapping<Mail::ParentMessageId>(&BufferBuilder::add_parentMessageId); | ||
93 | } | ||
diff --git a/common/domain/mail.h b/common/domain/mail.h index c0cfc55..c12976a 100644 --- a/common/domain/mail.h +++ b/common/domain/mail.h | |||
@@ -20,12 +20,7 @@ | |||
20 | 20 | ||
21 | #include "applicationdomaintype.h" | 21 | #include "applicationdomaintype.h" |
22 | 22 | ||
23 | #include "storage.h" | ||
24 | #include "storage/entitystore.h" | ||
25 | |||
26 | class ResultSet; | ||
27 | class QByteArray; | 23 | class QByteArray; |
28 | class DataStoreQuery; | ||
29 | 24 | ||
30 | template<typename T> | 25 | template<typename T> |
31 | class ReadPropertyMapper; | 26 | class ReadPropertyMapper; |
@@ -35,8 +30,6 @@ class WritePropertyMapper; | |||
35 | class TypeIndex; | 30 | class TypeIndex; |
36 | 31 | ||
37 | namespace Sink { | 32 | namespace Sink { |
38 | class Query; | ||
39 | |||
40 | namespace ApplicationDomain { | 33 | namespace ApplicationDomain { |
41 | namespace Buffer { | 34 | namespace Buffer { |
42 | struct Mail; | 35 | struct Mail; |
@@ -48,10 +41,9 @@ class TypeImplementation<Sink::ApplicationDomain::Mail> { | |||
48 | public: | 41 | public: |
49 | typedef Sink::ApplicationDomain::Buffer::Mail Buffer; | 42 | typedef Sink::ApplicationDomain::Buffer::Mail Buffer; |
50 | typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder; | 43 | typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder; |
51 | static void configureIndex(TypeIndex &index); | 44 | static void configure(TypeIndex &index); |
52 | static QSet<QByteArray> indexedProperties(); | 45 | static void configure(ReadPropertyMapper<Buffer> &propertyMapper); |
53 | static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper(); | 46 | static void configure(WritePropertyMapper<BufferBuilder> &propertyMapper); |
54 | static QSharedPointer<WritePropertyMapper<BufferBuilder> > initializeWritePropertyMapper(); | ||
55 | }; | 47 | }; |
56 | 48 | ||
57 | } | 49 | } |
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 195d5ec..0eb90b3 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -139,10 +139,14 @@ class SINK_EXPORT DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInte | |||
139 | 139 | ||
140 | public: | 140 | public: |
141 | DomainTypeAdaptorFactory() | 141 | DomainTypeAdaptorFactory() |
142 | : mLocalMapper(Sink::ApplicationDomain::TypeImplementation<DomainType>::initializeReadPropertyMapper()), | 142 | : mLocalMapper(QSharedPointer<ReadPropertyMapper<LocalBuffer>>::create()), |
143 | mResourceMapper(QSharedPointer<ReadPropertyMapper<ResourceBuffer>>::create()), | 143 | mResourceMapper(QSharedPointer<ReadPropertyMapper<ResourceBuffer>>::create()), |
144 | mLocalWriteMapper(Sink::ApplicationDomain::TypeImplementation<DomainType>::initializeWritePropertyMapper()), | 144 | mLocalWriteMapper(QSharedPointer<WritePropertyMapper<LocalBuilder>>::create()), |
145 | mResourceWriteMapper(QSharedPointer<WritePropertyMapper<ResourceBuilder>>::create()){}; | 145 | mResourceWriteMapper(QSharedPointer<WritePropertyMapper<ResourceBuilder>>::create()) |
146 | { | ||
147 | Sink::ApplicationDomain::TypeImplementation<DomainType>::configure(*mLocalMapper); | ||
148 | Sink::ApplicationDomain::TypeImplementation<DomainType>::configure(*mLocalWriteMapper); | ||
149 | } | ||
146 | virtual ~DomainTypeAdaptorFactory(){}; | 150 | virtual ~DomainTypeAdaptorFactory(){}; |
147 | 151 | ||
148 | /** | 152 | /** |
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index a3d9997..f7f235e 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -64,7 +64,7 @@ public: | |||
64 | /* return *indexByType.value(type); */ | 64 | /* return *indexByType.value(type); */ |
65 | /* } */ | 65 | /* } */ |
66 | /* auto index = QSharedPointer<TypeIndex>::create(type); */ | 66 | /* auto index = QSharedPointer<TypeIndex>::create(type); */ |
67 | /* ApplicationDomain::TypeImplementation<T>::configureIndex(*index); */ | 67 | /* ApplicationDomain::TypeImplementation<T>::configure(*index); */ |
68 | /* indexByType.insert(type, index); */ | 68 | /* indexByType.insert(type, index); */ |
69 | /* return *index; */ | 69 | /* return *index; */ |
70 | /* } */ | 70 | /* } */ |
@@ -81,11 +81,11 @@ public: | |||
81 | // Try this: (T would i.e. become | 81 | // Try this: (T would i.e. become |
82 | // TypeHelper<ApplicationDomain::TypeImplementation>::T::configureIndex(*index); | 82 | // TypeHelper<ApplicationDomain::TypeImplementation>::T::configureIndex(*index); |
83 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { | 83 | if (type == ApplicationDomain::getTypeName<ApplicationDomain::Folder>()) { |
84 | ApplicationDomain::TypeImplementation<ApplicationDomain::Folder>::configureIndex(*index); | 84 | ApplicationDomain::TypeImplementation<ApplicationDomain::Folder>::configure(*index); |
85 | } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { | 85 | } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Mail>()) { |
86 | ApplicationDomain::TypeImplementation<ApplicationDomain::Mail>::configureIndex(*index); | 86 | ApplicationDomain::TypeImplementation<ApplicationDomain::Mail>::configure(*index); |
87 | } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Event>()) { | 87 | } else if (type == ApplicationDomain::getTypeName<ApplicationDomain::Event>()) { |
88 | ApplicationDomain::TypeImplementation<ApplicationDomain::Event>::configureIndex(*index); | 88 | ApplicationDomain::TypeImplementation<ApplicationDomain::Event>::configure(*index); |
89 | } else { | 89 | } else { |
90 | Q_ASSERT(false); | 90 | Q_ASSERT(false); |
91 | SinkError() << "Unkonwn type " << type; | 91 | SinkError() << "Unkonwn type " << type; |
diff --git a/common/synchronizer.h b/common/synchronizer.h index 0a1efe1..12bb587 100644 --- a/common/synchronizer.h +++ b/common/synchronizer.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <query.h> | 26 | #include <query.h> |
27 | #include <messagequeue.h> | 27 | #include <messagequeue.h> |
28 | #include <storage.h> | 28 | #include <storage.h> |
29 | #include <storage/entitystore.h> | ||
29 | 30 | ||
30 | namespace Sink { | 31 | namespace Sink { |
31 | class RemoteIdMap; | 32 | class RemoteIdMap; |
diff --git a/tests/domainadaptortest.cpp b/tests/domainadaptortest.cpp index f4ac008..c29e61b 100644 --- a/tests/domainadaptortest.cpp +++ b/tests/domainadaptortest.cpp | |||
@@ -18,7 +18,8 @@ class TestFactory : public DomainTypeAdaptorFactory<Sink::ApplicationDomain::Eve | |||
18 | public: | 18 | public: |
19 | TestFactory() | 19 | TestFactory() |
20 | { | 20 | { |
21 | mResourceWriteMapper = Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::initializeWritePropertyMapper(); | 21 | mResourceWriteMapper = QSharedPointer<WritePropertyMapper<Sink::ApplicationDomain::Buffer::EventBuilder>>::create(); |
22 | Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::configure(*mResourceWriteMapper); | ||
22 | } | 23 | } |
23 | }; | 24 | }; |
24 | 25 | ||
@@ -39,7 +40,8 @@ private slots: | |||
39 | 40 | ||
40 | void testCreateBufferPart() | 41 | void testCreateBufferPart() |
41 | { | 42 | { |
42 | auto writeMapper = Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::initializeWritePropertyMapper(); | 43 | auto writeMapper = QSharedPointer<WritePropertyMapper<Sink::ApplicationDomain::Buffer::EventBuilder>>::create(); |
44 | Sink::ApplicationDomain::TypeImplementation<Sink::ApplicationDomain::Event>::configure(*writeMapper); | ||
43 | 45 | ||
44 | Sink::ApplicationDomain::Event event; | 46 | Sink::ApplicationDomain::Event event; |
45 | event.setProperty("summary", "foo"); | 47 | event.setProperty("summary", "foo"); |