Mercurial > hg > orthanc
annotate OrthancServer/Sources/Database/Compatibility/DatabaseLookup.cpp @ 4831:7053502fbf97
added copyright UCLouvain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 19:01:11 +0100 |
parents | ff8170d17d90 |
children | 2e71a08eea15 43e613a7756b |
rev | line source |
---|---|
3052
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4591
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3052
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU General Public License as |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * published by the Free Software Foundation, either version 3 of the |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * License, or (at your option) any later version. |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * In addition, as a special exception, the copyright holders of this |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * program give permission to link the code of its release with the |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * that use the same license as the "OpenSSL" library), and distribute |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * the linked executables. You must obey the GNU General Public License |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * in all respects for all of the code used other than "OpenSSL". If you |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * modify file(s) with this exception, you may extend this exception to |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * your version of the file(s), but you are not obligated to do so. If |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * you do not wish to do so, delete this exception statement from your |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * version. If you delete this exception statement from all source files |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * in the program, then also delete it here. |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * This program is distributed in the hope that it will be useful, but |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * WITHOUT ANY WARRANTY; without even the implied warranty of |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * General Public License for more details. |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * You should have received a copy of the GNU General Public License |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 **/ |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include "../../PrecompiledHeadersServer.h" |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 #include "DatabaseLookup.h" |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
4045 | 38 #include "../../../../OrthancFramework/Sources/OrthancException.h" |
3094
61da3c9b4121
cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3093
diff
changeset
|
39 #include "../../Search/DicomTagConstraint.h" |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
40 #include "../../ServerToolbox.h" |
3052
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 #include "SetOfResources.h" |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 namespace Orthanc |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 { |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 namespace Compatibility |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
46 { |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
47 namespace |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
48 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
49 // Anonymous namespace to avoid clashes between compiler modules |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
50 class MainTagsConstraints : boost::noncopyable |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
51 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
52 private: |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
53 std::vector<DicomTagConstraint*> constraints_; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
54 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
55 public: |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
56 ~MainTagsConstraints() |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
57 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
58 for (size_t i = 0; i < constraints_.size(); i++) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
59 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
60 assert(constraints_[i] != NULL); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
61 delete constraints_[i]; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
62 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
63 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
64 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
65 void Reserve(size_t n) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
66 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
67 constraints_.reserve(n); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
68 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
69 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
70 size_t GetSize() const |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
71 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
72 return constraints_.size(); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
73 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
74 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
75 DicomTagConstraint& GetConstraint(size_t i) const |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
76 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
77 if (i >= constraints_.size()) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
78 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
79 throw OrthancException(ErrorCode_ParameterOutOfRange); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
80 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
81 else |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
82 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
83 assert(constraints_[i] != NULL); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
84 return *constraints_[i]; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
85 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
86 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
87 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
88 void Add(const DatabaseConstraint& constraint) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
89 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
90 constraints_.push_back(new DicomTagConstraint(constraint)); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
91 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
92 }; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
93 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
94 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
95 |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
96 static void ApplyIdentifierConstraint(SetOfResources& candidates, |
3085 | 97 ILookupResources& compatibility, |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
98 const DatabaseConstraint& constraint, |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
99 ResourceType level) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
100 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
101 std::list<int64_t> matches; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
102 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
103 switch (constraint.GetConstraintType()) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
104 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
105 case ConstraintType_Equal: |
3084 | 106 compatibility.LookupIdentifier(matches, level, constraint.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
107 IdentifierConstraintType_Equal, constraint.GetSingleValue()); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
108 break; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
109 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
110 case ConstraintType_SmallerOrEqual: |
3084 | 111 compatibility.LookupIdentifier(matches, level, constraint.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
112 IdentifierConstraintType_SmallerOrEqual, constraint.GetSingleValue()); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
113 break; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
114 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
115 case ConstraintType_GreaterOrEqual: |
3084 | 116 compatibility.LookupIdentifier(matches, level, constraint.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
117 IdentifierConstraintType_GreaterOrEqual, constraint.GetSingleValue()); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
118 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
119 break; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
120 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
121 case ConstraintType_Wildcard: |
3084 | 122 compatibility.LookupIdentifier(matches, level, constraint.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
123 IdentifierConstraintType_Wildcard, constraint.GetSingleValue()); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
124 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
125 break; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
126 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
127 case ConstraintType_List: |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
128 for (size_t i = 0; i < constraint.GetValuesCount(); i++) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
129 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
130 std::list<int64_t> tmp; |
3084 | 131 compatibility.LookupIdentifier(tmp, level, constraint.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
132 IdentifierConstraintType_Wildcard, constraint.GetValue(i)); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
133 matches.splice(matches.end(), tmp); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
134 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
135 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
136 break; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
137 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
138 default: |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
139 throw OrthancException(ErrorCode_InternalError); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
140 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
141 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
142 candidates.Intersect(matches); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
143 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
144 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
145 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
146 static void ApplyIdentifierRange(SetOfResources& candidates, |
3085 | 147 ILookupResources& compatibility, |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
148 const DatabaseConstraint& smaller, |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
149 const DatabaseConstraint& greater, |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
150 ResourceType level) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
151 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
152 assert(smaller.GetConstraintType() == ConstraintType_SmallerOrEqual && |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
153 greater.GetConstraintType() == ConstraintType_GreaterOrEqual && |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
154 smaller.GetTag() == greater.GetTag() && |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
155 ServerToolbox::IsIdentifier(smaller.GetTag(), level)); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
156 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
157 std::list<int64_t> matches; |
3084 | 158 compatibility.LookupIdentifierRange(matches, level, smaller.GetTag(), |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
159 greater.GetSingleValue(), smaller.GetSingleValue()); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
160 candidates.Intersect(matches); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
161 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
162 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
163 |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
164 static void ApplyLevel(SetOfResources& candidates, |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
165 IDatabaseWrapper::ITransaction& transaction, |
3085 | 166 ILookupResources& compatibility, |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
167 const std::vector<DatabaseConstraint>& lookup, |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
168 ResourceType level) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
169 { |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
170 typedef std::set<const DatabaseConstraint*> SetOfConstraints; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
171 typedef std::map<DicomTag, SetOfConstraints> Identifiers; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
172 |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
173 // (1) Select which constraints apply to this level, and split |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
174 // them between "identifier tags" constraints and "main DICOM |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
175 // tags" constraints |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
176 |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
177 Identifiers identifiers; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
178 SetOfConstraints mainTags; |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
179 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
180 for (size_t i = 0; i < lookup.size(); i++) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
181 { |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
182 if (lookup[i].GetLevel() == level) |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
183 { |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
184 if (lookup[i].IsIdentifier()) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
185 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
186 identifiers[lookup[i].GetTag()].insert(&lookup[i]); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
187 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
188 else |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
189 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
190 mainTags.insert(&lookup[i]); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
191 } |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
192 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
193 } |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
194 |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
195 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
196 // (2) Apply the constraints over the identifiers |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
197 |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
198 for (Identifiers::const_iterator it = identifiers.begin(); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
199 it != identifiers.end(); ++it) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
200 { |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
201 // Check whether some range constraint over identifiers is |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
202 // present at this level |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
203 const DatabaseConstraint* smaller = NULL; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
204 const DatabaseConstraint* greater = NULL; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
205 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
206 for (SetOfConstraints::const_iterator it2 = it->second.begin(); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
207 it2 != it->second.end(); ++it2) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
208 { |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
209 assert(*it2 != NULL); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
210 |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
211 if ((*it2)->GetConstraintType() == ConstraintType_SmallerOrEqual) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
212 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
213 smaller = *it2; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
214 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
215 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
216 if ((*it2)->GetConstraintType() == ConstraintType_GreaterOrEqual) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
217 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
218 greater = *it2; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
219 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
220 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
221 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
222 if (smaller != NULL && |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
223 greater != NULL) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
224 { |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
225 // There is a range constraint: Apply it, as it is more efficient |
3084 | 226 ApplyIdentifierRange(candidates, compatibility, *smaller, *greater, level); |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
227 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
228 else |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
229 { |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
230 smaller = NULL; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
231 greater = NULL; |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
232 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
233 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
234 for (SetOfConstraints::const_iterator it2 = it->second.begin(); |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
235 it2 != it->second.end(); ++it2) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
236 { |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
237 // Check to avoid applying twice the range constraint |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
238 if (*it2 != smaller && |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
239 *it2 != greater) |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
240 { |
3084 | 241 ApplyIdentifierConstraint(candidates, compatibility, **it2, level); |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
242 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
243 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
244 } |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
245 |
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
246 |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
247 // (3) Apply the constraints over the main DICOM tags (no index |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
248 // here, so this is less efficient than filtering over the |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
249 // identifiers) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
250 if (!mainTags.empty()) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
251 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
252 MainTagsConstraints c; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
253 c.Reserve(mainTags.size()); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
254 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
255 for (SetOfConstraints::const_iterator it = mainTags.begin(); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
256 it != mainTags.end(); ++it) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
257 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
258 assert(*it != NULL); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
259 c.Add(**it); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
260 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
261 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
262 std::list<int64_t> source; |
3084 | 263 candidates.Flatten(compatibility, source); |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
264 candidates.Clear(); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
265 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
266 std::list<int64_t> filtered; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
267 for (std::list<int64_t>::const_iterator candidate = source.begin(); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
268 candidate != source.end(); ++candidate) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
269 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
270 DicomMap tags; |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
271 transaction.GetMainDicomTags(tags, *candidate); |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
272 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
273 bool match = true; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
274 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
275 for (size_t i = 0; i < c.GetSize(); i++) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
276 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
277 if (!c.GetConstraint(i).IsMatch(tags)) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
278 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
279 match = false; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
280 break; |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
281 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
282 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
283 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
284 if (match) |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
285 { |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
286 filtered.push_back(*candidate); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
287 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
288 } |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
289 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
290 candidates.Intersect(filtered); |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3054
diff
changeset
|
291 } |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
292 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
293 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
294 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
295 static std::string GetOneInstance(IDatabaseWrapper::ITransaction& compatibility, |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
296 int64_t resource, |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
297 ResourceType level) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
298 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
299 for (int i = level; i < ResourceType_Instance; i++) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
300 { |
3084 | 301 assert(compatibility.GetResourceType(resource) == static_cast<ResourceType>(i)); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
302 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
303 std::list<int64_t> children; |
3084 | 304 compatibility.GetChildrenInternalId(children, resource); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
305 |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
306 if (children.empty()) |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
307 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
308 throw OrthancException(ErrorCode_Database); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
309 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
310 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
311 resource = children.front(); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
312 } |
3054
3638de45a08c
backward compatibility with filtering identifiers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3053
diff
changeset
|
313 |
3084 | 314 return compatibility.GetPublicId(resource); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
315 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
316 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
317 |
3075
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
318 void DatabaseLookup::ApplyLookupResources(std::list<std::string>& resourcesId, |
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
319 std::list<std::string>* instancesId, |
3052
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
320 const std::vector<DatabaseConstraint>& lookup, |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
321 ResourceType queryLevel, |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
322 size_t limit) |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
323 { |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
324 // This is a re-implementation of |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
325 // "../../../Resources/Graveyard/DatabaseOptimizations/LookupResource.cpp" |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
326 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
327 assert(ResourceType_Patient < ResourceType_Study && |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
328 ResourceType_Study < ResourceType_Series && |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
329 ResourceType_Series < ResourceType_Instance); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
330 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
331 ResourceType upperLevel = queryLevel; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
332 ResourceType lowerLevel = queryLevel; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
333 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
334 for (size_t i = 0; i < lookup.size(); i++) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
335 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
336 ResourceType level = lookup[i].GetLevel(); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
337 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
338 if (level < upperLevel) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
339 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
340 upperLevel = level; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
341 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
342 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
343 if (level > lowerLevel) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
344 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
345 lowerLevel = level; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
346 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
347 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
348 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
349 assert(upperLevel <= queryLevel && |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
350 queryLevel <= lowerLevel); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
351 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
352 SetOfResources candidates(transaction_, upperLevel); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
353 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
354 for (int level = upperLevel; level <= lowerLevel; level++) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
355 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
356 ApplyLevel(candidates, transaction_, compatibility_, lookup, static_cast<ResourceType>(level)); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
357 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
358 if (level != lowerLevel) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
359 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
360 candidates.GoDown(); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
361 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
362 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
363 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
364 std::list<int64_t> resources; |
3084 | 365 candidates.Flatten(compatibility_, resources); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
366 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
367 // Climb up, up to queryLevel |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
368 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
369 for (int level = lowerLevel; level > queryLevel; level--) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
370 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
371 std::list<int64_t> parents; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
372 for (std::list<int64_t>::const_iterator |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
373 it = resources.begin(); it != resources.end(); ++it) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
374 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
375 int64_t parent; |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
376 if (transaction_.LookupParent(parent, *it)) |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
377 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
378 parents.push_back(parent); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
379 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
380 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
381 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
382 resources.swap(parents); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
383 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
384 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
385 // Apply the limit, if given |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
386 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
387 if (limit != 0 && |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
388 resources.size() > limit) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
389 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
390 resources.resize(limit); |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
391 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
392 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
393 // Get the public ID of all the selected resources |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
394 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
395 size_t pos = 0; |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
396 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
397 for (std::list<int64_t>::const_iterator |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
398 it = resources.begin(); it != resources.end(); ++it, pos++) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
399 { |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
400 assert(transaction_.GetResourceType(*it) == queryLevel); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
401 |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
402 const std::string resource = transaction_.GetPublicId(*it); |
3075
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
403 resourcesId.push_back(resource); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
404 |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
405 if (instancesId != NULL) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
406 { |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
407 if (queryLevel == ResourceType_Instance) |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
408 { |
3075
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
409 // The resource is itself the instance |
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
410 instancesId->push_back(resource); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
411 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
412 else |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
413 { |
3075
ead8576a02ef
IDatabaseWrapper::ApplyLookupResources now returns lists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
414 // Collect one child instance for each of the selected resources |
4591
ff8170d17d90
moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
415 instancesId->push_back(GetOneInstance(transaction_, *it, queryLevel)); |
3053
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
416 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
417 } |
3f986ce336c8
working on Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3052
diff
changeset
|
418 } |
3052
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
419 } |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
420 } |
c7db469bbe8e
new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
421 } |