Mercurial > hg > orthanc
annotate OrthancServer/Database/Compatibility/ICreateInstance.cpp @ 3493:c465c6ee2bfb
merge
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 19 Aug 2019 10:18:04 +0200 |
parents | c0d7aee8c3f8 |
children | 94f4a18a79cc |
rev | line source |
---|---|
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * License, or (at your option) any later version. |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * In addition, as a special exception, the copyright holders of this |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * program give permission to link the code of its release with the |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * that use the same license as the "OpenSSL" library), and distribute |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * the linked executables. You must obey the GNU General Public License |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * in all respects for all of the code used other than "OpenSSL". If you |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * modify file(s) with this exception, you may extend this exception to |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * your version of the file(s), but you are not obligated to do so. If |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * you do not wish to do so, delete this exception statement from your |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 * version. If you delete this exception statement from all source files |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 * in the program, then also delete it here. |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 * |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 * This program is distributed in the hope that it will be useful, but |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 * WITHOUT ANY WARRANTY; without even the implied warranty of |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 * General Public License for more details. |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 * |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 * You should have received a copy of the GNU General Public License |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 **/ |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 #include "../../PrecompiledHeadersServer.h" |
3084 | 35 #include "ICreateInstance.h" |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 #include "../../../Core/OrthancException.h" |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 namespace Orthanc |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 namespace Compatibility |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
43 bool ICreateInstance::Apply(ICreateInstance& database, |
3084 | 44 IDatabaseWrapper::CreateInstanceResult& result, |
45 int64_t& instanceId, | |
46 const std::string& hashPatient, | |
47 const std::string& hashStudy, | |
48 const std::string& hashSeries, | |
49 const std::string& hashInstance) | |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 ResourceType type; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 int64_t tmp; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 if (database.LookupResource(tmp, type, hashInstance)) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 { |
3082
847a0ed92654
new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3080
diff
changeset
|
57 // The instance already exists |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 assert(type == ResourceType_Instance); |
3082
847a0ed92654
new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3080
diff
changeset
|
59 instanceId = tmp; |
847a0ed92654
new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3080
diff
changeset
|
60 return false; |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
64 instanceId = database.CreateResource(hashInstance, ResourceType_Instance); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 result.isNewPatient_ = false; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 result.isNewStudy_ = false; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 result.isNewSeries_ = false; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 result.patientId_ = -1; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 result.studyId_ = -1; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 result.seriesId_ = -1; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
73 // Detect up to which level the patient/study/series/instance |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 // hierarchy must be created |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 ResourceType dummy; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 if (database.LookupResource(result.seriesId_, dummy, hashSeries)) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
81 assert(dummy == ResourceType_Series); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 // The patient, the study and the series already exist |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 bool ok = (database.LookupResource(result.patientId_, dummy, hashPatient) && |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 database.LookupResource(result.studyId_, dummy, hashStudy)); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 assert(ok); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 else if (database.LookupResource(result.studyId_, dummy, hashStudy)) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
89 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
90 assert(dummy == ResourceType_Study); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 // New series: The patient and the study already exist |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
93 result.isNewSeries_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 bool ok = database.LookupResource(result.patientId_, dummy, hashPatient); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
96 assert(ok); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 else if (database.LookupResource(result.patientId_, dummy, hashPatient)) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 assert(dummy == ResourceType_Patient); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 // New study and series: The patient already exist |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 result.isNewStudy_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
104 result.isNewSeries_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
105 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
106 else |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
107 { |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
108 // New patient, study and series: Nothing exists |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
109 result.isNewPatient_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
110 result.isNewStudy_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
111 result.isNewSeries_ = true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
112 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
114 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
115 // Create the series if needed |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 if (result.isNewSeries_) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
118 result.seriesId_ = database.CreateResource(hashSeries, ResourceType_Series); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 // Create the study if needed |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 if (result.isNewStudy_) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
124 result.studyId_ = database.CreateResource(hashStudy, ResourceType_Study); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 // Create the patient if needed |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 if (result.isNewPatient_) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
130 result.patientId_ = database.CreateResource(hashPatient, ResourceType_Patient); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 // Create the parent-to-child links |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
134 database.AttachChild(result.seriesId_, instanceId); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 if (result.isNewSeries_) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
138 database.AttachChild(result.studyId_, result.seriesId_); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 if (result.isNewStudy_) |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 { |
3091
476cba12c2b0
IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3084
diff
changeset
|
143 database.AttachChild(result.patientId_, result.studyId_); |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 |
3124
c0d7aee8c3f8
Fix issue #58 (Patient recycling order should be defined by their received last instance)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3121
diff
changeset
|
146 database.TagMostRecentPatient(result.patientId_); |
3121 | 147 |
3080
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 // Sanity checks |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 assert(result.patientId_ != -1); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 assert(result.studyId_ != -1); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 assert(result.seriesId_ != -1); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 assert(instanceId != -1); |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
154 return true; |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
155 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 } |
1a75595d8e44
started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
157 } |