annotate OrthancServer/Sources/Database/Compatibility/SetOfResources.cpp @ 5464:38f1d06875ad pg-transactions

delete attachment in case of same instance being uploaded multiple times at the same time
author Alain Mazy <am@osimis.io>
date Tue, 12 Dec 2023 17:20:10 +0100
parents 0ea402b4d901
children 48b8dae6dc77
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1753
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
5185
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4892
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4892
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
3052
c7db469bbe8e new class: Compatibility::DatabaseLookup
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3050
diff changeset
23 #include "../../PrecompiledHeadersServer.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "SetOfResources.h"
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 #include "../../../../OrthancFramework/Sources/OrthancException.h"
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace Orthanc
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
31 namespace Compatibility
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
33 void SetOfResources::Intersect(const std::list<int64_t>& resources)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
35 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
37 resources_.reset(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
39 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
40 it = resources.begin(); it != resources.end(); ++it)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
42 resources_->insert(*it);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 }
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
45 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
46 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
47 std::unique_ptr<Resources> filtered(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
49 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
50 it = resources.begin(); it != resources.end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
51 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
52 if (resources_->find(*it) != resources_->end())
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
53 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
54 filtered->insert(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
55 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
56 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
57
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
58 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
59 resources_.reset(filtered.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
60 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
61 resources_ = std::move(filtered);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
62 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
63 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
66
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
67 void SetOfResources::GoDown()
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
68 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
69 if (level_ == ResourceType_Instance)
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
70 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
71 throw OrthancException(ErrorCode_BadSequenceOfCalls);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
1753
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1751
diff changeset
73
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
74 if (resources_.get() != NULL)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
75 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
76 std::unique_ptr<Resources> children(new Resources);
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
78 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
79 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
80 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
81 std::list<int64_t> tmp;
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
82 transaction_.GetChildrenInternalId(tmp, *it);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
83
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
84 for (std::list<int64_t>::const_iterator
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
85 child = tmp.begin(); child != tmp.end(); ++child)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
86 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
87 children->insert(*child);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
88 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
89 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
90
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
91 #if __cplusplus < 201103L
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
92 resources_.reset(children.release());
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
93 #else
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
94 resources_ = std::move(children);
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
95 #endif
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
96 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
97
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
98 switch (level_)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
99 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
100 case ResourceType_Patient:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
101 level_ = ResourceType_Study;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
102 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
103
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
104 case ResourceType_Study:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
105 level_ = ResourceType_Series;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
106 break;
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
107
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
108 case ResourceType_Series:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
109 level_ = ResourceType_Instance;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
110 break;
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
111
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
112 default:
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
113 throw OrthancException(ErrorCode_InternalError);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
114 }
1747
ca69082ab200 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1746
diff changeset
115 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
118 void SetOfResources::Flatten(std::list<std::string>& result)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
120 result.clear();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
121
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
122 if (resources_.get() == NULL)
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
124 // All the resources of this level are part of the filter
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
125 transaction_.GetAllPublicIds(result, level_);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
126 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
127 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
128 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
129 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
130 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
131 {
4591
ff8170d17d90 moving all accesses to databases from IDatabaseWrapper to ITransaction
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
132 result.push_back(transaction_.GetPublicId(*it));
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
133 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 }
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
136
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
137
3085
c829758b9ca0 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
138 void SetOfResources::Flatten(ILookupResources& compatibility,
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
139 std::list<int64_t>& result)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
140 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
141 result.clear();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
142
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
143 if (resources_.get() == NULL)
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
144 {
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
145 // All the resources of this level are part of the filter
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3061
diff changeset
146 compatibility.GetAllInternalIds(result, level_);
3056
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
147 }
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
148 else
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
149 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
150 for (Resources::const_iterator it = resources_->begin();
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
151 it != resources_->end(); ++it)
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
152 {
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
153 result.push_back(*it);
6c5d4281da4a removal of SQLiteDatabaseWrapper::GetAllInternalIds
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3052
diff changeset
154 }
1750
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
155 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
156 }
55d52567bebb LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1747
diff changeset
157 }
1746
d143db00a794 SetOfResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 }