summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_regular/src/sql_pt_representation.cc
diff options
context:
space:
mode:
authorSKobziev <skobziev@luxoft.com>2018-10-25 15:20:50 +0300
committerSKobziev <skobziev@luxoft.com>2018-10-26 11:55:24 +0300
commit072bba71a3b553da369dd8b8e63edf94ab61bff6 (patch)
treeb4a98e0f584df6e1b7b6411bcaa08defd13aa92a /src/components/policy/policy_regular/src/sql_pt_representation.cc
parent0d5b3c4dc01844880f46b752076278578b77781f (diff)
parentd36316738785c96dab2ee892762ed08c059fffde (diff)
downloadsdl_core-fix/Fix_log_severity_level_in_on_vehicle_data_notification_cc.tar.gz
There are following minor issues was fixed: log severity level in on_vehicle_data_notification.cc: ERROR -> DEBUG typo in on_vehicle_data_notification.cc: nanme -> name typo in request_controller.cc: HmiConnectoinKey -> HmiConnectionKey typo in request_info.cc: HmiConnectoinKey -> HmiConnectionKey Also OnSystemError_SUCCESS was changed to DISABLED_OnSystemError_SUCCESS in policy_handler_test.cpp because the running this test case was successful locally and was unsuccess on Jenkins
Diffstat (limited to 'src/components/policy/policy_regular/src/sql_pt_representation.cc')
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index d32ee7133d..75f8be74eb 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -692,6 +692,7 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
while (query.Next()) {
rpc::Nullable<policy_table::ApplicationParams> params;
const std::string& app_id = query.GetString(0);
+
if (IsApplicationRevoked(app_id)) {
params.set_to_null();
(*policies).apps[app_id] = params;
@@ -720,29 +721,36 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
if (!query.IsNull(3)) {
*params.certificate = query.GetString(4);
}
- if (!GatherAppGroup(app_id, &params.groups)) {
+
+ const auto& gather_app_id = ((*policies).apps[app_id].is_string())
+ ? (*policies).apps[app_id].get_string()
+ : app_id;
+ // Data should be gathered from db by "default" key if application has
+ // default policies
+
+ if (!GatherAppGroup(gather_app_id, &params.groups)) {
return false;
}
bool denied = false;
- if (!GatherRemoteControlDenied(app_id, &denied)) {
+ if (!GatherRemoteControlDenied(gather_app_id, &denied)) {
return false;
}
if (!denied) {
- if (!GatherModuleType(app_id, &*params.moduleType)) {
+ if (!GatherModuleType(gather_app_id, &*params.moduleType)) {
return false;
}
}
- if (!GatherNickName(app_id, &*params.nicknames)) {
+ if (!GatherNickName(gather_app_id, &*params.nicknames)) {
return false;
}
- if (!GatherAppType(app_id, &*params.AppHMIType)) {
+ if (!GatherAppType(gather_app_id, &*params.AppHMIType)) {
return false;
}
- if (!GatherRequestType(app_id, &*params.RequestType)) {
+ if (!GatherRequestType(gather_app_id, &*params.RequestType)) {
return false;
}
- if (!GatherRequestSubType(app_id, &*params.RequestSubType)) {
+ if (!GatherRequestSubType(gather_app_id, &*params.RequestSubType)) {
return false;
}
@@ -1137,18 +1145,6 @@ bool SQLPTRepresentation::SaveRequestType(
LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request types omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
- return false;
- }
}
return true;
}
@@ -1181,18 +1177,6 @@ bool SQLPTRepresentation::SaveRequestSubType(
LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request subtypes omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
- return false;
- }
}
return true;
}