diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/domain/applicationdomaintype.h | 2 | ||||
-rw-r--r-- | common/propertymapper.cpp | 12 | ||||
-rw-r--r-- | common/storage/entitystore.cpp | 1 |
3 files changed, 12 insertions, 3 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index 98b7de7..7380c04 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -280,7 +280,7 @@ inline QDebug operator<< (QDebug d, const Reference &ref) | |||
280 | 280 | ||
281 | inline QDebug operator<< (QDebug d, const BLOB &blob) | 281 | inline QDebug operator<< (QDebug d, const BLOB &blob) |
282 | { | 282 | { |
283 | d << blob.value; | 283 | d << blob.value << "external:" << blob.isExternal ; |
284 | return d; | 284 | return d; |
285 | } | 285 | } |
286 | 286 | ||
diff --git a/common/propertymapper.cpp b/common/propertymapper.cpp index 4cfe154..4d45644 100644 --- a/common/propertymapper.cpp +++ b/common/propertymapper.cpp | |||
@@ -36,7 +36,9 @@ template <> | |||
36 | flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) | 36 | flatbuffers::uoffset_t variantToProperty<Sink::ApplicationDomain::BLOB>(const QVariant &property, flatbuffers::FlatBufferBuilder &fbb) |
37 | { | 37 | { |
38 | if (property.isValid()) { | 38 | if (property.isValid()) { |
39 | return fbb.CreateString(property.value<Sink::ApplicationDomain::BLOB>().value.toStdString()).o; | 39 | const auto blob = property.value<Sink::ApplicationDomain::BLOB>(); |
40 | auto s = blob.value + (blob.isExternal ? ":ext" : ":int"); | ||
41 | return fbb.CreateString(s.toStdString()).o; | ||
40 | } | 42 | } |
41 | return 0; | 43 | return 0; |
42 | } | 44 | } |
@@ -133,7 +135,13 @@ QVariant propertyToVariant<Sink::ApplicationDomain::BLOB>(const flatbuffers::Str | |||
133 | { | 135 | { |
134 | if (property) { | 136 | if (property) { |
135 | // We have to copy the memory, otherwise it would become eventually invalid | 137 | // We have to copy the memory, otherwise it would become eventually invalid |
136 | return QVariant::fromValue(Sink::ApplicationDomain::BLOB{QString::fromStdString(property->c_str())}); | 138 | auto s = QString::fromStdString(property->c_str()); |
139 | auto ext = s.endsWith(":ext"); | ||
140 | s.chop(4); | ||
141 | |||
142 | auto blob = Sink::ApplicationDomain::BLOB{s}; | ||
143 | blob.isExternal = ext; | ||
144 | return QVariant::fromValue(blob); | ||
137 | } | 145 | } |
138 | return QVariant(); | 146 | return QVariant(); |
139 | } | 147 | } |
diff --git a/common/storage/entitystore.cpp b/common/storage/entitystore.cpp index 51e5da7..9156dd4 100644 --- a/common/storage/entitystore.cpp +++ b/common/storage/entitystore.cpp | |||
@@ -162,6 +162,7 @@ void EntityStore::copyBlobs(ApplicationDomain::ApplicationDomainType &entity, qi | |||
162 | SinkWarningCtx(d->logCtx) << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); | 162 | SinkWarningCtx(d->logCtx) << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); |
163 | } | 163 | } |
164 | origFile.close(); | 164 | origFile.close(); |
165 | SinkTraceCtx(d->logCtx) << "Moved blob property: " << property << " from " << oldPath << "to" << filePath; | ||
165 | entity.setProperty(property, QVariant::fromValue(ApplicationDomain::BLOB{filePath})); | 166 | entity.setProperty(property, QVariant::fromValue(ApplicationDomain::BLOB{filePath})); |
166 | } | 167 | } |
167 | } | 168 | } |