comparison OrthancServer/Sources/ResourceFinder.cpp @ 5858:66fd63b8601e find-refactoring tip

StorageAccessOnFind: cont
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 22:34:14 +0100
parents d1dea8ad74a6
children
comparison
equal deleted inserted replaced
5857:39996519afce 5858:66fd63b8601e
1112 1112
1113 1113
1114 if (!remainingRequestedTags.empty() && 1114 if (!remainingRequestedTags.empty() &&
1115 !DicomMap::HasOnlyComputedTags(remainingRequestedTags)) // if the only remaining tags are computed tags, it is worthless to read them from disk 1115 !DicomMap::HasOnlyComputedTags(remainingRequestedTags)) // if the only remaining tags are computed tags, it is worthless to read them from disk
1116 { 1116 {
1117 if (IsStorageAccessAllowedOnAnswers()) 1117 // If a lookup tag is not available from DB, it is included in remainingRequestedTags and it will always be included in the answer too
1118 // -> from 1.12.5, "StorageAccessOnFind": "Always" is actually equivalent to "StorageAccessOnFind": "Answers"
1119 if (IsStorageAccessAllowed())
1118 { 1120 {
1119 ReadMissingTagsFromStorageArea(outRequestedTags, context, request_, resource, remainingRequestedTags); 1121 ReadMissingTagsFromStorageArea(outRequestedTags, context, request_, resource, remainingRequestedTags);
1120 } 1122 }
1121 else if (isWarning007Enabled) 1123 else if (isWarning007Enabled)
1122 { 1124 {
1193 { 1195 {
1194 visitor.MarkAsComplete(); 1196 visitor.MarkAsComplete();
1195 } 1197 }
1196 } 1198 }
1197 1199
1198 bool ResourceFinder::IsStorageAccessAllowedOnAnswers() 1200 bool ResourceFinder::IsStorageAccessAllowed()
1199 { 1201 {
1200 switch (storageAccessMode_) 1202 switch (storageAccessMode_)
1201 { 1203 {
1202 case FindStorageAccessMode_DiskOnAnswer: 1204 case FindStorageAccessMode_DiskOnAnswer:
1203 case FindStorageAccessMode_DiskOnLookupAndAnswer: 1205 case FindStorageAccessMode_DiskOnLookupAndAnswer:
1204 return true; 1206 return true;
1205 case FindStorageAccessMode_DatabaseOnly: 1207 case FindStorageAccessMode_DatabaseOnly:
1206 return false; 1208 return false;
1207 default:
1208 throw OrthancException(ErrorCode_InternalError);
1209 }
1210 }
1211
1212
1213 bool ResourceFinder::IsStorageAccessOnLookup()
1214 {
1215 switch (storageAccessMode_)
1216 {
1217 case FindStorageAccessMode_DiskOnAnswer:
1218 return false;
1219 case FindStorageAccessMode_DiskOnLookupAndAnswer:
1220 case FindStorageAccessMode_DatabaseOnly:
1221 return true;
1222 default: 1209 default:
1223 throw OrthancException(ErrorCode_InternalError); 1210 throw OrthancException(ErrorCode_InternalError);
1224 } 1211 }
1225 } 1212 }
1226 1213