comparison OrthancServer/Sources/OrthancWebDav.cpp @ 5856:d1dea8ad74a6 find-refactoring

implement StorageAccessOnFind for answers
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 21:51:24 +0100
parents ea547160f27e
children
comparison
equal deleted inserted replaced
5855:aeb9f63923b1 5856:d1dea8ad74a6
935 query.AddRestConstraint(DICOM_TAG_STUDY_DATE, year_ + month_ + "01-" + year_ + month_ + "31", 935 query.AddRestConstraint(DICOM_TAG_STUDY_DATE, year_ + month_ + "01-" + year_ + month_ + "31",
936 true /* case sensitive */, true /* mandatory tag */); 936 true /* case sensitive */, true /* mandatory tag */);
937 937
938 Visitor visitor(resources); 938 Visitor visitor(resources);
939 939
940 ResourceFinder finder(ResourceType_Study, ResponseContentFlags_ID); 940 ResourceFinder finder(ResourceType_Study, ResponseContentFlags_ID, GetContext().GetFindStorageAccessMode());
941 finder.SetDatabaseLookup(query); 941 finder.SetDatabaseLookup(query);
942 finder.Execute(visitor, GetContext()); 942 finder.Execute(visitor, GetContext());
943 } 943 }
944 944
945 virtual INode* CreateResourceNode(const std::string& resource) ORTHANC_OVERRIDE 945 virtual INode* CreateResourceNode(const std::string& resource) ORTHANC_OVERRIDE
1013 query.AddRestConstraint(DICOM_TAG_STUDY_DATE, year_ + "0101-" + year_ + "1231", 1013 query.AddRestConstraint(DICOM_TAG_STUDY_DATE, year_ + "0101-" + year_ + "1231",
1014 true /* case sensitive */, true /* mandatory tag */); 1014 true /* case sensitive */, true /* mandatory tag */);
1015 1015
1016 Visitor visitor; 1016 Visitor visitor;
1017 1017
1018 ResourceFinder finder(ResourceType_Study, ResponseContentFlags_ID); 1018 ResourceFinder finder(ResourceType_Study, ResponseContentFlags_ID, context_.GetFindStorageAccessMode());
1019 finder.SetDatabaseLookup(query); 1019 finder.SetDatabaseLookup(query);
1020 finder.Execute(visitor, context_); 1020 finder.Execute(visitor, context_);
1021 1021
1022 for (std::set<std::string>::const_iterator it = visitor.GetMonths().begin(); 1022 for (std::set<std::string>::const_iterator it = visitor.GetMonths().begin();
1023 it != visitor.GetMonths().end(); ++it) 1023 it != visitor.GetMonths().end(); ++it)
1391 else 1391 else
1392 { 1392 {
1393 return false; 1393 return false;
1394 } 1394 }
1395 1395
1396 ResourceFinder finder(level, ResponseContentFlags_ID); 1396 ResourceFinder finder(level, ResponseContentFlags_ID, context_.GetFindStorageAccessMode());
1397 finder.SetDatabaseLookup(query); 1397 finder.SetDatabaseLookup(query);
1398 finder.SetRetrieveMetadata(true); 1398 finder.SetRetrieveMetadata(true);
1399 1399
1400 switch (level) 1400 switch (level)
1401 { 1401 {
1442 static bool GetOrthancJson(std::string& target, 1442 static bool GetOrthancJson(std::string& target,
1443 ServerContext& context, 1443 ServerContext& context,
1444 ResourceType level, 1444 ResourceType level,
1445 const DatabaseLookup& query) 1445 const DatabaseLookup& query)
1446 { 1446 {
1447 ResourceFinder finder(level, ResponseContentFlags_ExpandTrue); 1447 ResourceFinder finder(level, ResponseContentFlags_ExpandTrue, context.GetFindStorageAccessMode());
1448 finder.SetDatabaseLookup(query); 1448 finder.SetDatabaseLookup(query);
1449 1449
1450 Json::Value expanded; 1450 Json::Value expanded;
1451 finder.Execute(expanded, context, DicomToJsonFormat_Human, false /* don't add "Metadata" */); 1451 finder.Execute(expanded, context, DicomToJsonFormat_Human, false /* don't add "Metadata" */);
1452 1452
1512 query.AddRestConstraint(DICOM_TAG_SOP_INSTANCE_UID, sopInstanceUid, 1512 query.AddRestConstraint(DICOM_TAG_SOP_INSTANCE_UID, sopInstanceUid,
1513 true /* case sensitive */, true /* mandatory tag */); 1513 true /* case sensitive */, true /* mandatory tag */);
1514 1514
1515 mime = MimeType_Dicom; 1515 mime = MimeType_Dicom;
1516 1516
1517 ResourceFinder finder(ResourceType_Instance, ResponseContentFlags_ID); 1517 ResourceFinder finder(ResourceType_Instance, ResponseContentFlags_ID, context_.GetFindStorageAccessMode());
1518 finder.SetDatabaseLookup(query); 1518 finder.SetDatabaseLookup(query);
1519 finder.SetRetrieveMetadata(true); 1519 finder.SetRetrieveMetadata(true);
1520 finder.SetRetrieveAttachments(true); 1520 finder.SetRetrieveAttachments(true);
1521 1521
1522 DicomFileVisitorV2 visitor(context_, content, modificationTime); 1522 DicomFileVisitorV2 visitor(context_, content, modificationTime);
1642 } 1642 }
1643 } 1643 }
1644 1644
1645 DicomDeleteVisitor visitor(context_, level); 1645 DicomDeleteVisitor visitor(context_, level);
1646 1646
1647 ResourceFinder finder(level, ResponseContentFlags_ID); 1647 ResourceFinder finder(level, ResponseContentFlags_ID, context_.GetFindStorageAccessMode());
1648 finder.SetDatabaseLookup(query); 1648 finder.SetDatabaseLookup(query);
1649 finder.Execute(visitor, context_); 1649 finder.Execute(visitor, context_);
1650 return true; 1650 return true;
1651 } 1651 }
1652 else 1652 else