diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-04 10:36:58 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-04 10:36:58 +0100 |
commit | 59aa460cf704d5f1a1fb1fe6b8ede4457da083ff (patch) | |
tree | d1cf394099e4897d2b8abf6817191c488c754667 /common/facade.cpp | |
parent | 41006b5cab7b0260f8abc42aa2d2e959a013764e (diff) | |
download | sink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.tar.gz sink-59aa460cf704d5f1a1fb1fe6b8ede4457da083ff.zip |
Copy command and proper move
Diffstat (limited to 'common/facade.cpp')
-rw-r--r-- | common/facade.cpp | 12 |
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 | |||
86 | template <class DomainType> | ||
87 | KAsync::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 | ||