Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 1727:1ae29c5e52fb db-changes
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Oct 2015 14:50:10 +0200 |
parents | 2b812969e136 |
children | 4941494b5dd8 |
comparison
equal
deleted
inserted
replaced
1725:a7c05bbfaf6a | 1727:1ae29c5e52fb |
---|---|
593 return ForwardSingleAnswer(target); | 593 return ForwardSingleAnswer(target); |
594 } | 594 } |
595 | 595 |
596 | 596 |
597 void OrthancPluginDatabase::LookupIdentifier(std::list<int64_t>& target, | 597 void OrthancPluginDatabase::LookupIdentifier(std::list<int64_t>& target, |
598 ResourceType level, | |
598 const DicomTag& tag, | 599 const DicomTag& tag, |
599 const std::string& value) | 600 const std::string& value) |
600 { | 601 { |
601 ResetAnswers(); | 602 ResetAnswers(); |
602 | 603 |
603 OrthancPluginDicomTag tmp; | 604 OrthancPluginDicomTag tmp; |
604 tmp.group = tag.GetGroup(); | 605 tmp.group = tag.GetGroup(); |
605 tmp.element = tag.GetElement(); | 606 tmp.element = tag.GetElement(); |
606 tmp.value = value.c_str(); | 607 tmp.value = value.c_str(); |
607 | 608 |
608 CheckSuccess(backend_.lookupIdentifier(GetContext(), payload_, &tmp)); | 609 if (extensions_.lookupIdentifier3 != NULL) |
609 | 610 { |
610 ForwardAnswers(target); | 611 CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level), &tmp)); |
612 ForwardAnswers(target); | |
613 } | |
614 else | |
615 { | |
616 // Emulate "lookupIdentifier3" if unavailable | |
617 | |
618 if (backend_.lookupIdentifier == NULL) | |
619 { | |
620 throw OrthancException(ErrorCode_DatabasePlugin); | |
621 } | |
622 | |
623 CheckSuccess(backend_.lookupIdentifier(GetContext(), payload_, &tmp)); | |
624 | |
625 if (type_ != _OrthancPluginDatabaseAnswerType_None && | |
626 type_ != _OrthancPluginDatabaseAnswerType_Int64) | |
627 { | |
628 throw OrthancException(ErrorCode_DatabasePlugin); | |
629 } | |
630 | |
631 target.clear(); | |
632 | |
633 if (type_ == _OrthancPluginDatabaseAnswerType_Int64) | |
634 { | |
635 for (std::list<int64_t>::const_iterator | |
636 it = answerInt64_.begin(); it != answerInt64_.end(); ++it) | |
637 { | |
638 if (GetResourceType(*it) == level) | |
639 { | |
640 target.push_back(*it); | |
641 } | |
642 } | |
643 } | |
644 } | |
611 } | 645 } |
612 | 646 |
613 | 647 |
614 bool OrthancPluginDatabase::LookupMetadata(std::string& target, | 648 bool OrthancPluginDatabase::LookupMetadata(std::string& target, |
615 int64_t id, | 649 int64_t id, |