comparison OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp @ 5220:df39c7583a49 db-protobuf

preparing virtual methods for labels
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 03 Apr 2023 18:09:04 +0200
parents 450ac804d3af
children d0f7c742d397
comparison
equal deleted inserted replaced
5218:afa96af2eb5a 5220:df39c7583a49
1064 1064
1065 1065
1066 void StatelessDatabaseOperations::GetAllUuids(std::list<std::string>& target, 1066 void StatelessDatabaseOperations::GetAllUuids(std::list<std::string>& target,
1067 ResourceType resourceType, 1067 ResourceType resourceType,
1068 size_t since, 1068 size_t since,
1069 size_t limit) 1069 uint32_t limit)
1070 { 1070 {
1071 if (limit == 0) 1071 if (limit == 0)
1072 { 1072 {
1073 target.clear(); 1073 target.clear();
1074 } 1074 }
1644 1644
1645 virtual void Apply(ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE 1645 virtual void Apply(ReadOnlyTransaction& transaction) ORTHANC_OVERRIDE
1646 { 1646 {
1647 // TODO - CANDIDATE FOR "TransactionType_Implicit" 1647 // TODO - CANDIDATE FOR "TransactionType_Implicit"
1648 std::list<std::string> tmp; 1648 std::list<std::string> tmp;
1649 transaction.ApplyLookupResources(tmp, NULL, query_, level_, 0); 1649 std::set<std::string> withLabels;
1650 std::set<std::string> withoutLabels;
1651 transaction.ApplyLookupResources(tmp, NULL, query_, level_, withLabels, withoutLabels, 0);
1650 CopyListToVector(result_, tmp); 1652 CopyListToVector(result_, tmp);
1651 } 1653 }
1652 }; 1654 };
1653 1655
1654 Operations operations(result, query, level); 1656 Operations operations(result, query, level);
1913 1915
1914 void StatelessDatabaseOperations::ApplyLookupResources(std::vector<std::string>& resourcesId, 1916 void StatelessDatabaseOperations::ApplyLookupResources(std::vector<std::string>& resourcesId,
1915 std::vector<std::string>* instancesId, 1917 std::vector<std::string>* instancesId,
1916 const DatabaseLookup& lookup, 1918 const DatabaseLookup& lookup,
1917 ResourceType queryLevel, 1919 ResourceType queryLevel,
1918 size_t limit) 1920 const std::set<std::string>& withLabels,
1919 { 1921 const std::set<std::string>& withoutLabels,
1920 class Operations : public ReadOnlyOperationsT4<bool, const std::vector<DatabaseConstraint>&, ResourceType, size_t> 1922 uint32_t limit)
1923 {
1924 class Operations : public ReadOnlyOperationsT6<bool, const std::vector<DatabaseConstraint>&, ResourceType,
1925 const std::set<std::string>&, const std::set<std::string>&, size_t>
1921 { 1926 {
1922 private: 1927 private:
1923 std::list<std::string> resourcesList_; 1928 std::list<std::string> resourcesList_;
1924 std::list<std::string> instancesList_; 1929 std::list<std::string> instancesList_;
1925 1930
1938 const Tuple& tuple) ORTHANC_OVERRIDE 1943 const Tuple& tuple) ORTHANC_OVERRIDE
1939 { 1944 {
1940 // TODO - CANDIDATE FOR "TransactionType_Implicit" 1945 // TODO - CANDIDATE FOR "TransactionType_Implicit"
1941 if (tuple.get<0>()) 1946 if (tuple.get<0>())
1942 { 1947 {
1943 transaction.ApplyLookupResources(resourcesList_, &instancesList_, tuple.get<1>(), tuple.get<2>(), tuple.get<3>()); 1948 transaction.ApplyLookupResources(
1949 resourcesList_, &instancesList_, tuple.get<1>(), tuple.get<2>(), tuple.get<3>(), tuple.get<4>(), tuple.get<5>());
1944 } 1950 }
1945 else 1951 else
1946 { 1952 {
1947 transaction.ApplyLookupResources(resourcesList_, NULL, tuple.get<1>(), tuple.get<2>(), tuple.get<3>()); 1953 transaction.ApplyLookupResources(
1954 resourcesList_, NULL, tuple.get<1>(), tuple.get<2>(), tuple.get<3>(), tuple.get<4>(), tuple.get<5>());
1948 } 1955 }
1949 } 1956 }
1950 }; 1957 };
1951 1958
1952 1959
1953 std::vector<DatabaseConstraint> normalized; 1960 std::vector<DatabaseConstraint> normalized;
1954 NormalizeLookup(normalized, lookup, queryLevel); 1961 NormalizeLookup(normalized, lookup, queryLevel);
1955 1962
1956 Operations operations; 1963 Operations operations;
1957 operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, limit); 1964 operations.Apply(*this, (instancesId != NULL), normalized, queryLevel, withLabels, withoutLabels, limit);
1958 1965
1959 CopyListToVector(resourcesId, operations.GetResourcesList()); 1966 CopyListToVector(resourcesId, operations.GetResourcesList());
1960 1967
1961 if (instancesId != NULL) 1968 if (instancesId != NULL)
1962 { 1969 {