mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-11-01 19:17:47 +00:00
Entity list call optimization.
This commit is contained in:
@@ -155,7 +155,7 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename DB, typename Record> void ReturnRecordList(const char *ArrayName,DB & DBInstance, RESTAPIHandler & R) {
|
template <typename DB, typename Record> void ReturnRecordList(const char *ArrayName,DB & DBInstance, RESTAPIHandler & R) {
|
||||||
auto UUIDs = Utils::Split(R.SelectedRecords());
|
const auto UUIDs = Utils::Split(R.SelectedRecords());
|
||||||
Poco::JSON::Array ObjArr;
|
Poco::JSON::Array ObjArr;
|
||||||
for(const auto &i:UUIDs) {
|
for(const auto &i:UUIDs) {
|
||||||
Record E;
|
Record E;
|
||||||
|
|||||||
@@ -14,14 +14,13 @@
|
|||||||
namespace OpenWifi{
|
namespace OpenWifi{
|
||||||
|
|
||||||
void RESTAPI_entity_list_handler::DoGet() {
|
void RESTAPI_entity_list_handler::DoGet() {
|
||||||
std::string Arg;
|
|
||||||
if(!QB_.Select.empty()) {
|
if(!QB_.Select.empty()) {
|
||||||
return ReturnRecordList<decltype(StorageService()->EntityDB()),
|
return ReturnRecordList<decltype(StorageService()->EntityDB()),
|
||||||
ProvObjects::Entity>("entities",StorageService()->EntityDB(),*this );
|
ProvObjects::Entity>("entities",StorageService()->EntityDB(),*this );
|
||||||
} else if(QB_.CountOnly) {
|
} else if(QB_.CountOnly) {
|
||||||
auto C = StorageService()->EntityDB().Count();
|
auto C = StorageService()->EntityDB().Count();
|
||||||
return ReturnCountOnly(C);
|
return ReturnCountOnly(C);
|
||||||
} if (HasParameter("getTree",Arg) && Arg=="true") {
|
} else if (GetBoolParameter("getTree",false)) {
|
||||||
Poco::JSON::Object FullTree;
|
Poco::JSON::Object FullTree;
|
||||||
StorageService()->EntityDB().BuildTree(FullTree);
|
StorageService()->EntityDB().BuildTree(FullTree);
|
||||||
return ReturnObject(FullTree);
|
return ReturnObject(FullTree);
|
||||||
@@ -33,8 +32,7 @@ namespace OpenWifi{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RESTAPI_entity_list_handler::DoPost() {
|
void RESTAPI_entity_list_handler::DoPost() {
|
||||||
std::string Arg;
|
if (GetBoolParameter("setTree",false)) {
|
||||||
if (HasParameter("setTree",Arg) && Arg=="true") {
|
|
||||||
auto FullTree = ParseStream();
|
auto FullTree = ParseStream();
|
||||||
StorageService()->EntityDB().ImportTree(FullTree);
|
StorageService()->EntityDB().ImportTree(FullTree);
|
||||||
return OK();
|
return OK();
|
||||||
|
|||||||
Reference in New Issue
Block a user