diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 21:52:34 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-03-03 21:52:34 +0100 |
commit | 3978a0128925081dac0d16c1956328b694796ce6 (patch) | |
tree | bc332f2467bca311168701cb43d31e5150156b42 /common/resourcefacade.cpp | |
parent | 4d9746c828558c9f872e0aed52442863affb25d5 (diff) | |
download | sink-3978a0128925081dac0d16c1956328b694796ce6.tar.gz sink-3978a0128925081dac0d16c1956328b694796ce6.zip |
Filter resources also by id, and load configuration.
Diffstat (limited to 'common/resourcefacade.cpp')
-rw-r--r-- | common/resourcefacade.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/common/resourcefacade.cpp b/common/resourcefacade.cpp index 9294926..3095c2e 100644 --- a/common/resourcefacade.cpp +++ b/common/resourcefacade.cpp | |||
@@ -103,11 +103,22 @@ QPair<KAsync::Job<void>, typename Sink::ResultEmitter<Sink::ApplicationDomain::S | |||
103 | const auto configuredResources = ResourceConfig::getResources(); | 103 | const auto configuredResources = ResourceConfig::getResources(); |
104 | for (const auto &res : configuredResources.keys()) { | 104 | for (const auto &res : configuredResources.keys()) { |
105 | const auto type = configuredResources.value(res); | 105 | const auto type = configuredResources.value(res); |
106 | if (!query.propertyFilter.contains("type") || query.propertyFilter.value("type").toByteArray() == type) { | 106 | if (query.propertyFilter.contains("type") && query.propertyFilter.value("type").toByteArray() != type) { |
107 | auto resource = Sink::ApplicationDomain::SinkResource::Ptr::create("", res, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); | 107 | continue; |
108 | resource->setProperty("type", type); | ||
109 | resultProvider->add(resource); | ||
110 | } | 108 | } |
109 | if (!query.ids.isEmpty() && !query.ids.contains(res)) { | ||
110 | continue; | ||
111 | } | ||
112 | |||
113 | auto resource = Sink::ApplicationDomain::SinkResource::Ptr::create("", res, 0, QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create()); | ||
114 | resource->setProperty("type", type); | ||
115 | |||
116 | const auto configurationValues = ResourceConfig::getConfiguration(res); | ||
117 | for (auto it = configurationValues.constBegin(); it != configurationValues.constEnd(); it++) { | ||
118 | resource->setProperty(it.key(), it.value()); | ||
119 | } | ||
120 | |||
121 | resultProvider->add(resource); | ||
111 | } | 122 | } |
112 | // TODO initialResultSetComplete should be implicit | 123 | // TODO initialResultSetComplete should be implicit |
113 | resultProvider->initialResultSetComplete(Sink::ApplicationDomain::SinkResource::Ptr()); | 124 | resultProvider->initialResultSetComplete(Sink::ApplicationDomain::SinkResource::Ptr()); |