diff options
Diffstat (limited to 'common/facadeinterface.h')
-rw-r--r-- | common/facadeinterface.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/common/facadeinterface.h b/common/facadeinterface.h index 7ec21bc..318abf3 100644 --- a/common/facadeinterface.h +++ b/common/facadeinterface.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <Async/Async> | 23 | #include <Async/Async> |
24 | #include <QByteArray> | 24 | #include <QByteArray> |
25 | #include <QSharedPointer> | 25 | #include <QSharedPointer> |
26 | #include <QPair> | ||
26 | #include "applicationdomaintype.h" | 27 | #include "applicationdomaintype.h" |
27 | #include "resultprovider.h" | 28 | #include "resultprovider.h" |
28 | 29 | ||
@@ -42,10 +43,32 @@ class StoreFacade { | |||
42 | public: | 43 | public: |
43 | virtual ~StoreFacade(){}; | 44 | virtual ~StoreFacade(){}; |
44 | QByteArray type() const { return ApplicationDomain::getTypeName<DomainType>(); } | 45 | QByteArray type() const { return ApplicationDomain::getTypeName<DomainType>(); } |
46 | |||
47 | /** | ||
48 | * Create an entity in the store. | ||
49 | * | ||
50 | * The job returns succefully once the task has been successfully placed in the queue | ||
51 | */ | ||
45 | virtual KAsync::Job<void> create(const DomainType &domainObject) = 0; | 52 | virtual KAsync::Job<void> create(const DomainType &domainObject) = 0; |
53 | |||
54 | /** | ||
55 | * Modify an entity in the store. | ||
56 | * | ||
57 | * The job returns succefully once the task has been successfully placed in the queue | ||
58 | */ | ||
46 | virtual KAsync::Job<void> modify(const DomainType &domainObject) = 0; | 59 | virtual KAsync::Job<void> modify(const DomainType &domainObject) = 0; |
60 | |||
61 | /** | ||
62 | * Remove an entity from the store. | ||
63 | * | ||
64 | * The job returns succefully once the task has been successfully placed in the queue | ||
65 | */ | ||
47 | virtual KAsync::Job<void> remove(const DomainType &domainObject) = 0; | 66 | virtual KAsync::Job<void> remove(const DomainType &domainObject) = 0; |
48 | virtual KAsync::Job<void> load(const Query &query, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) = 0; | 67 | |
68 | /** | ||
69 | * Load entities from the store. | ||
70 | */ | ||
71 | virtual QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename DomainType::Ptr>::Ptr > load(const Query &query) = 0; | ||
49 | }; | 72 | }; |
50 | 73 | ||
51 | template<class DomainType> | 74 | template<class DomainType> |
@@ -67,9 +90,9 @@ public: | |||
67 | return KAsync::error<void>(-1, "Failed to create a facade"); | 90 | return KAsync::error<void>(-1, "Failed to create a facade"); |
68 | } | 91 | } |
69 | 92 | ||
70 | KAsync::Job<void> load(const Query &query, Akonadi2::ResultProviderInterface<typename DomainType::Ptr> &resultProvider) | 93 | QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<typename DomainType::Ptr>::Ptr > load(const Query &query) |
71 | { | 94 | { |
72 | return KAsync::error<void>(-1, "Failed to create a facade"); | 95 | return qMakePair(KAsync::null<void>(), typename Akonadi2::ResultEmitter<typename DomainType::Ptr>::Ptr()); |
73 | } | 96 | } |
74 | }; | 97 | }; |
75 | 98 | ||