Mercurial > hg > orthanc
comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5679:527918e9c5d9 find-refactoring
integration mainline->find-refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jul 2024 09:03:40 +0200 |
parents | dc96401dbe88 e47ac5e133b1 |
children | 77875b51cf95 |
comparison
equal
deleted
inserted
replaced
5677:dc96401dbe88 | 5679:527918e9c5d9 |
---|---|
362 return SeriesStatus_Missing; | 362 return SeriesStatus_Missing; |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 void StatelessDatabaseOperations::NormalizeLookup(std::vector<DatabaseConstraint>& target, | |
368 const DatabaseLookup& source, | |
369 ResourceType queryLevel) const | |
370 { | |
371 assert(mainDicomTagsRegistry_.get() != NULL); | |
372 | |
373 target.clear(); | |
374 target.reserve(source.GetConstraintsCount()); | |
375 | |
376 for (size_t i = 0; i < source.GetConstraintsCount(); i++) | |
377 { | |
378 ResourceType level; | |
379 DicomTagType type; | |
380 | |
381 mainDicomTagsRegistry_->LookupTag(level, type, source.GetConstraint(i).GetTag()); | |
382 | |
383 if (type == DicomTagType_Identifier || | |
384 type == DicomTagType_Main) | |
385 { | |
386 // Use the fact that patient-level tags are copied at the study level | |
387 if (level == ResourceType_Patient && | |
388 queryLevel != ResourceType_Patient) | |
389 { | |
390 level = ResourceType_Study; | |
391 } | |
392 | |
393 target.push_back(source.GetConstraint(i).ConvertToDatabaseConstraint(level, type)); | |
394 } | |
395 } | |
396 } | |
397 | |
398 | |
399 class StatelessDatabaseOperations::Transaction : public boost::noncopyable | 367 class StatelessDatabaseOperations::Transaction : public boost::noncopyable |
400 { | 368 { |
401 private: | 369 private: |
402 IDatabaseWrapper& db_; | 370 IDatabaseWrapper& db_; |
403 std::unique_ptr<IDatabaseWrapper::ITransaction> transaction_; | 371 std::unique_ptr<IDatabaseWrapper::ITransaction> transaction_; |
1927 { | 1895 { |
1928 ServerToolbox::CheckValidLabel(*it); | 1896 ServerToolbox::CheckValidLabel(*it); |
1929 } | 1897 } |
1930 | 1898 |
1931 std::vector<DatabaseConstraint> normalized; | 1899 std::vector<DatabaseConstraint> normalized; |
1932 NormalizeLookup(normalized, lookup, queryLevel); | 1900 |
1901 assert(mainDicomTagsRegistry_.get() != NULL); | |
1902 mainDicomTagsRegistry_->NormalizeLookup(normalized, lookup, queryLevel); | |
1933 | 1903 |
1934 Operations operations; | 1904 Operations operations; |
1935 operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, labels, labelsConstraint, limit); | 1905 operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, labels, labelsConstraint, limit); |
1936 | 1906 |
1937 CopyListToVector(resourcesId, operations.GetResourcesList()); | 1907 CopyListToVector(resourcesId, operations.GetResourcesList()); |