From 5275b0f173579162176e2340cbb9eaedafe8334a Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 27 Jul 2017 16:00:50 -0600 Subject: Adjusted docs and test. --- common/domain/applicationdomaintype.h | 10 ++++++++++ common/store.h | 3 +++ tests/clientapitest.cpp | 2 ++ 3 files changed, 15 insertions(+) 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: bool hasProperty(const QByteArray &key) const; QVariant getProperty(const QByteArray &key) const; + + /** + * Set a property and record a changed property + * + * If the propery is available and did not change the call will be ignored. + */ void setProperty(const QByteArray &key, const QVariant &value); + + /** + * Convenience method to set a reference property. + */ void setProperty(const QByteArray &key, const ApplicationDomainType &value); 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 SINK_EXPORT create(const DomainType &domainObject); * Modify an entity. * * This includes moving etc. since these are also simple settings on a property. + * Note that the modification will be dropped if there is no changedProperty on the domain object. */ template KAsync::Job SINK_EXPORT modify(const DomainType &domainObject); /** * Modify a set of entities identified by @param query. + * + * Note that the modification will be dropped if there is no changedProperty on the domain object. */ template KAsync::Job 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: auto event = Sink::ApplicationDomain::Event::createEntity("dummyresource.instance1"); Sink::Store::create(event).exec().waitForFinished(); QCOMPARE(facade->creations.size(), 1); + //Modify something so the mdofication won't be dropped + event.setSummary("foobar"); Sink::Store::modify(event).exec().waitForFinished(); QCOMPARE(facade->modifications.size(), 1); Sink::Store::remove(event).exec().waitForFinished(); -- cgit v1.2.3