comparison OrthancServer/ServerContext.cpp @ 1006:649d47854314 lua-scripting

proper handling of metadata in Store
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jul 2014 15:11:00 +0200
parents 84b6d7bca6db
children 871c49c9b11d
comparison
equal deleted inserted replaced
1005:84b6d7bca6db 1006:649d47854314
191 191
192 ServerIndex::Attachments attachments; 192 ServerIndex::Attachments attachments;
193 attachments.push_back(dicomInfo); 193 attachments.push_back(dicomInfo);
194 attachments.push_back(jsonInfo); 194 attachments.push_back(jsonInfo);
195 195
196 StoreStatus status = index_.Store(dicom.GetSummary(), attachments, dicom.GetRemoteAet(), dicom.GetMetadata()); 196 std::map<MetadataType, std::string> instanceMetadata;
197 StoreStatus status = index_.Store(instanceMetadata, dicom.GetSummary(), attachments,
198 dicom.GetRemoteAet(), dicom.GetMetadata());
197 199
198 if (status != StoreStatus_Success) 200 if (status != StoreStatus_Success)
199 { 201 {
200 storage_.Remove(dicomInfo.GetUuid()); 202 storage_.Remove(dicomInfo.GetUuid());
201 storage_.Remove(jsonInfo.GetUuid()); 203 storage_.Remove(jsonInfo.GetUuid());
223 if (status == StoreStatus_Success || 225 if (status == StoreStatus_Success ||
224 status == StoreStatus_AlreadyStored) 226 status == StoreStatus_AlreadyStored)
225 { 227 {
226 try 228 try
227 { 229 {
230 #if 1
228 Json::Value metadata = Json::objectValue; 231 Json::Value metadata = Json::objectValue;
229 for (ServerIndex::MetadataMap::const_iterator 232 for (std::map<MetadataType, std::string>::const_iterator
230 it = dicom.GetMetadata().begin(); 233 it = instanceMetadata.begin();
231 it != dicom.GetMetadata().end(); ++it) 234 it != instanceMetadata.end(); ++it)
232 { 235 {
233 if (it->first.first == ResourceType_Instance) 236 metadata[EnumerationToString(it->first)] = it->second;
234 {
235 metadata[EnumerationToString(it->first.second)] = it->second;
236 }
237 } 237 }
238 #else
239 Json::Value metadata;
240 index_.GetMetadata(metadata, resultPublicId);
241 #endif
242
243 std::cout << metadata;
238 244
239 ApplyOnStoredInstance(resultPublicId, simplified, metadata); 245 ApplyOnStoredInstance(resultPublicId, simplified, metadata);
240 } 246 }
241 catch (OrthancException&) 247 catch (OrthancException&)
242 { 248 {