comparison OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5586:fc3914c07dd3 find-refactoring

refactoring FindResponse
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 May 2024 17:02:02 +0200
parents 74cc31c8db2b
children b51ee994cd6f
comparison
equal deleted inserted replaced
5583:74cc31c8db2b 5586:fc3914c07dd3
57 transaction_.GetAllPublicIds(ids, request.GetLevel()); 57 transaction_.GetAllPublicIds(ids, request.GetLevel());
58 } 58 }
59 59
60 for (std::list<std::string>::const_iterator it = ids.begin(); it != ids.end(); ++it) 60 for (std::list<std::string>::const_iterator it = ids.begin(); it != ids.end(); ++it)
61 { 61 {
62 OrthancIdentifiers identifiers; 62 response.Add(new FindResponse::Item(request.GetLevel(), *it));
63 identifiers.SetLevel(request.GetLevel(), *it);
64
65 response.Add(new FindResponse::Item(identifiers));
66 } 63 }
67 } 64 }
68 else 65 else
69 { 66 {
70 throw OrthancException(ErrorCode_NotImplemented); 67 throw OrthancException(ErrorCode_NotImplemented);
77 74
78 for (size_t i = 0; i < response.GetSize(); i++) 75 for (size_t i = 0; i < response.GetSize(); i++)
79 { 76 {
80 const FindResponse::Item& item = response.GetItem(i); 77 const FindResponse::Item& item = response.GetItem(i);
81 78
82 if (request.HasResponseContent(FindRequest::ResponseContent_MainDicomTags) 79 if (request.HasResponseContent(FindRequest::ResponseContent_MainDicomTags))
83 && !item.HasDicomMap())
84 { 80 {
85 throw OrthancException(ErrorCode_InternalError); 81 DicomMap tmp;
82 item.GetDicomTagsAtLevel(tmp, request.GetLevel());
83 if (tmp.GetSize() == 0)
84 {
85 throw OrthancException(ErrorCode_InternalError);
86 }
86 } 87 }
87 88
88 // TODO: other sanity checks 89 // TODO: other sanity checks
89 } 90 }
90 } 91 }