1 // Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #include "set_pkginfo_request_handler.hh"
6 #include "../common/parcel/parcelable_factory.hh"
7 #include "../common/parcel/pkginfo_parcelable.hh"
8 #include "../common/database/pkg_set_db_handler.hh"
12 using namespace pkgmgr_common::parcel;
13 using namespace pkgmgr_common::database;
15 namespace pkgmgr_server {
16 namespace request_handler {
18 bool SetPkginfoRequestHandler::HandleRequest(unsigned char* data, int size,
20 auto abstract_parcel = ParcelableFactory::GetInst().CreateParcel(data, size);
22 if (abstract_parcel == nullptr ||
23 abstract_parcel->GetType() != ParcelableType::PkgInfo)
26 auto* parcel = dynamic_cast<PkgInfoParcelable*>(abstract_parcel.get());
27 if (parcel == nullptr) return false;
29 PkgSetDBHandler db(parcel->GetUid());
32 for (auto& i : parcel->GetPkgInfo()) {
34 if (db.Execute() == false) return false;
39 std::vector<uint8_t> SetPkginfoRequestHandler::GetResult() {
40 return std::vector<uint8_t>('0');
43 } // namespace request_handler
44 } // namespace pkgmgr_server