summaryrefslogtreecommitdiffstats
path: root/common/facade.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-04 10:36:58 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-12-04 10:36:58 +0100
commit59aa460cf704d5f1a1fb1fe6b8ede4457da083ff (patch)
treed1cf394099e4897d2b8abf6817191c488c754667 /common/facade.cpp
parent41006b5cab7b0260f8abc42aa2d2e959a013764e (diff)
downloadsink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.tar.gz
sink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.zip
Copy command and proper move
Diffstat (limited to 'common/facade.cpp')
-rw-r--r--common/facade.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/facade.cpp b/common/facade.cpp
index c618d4e..4f03073 100644
--- a/common/facade.cpp
+++ b/common/facade.cpp
@@ -80,6 +80,18 @@ KAsync::Job<void> GenericFacade<DomainType>::move(const DomainType &domainObject
80 SinkWarning() << "No domain type adaptor factory available"; 80 SinkWarning() << "No domain type adaptor factory available";
81 return KAsync::error<void>(); 81 return KAsync::error<void>();
82 } 82 }
83 return mResourceAccess->sendModifyCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType(), QByteArrayList(), BufferUtils::extractBuffer(entityFbb), domainObject.changedProperties(), newResource, true);
84}
85
86template <class DomainType>
87KAsync::Job<void> GenericFacade<DomainType>::copy(const DomainType &domainObject, const QByteArray &newResource)
88{
89 SinkTrace() << "Copying entity: " << domainObject.identifier() << domainObject.changedProperties() << newResource;
90 flatbuffers::FlatBufferBuilder entityFbb;
91 if (!mResourceContext.adaptorFactory<DomainType>().createBuffer(domainObject, entityFbb)) {
92 SinkWarning() << "No domain type adaptor factory available";
93 return KAsync::error<void>();
94 }
83 return mResourceAccess->sendModifyCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType(), QByteArrayList(), BufferUtils::extractBuffer(entityFbb), domainObject.changedProperties(), newResource, false); 95 return mResourceAccess->sendModifyCommand(domainObject.identifier(), domainObject.revision(), bufferTypeForDomainType(), QByteArrayList(), BufferUtils::extractBuffer(entityFbb), domainObject.changedProperties(), newResource, false);
84} 96}
85 97