summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/domain/applicationdomaintype.h10
-rw-r--r--common/store.h3
-rw-r--r--tests/clientapitest.cpp2
3 files changed, 15 insertions, 0 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 602d54c..1250455 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -270,7 +270,17 @@ public:
270 bool hasProperty(const QByteArray &key) const; 270 bool hasProperty(const QByteArray &key) const;
271 271
272 QVariant getProperty(const QByteArray &key) const; 272 QVariant getProperty(const QByteArray &key) const;
273
274 /**
275 * Set a property and record a changed property
276 *
277 * If the propery is available and did not change the call will be ignored.
278 */
273 void setProperty(const QByteArray &key, const QVariant &value); 279 void setProperty(const QByteArray &key, const QVariant &value);
280
281 /**
282 * Convenience method to set a reference property.
283 */
274 void setProperty(const QByteArray &key, const ApplicationDomainType &value); 284 void setProperty(const QByteArray &key, const ApplicationDomainType &value);
275 285
276 QByteArray getBlobProperty(const QByteArray &key) const; 286 QByteArray getBlobProperty(const QByteArray &key) const;
diff --git a/common/store.h b/common/store.h
index 34e14df..3ad547e 100644
--- a/common/store.h
+++ b/common/store.h
@@ -75,12 +75,15 @@ KAsync::Job<void> SINK_EXPORT create(const DomainType &domainObject);
75 * Modify an entity. 75 * Modify an entity.
76 * 76 *
77 * This includes moving etc. since these are also simple settings on a property. 77 * This includes moving etc. since these are also simple settings on a property.
78 * Note that the modification will be dropped if there is no changedProperty on the domain object.
78 */ 79 */
79template <class DomainType> 80template <class DomainType>
80KAsync::Job<void> SINK_EXPORT modify(const DomainType &domainObject); 81KAsync::Job<void> SINK_EXPORT modify(const DomainType &domainObject);
81 82
82/** 83/**
83 * Modify a set of entities identified by @param query. 84 * Modify a set of entities identified by @param query.
85 *
86 * Note that the modification will be dropped if there is no changedProperty on the domain object.
84 */ 87 */
85template <class DomainType> 88template <class DomainType>
86KAsync::Job<void> SINK_EXPORT modify(const Query &query, const DomainType &domainObject); 89KAsync::Job<void> SINK_EXPORT modify(const Query &query, const DomainType &domainObject);
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp
index 3955ebd..7e348c2 100644
--- a/tests/clientapitest.cpp
+++ b/tests/clientapitest.cpp
@@ -360,6 +360,8 @@ private slots:
360 auto event = Sink::ApplicationDomain::Event::createEntity<Sink::ApplicationDomain::Event>("dummyresource.instance1"); 360 auto event = Sink::ApplicationDomain::Event::createEntity<Sink::ApplicationDomain::Event>("dummyresource.instance1");
361 Sink::Store::create(event).exec().waitForFinished(); 361 Sink::Store::create(event).exec().waitForFinished();
362 QCOMPARE(facade->creations.size(), 1); 362 QCOMPARE(facade->creations.size(), 1);
363 //Modify something so the mdofication won't be dropped
364 event.setSummary("foobar");
363 Sink::Store::modify(event).exec().waitForFinished(); 365 Sink::Store::modify(event).exec().waitForFinished();
364 QCOMPARE(facade->modifications.size(), 1); 366 QCOMPARE(facade->modifications.size(), 1);
365 Sink::Store::remove(event).exec().waitForFinished(); 367 Sink::Store::remove(event).exec().waitForFinished();