summaryrefslogtreecommitdiffstats
path: root/examples/dummyresource
diff options
context:
space:
mode:
Diffstat (limited to 'examples/dummyresource')
-rw-r--r--examples/dummyresource/CMakeLists.txt2
-rw-r--r--examples/dummyresource/facade.cpp51
-rw-r--r--examples/dummyresource/facade.h44
-rw-r--r--examples/dummyresource/resourcefactory.cpp13
4 files changed, 8 insertions, 102 deletions
diff --git a/examples/dummyresource/CMakeLists.txt b/examples/dummyresource/CMakeLists.txt
index 6400f0c..2bbaa47 100644
--- a/examples/dummyresource/CMakeLists.txt
+++ b/examples/dummyresource/CMakeLists.txt
@@ -4,7 +4,7 @@ add_definitions(-DQT_PLUGIN)
4include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) 4include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
5 5
6 6
7add_library(${PROJECT_NAME} SHARED facade.cpp resourcefactory.cpp domainadaptor.cpp dummystore.cpp) 7add_library(${PROJECT_NAME} SHARED resourcefactory.cpp domainadaptor.cpp dummystore.cpp)
8generate_flatbuffers(${PROJECT_NAME} dummycalendar) 8generate_flatbuffers(${PROJECT_NAME} dummycalendar)
9qt5_use_modules(${PROJECT_NAME} Core Network) 9qt5_use_modules(${PROJECT_NAME} Core Network)
10target_link_libraries(${PROJECT_NAME} sink) 10target_link_libraries(${PROJECT_NAME} sink)
diff --git a/examples/dummyresource/facade.cpp b/examples/dummyresource/facade.cpp
deleted file mode 100644
index 4343eba..0000000
--- a/examples/dummyresource/facade.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#include "facade.h"
21
22#include "domainadaptor.h"
23
24DummyResourceFacade::DummyResourceFacade(const Sink::ResourceContext &context)
25 : Sink::GenericFacade<Sink::ApplicationDomain::Event>(context)
26{
27}
28
29DummyResourceFacade::~DummyResourceFacade()
30{
31}
32
33
34DummyResourceMailFacade::DummyResourceMailFacade(const Sink::ResourceContext &context)
35 : Sink::GenericFacade<Sink::ApplicationDomain::Mail>(context)
36{
37}
38
39DummyResourceMailFacade::~DummyResourceMailFacade()
40{
41}
42
43
44DummyResourceFolderFacade::DummyResourceFolderFacade(const Sink::ResourceContext &context)
45 : Sink::GenericFacade<Sink::ApplicationDomain::Folder>(context)
46{
47}
48
49DummyResourceFolderFacade::~DummyResourceFolderFacade()
50{
51}
diff --git a/examples/dummyresource/facade.h b/examples/dummyresource/facade.h
deleted file mode 100644
index 1bb45fd..0000000
--- a/examples/dummyresource/facade.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 2014 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#include "common/facade.h"
23#include "common/domain/event.h"
24
25class DummyResourceFacade : public Sink::GenericFacade<Sink::ApplicationDomain::Event>
26{
27public:
28 DummyResourceFacade(const Sink::ResourceContext &context);
29 virtual ~DummyResourceFacade();
30};
31
32class DummyResourceMailFacade : public Sink::GenericFacade<Sink::ApplicationDomain::Mail>
33{
34public:
35 DummyResourceMailFacade(const Sink::ResourceContext &context);
36 virtual ~DummyResourceMailFacade();
37};
38
39class DummyResourceFolderFacade : public Sink::GenericFacade<Sink::ApplicationDomain::Folder>
40{
41public:
42 DummyResourceFolderFacade(const Sink::ResourceContext &context);
43 virtual ~DummyResourceFolderFacade();
44};
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp
index e915710..c1f536e 100644
--- a/examples/dummyresource/resourcefactory.cpp
+++ b/examples/dummyresource/resourcefactory.cpp
@@ -26,8 +26,6 @@
26#include "mail_generated.h" 26#include "mail_generated.h"
27#include "domainadaptor.h" 27#include "domainadaptor.h"
28#include "log.h" 28#include "log.h"
29#include "domain/event.h"
30#include "domain/mail.h"
31#include "dummystore.h" 29#include "dummystore.h"
32#include "definitions.h" 30#include "definitions.h"
33#include "facadefactory.h" 31#include "facadefactory.h"
@@ -46,6 +44,8 @@
46 44
47SINK_DEBUG_AREA("dummyresource") 45SINK_DEBUG_AREA("dummyresource")
48 46
47using namespace Sink;
48
49class DummySynchronizer : public Sink::Synchronizer { 49class DummySynchronizer : public Sink::Synchronizer {
50 public: 50 public:
51 51
@@ -69,6 +69,7 @@ class DummySynchronizer : public Sink::Synchronizer {
69 Sink::ApplicationDomain::Mail::Ptr createMail(const QByteArray &ridBuffer, const QMap<QString, QVariant> &data) 69 Sink::ApplicationDomain::Mail::Ptr createMail(const QByteArray &ridBuffer, const QMap<QString, QVariant> &data)
70 { 70 {
71 auto mail = Sink::ApplicationDomain::Mail::Ptr::create(); 71 auto mail = Sink::ApplicationDomain::Mail::Ptr::create();
72 mail->setExtractedMessageId(ridBuffer);
72 mail->setExtractedSubject(data.value("subject").toString()); 73 mail->setExtractedSubject(data.value("subject").toString());
73 mail->setExtractedSender(Sink::ApplicationDomain::Mail::Contact{data.value("senderName").toString(), data.value("senderEmail").toString()}); 74 mail->setExtractedSender(Sink::ApplicationDomain::Mail::Contact{data.value("senderName").toString(), data.value("senderEmail").toString()});
74 mail->setExtractedDate(data.value("date").toDateTime()); 75 mail->setExtractedDate(data.value("date").toDateTime());
@@ -163,7 +164,7 @@ DummyResource::DummyResource(const Sink::ResourceContext &resourceContext, const
163 setupSynchronizer(QSharedPointer<DummySynchronizer>::create(resourceContext)); 164 setupSynchronizer(QSharedPointer<DummySynchronizer>::create(resourceContext));
164 setupInspector(QSharedPointer<DummyInspector>::create(resourceContext)); 165 setupInspector(QSharedPointer<DummyInspector>::create(resourceContext));
165 setupPreprocessors(ENTITY_TYPE_MAIL, 166 setupPreprocessors(ENTITY_TYPE_MAIL,
166 QVector<Sink::Preprocessor*>() << new MailPropertyExtractor << new SpecialPurposeProcessor{resourceContext.resourceType, resourceContext.instanceId()}); 167 QVector<Sink::Preprocessor*>() << new MailPropertyExtractor << new SpecialPurposeProcessor);
167 setupPreprocessors(ENTITY_TYPE_FOLDER, 168 setupPreprocessors(ENTITY_TYPE_FOLDER,
168 QVector<Sink::Preprocessor*>()); 169 QVector<Sink::Preprocessor*>());
169 setupPreprocessors(ENTITY_TYPE_EVENT, 170 setupPreprocessors(ENTITY_TYPE_EVENT,
@@ -194,9 +195,9 @@ Sink::Resource *DummyResourceFactory::createResource(const Sink::ResourceContext
194 195
195void DummyResourceFactory::registerFacades(const QByteArray &resourceName, Sink::FacadeFactory &factory) 196void DummyResourceFactory::registerFacades(const QByteArray &resourceName, Sink::FacadeFactory &factory)
196{ 197{
197 factory.registerFacade<Sink::ApplicationDomain::Event, DummyResourceFacade>(resourceName); 198 factory.registerFacade<ApplicationDomain::Event, DefaultFacade<ApplicationDomain::Event>>(resourceName);
198 factory.registerFacade<Sink::ApplicationDomain::Mail, DummyResourceMailFacade>(resourceName); 199 factory.registerFacade<ApplicationDomain::Mail, DefaultFacade<ApplicationDomain::Mail>>(resourceName);
199 factory.registerFacade<Sink::ApplicationDomain::Folder, DummyResourceFolderFacade>(resourceName); 200 factory.registerFacade<ApplicationDomain::Folder, DefaultFacade<ApplicationDomain::Folder>>(resourceName);
200} 201}
201 202
202void DummyResourceFactory::registerAdaptorFactories(const QByteArray &resourceName, Sink::AdaptorFactoryRegistry &registry) 203void DummyResourceFactory::registerAdaptorFactories(const QByteArray &resourceName, Sink::AdaptorFactoryRegistry &registry)