changeset 1719:3b1f7e706d38 db-changes

fix Orthanc.test_lookup
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 20 Oct 2015 10:21:41 +0200
parents 2b812969e136
children 88b74d8512be
files OrthancServer/OrthancRestApi/OrthancRestResources.cpp
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Tue Oct 20 10:11:22 2015 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp	Tue Oct 20 10:21:41 2015 +0200
@@ -882,11 +882,17 @@
   static void AccumulateLookupResults(ServerIndex::LookupResults& result,
                                       ServerIndex& index,
                                       const DicomTag& tag,
-                                      const std::string& value)
+                                      const std::string& value,
+                                      ResourceType level)
   {
-    ServerIndex::LookupResults tmp;
-    index.LookupIdentifier(tmp, tag, value);
-    result.insert(result.end(), tmp.begin(), tmp.end());
+    std::list<std::string> tmp;
+    index.LookupIdentifier(tmp, tag, value, level);
+
+    for (std::list<std::string>::const_iterator
+           it = tmp.begin(); it != tmp.end(); ++it)
+    {
+      result.push_back(std::make_pair(level, *it));
+    }
   }
 
 
@@ -897,10 +903,10 @@
 
     ServerIndex::LookupResults resources;
     ServerIndex& index = OrthancRestApi::GetIndex(call);
-    AccumulateLookupResults(resources, index, DICOM_TAG_PATIENT_ID, tag);
-    AccumulateLookupResults(resources, index, DICOM_TAG_STUDY_INSTANCE_UID, tag);
-    AccumulateLookupResults(resources, index, DICOM_TAG_SERIES_INSTANCE_UID, tag);
-    AccumulateLookupResults(resources, index, DICOM_TAG_SOP_INSTANCE_UID, tag);
+    AccumulateLookupResults(resources, index, DICOM_TAG_PATIENT_ID, tag, ResourceType_Patient);
+    AccumulateLookupResults(resources, index, DICOM_TAG_STUDY_INSTANCE_UID, tag, ResourceType_Study);
+    AccumulateLookupResults(resources, index, DICOM_TAG_SERIES_INSTANCE_UID, tag, ResourceType_Series);
+    AccumulateLookupResults(resources, index, DICOM_TAG_SOP_INSTANCE_UID, tag, ResourceType_Instance);
 
     Json::Value result = Json::arrayValue;    
     for (ServerIndex::LookupResults::const_iterator