summaryrefslogtreecommitdiffstats
path: root/common/store.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/store.cpp')
-rw-r--r--common/store.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/store.cpp b/common/store.cpp
index 8007626..554f540 100644
--- a/common/store.cpp
+++ b/common/store.cpp
@@ -57,7 +57,7 @@ QString Store::getTemporaryFilePath()
57/* 57/*
58 * Returns a map of resource instance identifiers and resource type 58 * Returns a map of resource instance identifiers and resource type
59 */ 59 */
60static QMap<QByteArray, QByteArray> getResources(const Sink::Query::Filter &query, const QByteArray &type = QByteArray()) 60static QMap<QByteArray, QByteArray> getResources(const Sink::Query::Filter &query, const QByteArray &type, const Sink::Log::Context &ctx)
61{ 61{
62 const QList<QByteArray> resourceFilter = query.ids; 62 const QList<QByteArray> resourceFilter = query.ids;
63 63
@@ -97,11 +97,11 @@ static QMap<QByteArray, QByteArray> getResources(const Sink::Query::Filter &quer
97 } 97 }
98 resources.insert(res, configuredResources.value(res)); 98 resources.insert(res, configuredResources.value(res));
99 } else { 99 } else {
100 SinkWarning() << "Resource is not existing: " << res; 100 SinkWarningCtx(ctx) << "Resource is not existing: " << res;
101 } 101 }
102 } 102 }
103 } 103 }
104 SinkTrace() << "Found resources: " << resources; 104 SinkTraceCtx(ctx) << "Found resources: " << resources;
105 return resources; 105 return resources;
106} 106}
107 107
@@ -133,7 +133,7 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query)
133 Log::Context ctx{query.id()}; 133 Log::Context ctx{query.id()};
134 query.setType(ApplicationDomain::getTypeName<DomainType>()); 134 query.setType(ApplicationDomain::getTypeName<DomainType>());
135 SinkTraceCtx(ctx) << "Loading model: " << query; 135 SinkTraceCtx(ctx) << "Loading model: " << query;
136 auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties); 136 auto model = QSharedPointer<ModelResult<DomainType, typename DomainType::Ptr>>::create(query, query.requestedProperties, ctx);
137 137
138 //* Client defines lifetime of model 138 //* Client defines lifetime of model
139 //* The model lifetime defines the duration of live-queries 139 //* The model lifetime defines the duration of live-queries
@@ -142,7 +142,7 @@ QSharedPointer<QAbstractItemModel> Store::loadModel(Query query)
142 //* The result provider needs to live for as long as results are provided (until the last thread exits). 142 //* The result provider needs to live for as long as results are provided (until the last thread exits).
143 143
144 // Query all resources and aggregate results 144 // Query all resources and aggregate results
145 auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>()); 145 auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>(), ctx);
146 auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); 146 auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create();
147 model->setEmitter(aggregatingEmitter); 147 model->setEmitter(aggregatingEmitter);
148 148
@@ -297,7 +297,7 @@ KAsync::Job<void> Store::synchronize(const Sink::Query &query)
297 297
298KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope) 298KAsync::Job<void> Store::synchronize(const Sink::SyncScope &scope)
299{ 299{
300 auto resources = getResources(scope.getResourceFilter()).keys(); 300 auto resources = getResources(scope.getResourceFilter(), {}, {}).keys();
301 SinkLog() << "Synchronize" << resources; 301 SinkLog() << "Synchronize" << resources;
302 return KAsync::value(resources) 302 return KAsync::value(resources)
303 .template each([scope](const QByteArray &resource) { 303 .template each([scope](const QByteArray &resource) {
@@ -377,7 +377,7 @@ QList<DomainType> Store::read(const Sink::Query &q)
377 auto query = q; 377 auto query = q;
378 query.setFlags(Query::SynchronousQuery); 378 query.setFlags(Query::SynchronousQuery);
379 QList<DomainType> list; 379 QList<DomainType> list;
380 auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>()); 380 auto resources = getResources(query.getResourceFilter(), ApplicationDomain::getTypeName<DomainType>(), ctx);
381 auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create(); 381 auto aggregatingEmitter = AggregatingResultEmitter<typename DomainType::Ptr>::Ptr::create();
382 aggregatingEmitter->onAdded([&list, ctx](const typename DomainType::Ptr &value){ 382 aggregatingEmitter->onAdded([&list, ctx](const typename DomainType::Ptr &value){
383 SinkTraceCtx(ctx) << "Found value: " << value->identifier(); 383 SinkTraceCtx(ctx) << "Found value: " << value->identifier();