Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5676:b744a2cf408a find-refactoring
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 06 Jul 2024 15:04:28 +0200 |
parents | 74f3aab95886 |
children | dc96401dbe88 |
comparison
equal
deleted
inserted
replaced
5675:2b65f25cb1c8 | 5676:b744a2cf408a |
---|---|
238 { | 238 { |
239 case ResourceType_Patient: | 239 case ResourceType_Patient: |
240 return ResourceType_Patient; | 240 return ResourceType_Patient; |
241 | 241 |
242 case ResourceType_Study: | 242 case ResourceType_Study: |
243 if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) | 243 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
244 { | 244 { |
245 return ResourceType_Patient; | 245 return ResourceType_Patient; |
246 } | 246 } |
247 else | 247 else |
248 { | 248 { |
249 return ResourceType_Study; | 249 return ResourceType_Study; |
250 } | 250 } |
251 | 251 |
252 case ResourceType_Series: | 252 case ResourceType_Series: |
253 if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) | 253 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
254 { | 254 { |
255 return ResourceType_Patient; | 255 return ResourceType_Patient; |
256 } | 256 } |
257 else if (request.GetParentRetrieveSpecification(ResourceType_Study).IsOfInterest()) | 257 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
258 { | 258 { |
259 return ResourceType_Study; | 259 return ResourceType_Study; |
260 } | 260 } |
261 else | 261 else |
262 { | 262 { |
263 return ResourceType_Series; | 263 return ResourceType_Series; |
264 } | 264 } |
265 | 265 |
266 case ResourceType_Instance: | 266 case ResourceType_Instance: |
267 if (request.GetParentRetrieveSpecification(ResourceType_Patient).IsOfInterest()) | 267 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
268 { | 268 { |
269 return ResourceType_Patient; | 269 return ResourceType_Patient; |
270 } | 270 } |
271 else if (request.GetParentRetrieveSpecification(ResourceType_Study).IsOfInterest()) | 271 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
272 { | 272 { |
273 return ResourceType_Study; | 273 return ResourceType_Study; |
274 } | 274 } |
275 else if (request.GetParentRetrieveSpecification(ResourceType_Series).IsOfInterest()) | 275 else if (request.GetParentSpecification(ResourceType_Series).IsOfInterest()) |
276 { | 276 { |
277 return ResourceType_Series; | 277 return ResourceType_Series; |
278 } | 278 } |
279 else | 279 else |
280 { | 280 { |
290 static ResourceType GetBottomLevelOfInterest(const FindRequest& request) | 290 static ResourceType GetBottomLevelOfInterest(const FindRequest& request) |
291 { | 291 { |
292 switch (request.GetLevel()) | 292 switch (request.GetLevel()) |
293 { | 293 { |
294 case ResourceType_Patient: | 294 case ResourceType_Patient: |
295 if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) | 295 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
296 { | 296 { |
297 return ResourceType_Instance; | 297 return ResourceType_Instance; |
298 } | 298 } |
299 else if (request.GetChildrenRetrieveSpecification(ResourceType_Series).IsOfInterest()) | 299 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
300 { | 300 { |
301 return ResourceType_Series; | 301 return ResourceType_Series; |
302 } | 302 } |
303 else if (request.GetChildrenRetrieveSpecification(ResourceType_Study).IsOfInterest()) | 303 else if (request.GetChildrenSpecification(ResourceType_Study).IsOfInterest()) |
304 { | 304 { |
305 return ResourceType_Study; | 305 return ResourceType_Study; |
306 } | 306 } |
307 else | 307 else |
308 { | 308 { |
309 return ResourceType_Patient; | 309 return ResourceType_Patient; |
310 } | 310 } |
311 | 311 |
312 case ResourceType_Study: | 312 case ResourceType_Study: |
313 if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) | 313 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
314 { | 314 { |
315 return ResourceType_Instance; | 315 return ResourceType_Instance; |
316 } | 316 } |
317 else if (request.GetChildrenRetrieveSpecification(ResourceType_Series).IsOfInterest()) | 317 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
318 { | 318 { |
319 return ResourceType_Series; | 319 return ResourceType_Series; |
320 } | 320 } |
321 else | 321 else |
322 { | 322 { |
323 return ResourceType_Study; | 323 return ResourceType_Study; |
324 } | 324 } |
325 | 325 |
326 case ResourceType_Series: | 326 case ResourceType_Series: |
327 if (request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsOfInterest()) | 327 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
328 { | 328 { |
329 return ResourceType_Instance; | 329 return ResourceType_Instance; |
330 } | 330 } |
331 else | 331 else |
332 { | 332 { |
420 else | 420 else |
421 { | 421 { |
422 throw OrthancException(ErrorCode_DatabasePlugin); | 422 throw OrthancException(ErrorCode_DatabasePlugin); |
423 } | 423 } |
424 | 424 |
425 if (request.GetParentRetrieveSpecification(currentLevel).IsRetrieveMainDicomTags()) | 425 if (request.GetParentSpecification(currentLevel).IsRetrieveMainDicomTags()) |
426 { | 426 { |
427 RetrieveMainDicomTags(*resource, currentLevel, currentId); | 427 RetrieveMainDicomTags(*resource, currentLevel, currentId); |
428 } | 428 } |
429 | 429 |
430 if (request.GetParentRetrieveSpecification(currentLevel).IsRetrieveMetadata()) | 430 if (request.GetParentSpecification(currentLevel).IsRetrieveMetadata()) |
431 { | 431 { |
432 transaction_.GetAllMetadata(resource->GetMetadata(currentLevel), currentId); | 432 transaction_.GetAllMetadata(resource->GetMetadata(currentLevel), currentId); |
433 } | 433 } |
434 } | 434 } |
435 } | 435 } |
470 | 470 |
471 while (currentLevel != bottomLevel) | 471 while (currentLevel != bottomLevel) |
472 { | 472 { |
473 ResourceType childrenLevel = GetChildResourceType(currentLevel); | 473 ResourceType childrenLevel = GetChildResourceType(currentLevel); |
474 | 474 |
475 if (request.GetChildrenRetrieveSpecification(childrenLevel).IsRetrieveIdentifiers()) | 475 if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) |
476 { | 476 { |
477 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) | 477 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) |
478 { | 478 { |
479 std::list<std::string> ids; | 479 std::list<std::string> ids; |
480 transaction_.GetChildrenPublicId(ids, *it); | 480 transaction_.GetChildrenPublicId(ids, *it); |
484 resource->AddChildIdentifier(childrenLevel, *it2); | 484 resource->AddChildIdentifier(childrenLevel, *it2); |
485 } | 485 } |
486 } | 486 } |
487 } | 487 } |
488 | 488 |
489 const std::set<MetadataType>& metadata = request.GetChildrenRetrieveSpecification(childrenLevel).GetMetadata(); | 489 const std::set<MetadataType>& metadata = request.GetChildrenSpecification(childrenLevel).GetMetadata(); |
490 | 490 |
491 for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) | 491 for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) |
492 { | 492 { |
493 for (std::list<int64_t>::const_iterator it2 = currentIds.begin(); it2 != currentIds.end(); ++it2) | 493 for (std::list<int64_t>::const_iterator it2 = currentIds.begin(); it2 != currentIds.end(); ++it2) |
494 { | 494 { |
500 resource->AddChildrenMetadataValue(childrenLevel, *it, *it3); | 500 resource->AddChildrenMetadataValue(childrenLevel, *it, *it3); |
501 } | 501 } |
502 } | 502 } |
503 } | 503 } |
504 | 504 |
505 const std::set<DicomTag>& mainDicomTags = request.GetChildrenRetrieveSpecification(childrenLevel).GetMainDicomTags(); | 505 const std::set<DicomTag>& mainDicomTags = request.GetChildrenSpecification(childrenLevel).GetMainDicomTags(); |
506 | 506 |
507 if (childrenLevel != bottomLevel || | 507 if (childrenLevel != bottomLevel || |
508 !mainDicomTags.empty()) | 508 !mainDicomTags.empty()) |
509 { | 509 { |
510 std::list<int64_t> childrenIds; | 510 std::list<int64_t> childrenIds; |
545 currentLevel = childrenLevel; | 545 currentLevel = childrenLevel; |
546 } | 546 } |
547 } | 547 } |
548 | 548 |
549 if (request.IsRetrieveOneInstanceIdentifier() && | 549 if (request.IsRetrieveOneInstanceIdentifier() && |
550 !request.GetChildrenRetrieveSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) | 550 !request.GetChildrenSpecification(ResourceType_Instance).IsRetrieveIdentifiers()) |
551 { | 551 { |
552 int64_t currentId = internalId; | 552 int64_t currentId = internalId; |
553 ResourceType currentLevel = level; | 553 ResourceType currentLevel = level; |
554 | 554 |
555 while (currentLevel != ResourceType_Instance) | 555 while (currentLevel != ResourceType_Instance) |