annotate OrthancServer/Sources/Database/Compatibility/ICreateInstance.cpp @ 5640:f7adfb22e20e

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 21:19:57 +0200
parents 48b8dae6dc77
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * 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
10 * 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
11 * 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
12 * License, or (at your option) any later version.
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * 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
17 * General Public License for more details.
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * 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
20 * 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
21 **/
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
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 #include "../../PrecompiledHeadersServer.h"
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
25 #include "ICreateInstance.h"
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27 #include "../../../../OrthancFramework/Sources/OrthancException.h"
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
4304
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4121
diff changeset
29 #include <cassert>
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4121
diff changeset
30
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4121
diff changeset
31
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace Orthanc
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 namespace Compatibility
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
36 bool ICreateInstance::Apply(ICreateInstance& database,
3084
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
37 IDatabaseWrapper::CreateInstanceResult& result,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
38 int64_t& instanceId,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
39 const std::string& hashPatient,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
40 const std::string& hashStudy,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
41 const std::string& hashSeries,
195ba4cbac3f reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3082
diff changeset
42 const std::string& hashInstance)
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 ResourceType type;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 int64_t tmp;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 if (database.LookupResource(tmp, type, hashInstance))
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
50 // The instance already exists
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 assert(type == ResourceType_Instance);
3082
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
52 instanceId = tmp;
847a0ed92654 new extension for database plugin SDK: createInstance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3080
diff changeset
53 return false;
3080
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 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
57 instanceId = database.CreateResource(hashInstance, ResourceType_Instance);
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 result.isNewPatient_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 result.isNewStudy_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 result.isNewSeries_ = false;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 result.patientId_ = -1;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 result.studyId_ = -1;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 result.seriesId_ = -1;
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 // 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
67 // hierarchy must be created
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ResourceType dummy;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 if (database.LookupResource(result.seriesId_, dummy, hashSeries))
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 assert(dummy == ResourceType_Series);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 // The patient, the study and the series already exist
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 bool ok = (database.LookupResource(result.patientId_, dummy, hashPatient) &&
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 database.LookupResource(result.studyId_, dummy, hashStudy));
4121
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
79 (void) ok; // Remove warning about unused variable in release builds
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 assert(ok);
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 else if (database.LookupResource(result.studyId_, dummy, hashStudy))
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 assert(dummy == ResourceType_Study);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 // New series: The patient and the study already exist
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 result.isNewSeries_ = true;
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 bool ok = database.LookupResource(result.patientId_, dummy, hashPatient);
4121
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
90 (void) ok; // Remove warning about unused variable in release builds
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 assert(ok);
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 else if (database.LookupResource(result.patientId_, dummy, hashPatient))
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 assert(dummy == ResourceType_Patient);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 // New study and series: The patient already exist
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 result.isNewStudy_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 result.isNewSeries_ = true;
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 else
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 patient, study and series: Nothing exists
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 result.isNewPatient_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 result.isNewStudy_ = true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 result.isNewSeries_ = true;
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 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 // Create the series if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 if (result.isNewSeries_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
113 result.seriesId_ = database.CreateResource(hashSeries, ResourceType_Series);
3080
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 study if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 if (result.isNewStudy_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 {
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
119 result.studyId_ = database.CreateResource(hashStudy, ResourceType_Study);
3080
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 patient if needed
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 if (result.isNewPatient_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 {
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
125 result.patientId_ = database.CreateResource(hashPatient, ResourceType_Patient);
3080
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 parent-to-child links
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
129 database.AttachChild(result.seriesId_, instanceId);
3080
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 if (result.isNewSeries_)
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 {
3091
476cba12c2b0 IDatabaseWrapper::GetChildrenMetadata()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3084
diff changeset
133 database.AttachChild(result.studyId_, result.seriesId_);
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 }
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.isNewStudy_)
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.patientId_, result.studyId_);
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
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
141 database.TagMostRecentPatient(result.patientId_);
3121
f86ebf971a72 fix unit tests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3093
diff changeset
142
3080
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 // Sanity checks
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 assert(result.patientId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 assert(result.studyId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 assert(result.seriesId_ != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 assert(instanceId != -1);
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 return true;
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
1a75595d8e44 started refactoring of ServerIndex::Store()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 }