From c08c329580a6f5e5da1ebba931461e7e7e47ba72 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 1 Mar 2017 01:03:18 +0100 Subject: Filter resources by the types they support. This avoid uselessly querying resources only to discover that they don't have a facade for the type. --- examples/mailtransportresource/mailtransportresource.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'examples/mailtransportresource/mailtransportresource.cpp') diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index 0118140..88a90c6 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp @@ -91,6 +91,9 @@ public: modifiedMail.setSent(true); auto resource = Store::readOne(Query{}.filter(mResourceInstanceIdentifier).request()); + if (resource.identifier().isEmpty()) { + SinkWarning() << "Failed to retrieve target resource: " << mResourceInstanceIdentifier; + } //Then copy the mail to the target resource Query query; query.containsFilter(ApplicationDomain::ResourceCapabilities::Mail::sent); @@ -193,7 +196,8 @@ MailtransportResource::MailtransportResource(const Sink::ResourceContext &resour } MailtransportResourceFactory::MailtransportResourceFactory(QObject *parent) - : Sink::ResourceFactory(parent, {Sink::ApplicationDomain::ResourceCapabilities::Mail::transport}) + : Sink::ResourceFactory(parent, {Sink::ApplicationDomain::ResourceCapabilities::Mail::mail, + Sink::ApplicationDomain::ResourceCapabilities::Mail::transport}) { } -- cgit v1.2.3