Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 1760:51db4a25a741 db-changes
LookupIdentifier is plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Oct 2015 11:09:00 +0100 |
parents | 55d52567bebb |
children | 2b91363cc1d1 |
comparison
equal
deleted
inserted
replaced
1759:e268412adcf1 | 1760:51db4a25a741 |
---|---|
275 | 275 |
276 | 276 |
277 void OrthancPluginDatabase::GetAllInternalIds(std::list<int64_t>& target, | 277 void OrthancPluginDatabase::GetAllInternalIds(std::list<int64_t>& target, |
278 ResourceType resourceType) | 278 ResourceType resourceType) |
279 { | 279 { |
280 // TODO | 280 if (extensions_.getAllInternalIds == NULL) |
281 throw OrthancException(ErrorCode_NotImplemented); | 281 { |
282 LOG(ERROR) << "The database plugin does not implement the GetAllInternalIds primitive"; | |
283 throw OrthancException(ErrorCode_DatabasePlugin); | |
284 } | |
285 | |
286 ResetAnswers(); | |
287 CheckSuccess(extensions_.getAllInternalIds(GetContext(), payload_, Plugins::Convert(resourceType))); | |
288 ForwardAnswers(target); | |
282 } | 289 } |
283 | 290 |
284 | 291 |
285 void OrthancPluginDatabase::GetAllPublicIds(std::list<std::string>& target, | 292 void OrthancPluginDatabase::GetAllPublicIds(std::list<std::string>& target, |
286 ResourceType resourceType) | 293 ResourceType resourceType) |
600 | 607 |
601 return ForwardSingleAnswer(target); | 608 return ForwardSingleAnswer(target); |
602 } | 609 } |
603 | 610 |
604 | 611 |
605 /* | |
606 | |
607 TODO REMOVE THIS | |
608 | |
609 void OrthancPluginDatabase::LookupIdentifierExact(std::list<int64_t>& target, | |
610 ResourceType level, | |
611 const DicomTag& tag, | |
612 const std::string& value) | |
613 { | |
614 ResetAnswers(); | |
615 | |
616 OrthancPluginDicomTag tmp; | |
617 tmp.group = tag.GetGroup(); | |
618 tmp.element = tag.GetElement(); | |
619 tmp.value = value.c_str(); | |
620 | |
621 if (extensions_.lookupIdentifierExact != NULL) | |
622 { | |
623 CheckSuccess(extensions_.lookupIdentifierExact(GetContext(), payload_, Plugins::Convert(level), &tmp)); | |
624 ForwardAnswers(target); | |
625 } | |
626 else | |
627 { | |
628 // Emulate "lookupIdentifierExact" if unavailable | |
629 | |
630 if (backend_.lookupIdentifier == NULL) | |
631 { | |
632 LOG(ERROR) << "The plugin does not have the extension \"lookupIdentifierExact\""; | |
633 throw OrthancException(ErrorCode_DatabasePlugin); | |
634 } | |
635 | |
636 CheckSuccess(backend_.lookupIdentifier(GetContext(), payload_, &tmp)); | |
637 | |
638 if (type_ != _OrthancPluginDatabaseAnswerType_None && | |
639 type_ != _OrthancPluginDatabaseAnswerType_Int64) | |
640 { | |
641 throw OrthancException(ErrorCode_DatabasePlugin); | |
642 } | |
643 | |
644 target.clear(); | |
645 | |
646 if (type_ == _OrthancPluginDatabaseAnswerType_Int64) | |
647 { | |
648 for (std::list<int64_t>::const_iterator | |
649 it = answerInt64_.begin(); it != answerInt64_.end(); ++it) | |
650 { | |
651 if (GetResourceType(*it) == level) | |
652 { | |
653 target.push_back(*it); | |
654 } | |
655 } | |
656 } | |
657 } | |
658 }*/ | |
659 | |
660 | |
661 void OrthancPluginDatabase::LookupIdentifier(std::list<int64_t>& result, | 612 void OrthancPluginDatabase::LookupIdentifier(std::list<int64_t>& result, |
662 ResourceType level, | 613 ResourceType level, |
663 const DicomTag& tag, | 614 const DicomTag& tag, |
664 IdentifierConstraintType type, | 615 IdentifierConstraintType type, |
665 const std::string& value) | 616 const std::string& value) |
666 { | 617 { |
667 // TODO | 618 if (extensions_.lookupIdentifier3 == NULL) |
668 throw OrthancException(ErrorCode_NotImplemented); | 619 { |
620 LOG(ERROR) << "The database plugin does not implement the GetAllInternalIds primitive"; | |
621 throw OrthancException(ErrorCode_DatabasePlugin); | |
622 } | |
623 | |
624 OrthancPluginDicomTag tmp; | |
625 tmp.group = tag.GetGroup(); | |
626 tmp.element = tag.GetElement(); | |
627 tmp.value = value.c_str(); | |
628 | |
629 ResetAnswers(); | |
630 CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level), | |
631 &tmp, Plugins::Convert(type))); | |
632 ForwardAnswers(result); | |
669 } | 633 } |
670 | 634 |
671 | 635 |
672 bool OrthancPluginDatabase::LookupMetadata(std::string& target, | 636 bool OrthancPluginDatabase::LookupMetadata(std::string& target, |
673 int64_t id, | 637 int64_t id, |