annotate OrthancServer/OrthancMoveRequestHandler.cpp @ 655:93adc693cc60

fix mainline version
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Oct 2013 11:56:28 +0100
parents 70d0f27e5bd3
children 08eca5d86aad
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
619
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * In addition, as a special exception, the copyright holders of this
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * program give permission to link the code of its release with the
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * the linked executables. You must obey the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * in all respects for all of the code used other than "OpenSSL". If you
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * modify file(s) with this exception, you may extend this exception to
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * your version of the file(s), but you are not obligated to do so. If
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * you do not wish to do so, delete this exception statement from your
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * version. If you delete this exception statement from all source files
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * in the program, then also delete it here.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * This program is distributed in the hope that it will be useful, but
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include "OrthancMoveRequestHandler.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include <glog/logging.h>
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include "DicomProtocol/DicomUserConnection.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "OrthancInitialization.h"
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 namespace Orthanc
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 namespace
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 // Anonymous namespace to avoid clashes between compilation modules
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 class OrthancMoveRequestIterator : public IMoveRequestIterator
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 private:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 ServerContext& context_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 std::vector<std::string> instances_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 DicomUserConnection connection_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 size_t position_;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 public:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 OrthancMoveRequestIterator(ServerContext& context,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 const std::string& target,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 const std::string& publicId) :
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 context_(context),
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 position_(0)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 LOG(INFO) << "Sending resource " << publicId << " to modality \"" << target << "\"";
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 std::list<std::string> tmp;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 context_.GetIndex().GetChildInstances(tmp, publicId);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 instances_.reserve(tmp.size());
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 for (std::list<std::string>::iterator it = tmp.begin(); it != tmp.end(); it++)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 instances_.push_back(*it);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 ConnectToModalityUsingAETitle(connection_, target);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 virtual unsigned int GetSubOperationCount() const
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return instances_.size();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 virtual Status DoNext()
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 if (position_ >= instances_.size())
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 return Status_Failure;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 const std::string& id = instances_[position_++];
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 std::string dicom;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 context_.ReadFile(dicom, id, FileContentType_Dicom);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 connection_.Store(dicom);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 return Status_Success;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 };
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 bool OrthancMoveRequestHandler::LookupResource(std::string& publicId,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 DicomTag tag,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 const DicomMap& input)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 if (!input.HasTag(tag))
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 std::string value = input.GetValue(tag).AsString();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 std::list<std::string> ids;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 context_.GetIndex().LookupTagValue(ids, tag, value);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 if (ids.size() != 1)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 return false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 else
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 publicId = ids.front();
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 return true;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 IMoveRequestIterator* OrthancMoveRequestHandler::Handle(const std::string& target,
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 const DicomMap& input)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 LOG(WARNING) << "Move-SCU request received for AET \"" << target << "\"";
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 * Retrieve the query level.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 const DicomValue* levelTmp = input.TestAndGetValue(DICOM_TAG_QUERY_RETRIEVE_LEVEL);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 if (levelTmp == NULL)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 throw OrthancException(ErrorCode_BadRequest);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 ResourceType level = StringToResourceType(levelTmp->AsString().c_str());
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 /**
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 * Lookup for the resource to be sent.
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 **/
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 bool ok;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 std::string publicId;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 switch (level)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 case ResourceType_Patient:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 ok = LookupResource(publicId, DICOM_TAG_PATIENT_ID, input);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 case ResourceType_Study:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 ok = LookupResource(publicId, DICOM_TAG_STUDY_INSTANCE_UID, input);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 case ResourceType_Series:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 ok = LookupResource(publicId, DICOM_TAG_SERIES_INSTANCE_UID, input);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 case ResourceType_Instance:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 ok = LookupResource(publicId, DICOM_TAG_SOP_INSTANCE_UID, input);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 break;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 default:
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 ok = false;
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 if (!ok)
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 {
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 throw OrthancException(ErrorCode_BadRequest);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 return new OrthancMoveRequestIterator(context_, target, publicId);
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
70d0f27e5bd3 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 }