|
|
@ -62,14 +62,16 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
return complianceData;
|
|
|
|
return complianceData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
|
|
|
|
|
|
|
|
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
|
|
|
|
|
|
|
|
String compliancePayloadString = new Gson().toJson(compliancePayload);
|
|
|
|
// Parsing json string to get compliance features.
|
|
|
|
// Parsing json string to get compliance features.
|
|
|
|
JsonElement jsonElement;
|
|
|
|
JsonElement jsonElement;
|
|
|
|
if (compliancePayload instanceof String) {
|
|
|
|
if (compliancePayloadString instanceof String) {
|
|
|
|
jsonElement = new JsonParser().parse((String) compliancePayload);
|
|
|
|
jsonElement = new JsonParser().parse(compliancePayloadString);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw new PolicyComplianceException("Invalid policy compliance payload");
|
|
|
|
throw new PolicyComplianceException("Invalid policy compliance payload");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
|
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
ComplianceFeature complianceFeature;
|
|
|
|
ComplianceFeature complianceFeature;
|
|
|
@ -79,14 +81,15 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
complianceFeatures.add(complianceFeature);
|
|
|
|
complianceFeatures.add(complianceFeature);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
complianceData.setComplianceFeatures(complianceFeatures);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (ComplianceFeature cf : complianceFeatures) {
|
|
|
|
for (ComplianceFeature cf : complianceFeatures) {
|
|
|
|
if (!cf.isCompliant()) {
|
|
|
|
if (!cf.isCompliant()) {
|
|
|
|
complianceData.setStatus(false);
|
|
|
|
complianceData.setStatus(false);
|
|
|
|
|
|
|
|
nonComplianceFeatures.add(cf);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
complianceData.setComplianceFeatures(nonComplianceFeatures);
|
|
|
|
return complianceData;
|
|
|
|
return complianceData;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|