# HG changeset patch # User Alain Mazy # Date 1647331792 -3600 # Node ID e8a2e145c80e79860749273f523c50ad61c7b0bb # Parent f630796a59b1383516fa48c1efbb71933ddf2167 cleanup diff -r f630796a59b1 -r e8a2e145c80e OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Mon Mar 14 16:44:00 2022 +0100 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Tue Mar 15 09:09:52 2022 +0100 @@ -713,11 +713,10 @@ bool StatelessDatabaseOperations::ExpandResource(ExpandedResource& target, const std::string& publicId, ResourceType level, - DicomToJsonFormat format, const std::set& requestedTags) { - class Operations : public ReadOnlyOperationsT6< - bool&, ExpandedResource&, const std::string&, ResourceType, DicomToJsonFormat, const std::set&> + class Operations : public ReadOnlyOperationsT5< + bool&, ExpandedResource&, const std::string&, ResourceType, const std::set&> { private: @@ -1025,7 +1024,7 @@ transaction.GetMainDicomTags(target.tags_, internalId); // check if we have access to all requestedTags or if we must get tags from parents - const std::set& requestedTags = tuple.get<5>(); + const std::set& requestedTags = tuple.get<4>(); if (requestedTags.size() > 0) { @@ -1140,7 +1139,7 @@ bool found; Operations operations; - operations.Apply(*this, found, target, publicId, level, format, requestedTags); + operations.Apply(*this, found, target, publicId, level, requestedTags); return found; } diff -r f630796a59b1 -r e8a2e145c80e OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Mon Mar 14 16:44:00 2022 +0100 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Tue Mar 15 09:09:52 2022 +0100 @@ -479,7 +479,6 @@ bool ExpandResource(ExpandedResource& target, const std::string& publicId, ResourceType level, - DicomToJsonFormat format, const std::set& requestedTags); void GetAllMetadata(std::map& target, diff -r f630796a59b1 -r e8a2e145c80e OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Mon Mar 14 16:44:00 2022 +0100 +++ b/OrthancServer/Sources/ServerContext.cpp Tue Mar 15 09:09:52 2022 +0100 @@ -2270,15 +2270,31 @@ bool ServerContext::ExpandResource(Json::Value& target, const std::string& publicId, - const std::string& instanceId, // optional: the id of an instance for the resource - const Json::Value& dicomAsJson, // optional: the dicom-as-json for the resource + const std::string& instanceId, // optional: the id of an instance for the resource (if already available) + const Json::Value& dicomAsJson, // optional: the dicom-as-json for the resource (if already available) ResourceType level, DicomToJsonFormat format, const std::set& requestedTags) { ExpandedResource resource; - if (GetIndex().ExpandResource(resource, publicId, level, format, requestedTags)) + if (ExpandResource(resource, publicId, instanceId, dicomAsJson, level, requestedTags)) + { + SerializeExpandedResource(target, resource, format, requestedTags); + return true; + } + + return false; + } + + bool ServerContext::ExpandResource(ExpandedResource& resource, + const std::string& publicId, + const std::string& instanceId, // optional: the id of an instance for the resource (if already available) + const Json::Value& dicomAsJson, // optional: the dicom-as-json for the resource (if already available) + ResourceType level, + const std::set& requestedTags) + { + if (GetIndex().ExpandResource(resource, publicId, level, requestedTags)) { // check the main dicom tags list has not changed since the resource was stored if (resource.mainDicomTagsSignature_ != DicomMap::GetMainDicomTagsSignature(resource.type_)) @@ -2325,8 +2341,6 @@ resource.tags_.Merge(allTags); } - SerializeExpandedResource(target, resource, format, requestedTags); - return true; } diff -r f630796a59b1 -r e8a2e145c80e OrthancServer/Sources/ServerContext.h --- a/OrthancServer/Sources/ServerContext.h Mon Mar 14 16:44:00 2022 +0100 +++ b/OrthancServer/Sources/ServerContext.h Tue Mar 15 09:09:52 2022 +0100 @@ -554,5 +554,12 @@ DicomToJsonFormat format, const std::set& requestedTags); + bool ExpandResource(ExpandedResource& target, + const std::string& publicId, + const std::string& instanceId, // optional: the id of an instance for the resource + const Json::Value& dicomAsJson, // optional: the dicom-as-json for the resource + ResourceType level, + const std::set& requestedTags); + }; }