# HG changeset patch # User Sebastien Jodogne # Date 1715157971 -7200 # Node ID 6e2dad336446fe1f7db825fcda903c39cd0fdbf8 # Parent 3f24eb4013d8b5fcb1352f24d3d86064622cd34e added "IsStable" field in expanded resources diff -r 3f24eb4013d8 -r 6e2dad336446 OrthancServer/Sources/Database/Compatibility/GenericFind.cpp --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed May 08 10:30:57 2024 +0200 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed May 08 10:46:11 2024 +0200 @@ -189,7 +189,7 @@ throw OrthancException(ErrorCode_DatabasePlugin); } - std::unique_ptr resource(new FindResponse::Resource(request.GetLevel(), identifier)); + std::unique_ptr resource(new FindResponse::Resource(request.GetLevel(), internalId, identifier)); if (request.IsRetrieveParentIdentifier()) { diff -r 3f24eb4013d8 -r 6e2dad336446 OrthancServer/Sources/Database/FindResponse.h --- a/OrthancServer/Sources/Database/FindResponse.h Wed May 08 10:30:57 2024 +0200 +++ b/OrthancServer/Sources/Database/FindResponse.h Wed May 08 10:46:11 2024 +0200 @@ -73,6 +73,7 @@ typedef std::map*> ChildrenMetadata; ResourceType level_; + int64_t internalId_; // Internal ID of the resource in the database std::string identifier_; std::unique_ptr parentIdentifier_; MainDicomTagsAtLevel mainDicomTagsPatient_; @@ -98,8 +99,10 @@ public: Resource(ResourceType level, + int64_t internalId, const std::string& identifier) : level_(level), + internalId_(internalId), identifier_(identifier) { } @@ -111,6 +114,11 @@ return level_; } + int64_t GetInternalId() const + { + return internalId_; + } + const std::string& GetIdentifier() const { return identifier_; diff -r 3f24eb4013d8 -r 6e2dad336446 OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed May 08 10:30:57 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed May 08 10:46:11 2024 +0200 @@ -268,29 +268,10 @@ void Expand(Json::Value& target, - const FindResponse::Resource& resource) const + const FindResponse::Resource& resource, + ServerIndex& index) const { /** - - TODO-FIND: - - - Metadata / Series / ExpectedNumberOfInstances - - - Metadata / Series / Status - - - Metadata / Instance / FileSize - - - Metadata / Instance / FileUuid - - - Metadata / Instance / IndexInSeries - - - Metadata / AnonymizedFrom - - - Metadata / ModifiedFrom - - **/ - - /** * This method closely follows "SerializeExpandedResource()" in * "ServerContext.cpp" from Orthanc 1.12.3. **/ @@ -300,6 +281,11 @@ throw OrthancException(ErrorCode_InternalError); } + if (!requestedTags_.empty()) + { + throw OrthancException(ErrorCode_NotImplemented); + } + target = Json::objectValue; target["Type"] = GetResourceTypeText(resource.GetLevel(), false, true); @@ -428,14 +414,7 @@ resource.GetLevel() == ResourceType_Study || resource.GetLevel() == ResourceType_Series) { - // TODO-FIND: Stable - - /* - if (resource.IsStable()) - { - target["IsStable"] = true; - } - */ + target["IsStable"] = !index.IsUnstableResource(resource.GetLevel(), resource.GetInternalId()); if (resource.LookupMetadata(s, resource.GetLevel(), MetadataType_LastUpdate)) { @@ -444,6 +423,10 @@ } { + // TODO-FIND : (expandFlags & ExpandResourceFlags_IncludeMainDicomTags) + } + + { Json::Value labels = Json::arrayValue; for (std::set::const_iterator @@ -455,7 +438,7 @@ target["Labels"] = labels; } - if (includeAllMetadata_) + if (includeAllMetadata_) // new in Orthanc 1.12.4 { const std::map& m = resource.GetMetadata(resource.GetLevel()); @@ -540,7 +523,7 @@ for (size_t i = 0; i < response.GetSize(); i++) { Json::Value item; - Expand(item, response.GetResource(i)); + Expand(item, response.GetResource(i), context.GetIndex()); #if 0 target.append(item); diff -r 3f24eb4013d8 -r 6e2dad336446 OrthancServer/Sources/ServerIndex.h --- a/OrthancServer/Sources/ServerIndex.h Wed May 08 10:30:57 2024 +0200 +++ b/OrthancServer/Sources/ServerIndex.h Wed May 08 10:46:11 2024 +0200 @@ -59,9 +59,6 @@ int64_t id, const std::string& publicId); - bool IsUnstableResource(ResourceType type, - int64_t id); - public: ServerIndex(ServerContext& context, IDatabaseWrapper& database, @@ -98,5 +95,8 @@ bool hasOldRevision, int64_t oldRevision, const std::string& oldMD5); + + bool IsUnstableResource(ResourceType type, + int64_t id); }; }