comparison OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5615:a10978a5e65c find-refactoring

expansion of single resources using ResourceFinder
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 09 May 2024 12:24:29 +0200
parents 4640b7ae9a11
children 1e92fb051fd7
comparison
equal deleted inserted replaced
5614:4640b7ae9a11 5615:a10978a5e65c
30 30
31 namespace Orthanc 31 namespace Orthanc
32 { 32 {
33 namespace Compatibility 33 namespace Compatibility
34 { 34 {
35 static bool IsRequestWithoutContraint(const FindRequest& request)
36 {
37 return (request.GetDicomTagConstraintsCount() == 0 &&
38 request.GetMetadataConstraintsCount() == 0 &&
39 request.GetLabels().empty() &&
40 request.GetOrdering().empty());
41 }
42
35 void GenericFind::ExecuteFind(std::list<std::string>& identifiers, 43 void GenericFind::ExecuteFind(std::list<std::string>& identifiers,
36 const FindRequest& request) 44 const FindRequest& request)
37 { 45 {
38 if (!request.GetOrthancIdentifiers().HasPatientId() && 46 if (IsRequestWithoutContraint(request) &&
47 !request.GetOrthancIdentifiers().HasPatientId() &&
39 !request.GetOrthancIdentifiers().HasStudyId() && 48 !request.GetOrthancIdentifiers().HasStudyId() &&
40 !request.GetOrthancIdentifiers().HasSeriesId() && 49 !request.GetOrthancIdentifiers().HasSeriesId() &&
41 !request.GetOrthancIdentifiers().HasInstanceId() && 50 !request.GetOrthancIdentifiers().HasInstanceId())
42 request.GetDicomTagConstraintsCount() == 0 &&
43 request.GetMetadataConstraintsCount() == 0 &&
44 request.GetLabels().empty() &&
45 request.GetOrdering().empty())
46 { 51 {
47 if (request.HasLimits()) 52 if (request.HasLimits())
48 { 53 {
49 transaction_.GetAllPublicIds(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); 54 transaction_.GetAllPublicIds(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount());
50 } 55 }
51 else 56 else
52 { 57 {
53 transaction_.GetAllPublicIds(identifiers, request.GetLevel()); 58 transaction_.GetAllPublicIds(identifiers, request.GetLevel());
54 } 59 }
60 }
61 else if (IsRequestWithoutContraint(request) &&
62 request.GetOrthancIdentifiers().HasPatientId() &&
63 !request.GetOrthancIdentifiers().HasStudyId() &&
64 !request.GetOrthancIdentifiers().HasSeriesId() &&
65 !request.GetOrthancIdentifiers().HasInstanceId())
66 {
67 identifiers.push_back(request.GetOrthancIdentifiers().GetPatientId());
68 }
69 else if (IsRequestWithoutContraint(request) &&
70 !request.GetOrthancIdentifiers().HasPatientId() &&
71 request.GetOrthancIdentifiers().HasStudyId() &&
72 !request.GetOrthancIdentifiers().HasSeriesId() &&
73 !request.GetOrthancIdentifiers().HasInstanceId())
74 {
75 identifiers.push_back(request.GetOrthancIdentifiers().GetStudyId());
76 }
77 else if (IsRequestWithoutContraint(request) &&
78 !request.GetOrthancIdentifiers().HasPatientId() &&
79 !request.GetOrthancIdentifiers().HasStudyId() &&
80 request.GetOrthancIdentifiers().HasSeriesId() &&
81 !request.GetOrthancIdentifiers().HasInstanceId())
82 {
83 identifiers.push_back(request.GetOrthancIdentifiers().GetSeriesId());
84 }
85 else if (IsRequestWithoutContraint(request) &&
86 !request.GetOrthancIdentifiers().HasPatientId() &&
87 !request.GetOrthancIdentifiers().HasStudyId() &&
88 !request.GetOrthancIdentifiers().HasSeriesId() &&
89 request.GetOrthancIdentifiers().HasInstanceId())
90 {
91 identifiers.push_back(request.GetOrthancIdentifiers().GetInstanceId());
55 } 92 }
56 else 93 else
57 { 94 {
58 throw OrthancException(ErrorCode_NotImplemented); // Not supported 95 throw OrthancException(ErrorCode_NotImplemented); // Not supported
59 } 96 }