annotate OrthancServer/Search/Compatibility/ICompatibilityCreateInstance.cpp @ 3083:683d572424b6 db-changes

IDatabaseWrapper::SetResourcesContent
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 04 Jan 2019 15:52:19 +0100
parents 847a0ed92654
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "ICompatibilityCreateInstance.h"
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 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 bool ICompatibilityCreateInstance::Apply(IDatabaseWrapper::CreateInstanceResult& result,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 int64_t& instanceId,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 ICompatibilityCreateInstance& compatibility,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 IDatabaseWrapper& database,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 const std::string& hashPatient,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 const std::string& hashStudy,
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 const std::string& hashSeries,
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
50 const std::string& hashInstance)
3080
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 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 ResourceType type;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 int64_t tmp;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 if (database.LookupResource(tmp, type, hashInstance))
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
58 // The instance already exists
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 assert(type == ResourceType_Instance);
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
60 instanceId = tmp;
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
61 return false;
3080
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 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 instanceId = compatibility.CreateResource(hashInstance, ResourceType_Instance);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 result.isNewPatient_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 result.isNewStudy_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 result.isNewSeries_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 result.patientId_ = -1;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 result.studyId_ = -1;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 result.seriesId_ = -1;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 // 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
75 // hierarchy must be created
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 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ResourceType dummy;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 if (database.LookupResource(result.seriesId_, dummy, hashSeries))
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 assert(dummy == ResourceType_Series);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 // The patient, the study and the series already exist
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 bool ok = (database.LookupResource(result.patientId_, dummy, hashPatient) &&
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 database.LookupResource(result.studyId_, dummy, hashStudy));
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 assert(ok);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 else if (database.LookupResource(result.studyId_, dummy, hashStudy))
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 assert(dummy == ResourceType_Study);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 // New series: The patient and the study already exist
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 result.isNewSeries_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 bool ok = database.LookupResource(result.patientId_, dummy, hashPatient);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 assert(ok);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 else if (database.LookupResource(result.patientId_, dummy, hashPatient))
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 assert(dummy == ResourceType_Patient);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 // New study and series: The patient already exist
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 result.isNewStudy_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 result.isNewSeries_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 else
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 // New patient, study and series: Nothing exists
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 result.isNewPatient_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 result.isNewStudy_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 result.isNewSeries_ = true;
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
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 // Create the series if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 if (result.isNewSeries_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 result.seriesId_ = compatibility.CreateResource(hashSeries, ResourceType_Series);
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
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 // Create the study if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 if (result.isNewStudy_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 result.studyId_ = compatibility.CreateResource(hashStudy, ResourceType_Study);
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
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 // Create the patient if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 if (result.isNewPatient_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 result.patientId_ = compatibility.CreateResource(hashPatient, ResourceType_Patient);
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
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 // Create the parent-to-child links
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 compatibility.AttachChild(result.seriesId_, instanceId);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 if (result.isNewSeries_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 compatibility.AttachChild(result.studyId_, result.seriesId_);
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
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 if (result.isNewStudy_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 compatibility.AttachChild(result.patientId_, result.studyId_);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 // Sanity checks
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 assert(result.patientId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 assert(result.studyId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 assert(result.seriesId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 assert(instanceId != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 return true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 }
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 }