refactored checkPolicyCompliance

revert-dabc3590
hasuniea 9 years ago
parent aba2cf4447
commit c5397cde67

@ -47,19 +47,22 @@ public class WindowsPolicyMonitoringService implements PolicyMonitoringService {
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() + "'");
} }
List<ComplianceFeature> complianceFeatures = (List<ComplianceFeature>) compliancePayload;
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
ComplianceData complianceData = new ComplianceData(); ComplianceData complianceData = new ComplianceData();
if (policy == null || compliancePayload == null) { if (policy == null || compliancePayload == null) {
return complianceData; return complianceData;
} }
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
complianceData.setComplianceFeatures((List<ComplianceFeature>) compliancePayload);
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;
} }

Loading…
Cancel
Save