diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-20 17:46:10 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-10-21 09:18:50 +0200 |
commit | 0c1f6da51631c0a573a44e2f93eb4012d52dfe5c (patch) | |
tree | cf3cd3bec9fabd44a7107f47e7b0b057880ecb61 /common/domain/mail.cpp | |
parent | 9a03eb1a54c6289773bc1b8eb96181ed01553927 (diff) | |
download | sink-0c1f6da51631c0a573a44e2f93eb4012d52dfe5c.tar.gz sink-0c1f6da51631c0a573a44e2f93eb4012d52dfe5c.zip |
Get access to properties in indexes.
Diffstat (limited to 'common/domain/mail.cpp')
-rw-r--r-- | common/domain/mail.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/domain/mail.cpp b/common/domain/mail.cpp index 8abe259..c1b0b34 100644 --- a/common/domain/mail.cpp +++ b/common/domain/mail.cpp | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "entitybuffer.h" | 27 | #include "entitybuffer.h" |
28 | #include "entity_generated.h" | 28 | #include "entity_generated.h" |
29 | #include "mail/threadindexer.h" | 29 | #include "mail/threadindexer.h" |
30 | #include "domainadaptor.h" | ||
30 | 31 | ||
31 | #include "mail_generated.h" | 32 | #include "mail_generated.h" |
32 | 33 | ||
@@ -53,6 +54,15 @@ void TypeImplementation<Mail>::configure(TypeIndex &index) | |||
53 | index.addSecondaryProperty<Mail::ThreadId, Mail::MessageId>(); | 54 | index.addSecondaryProperty<Mail::ThreadId, Mail::MessageId>(); |
54 | } | 55 | } |
55 | 56 | ||
57 | void TypeImplementation<Mail>::configure(IndexPropertyMapper &indexPropertyMapper) | ||
58 | { | ||
59 | indexPropertyMapper.addIndexLookupProperty<Mail::ThreadId>([](TypeIndex &index, const ApplicationDomain::BufferAdaptor &entity) { | ||
60 | auto messageId = entity.getProperty(Mail::MessageId::name); | ||
61 | auto thread = index.secondaryLookup<Mail::MessageId, Mail::ThreadId>(messageId); | ||
62 | Q_ASSERT(!thread.isEmpty()); | ||
63 | return thread.first(); | ||
64 | }); | ||
65 | } | ||
56 | 66 | ||
57 | void TypeImplementation<Mail>::configure(ReadPropertyMapper<Buffer> &propertyMapper) | 67 | void TypeImplementation<Mail>::configure(ReadPropertyMapper<Buffer> &propertyMapper) |
58 | { | 68 | { |