summaryrefslogtreecommitdiffstats
path: root/common/typeindex.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-19 15:28:42 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-10-21 09:18:49 +0200
commitba7c8b890c45d735216888204ec88882ef58c918 (patch)
treecb00c9b51e5353ba3726216679c81c0e2fe9ac35 /common/typeindex.cpp
parentda1c86b80f230c3a2023f97c0048020a12e38de4 (diff)
downloadsink-ba7c8b890c45d735216888204ec88882ef58c918.tar.gz
sink-ba7c8b890c45d735216888204ec88882ef58c918.zip
Ported the pipeline to the entitystore
Diffstat (limited to 'common/typeindex.cpp')
-rw-r--r--common/typeindex.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/common/typeindex.cpp b/common/typeindex.cpp
index 64c2a01..7920efc 100644
--- a/common/typeindex.cpp
+++ b/common/typeindex.cpp
@@ -108,30 +108,30 @@ void TypeIndex::addPropertyWithSorting<QByteArray, QDateTime>(const QByteArray &
108 mSortedProperties.insert(property, sortProperty); 108 mSortedProperties.insert(property, sortProperty);
109} 109}
110 110
111void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction) 111void TypeIndex::add(const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction)
112{ 112{
113 for (const auto &property : mProperties) { 113 for (const auto &property : mProperties) {
114 const auto value = bufferAdaptor.getProperty(property); 114 const auto value = entity.getProperty(property);
115 auto indexer = mIndexer.value(property); 115 auto indexer = mIndexer.value(property);
116 indexer(identifier, value, transaction); 116 indexer(identifier, value, transaction);
117 } 117 }
118 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) { 118 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) {
119 const auto value = bufferAdaptor.getProperty(it.key()); 119 const auto value = entity.getProperty(it.key());
120 const auto sortValue = bufferAdaptor.getProperty(it.value()); 120 const auto sortValue = entity.getProperty(it.value());
121 auto indexer = mSortIndexer.value(it.key() + it.value()); 121 auto indexer = mSortIndexer.value(it.key() + it.value());
122 indexer(identifier, value, sortValue, transaction); 122 indexer(identifier, value, sortValue, transaction);
123 } 123 }
124} 124}
125 125
126void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::BufferAdaptor &bufferAdaptor, Sink::Storage::DataStore::Transaction &transaction) 126void TypeIndex::remove(const QByteArray &identifier, const Sink::ApplicationDomain::ApplicationDomainType &entity, Sink::Storage::DataStore::Transaction &transaction)
127{ 127{
128 for (const auto &property : mProperties) { 128 for (const auto &property : mProperties) {
129 const auto value = bufferAdaptor.getProperty(property); 129 const auto value = entity.getProperty(property);
130 Index(indexName(property), transaction).remove(getByteArray(value), identifier); 130 Index(indexName(property), transaction).remove(getByteArray(value), identifier);
131 } 131 }
132 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) { 132 for (auto it = mSortedProperties.constBegin(); it != mSortedProperties.constEnd(); it++) {
133 const auto propertyValue = bufferAdaptor.getProperty(it.key()); 133 const auto propertyValue = entity.getProperty(it.key());
134 const auto sortValue = bufferAdaptor.getProperty(it.value()); 134 const auto sortValue = entity.getProperty(it.value());
135 if (sortValue.type() == QVariant::DateTime) { 135 if (sortValue.type() == QVariant::DateTime) {
136 Index(indexName(it.key(), it.value()), transaction).remove(propertyValue.toByteArray() + toSortableByteArray(sortValue.toDateTime()), identifier); 136 Index(indexName(it.key(), it.value()), transaction).remove(propertyValue.toByteArray() + toSortableByteArray(sortValue.toDateTime()), identifier);
137 } else { 137 } else {