summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-21 10:10:15 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-11-21 10:45:04 +0100
commita188fb648ba001314adbb9d5cfc0bfb77198a5b9 (patch)
tree899e46c4d581e7a13df0efc58ceaaa80098d64c7
parenta1dcb117835f7c1f0604f0302b42edd905190a52 (diff)
downloadsink-a188fb648ba001314adbb9d5cfc0bfb77198a5b9.tar.gz
sink-a188fb648ba001314adbb9d5cfc0bfb77198a5b9.zip
sinksh list identity support
-rw-r--r--common/domain/applicationdomaintype.h2
-rw-r--r--common/store.cpp3
-rw-r--r--sinksh/sinksh_utils.cpp5
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
324struct SINK_EXPORT DummyResource { 326struct 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
200template <class DomainType> 200template <class DomainType>
201KAsync::Job<void> Store::create(const DomainType &domainObject) 201KAsync::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)
208template <class DomainType> 209template <class DomainType>
209KAsync::Job<void> Store::modify(const DomainType &domainObject) 210KAsync::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)
216template <class DomainType> 218template <class DomainType>
217KAsync::Job<void> Store::remove(const DomainType &domainObject) 219KAsync::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}