# HG changeset patch # User Sebastien Jodogne # Date 1545239206 -3600 # Node ID 53d583d2c7756adec1ed1e39d6b8f6aaabb63f42 # Parent d23c84b1c0f50e1f3e0dbb1d922594f387ee4824 removing IDatabaseWrapper::LookupIdentifier() diff -r d23c84b1c0f5 -r 53d583d2c775 OrthancServer/IDatabaseWrapper.h --- a/OrthancServer/IDatabaseWrapper.h Wed Dec 19 16:31:10 2018 +0100 +++ b/OrthancServer/IDatabaseWrapper.h Wed Dec 19 18:06:46 2018 +0100 @@ -102,6 +102,7 @@ virtual void GetAllMetadata(std::map& target, int64_t id) = 0; + // TODO: REMOVE THIS virtual void GetAllInternalIds(std::list& target, ResourceType resourceType) = 0; @@ -168,18 +169,6 @@ virtual bool LookupGlobalProperty(std::string& target, GlobalProperty property) = 0; - virtual void LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value) = 0; - - virtual void LookupIdentifierRange(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end) = 0; - virtual bool LookupMetadata(std::string& target, int64_t id, MetadataType type) = 0; diff -r d23c84b1c0f5 -r 53d583d2c775 OrthancServer/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/SQLiteDatabaseWrapper.cpp Wed Dec 19 16:31:10 2018 +0100 +++ b/OrthancServer/SQLiteDatabaseWrapper.cpp Wed Dec 19 18:06:46 2018 +0100 @@ -1126,80 +1126,6 @@ } - void SQLiteDatabaseWrapper::LookupIdentifier(std::list& target, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value) - { - static const char* COMMON = ("SELECT d.id FROM DicomIdentifiers AS d, Resources AS r WHERE " - "d.id = r.internalId AND r.resourceType=? AND " - "d.tagGroup=? AND d.tagElement=? AND "); - - std::auto_ptr s; - - switch (type) - { - case IdentifierConstraintType_GreaterOrEqual: - s.reset(new SQLite::Statement(db_, std::string(COMMON) + "d.value>=?")); - break; - - case IdentifierConstraintType_SmallerOrEqual: - s.reset(new SQLite::Statement(db_, std::string(COMMON) + "d.value<=?")); - break; - - case IdentifierConstraintType_Wildcard: - s.reset(new SQLite::Statement(db_, std::string(COMMON) + "d.value GLOB ?")); - break; - - case IdentifierConstraintType_Equal: - default: - s.reset(new SQLite::Statement(db_, std::string(COMMON) + "d.value=?")); - break; - } - - assert(s.get() != NULL); - - s->BindInt(0, level); - s->BindInt(1, tag.GetGroup()); - s->BindInt(2, tag.GetElement()); - s->BindString(3, value); - - target.clear(); - - while (s->Step()) - { - target.push_back(s->ColumnInt64(0)); - } - } - - - void SQLiteDatabaseWrapper::LookupIdentifierRange(std::list& target, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end) - { - SQLite::Statement statement(db_, SQLITE_FROM_HERE, - "SELECT d.id FROM DicomIdentifiers AS d, Resources AS r WHERE " - "d.id = r.internalId AND r.resourceType=? AND " - "d.tagGroup=? AND d.tagElement=? AND d.value>=? AND d.value<=?"); - - statement.BindInt(0, level); - statement.BindInt(1, tag.GetGroup()); - statement.BindInt(2, tag.GetElement()); - statement.BindString(3, start); - statement.BindString(4, end); - - target.clear(); - - while (statement.Step()) - { - target.push_back(statement.ColumnInt64(0)); - } - } - - bool SQLiteDatabaseWrapper::IsDiskSizeAbove(uint64_t threshold) { return GetTotalCompressedSize() > threshold; diff -r d23c84b1c0f5 -r 53d583d2c775 OrthancServer/SQLiteDatabaseWrapper.h --- a/OrthancServer/SQLiteDatabaseWrapper.h Wed Dec 19 16:31:10 2018 +0100 +++ b/OrthancServer/SQLiteDatabaseWrapper.h Wed Dec 19 18:06:46 2018 +0100 @@ -263,18 +263,6 @@ virtual bool IsExistingResource(int64_t internalId); - virtual void LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value); - - virtual void LookupIdentifierRange(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end); - virtual bool IsDiskSizeAbove(uint64_t threshold); virtual void ApplyLookupResources(std::vector& resourcesId, diff -r d23c84b1c0f5 -r 53d583d2c775 OrthancServer/ServerEnumerations.h --- a/OrthancServer/ServerEnumerations.h Wed Dec 19 16:31:10 2018 +0100 +++ b/OrthancServer/ServerEnumerations.h Wed Dec 19 18:06:46 2018 +0100 @@ -56,6 +56,7 @@ StoreStatus_FilteredOut // Removed by NewInstanceFilter }; + // TODO REMOVE THIS enum IdentifierConstraintType { IdentifierConstraintType_Equal, diff -r d23c84b1c0f5 -r 53d583d2c775 Plugins/Engine/OrthancPluginDatabase.cpp --- a/Plugins/Engine/OrthancPluginDatabase.cpp Wed Dec 19 16:31:10 2018 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.cpp Wed Dec 19 18:06:46 2018 +0100 @@ -695,58 +695,6 @@ } - void OrthancPluginDatabase::LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value) - { - if (extensions_.lookupIdentifier3 == NULL) - { - throw OrthancException(ErrorCode_DatabasePlugin, - "The database plugin does not implement the LookupIdentifier3 primitive"); - } - - OrthancPluginDicomTag tmp; - tmp.group = tag.GetGroup(); - tmp.element = tag.GetElement(); - tmp.value = value.c_str(); - - ResetAnswers(); - CheckSuccess(extensions_.lookupIdentifier3(GetContext(), payload_, Plugins::Convert(level), - &tmp, Plugins::Convert(type))); - ForwardAnswers(result); - } - - - void OrthancPluginDatabase::LookupIdentifierRange(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end) - { - if (extensions_.lookupIdentifierRange == NULL) - { - // Default implementation, for plugins using Orthanc SDK <= 1.3.2 - - LookupIdentifier(result, level, tag, IdentifierConstraintType_GreaterOrEqual, start); - - std::list b; - LookupIdentifier(result, level, tag, IdentifierConstraintType_SmallerOrEqual, end); - - result.splice(result.end(), b); - } - else - { - ResetAnswers(); - CheckSuccess(extensions_.lookupIdentifierRange(GetContext(), payload_, Plugins::Convert(level), - tag.GetGroup(), tag.GetElement(), - start.c_str(), end.c_str())); - ForwardAnswers(result); - } - } - - bool OrthancPluginDatabase::LookupMetadata(std::string& target, int64_t id, MetadataType type) diff -r d23c84b1c0f5 -r 53d583d2c775 Plugins/Engine/OrthancPluginDatabase.h --- a/Plugins/Engine/OrthancPluginDatabase.h Wed Dec 19 16:31:10 2018 +0100 +++ b/Plugins/Engine/OrthancPluginDatabase.h Wed Dec 19 18:06:46 2018 +0100 @@ -207,18 +207,6 @@ virtual bool LookupGlobalProperty(std::string& target, GlobalProperty property); - virtual void LookupIdentifier(std::list& result, - ResourceType level, - const DicomTag& tag, - IdentifierConstraintType type, - const std::string& value); - - virtual void LookupIdentifierRange(std::list& result, - ResourceType level, - const DicomTag& tag, - const std::string& start, - const std::string& end); - virtual bool LookupMetadata(std::string& target, int64_t id, MetadataType type);