comparison OrthancServer/ServerIndex.cpp @ 190:b6cef9d45cc3

getallpublicids
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Nov 2012 11:20:50 +0100
parents ccbc2cf64a0d
children bff0b77b02fa
comparison
equal deleted inserted replaced
189:ccbc2cf64a0d 190:b6cef9d45cc3
535 { 535 {
536 assert(type == ResourceType_Instance); 536 assert(type == ResourceType_Instance);
537 return StoreStatus_AlreadyStored; 537 return StoreStatus_AlreadyStored;
538 } 538 }
539 539
540 // Create the patient/study/series/instance hierarchy 540 // Create the instance
541 instance = db2_->CreateResource(hasher.HashInstance(), ResourceType_Instance); 541 instance = db2_->CreateResource(hasher.HashInstance(), ResourceType_Instance);
542 542
543 DicomMap dicom; 543 DicomMap dicom;
544 dicomSummary.ExtractInstanceInformation(dicom); 544 dicomSummary.ExtractInstanceInformation(dicom);
545 db2_->SetMainDicomTags(instance, dicom); 545 db2_->SetMainDicomTags(instance, dicom);
546 546
547 // Create the patient/study/series/instance hierarchy
547 if (!db2_->LookupResource(hasher.HashSeries(), series, type)) 548 if (!db2_->LookupResource(hasher.HashSeries(), series, type))
548 { 549 {
549 // This is a new series 550 // This is a new series
550 isNewSeries = true; 551 isNewSeries = true;
551 series = db2_->CreateResource(hasher.HashSeries(), ResourceType_Series); 552 series = db2_->CreateResource(hasher.HashSeries(), ResourceType_Series);
978 } 979 }
979 } 980 }
980 981
981 982
982 void ServerIndex::GetAllUuids(Json::Value& target, 983 void ServerIndex::GetAllUuids(Json::Value& target,
983 const std::string& tableName) 984 ResourceType resourceType)
984 { 985 {
986 boost::mutex::scoped_lock scoped_lock(mutex_);
987
988 std::string tableName;
989
990 switch (resourceType)
991 {
992 case ResourceType_Patient:
993 tableName = "Patients";
994 break;
995
996 case ResourceType_Study:
997 tableName = "Studies";
998 break;
999
1000 case ResourceType_Series:
1001 tableName = "Series";
1002 break;
1003
1004 case ResourceType_Instance:
1005 tableName = "Instances";
1006 break;
1007
1008 default:
1009 throw OrthancException(ErrorCode_InternalError);
1010 }
1011
985 assert(target.type() == Json::arrayValue); 1012 assert(target.type() == Json::arrayValue);
986 boost::mutex::scoped_lock scoped_lock(mutex_);
987 1013
988 std::string query = "SELECT uuid FROM " + tableName; 1014 std::string query = "SELECT uuid FROM " + tableName;
989 SQLite::Statement s(db_, query); 1015 SQLite::Statement s(db_, query);
990 while (s.Step()) 1016 while (s.Step())
991 { 1017 {