Refactor slp-pkgmgr with tidl
[platform/core/appfw/slp-pkgmgr.git] / installer / src / request.cc
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include "request.hh"
19
20 #include <unistd.h>
21
22 namespace pkgmgr {
23 namespace installer {
24
25 Request::Request() {
26   target_uid_ = getuid();
27 }
28
29 Request::~Request() = default;
30
31 int Request::GetRequestType() const {
32   return request_type_;
33 }
34
35 int Request::GetMoveType() const {
36   return move_type_;
37 }
38
39 void Request::SetUpgrade(bool is_upgrade) {
40   is_upgrade_ = is_upgrade;
41 }
42
43 const std::string& Request::GetRequestInfo() const {
44   return pkgmgr_info_;
45 }
46
47 const std::string& Request::GetSessionId() const {
48   return session_id_;
49 }
50
51 const std::string& Request::GetLicensePath() const {
52   return license_path_;
53 }
54
55 const std::string& Request::GetOptionalData() const {
56   return optional_data_;
57 }
58
59 const std::string& Request::GetCallerPkgid() const {
60   return caller_pkgid_;
61 }
62
63 void Request::SetUid(uid_t uid) {
64   target_uid_ = uid;
65 }
66
67 void Request::SetRequestType(int type) {
68   request_type_ = type;
69 }
70
71 void Request::SetSessionId(std::string id) {
72   session_id_ = id;
73 }
74
75 uid_t Request::GetUid() const {
76   return target_uid_;
77 }
78
79 const std::string& Request::GetTepPath() const {
80   return tep_path_;
81 }
82
83 bool Request::IsUpgrade() const {
84   return is_upgrade_;
85 }
86
87 bool Request::IsTepMove() const {
88   return tep_move_;
89 }
90
91 bool Request::IsPreload() const {
92   return is_preload_;
93 }
94
95 bool Request::IsForceRemoval() const {
96   return force_removal_;
97 }
98
99 bool Request::IsPreloadRw() const {
100   return is_preload_rw_;
101 }
102
103 bool Request::IsNoRemoval() const {
104   return no_removal_;
105 }
106
107 bool Request::IsKeepRwData() const {
108   return keep_rwdata_;
109 }
110
111 bool Request::IsPartialRw() const {
112   return partial_rw_;
113 }
114
115 bool Request::IsDebugMode() const {
116   return debug_mode_;
117 }
118
119 bool Request::IsSkipCheckReference() const {
120   return skip_check_reference_;
121 }
122
123 bool Request::IsSkipOptimization() const {
124   return skip_optimization_;
125 }
126
127 bool Request::IsRecoveryCleanup() const {
128   return recovery_cleanup_;
129 }
130
131 const std::vector<std::string>& Request::GetRequests() const {
132   return pkgs_;
133 }
134
135 }  // namespace installer
136 }  // namespace pkgmgr