comparison OrthancServer/ServerIndex.cpp @ 192:c56dc32266e0

refactoring getfile
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Nov 2012 11:29:43 +0100
parents bff0b77b02fa
children a1b9d1e1497b
comparison
equal deleted inserted replaced
191:bff0b77b02fa 192:c56dc32266e0
587 assert(type == ResourceType_Series); 587 assert(type == ResourceType_Series);
588 db2_->AttachChild(series, instance); 588 db2_->AttachChild(series, instance);
589 } 589 }
590 590
591 // Attach the files to the newly created instance 591 // Attach the files to the newly created instance
592 db2_->AttachFile(instance, "_dicom", fileUuid, uncompressedFileSize); 592 db2_->AttachFile(instance, "dicom", fileUuid, uncompressedFileSize);
593 db2_->AttachFile(instance, "_json", jsonUuid, 0); // TODO "0" 593 db2_->AttachFile(instance, "json", jsonUuid, 0); // TODO "0"
594 594
595 // Attach the metadata 595 // Attach the metadata
596 db2_->SetMetadata(instance, MetadataType_Instance_ReceptionDate, Toolbox::GetNowIsoString()); 596 db2_->SetMetadata(instance, MetadataType_Instance_ReceptionDate, Toolbox::GetNowIsoString());
597 db2_->SetMetadata(instance, MetadataType_Instance_RemoteAet, remoteAet); 597 db2_->SetMetadata(instance, MetadataType_Instance_RemoteAet, remoteAet);
598 598
978 return false; 978 return false;
979 } 979 }
980 } 980 }
981 981
982 982
983 bool ServerIndex::GetFile(std::string& fileUuid,
984 const std::string& instanceUuid,
985 const std::string& contentName)
986 {
987 if (contentName == "json")
988 {
989 return GetJsonFile(fileUuid, instanceUuid);
990 }
991 else if (contentName == "dicom")
992 {
993 return GetDicomFile(fileUuid, instanceUuid);
994 }
995 else
996 {
997 throw OrthancException(ErrorCode_InternalError);
998 }
999 }
1000
1001
1002
983 void ServerIndex::GetAllUuids(Json::Value& target, 1003 void ServerIndex::GetAllUuids(Json::Value& target,
984 ResourceType resourceType) 1004 ResourceType resourceType)
985 { 1005 {
986 boost::mutex::scoped_lock scoped_lock(mutex_); 1006 boost::mutex::scoped_lock scoped_lock(mutex_);
987 db2_->GetAllPublicIds(target, resourceType); 1007 db2_->GetAllPublicIds(target, resourceType);