comparison Plugins/Engine/OrthancPluginDatabase.cpp @ 3038:53d583d2c775 db-changes

removing IDatabaseWrapper::LookupIdentifier()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Dec 2018 18:06:46 +0100
parents 8fd203510d8b
children 39db63e68dcf
comparison
equal deleted inserted replaced
3037:d23c84b1c0f5 3038:53d583d2c775
693 693
694 return ForwardSingleAnswer(target); 694 return ForwardSingleAnswer(target);
695 } 695 }
696 696
697 697
698 void OrthancPluginDatabase::LookupIdentifier(std::list<int64_t>& result,
699 ResourceType level,
700 const DicomTag& tag,
701 IdentifierConstraintType type,
702 const std::string& value)
703 {
704 if (extensions_.lookupIdentifier3 == NULL)
705 {
706 throw OrthancException(ErrorCode_DatabasePlugin,
707 "The database plugin does not implement the LookupIdentifier3 primitive");
708 }
709
710 OrthancPluginDicomTag tmp;
711 tmp.group = tag.GetGroup();
712 tmp.element = tag.GetElement();
713 tmp.value = value.c_str();
714
715 ResetAnswers();
716 CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level),
717 &tmp, Plugins::Convert(type)));
718 ForwardAnswers(result);
719 }
720
721
722 void OrthancPluginDatabase::LookupIdentifierRange(std::list<int64_t>& result,
723 ResourceType level,
724 const DicomTag& tag,
725 const std::string& start,
726 const std::string& end)
727 {
728 if (extensions_.lookupIdentifierRange == NULL)
729 {
730 // Default implementation, for plugins using Orthanc SDK <= 1.3.2
731
732 LookupIdentifier(result, level, tag, IdentifierConstraintType_GreaterOrEqual, start);
733
734 std::list<int64_t> b;
735 LookupIdentifier(result, level, tag, IdentifierConstraintType_SmallerOrEqual, end);
736
737 result.splice(result.end(), b);
738 }
739 else
740 {
741 ResetAnswers();
742 CheckSuccess(extensions_.lookupIdentifierRange(GetContext(), payload_, Plugins::Convert(level),
743 tag.GetGroup(), tag.GetElement(),
744 start.c_str(), end.c_str()));
745 ForwardAnswers(result);
746 }
747 }
748
749
750 bool OrthancPluginDatabase::LookupMetadata(std::string& target, 698 bool OrthancPluginDatabase::LookupMetadata(std::string& target,
751 int64_t id, 699 int64_t id,
752 MetadataType type) 700 MetadataType type)
753 { 701 {
754 ResetAnswers(); 702 ResetAnswers();