Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/Compatibility/GenericFind.cpp @ 5849:0f4345cbe558 find-refactoring
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2024 14:05:59 +0000 |
parents | 70a879a7b658 |
children | ea547160f27e |
rev | line source |
---|---|
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5641
3f13db27b399
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5621
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
3f13db27b399
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5621
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "GenericFind.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
5592
1e2631b8b9af
GenericFind::Execute() is working for a basic request
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5590
diff
changeset
|
26 #include "../../../../OrthancFramework/Sources/DicomFormat/DicomArray.h" |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "../../../../OrthancFramework/Sources/OrthancException.h" |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
29 #include <stack> |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
30 |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 namespace Orthanc |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 { |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 namespace Compatibility |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 { |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
36 static bool IsRequestWithoutContraint(const FindRequest& request) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
37 { |
5681
77875b51cf95
integration mainline->find-refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5677
diff
changeset
|
38 return (request.GetDicomTagConstraints().IsEmpty() && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
39 request.GetMetadataConstraintsCount() == 0 && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
40 request.GetLabels().empty() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
41 request.GetOrdering().empty()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
42 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
43 |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
44 static void GetChildren(std::list<int64_t>& target, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
45 IDatabaseWrapper::ITransaction& transaction, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
46 const std::list<int64_t>& resources) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
47 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
48 target.clear(); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
49 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
50 for (std::list<int64_t>::const_iterator it = resources.begin(); it != resources.end(); ++it) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
51 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
52 std::list<int64_t> tmp; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
53 transaction.GetChildrenInternalId(tmp, *it); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
54 target.splice(target.begin(), tmp); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
55 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
56 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
57 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
58 static void GetChildren(std::list<std::string>& target, |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
59 IDatabaseWrapper::ICompatibilityTransaction& transaction, |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
60 const std::list<int64_t>& resources) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
61 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
62 target.clear(); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
63 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
64 for (std::list<int64_t>::const_iterator it = resources.begin(); it != resources.end(); ++it) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
65 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
66 std::list<std::string> tmp; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
67 transaction.GetChildrenPublicId(tmp, *it); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
68 target.splice(target.begin(), tmp); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
69 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
70 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
71 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
72 static void GetChildrenIdentifiers(std::list<std::string>& children, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
73 IDatabaseWrapper::ITransaction& transaction, |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
74 IDatabaseWrapper::ICompatibilityTransaction& compatibilityTransaction, |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
75 const OrthancIdentifiers& identifiers, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
76 ResourceType topLevel, |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
77 ResourceType bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
78 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
79 if (!IsResourceLevelAboveOrEqual(topLevel, bottomLevel) || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
80 topLevel == bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
81 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
82 throw OrthancException(ErrorCode_InternalError); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
83 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
84 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
85 std::list<int64_t> currentResources; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
86 ResourceType currentLevel; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
87 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
88 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
89 int64_t id; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
90 if (!transaction.LookupResource(id, currentLevel, identifiers.GetLevel(topLevel)) || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
91 currentLevel != topLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
92 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
93 throw OrthancException(ErrorCode_InexistentItem); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
94 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
95 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
96 currentResources.push_back(id); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
97 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
98 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
99 while (currentLevel != bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
100 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
101 ResourceType nextLevel = GetChildResourceType(currentLevel); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
102 if (nextLevel == bottomLevel) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
103 { |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
104 GetChildren(children, compatibilityTransaction, currentResources); |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
105 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
106 else |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
107 { |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
108 std::list<int64_t> nextResources; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
109 GetChildren(nextResources, transaction, currentResources); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
110 currentResources.swap(nextResources); |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
111 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
112 |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
113 currentLevel = nextLevel; |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
114 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
115 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
116 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
117 void GenericFind::ExecuteFind(std::list<std::string>& identifiers, |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
118 const IDatabaseWrapper::Capabilities& capabilities, |
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
119 const FindRequest& request) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 { |
5677
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
121 if (!request.GetLabels().empty() && |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
122 !capabilities.HasLabelsSupport()) |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
123 { |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
124 throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support labels"); |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
125 } |
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
126 |
5840
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
127 if (!request.GetOrdering().empty()) |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
128 { |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
129 throw OrthancException(ErrorCode_NotImplemented, "The database backend doesn't support ordering"); |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
130 } |
b24b61331566
pagination: fixed compat with ODBC that does not support ExtendedFind
Alain Mazy <am@orthanc.team>
parents:
5773
diff
changeset
|
131 |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
132 if (IsRequestWithoutContraint(request) && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
133 !request.GetOrthancIdentifiers().HasPatientId() && |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 !request.GetOrthancIdentifiers().HasStudyId() && |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 !request.GetOrthancIdentifiers().HasSeriesId() && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
136 !request.GetOrthancIdentifiers().HasInstanceId()) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
5773
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
138 if (!request.HasLimits()) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
139 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
140 transaction_.GetAllPublicIds(identifiers, request.GetLevel()); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
141 } |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
142 else if (request.GetLimitsCount() != 0) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 { |
5847
70a879a7b658
introduction of IDatabaseWrapper::ICompatibilityTransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5840
diff
changeset
|
144 compatibilityTransaction_.GetAllPublicIdsCompatibility(identifiers, request.GetLevel(), request.GetLimitsSince(), request.GetLimitsCount()); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 { |
5773
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
148 // Starting with Orthanc 1.12.5, "limit=0" means "no limit" |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
149 std::list<std::string> tmp; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
150 transaction_.GetAllPublicIds(tmp, request.GetLevel()); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
151 |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
152 size_t count = 0; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
153 for (std::list<std::string>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
154 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
155 if (count >= request.GetLimitsSince()) |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
156 { |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
157 identifiers.push_back(*it); |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
158 } |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
159 |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
160 count++; |
3b7dce0e43c6
handling of case limit=0
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5772
diff
changeset
|
161 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
162 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 } |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
164 else if (IsRequestWithoutContraint(request) && |
5616 | 165 request.GetLevel() == ResourceType_Patient && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
166 request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
167 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
168 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
169 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
170 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
171 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
172 identifiers.push_back(request.GetOrthancIdentifiers().GetPatientId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
173 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
174 else if (IsRequestWithoutContraint(request) && |
5616 | 175 request.GetLevel() == ResourceType_Study && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
176 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
177 request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
178 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
179 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
180 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
181 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
182 identifiers.push_back(request.GetOrthancIdentifiers().GetStudyId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
183 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
184 else if (IsRequestWithoutContraint(request) && |
5616 | 185 request.GetLevel() == ResourceType_Series && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
186 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
187 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
188 request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
189 !request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
190 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
191 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
192 identifiers.push_back(request.GetOrthancIdentifiers().GetSeriesId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
193 } |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
194 else if (IsRequestWithoutContraint(request) && |
5616 | 195 request.GetLevel() == ResourceType_Instance && |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
196 !request.GetOrthancIdentifiers().HasPatientId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
197 !request.GetOrthancIdentifiers().HasStudyId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
198 !request.GetOrthancIdentifiers().HasSeriesId() && |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
199 request.GetOrthancIdentifiers().HasInstanceId()) |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
200 { |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
201 // TODO-FIND: This is a trivial case for which no transaction is needed |
5615
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
202 identifiers.push_back(request.GetOrthancIdentifiers().GetInstanceId()); |
a10978a5e65c
expansion of single resources using ResourceFinder
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5614
diff
changeset
|
203 } |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
204 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
205 (request.GetLevel() == ResourceType_Study || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
206 request.GetLevel() == ResourceType_Series || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
207 request.GetLevel() == ResourceType_Instance) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
208 request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
209 !request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
210 !request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
211 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
212 { |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
213 GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, |
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
214 request.GetOrthancIdentifiers(), ResourceType_Patient, request.GetLevel()); |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
215 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
216 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
217 (request.GetLevel() == ResourceType_Series || |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
218 request.GetLevel() == ResourceType_Instance) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
219 !request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
220 request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
221 !request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
222 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
223 { |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
224 GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, |
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
225 request.GetOrthancIdentifiers(), ResourceType_Study, request.GetLevel()); |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
226 } |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
227 else if (IsRequestWithoutContraint(request) && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
228 request.GetLevel() == ResourceType_Instance && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
229 !request.GetOrthancIdentifiers().HasPatientId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
230 !request.GetOrthancIdentifiers().HasStudyId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
231 request.GetOrthancIdentifiers().HasSeriesId() && |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
232 !request.GetOrthancIdentifiers().HasInstanceId()) |
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
233 { |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
234 GetChildrenIdentifiers(identifiers, transaction_, compatibilityTransaction_, |
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
235 request.GetOrthancIdentifiers(), ResourceType_Series, request.GetLevel()); |
5617
8905ffa45fc2
started listing of children resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5616
diff
changeset
|
236 } |
5682
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
237 else if (request.GetMetadataConstraintsCount() == 0 && |
5724 | 238 request.GetOrdering().empty() && |
239 !request.GetOrthancIdentifiers().HasPatientId() && | |
240 !request.GetOrthancIdentifiers().HasStudyId() && | |
241 !request.GetOrthancIdentifiers().HasSeriesId() && | |
242 !request.GetOrthancIdentifiers().HasInstanceId()) | |
5682
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
243 { |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
244 transaction_.ApplyLookupResources(identifiers, NULL /* TODO-FIND: Could the "instancesId" information be exploited? */, |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
245 request.GetDicomTagConstraints(), request.GetLevel(), request.GetLabels(), |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
246 request.GetLabelsConstraint(), request.HasLimits() ? request.GetLimitsCount() : 0); |
fd4c5e064cbe
started refactoring of ServerContext::Apply()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5681
diff
changeset
|
247 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
248 else |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
249 { |
5677
dc96401dbe88
starting the refactoring of /tools/find
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5676
diff
changeset
|
250 throw OrthancException(ErrorCode_NotImplemented); |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
251 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
252 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
253 |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
254 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
255 void GenericFind::RetrieveMainDicomTags(FindResponse::Resource& target, |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
256 ResourceType level, |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
257 int64_t internalId) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
258 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
259 DicomMap m; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
260 transaction_.GetMainDicomTags(m, internalId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
261 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
262 DicomArray a(m); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
263 for (size_t i = 0; i < a.GetSize(); i++) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
264 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
265 const DicomElement& element = a.GetElement(i); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
266 if (element.GetValue().IsString()) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
267 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
268 target.AddStringDicomTag(level, element.GetTag().GetGroup(), |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
269 element.GetTag().GetElement(), element.GetValue().GetContent()); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
270 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
271 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
272 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
273 throw OrthancException(ErrorCode_BadParameterType); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
274 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
275 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
276 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
277 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
278 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
279 static ResourceType GetTopLevelOfInterest(const FindRequest& request) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
280 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
281 switch (request.GetLevel()) |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
282 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
283 case ResourceType_Patient: |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
284 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
285 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
286 case ResourceType_Study: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
287 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
288 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
289 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
290 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
291 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
292 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
293 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
294 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
295 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
296 case ResourceType_Series: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
297 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
298 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
299 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
300 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
301 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
302 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
303 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
304 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
305 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
306 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
307 return ResourceType_Series; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
308 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
309 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
310 case ResourceType_Instance: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
311 if (request.GetParentSpecification(ResourceType_Patient).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
312 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
313 return ResourceType_Patient; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
314 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
315 else if (request.GetParentSpecification(ResourceType_Study).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
316 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
317 return ResourceType_Study; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
318 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
319 else if (request.GetParentSpecification(ResourceType_Series).IsOfInterest()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
320 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
321 return ResourceType_Series; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
322 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
323 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
324 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
325 return ResourceType_Instance; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
326 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
327 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
328 default: |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
329 throw OrthancException(ErrorCode_ParameterOutOfRange); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
330 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
331 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
332 |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
333 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
334 static ResourceType GetBottomLevelOfInterest(const FindRequest& request) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
335 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
336 switch (request.GetLevel()) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
337 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
338 case ResourceType_Patient: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
339 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
340 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
341 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
342 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
343 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
344 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
345 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
346 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
347 else if (request.GetChildrenSpecification(ResourceType_Study).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
348 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
349 return ResourceType_Study; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
350 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
351 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
352 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
353 return ResourceType_Patient; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
354 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
355 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
356 case ResourceType_Study: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
357 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
358 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
359 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
360 } |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
361 else if (request.GetChildrenSpecification(ResourceType_Series).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
362 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
363 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
364 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
365 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
366 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
367 return ResourceType_Study; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
368 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
369 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
370 case ResourceType_Series: |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
371 if (request.GetChildrenSpecification(ResourceType_Instance).IsOfInterest()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
372 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
373 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
374 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
375 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
376 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
377 return ResourceType_Series; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
378 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
379 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
380 case ResourceType_Instance: |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
381 return ResourceType_Instance; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
382 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
383 default: |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
384 throw OrthancException(ErrorCode_ParameterOutOfRange); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
385 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
386 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
387 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
388 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
389 void GenericFind::ExecuteExpand(FindResponse& response, |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
390 const IDatabaseWrapper::Capabilities& capabilities, |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
391 const FindRequest& request, |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
392 const std::string& identifier) |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
393 { |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
394 int64_t internalId; |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
395 ResourceType level; |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
396 std::string parent; |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
397 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
398 if (request.IsRetrieveParentIdentifier()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
399 { |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
400 if (!compatibilityTransaction_.LookupResourceAndParent(internalId, level, parent, identifier)) |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
401 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
402 return; // The resource is not available anymore |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
403 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
404 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
405 if (level == ResourceType_Patient) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
406 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
407 if (!parent.empty()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
408 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
409 throw OrthancException(ErrorCode_DatabasePlugin); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
410 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
411 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
412 else |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
413 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
414 if (parent.empty()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
415 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
416 throw OrthancException(ErrorCode_DatabasePlugin); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
417 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
418 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
419 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
420 else |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
421 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
422 if (!transaction_.LookupResource(internalId, level, identifier)) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
423 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
424 return; // The resource is not available anymore |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
425 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
426 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
427 |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
428 if (level != request.GetLevel()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
429 { |
5771 | 430 throw OrthancException(ErrorCode_UnknownResource, "Wrong resource level for this ID"); // this might happen e.g if you call /instances/... with a series instance id |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
431 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
432 |
5606
6e2dad336446
added "IsStable" field in expanded resources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5596
diff
changeset
|
433 std::unique_ptr<FindResponse::Resource> resource(new FindResponse::Resource(request.GetLevel(), internalId, identifier)); |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
434 |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
435 if (request.IsRetrieveParentIdentifier()) |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
436 { |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
437 assert(!parent.empty()); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
438 resource->SetParentIdentifier(parent); |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
439 } |
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
440 |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
441 if (request.IsRetrieveMainDicomTags()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
442 { |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
443 RetrieveMainDicomTags(*resource, level, internalId); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
444 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
445 |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
446 if (request.IsRetrieveMetadata()) |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
447 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
448 transaction_.GetAllMetadata(resource->GetMetadata(level), internalId); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
449 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
450 |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
451 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
452 const ResourceType topLevel = GetTopLevelOfInterest(request); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
453 |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
454 int64_t currentId = internalId; |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
455 ResourceType currentLevel = level; |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
456 |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
457 while (currentLevel != topLevel) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
458 { |
5619
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
459 int64_t parentId; |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
460 if (transaction_.LookupParent(parentId, currentId)) |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
461 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
462 currentId = parentId; |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
463 currentLevel = GetParentResourceType(currentLevel); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
464 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
465 else |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
466 { |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
467 throw OrthancException(ErrorCode_DatabasePlugin); |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
468 } |
1864b16bc7b1
added FindRequest::ParentRetrieveSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5617
diff
changeset
|
469 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
470 if (request.GetParentSpecification(currentLevel).IsRetrieveMainDicomTags()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
471 { |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
472 RetrieveMainDicomTags(*resource, currentLevel, currentId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
473 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
474 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
475 if (request.GetParentSpecification(currentLevel).IsRetrieveMetadata()) |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
476 { |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
477 transaction_.GetAllMetadata(resource->GetMetadata(currentLevel), currentId); |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
478 } |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
479 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
480 } |
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
481 |
5720
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
482 if (capabilities.HasLabelsSupport() && |
89d559e67b03
fix compatibility with old database plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5682
diff
changeset
|
483 request.IsRetrieveLabels()) |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
484 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
485 transaction_.ListLabels(resource->GetLabels(), internalId); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
486 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
487 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
488 if (request.IsRetrieveAttachments()) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
489 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
490 std::set<FileContentType> attachments; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
491 transaction_.ListAvailableAttachments(attachments, internalId); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
492 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
493 for (std::set<FileContentType>::const_iterator it = attachments.begin(); it != attachments.end(); ++it) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
494 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
495 FileInfo info; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
496 int64_t revision; |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
497 if (transaction_.LookupAttachment(info, revision, internalId, *it) && |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
498 info.GetContentType() == *it) |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
499 { |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
500 resource->AddAttachment(info); |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
501 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
502 else |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
503 { |
5595
a87f2a56257d
implemented FindRequest::retrieveChildrenMetadata_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5594
diff
changeset
|
504 throw OrthancException(ErrorCode_DatabasePlugin); |
5594
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
505 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
506 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
507 } |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
508 |
a906dc19264c
created FindResponse::Resource::Format()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5593
diff
changeset
|
509 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
510 const ResourceType bottomLevel = GetBottomLevelOfInterest(request); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
511 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
512 std::list<int64_t> currentIds; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
513 currentIds.push_back(internalId); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
514 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
515 ResourceType currentLevel = level; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
516 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
517 while (currentLevel != bottomLevel) |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
518 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
519 ResourceType childrenLevel = GetChildResourceType(currentLevel); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
520 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
521 if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
522 { |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
523 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
524 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
525 std::list<std::string> ids; |
5849
0f4345cbe558
GetChildrenPublicId() and LookupResourceAndParent() tagged as compatibility database primitives
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5847
diff
changeset
|
526 compatibilityTransaction_.GetChildrenPublicId(ids, *it); |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
527 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
528 for (std::list<std::string>::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
529 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
530 resource->AddChildIdentifier(childrenLevel, *it2); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
531 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
532 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
533 } |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
534 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
535 const std::set<MetadataType>& metadata = request.GetChildrenSpecification(childrenLevel).GetMetadata(); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
536 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
537 for (std::set<MetadataType>::const_iterator it = metadata.begin(); it != metadata.end(); ++it) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
538 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
539 for (std::list<int64_t>::const_iterator it2 = currentIds.begin(); it2 != currentIds.end(); ++it2) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
540 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
541 std::list<std::string> values; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
542 transaction_.GetChildrenMetadata(values, *it2, *it); |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
543 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
544 for (std::list<std::string>::const_iterator it3 = values.begin(); it3 != values.end(); ++it3) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
545 { |
5672
e300f22a46f0
implemented computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5668
diff
changeset
|
546 resource->AddChildrenMetadataValue(childrenLevel, *it, *it3); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
547 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
548 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
549 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
550 |
5676
b744a2cf408a
shorten ParentRetrieveSpecification/ChildrenRetrieveSpecification as ParentSpecification/ChildrenSpecification
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5674
diff
changeset
|
551 const std::set<DicomTag>& mainDicomTags = request.GetChildrenSpecification(childrenLevel).GetMainDicomTags(); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
552 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
553 if (childrenLevel != bottomLevel || |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
554 !mainDicomTags.empty()) |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
555 { |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
556 std::list<int64_t> childrenIds; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
557 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
558 for (std::list<int64_t>::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
559 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
560 std::list<int64_t> tmp; |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
561 transaction_.GetChildrenInternalId(tmp, *it); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
562 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
563 childrenIds.splice(childrenIds.end(), tmp); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
564 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
565 |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
566 if (!mainDicomTags.empty()) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
567 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
568 for (std::list<int64_t>::const_iterator it = childrenIds.begin(); it != childrenIds.end(); ++it) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
569 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
570 DicomMap m; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
571 transaction_.GetMainDicomTags(m, *it); |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
572 |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
573 for (std::set<DicomTag>::const_iterator it2 = mainDicomTags.begin(); it2 != mainDicomTags.end(); ++it2) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
574 { |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
575 std::string value; |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
576 if (m.LookupStringValue(value, *it2, false /* no binary allowed */)) |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
577 { |
5672
e300f22a46f0
implemented computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5668
diff
changeset
|
578 resource->AddChildrenMainDicomTagValue(childrenLevel, *it2, value); |
5668
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
579 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
580 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
581 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
582 } |
bd1352bd9d82
configuring requests for ModalitiesInStudy and SOPClassesInStudy
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5667
diff
changeset
|
583 |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
584 currentIds = childrenIds; |
5666
aa231c18b9d2
adding computed tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5641
diff
changeset
|
585 } |
5667
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
586 else |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
587 { |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
588 currentIds.clear(); |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
589 } |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
590 |
93dff1fccf36
recursive descent to the children
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5666
diff
changeset
|
591 currentLevel = childrenLevel; |
5565
def06a42e5ef
Updated FindRequest & FindResponse definitions
Alain Mazy <am@orthanc.team>
parents:
5554
diff
changeset
|
592 } |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
593 } |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
594 |
5772
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
595 if (request.GetLevel() != ResourceType_Instance && |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
596 request.IsRetrieveOneInstanceMetadataAndAttachments()) |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
597 { |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
598 int64_t currentId = internalId; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
599 ResourceType currentLevel = level; |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
600 |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
601 while (currentLevel != ResourceType_Instance) |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
602 { |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
603 std::list<int64_t> children; |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
604 transaction_.GetChildrenInternalId(children, currentId); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
605 if (children.empty()) |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
606 { |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
607 throw OrthancException(ErrorCode_DatabasePlugin); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
608 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
609 else |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
610 { |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
611 currentId = children.front(); |
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
612 currentLevel = GetChildResourceType(currentLevel); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
613 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
614 } |
5609
4690a0d2b01e
preliminary support of requestedTags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5606
diff
changeset
|
615 |
5772
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
616 std::map<MetadataType, std::string> metadata; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
617 transaction_.GetAllMetadata(metadata, currentId); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
618 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
619 std::set<FileContentType> attachmentsType; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
620 transaction_.ListAvailableAttachments(attachmentsType, currentId); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
621 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
622 std::map<FileContentType, FileInfo> attachments; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
623 for (std::set<FileContentType>::const_iterator it = attachmentsType.begin(); it != attachmentsType.end(); ++it) |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
624 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
625 FileInfo info; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
626 int64_t revision; // Unused in this case |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
627 if (transaction_.LookupAttachment(info, revision, currentId, *it)) |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
628 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
629 attachments[*it] = info; |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
630 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
631 else |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
632 { |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
633 throw OrthancException(ErrorCode_DatabasePlugin); |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
634 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
635 } |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
636 |
093a8693ba16
replaced SetRetrieveOneInstanceIdentifier() by SetRetrieveOneInstanceMetadataAndAttachments()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5771
diff
changeset
|
637 resource->SetOneInstanceMetadataAndAttachments(transaction_.GetPublicId(currentId), metadata, attachments); |
5596
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
638 } |
81a29ad7fb4b
added possibility to retrieve main DICOM tags and metadata at any level
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5595
diff
changeset
|
639 |
5593
862b54b4cfe2
implemented the default multi-stage find/expand
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5592
diff
changeset
|
640 response.Add(resource.release()); |
5554
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
641 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
642 } |
12d8a1a266e9
introduction of FindRequest and FindResponse
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
643 } |