|
|
@ -47,19 +47,19 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy, Object o)
|
|
|
|
public ComplianceData checkPolicyCompliance(DeviceIdentifier deviceIdentifier, Policy policy,
|
|
|
|
throws PolicyComplianceException {
|
|
|
|
Object compliancePayload) throws PolicyComplianceException {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Checking policy compliance status of device '" + deviceIdentifier.getId() + "'");
|
|
|
|
log.debug("Checking policy compliance status of device '" + deviceIdentifier.getId() + "'");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (o == null || policy == null) {
|
|
|
|
if (compliancePayload == null || policy == null) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ComplianceData complianceData = new ComplianceData();
|
|
|
|
ComplianceData complianceData = new ComplianceData();
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
|
|
|
|
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
|
|
|
|
|
|
|
|
|
|
|
|
// Parsing json string to get compliance features.
|
|
|
|
// Parsing json string to get compliance features.
|
|
|
|
JsonElement jsonElement = new JsonParser().parse((String) o);
|
|
|
|
JsonElement jsonElement = new JsonParser().parse((String) compliancePayload);
|
|
|
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
|
|
JsonArray jsonArray = jsonElement.getAsJsonArray();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
ComplianceFeature complianceFeature;
|
|
|
|
ComplianceFeature complianceFeature;
|
|
|
@ -72,7 +72,7 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
|
|
|
|
complianceData.setComplianceFeatures(complianceFeatures);
|
|
|
|
complianceData.setComplianceFeatures(complianceFeatures);
|
|
|
|
|
|
|
|
|
|
|
|
for (ComplianceFeature cf : complianceFeatures) {
|
|
|
|
for (ComplianceFeature cf : complianceFeatures) {
|
|
|
|
if(!cf.isCompliance()){
|
|
|
|
if (!cf.isCompliance()) {
|
|
|
|
complianceData.setStatus(false);
|
|
|
|
complianceData.setStatus(false);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|