Mercurial > hg > orthanc
diff 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 |
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp Tue Nov 13 11:22:33 2012 +0100 +++ b/OrthancServer/ServerIndex.cpp Tue Nov 13 11:29:43 2012 +0100 @@ -589,8 +589,8 @@ } // Attach the files to the newly created instance - db2_->AttachFile(instance, "_dicom", fileUuid, uncompressedFileSize); - db2_->AttachFile(instance, "_json", jsonUuid, 0); // TODO "0" + db2_->AttachFile(instance, "dicom", fileUuid, uncompressedFileSize); + db2_->AttachFile(instance, "json", jsonUuid, 0); // TODO "0" // Attach the metadata db2_->SetMetadata(instance, MetadataType_Instance_ReceptionDate, Toolbox::GetNowIsoString()); @@ -980,6 +980,26 @@ } + bool ServerIndex::GetFile(std::string& fileUuid, + const std::string& instanceUuid, + const std::string& contentName) + { + if (contentName == "json") + { + return GetJsonFile(fileUuid, instanceUuid); + } + else if (contentName == "dicom") + { + return GetDicomFile(fileUuid, instanceUuid); + } + else + { + throw OrthancException(ErrorCode_InternalError); + } + } + + + void ServerIndex::GetAllUuids(Json::Value& target, ResourceType resourceType) {