diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-21 10:10:15 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-11-21 10:45:04 +0100 |
commit | a188fb648ba001314adbb9d5cfc0bfb77198a5b9 (patch) | |
tree | 899e46c4d581e7a13df0efc58ceaaa80098d64c7 | |
parent | a1dcb117835f7c1f0604f0302b42edd905190a52 (diff) | |
download | sink-a188fb648ba001314adbb9d5cfc0bfb77198a5b9.tar.gz sink-a188fb648ba001314adbb9d5cfc0bfb77198a5b9.zip |
sinksh list identity support
-rw-r--r-- | common/domain/applicationdomaintype.h | 2 | ||||
-rw-r--r-- | common/store.cpp | 3 | ||||
-rw-r--r-- | sinksh/sinksh_utils.cpp | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index d2b4d83..4621316 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -319,6 +319,8 @@ struct SINK_EXPORT Identity : public ApplicationDomainType { | |||
319 | Identity(); | 319 | Identity(); |
320 | virtual ~Identity(); | 320 | virtual ~Identity(); |
321 | SINK_REFERENCE_PROPERTY(SinkAccount, Account, account); | 321 | SINK_REFERENCE_PROPERTY(SinkAccount, Account, account); |
322 | SINK_PROPERTY(QString, Name, name); | ||
323 | SINK_PROPERTY(QString, Address, address); | ||
322 | }; | 324 | }; |
323 | 325 | ||
324 | struct SINK_EXPORT DummyResource { | 326 | struct SINK_EXPORT DummyResource { |
diff --git a/common/store.cpp b/common/store.cpp index 41b4867..5e0c327 100644 --- a/common/store.cpp +++ b/common/store.cpp | |||
@@ -200,6 +200,7 @@ static std::shared_ptr<StoreFacade<DomainType>> getFacade(const QByteArray &reso | |||
200 | template <class DomainType> | 200 | template <class DomainType> |
201 | KAsync::Job<void> Store::create(const DomainType &domainObject) | 201 | KAsync::Job<void> Store::create(const DomainType &domainObject) |
202 | { | 202 | { |
203 | SinkTrace() << "Create: " << domainObject; | ||
203 | // Potentially move to separate thread as well | 204 | // Potentially move to separate thread as well |
204 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); | 205 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); |
205 | return facade->create(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to create"; }); | 206 | return facade->create(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to create"; }); |
@@ -208,6 +209,7 @@ KAsync::Job<void> Store::create(const DomainType &domainObject) | |||
208 | template <class DomainType> | 209 | template <class DomainType> |
209 | KAsync::Job<void> Store::modify(const DomainType &domainObject) | 210 | KAsync::Job<void> Store::modify(const DomainType &domainObject) |
210 | { | 211 | { |
212 | SinkTrace() << "Modify: " << domainObject; | ||
211 | // Potentially move to separate thread as well | 213 | // Potentially move to separate thread as well |
212 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); | 214 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); |
213 | return facade->modify(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to modify"; }); | 215 | return facade->modify(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to modify"; }); |
@@ -216,6 +218,7 @@ KAsync::Job<void> Store::modify(const DomainType &domainObject) | |||
216 | template <class DomainType> | 218 | template <class DomainType> |
217 | KAsync::Job<void> Store::remove(const DomainType &domainObject) | 219 | KAsync::Job<void> Store::remove(const DomainType &domainObject) |
218 | { | 220 | { |
221 | SinkTrace() << "Remove: " << domainObject; | ||
219 | // Potentially move to separate thread as well | 222 | // Potentially move to separate thread as well |
220 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); | 223 | auto facade = getFacade<DomainType>(domainObject.resourceInstanceIdentifier()); |
221 | return facade->remove(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to remove"; }); | 224 | return facade->remove(domainObject).addToContext(std::shared_ptr<void>(facade)).onError([](const KAsync::Error &error) { SinkWarning() << "Failed to remove"; }); |
diff --git a/sinksh/sinksh_utils.cpp b/sinksh/sinksh_utils.cpp index cb53ff2..06bcb8e 100644 --- a/sinksh/sinksh_utils.cpp +++ b/sinksh/sinksh_utils.cpp | |||
@@ -51,6 +51,9 @@ StoreBase &getStore(const QString &type) | |||
51 | } else if (type == getTypeName<SinkAccount>()) { | 51 | } else if (type == getTypeName<SinkAccount>()) { |
52 | static Store<SinkAccount> store; | 52 | static Store<SinkAccount> store; |
53 | return store; | 53 | return store; |
54 | } else if (type == getTypeName<Identity>()) { | ||
55 | static Store<Identity> store; | ||
56 | return store; | ||
54 | } | 57 | } |
55 | 58 | ||
56 | qWarning() << "Trying to get a store that doesn't exist, falling back to event"; | 59 | qWarning() << "Trying to get a store that doesn't exist, falling back to event"; |
@@ -75,6 +78,8 @@ QList<QByteArray> requestedProperties(const QString &type) | |||
75 | return QList<QByteArray>() << SinkResource::ResourceType::name << SinkResource::Account::name; | 78 | return QList<QByteArray>() << SinkResource::ResourceType::name << SinkResource::Account::name; |
76 | } else if (type == getTypeName<SinkAccount>()) { | 79 | } else if (type == getTypeName<SinkAccount>()) { |
77 | return QList<QByteArray>() << SinkAccount::AccountType::name << SinkAccount::Name::name; | 80 | return QList<QByteArray>() << SinkAccount::AccountType::name << SinkAccount::Name::name; |
81 | } else if (type == getTypeName<Identity>()) { | ||
82 | return QList<QByteArray>() << Identity::Name::name << Identity::Address::name; | ||
78 | } | 83 | } |
79 | return QList<QByteArray>(); | 84 | return QList<QByteArray>(); |
80 | } | 85 | } |