summaryrefslogtreecommitdiffstats
path: root/examples/dummyresource/facade.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-19 21:07:36 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-19 21:07:36 +0200
commitb4db894f76de9ac252081972143efcd3fcd66533 (patch)
tree2ef5929648c7cbaa5293a9175189c218f0dbe804 /examples/dummyresource/facade.cpp
parentf89e43b3603976bc0e6eb885b3b9a43a6caff1c2 (diff)
downloadsink-b4db894f76de9ac252081972143efcd3fcd66533.tar.gz
sink-b4db894f76de9ac252081972143efcd3fcd66533.zip
Moved complete writing part to GenericFacade
Diffstat (limited to 'examples/dummyresource/facade.cpp')
-rw-r--r--examples/dummyresource/facade.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/examples/dummyresource/facade.cpp b/examples/dummyresource/facade.cpp
index e50e4f3..37f75ae 100644
--- a/examples/dummyresource/facade.cpp
+++ b/examples/dummyresource/facade.cpp
@@ -38,8 +38,7 @@ using namespace flatbuffers;
38 38
39 39
40DummyResourceFacade::DummyResourceFacade() 40DummyResourceFacade::DummyResourceFacade()
41 : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>("org.kde.dummy"), 41 : Akonadi2::GenericFacade<Akonadi2::ApplicationDomain::Event>("org.kde.dummy", QSharedPointer<DummyEventAdaptorFactory>::create())
42 mFactory(new DummyEventAdaptorFactory)
43{ 42{
44} 43}
45 44
@@ -47,25 +46,6 @@ DummyResourceFacade::~DummyResourceFacade()
47{ 46{
48} 47}
49 48
50Async::Job<void> DummyResourceFacade::create(const Akonadi2::ApplicationDomain::Event &domainObject)
51{
52 flatbuffers::FlatBufferBuilder entityFbb;
53 mFactory->createBuffer(domainObject, entityFbb);
54 return sendCreateCommand("event", QByteArray::fromRawData(reinterpret_cast<const char*>(entityFbb.GetBufferPointer()), entityFbb.GetSize()));
55}
56
57Async::Job<void> DummyResourceFacade::modify(const Akonadi2::ApplicationDomain::Event &domainObject)
58{
59 //Create message buffer and send to resource
60 return Async::null<void>();
61}
62
63Async::Job<void> DummyResourceFacade::remove(const Akonadi2::ApplicationDomain::Event &domainObject)
64{
65 //Create message buffer and send to resource
66 return Async::null<void>();
67}
68
69static std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)> prepareQuery(const Akonadi2::Query &query) 49static std::function<bool(const std::string &key, DummyEvent const *buffer, Akonadi2::ApplicationDomain::Buffer::Event const *local)> prepareQuery(const Akonadi2::Query &query)
70{ 50{
71 //Compose some functions to make query matching fast. 51 //Compose some functions to make query matching fast.
@@ -133,7 +113,7 @@ void DummyResourceFacade::readValue(QSharedPointer<Akonadi2::Storage> storage, c
133 qint64 revision = metadataBuffer ? metadataBuffer->revision() : -1; 113 qint64 revision = metadataBuffer ? metadataBuffer->revision() : -1;
134 //This only works for a 1:1 mapping of resource to domain types. 114 //This only works for a 1:1 mapping of resource to domain types.
135 //Not i.e. for tags that are stored as flags in each entity of an imap store. 115 //Not i.e. for tags that are stored as flags in each entity of an imap store.
136 auto adaptor = mFactory->createAdaptor(buffer.entity()); 116 auto adaptor = mDomainTypeAdaptorFactory->createAdaptor(buffer.entity());
137 //TODO only copy requested properties 117 //TODO only copy requested properties
138 auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*adaptor); 118 auto memoryAdaptor = QSharedPointer<Akonadi2::ApplicationDomain::MemoryBufferAdaptor>::create(*adaptor);
139 // here we could copy additional properties that don't have a 1:1 mapping, such as separately stored tags. 119 // here we could copy additional properties that don't have a 1:1 mapping, such as separately stored tags.