summaryrefslogtreecommitdiffstats
path: root/common/domain
diff options
context:
space:
mode:
Diffstat (limited to 'common/domain')
-rw-r--r--common/domain/event.cpp10
-rw-r--r--common/domain/event.h2
-rw-r--r--common/domain/folder.cpp9
-rw-r--r--common/domain/folder.h1
-rw-r--r--common/domain/mail.cpp23
-rw-r--r--common/domain/mail.h1
6 files changed, 0 insertions, 46 deletions
diff --git a/common/domain/event.cpp b/common/domain/event.cpp
index 6717187..d50652d 100644
--- a/common/domain/event.cpp
+++ b/common/domain/event.cpp
@@ -87,13 +87,3 @@ QSharedPointer<WritePropertyMapper<TypeImplementation<Event>::BufferBuilder> > T
87 propertyMapper->addMapping<Event::Attachment>(&BufferBuilder::add_attachment); 87 propertyMapper->addMapping<Event::Attachment>(&BufferBuilder::add_attachment);
88 return propertyMapper; 88 return propertyMapper;
89} 89}
90
91DataStoreQuery::Ptr TypeImplementation<Event>::prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store)
92{
93 auto mapper = initializeReadPropertyMapper();
94 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Event>(), store, [mapper](const Sink::Entity &entity, const QByteArray &property) {
95
96 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
97 return mapper->getProperty(property, localBuffer);
98 });
99}
diff --git a/common/domain/event.h b/common/domain/event.h
index ce9691d..18e0f20 100644
--- a/common/domain/event.h
+++ b/common/domain/event.h
@@ -56,8 +56,6 @@ public:
56 typedef Sink::ApplicationDomain::Buffer::EventBuilder BufferBuilder; 56 typedef Sink::ApplicationDomain::Buffer::EventBuilder BufferBuilder;
57 static void configureIndex(TypeIndex &index); 57 static void configureIndex(TypeIndex &index);
58 static QSet<QByteArray> indexedProperties(); 58 static QSet<QByteArray> indexedProperties();
59 static QSharedPointer<DataStoreQuery> prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store);
60
61 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 59 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
62 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 60 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
63 static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper(); 61 static QSharedPointer<ReadPropertyMapper<Buffer> > initializeReadPropertyMapper();
diff --git a/common/domain/folder.cpp b/common/domain/folder.cpp
index 34e59f6..94727a3 100644
--- a/common/domain/folder.cpp
+++ b/common/domain/folder.cpp
@@ -91,12 +91,3 @@ QSharedPointer<WritePropertyMapper<TypeImplementation<Folder>::BufferBuilder> >
91 propertyMapper->addMapping<Folder::SpecialPurpose>(&BufferBuilder::add_specialpurpose); 91 propertyMapper->addMapping<Folder::SpecialPurpose>(&BufferBuilder::add_specialpurpose);
92 return propertyMapper; 92 return propertyMapper;
93} 93}
94
95DataStoreQuery::Ptr TypeImplementation<Folder>::prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store)
96{
97 auto mapper = initializeReadPropertyMapper();
98 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Folder>(), store, [mapper](const Sink::Entity &entity, const QByteArray &property) {
99 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
100 return mapper->getProperty(property, localBuffer);
101 });
102}
diff --git a/common/domain/folder.h b/common/domain/folder.h
index 0a52b01..ea0d79a 100644
--- a/common/domain/folder.h
+++ b/common/domain/folder.h
@@ -49,7 +49,6 @@ public:
49 typedef Sink::ApplicationDomain::Buffer::Folder Buffer; 49 typedef Sink::ApplicationDomain::Buffer::Folder Buffer;
50 typedef Sink::ApplicationDomain::Buffer::FolderBuilder BufferBuilder; 50 typedef Sink::ApplicationDomain::Buffer::FolderBuilder BufferBuilder;
51 static void configureIndex(TypeIndex &index); 51 static void configureIndex(TypeIndex &index);
52 static QSharedPointer<DataStoreQuery> prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store);
53 static QSet<QByteArray> indexedProperties(); 52 static QSet<QByteArray> indexedProperties();
54 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 53 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
55 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 54 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp
index 9e3a824..b0a3aae 100644
--- a/common/domain/mail.cpp
+++ b/common/domain/mail.cpp
@@ -225,26 +225,3 @@ QSharedPointer<WritePropertyMapper<TypeImplementation<Mail>::BufferBuilder> > Ty
225} 225}
226 226
227 227
228DataStoreQuery::Ptr TypeImplementation<Mail>::prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr store)
229{
230 auto mapper = initializeReadPropertyMapper();
231 return DataStoreQuery::Ptr::create(query, ApplicationDomain::getTypeName<Mail>(), store, [mapper, store](const Sink::Entity &entity, const QByteArray &property) -> QVariant {
232 if (property == Mail::ThreadId::name) {
233 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
234 Q_ASSERT(localBuffer);
235 auto messageId = mapper->getProperty(Mail::MessageId::name, localBuffer);
236 //FIXME
237 //This is an index property that we have too lookup
238 /* auto thread = getIndex().secondaryLookup<Mail::MessageId, Mail::ThreadId>(messageId); */
239 /* auto thread = store->secondaryLookup<Mail::MessageId, Mail::ThreadId>(messageId); */
240 /* Q_ASSERT(!thread.isEmpty()); */
241 /* return thread.first(); */
242 return QVariant();
243 } else {
244 const auto localBuffer = Sink::EntityBuffer::readBuffer<Buffer>(entity.local());
245 Q_ASSERT(localBuffer);
246 return mapper->getProperty(property, localBuffer);
247 }
248 });
249}
250
diff --git a/common/domain/mail.h b/common/domain/mail.h
index 6c1f670..81a0d1c 100644
--- a/common/domain/mail.h
+++ b/common/domain/mail.h
@@ -49,7 +49,6 @@ public:
49 typedef Sink::ApplicationDomain::Buffer::Mail Buffer; 49 typedef Sink::ApplicationDomain::Buffer::Mail Buffer;
50 typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder; 50 typedef Sink::ApplicationDomain::Buffer::MailBuilder BufferBuilder;
51 static void configureIndex(TypeIndex &index); 51 static void configureIndex(TypeIndex &index);
52 static QSharedPointer<DataStoreQuery> prepareQuery(const Sink::Query &query, Sink::Storage::EntityStore::Ptr storage);
53 static QSet<QByteArray> indexedProperties(); 52 static QSet<QByteArray> indexedProperties();
54 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 53 static void index(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);
55 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction); 54 static void removeIndex(const QByteArray &identifier, const BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction);