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, std::string locale) {
19 auto abstract_parcel = ParcelableFactory::GetInst().CreateParcel(data, size);
21 if (abstract_parcel->GetType() != ParcelableType::PkgInfo)
24 auto* parcel = dynamic_cast<PkgInfoParcelable*>(abstract_parcel.get());
26 PkgSetDBHandler db(parcel->GetUid());
29 for (auto& i : parcel->GetPkgInfo()) {
31 if (db.Execute() == false)
37 std::vector<uint8_t> SetPkginfoRequestHandler::GetResult() {
38 return std::vector<uint8_t>('0');
41 } // namespace request_handler
42 } // namespace pkgmgr_server