Adding the activate method when policies are added.

revert-70aa11f8
geethkokila 9 years ago
parent b391681438
commit 044995ed97

@ -59,7 +59,7 @@ import java.util.Map;
public class MonitoringManagerImpl implements MonitoringManager { public class MonitoringManagerImpl implements MonitoringManager {
private PolicyDAO policyDAO; private PolicyDAO policyDAO;
// private DeviceDAO deviceDAO; // private DeviceDAO deviceDAO;
private DeviceTypeDAO deviceTypeDAO; private DeviceTypeDAO deviceTypeDAO;
private MonitoringDAO monitoringDAO; private MonitoringDAO monitoringDAO;
private ComplianceDecisionPoint complianceDecisionPoint; private ComplianceDecisionPoint complianceDecisionPoint;
@ -226,8 +226,6 @@ public class MonitoringManagerImpl implements MonitoringManager {
@Override @Override
public void addMonitoringOperation(List<Device> devices) throws PolicyComplianceException { public void addMonitoringOperation(List<Device> devices) throws PolicyComplianceException {
ComplianceDecisionPoint decisionPoint = new ComplianceDecisionPointImpl();
//int tenantId = PolicyManagerUtil.getTenantId(); //int tenantId = PolicyManagerUtil.getTenantId();
Map<Integer, Device> deviceIds = new HashMap<>(); Map<Integer, Device> deviceIds = new HashMap<>();
List<ComplianceData> complianceDatas; List<ComplianceData> complianceDatas;
@ -327,10 +325,11 @@ public class MonitoringManagerImpl implements MonitoringManager {
} }
} }
// TODO : This should be uncommented, this is to mark the device as unreachable, But given the current implementation // TODO : This should be uncommented, this is to mark the device as unreachable, But given the current
// we are not able to do so. // implementation we are not able to do so.
// if(!deviceToMarkUnreachable.isEmpty()) { // if(!deviceToMarkUnreachable.isEmpty()) {
// ComplianceDecisionPoint decisionPoint = new ComplianceDecisionPointImpl();
// decisionPoint.setDevicesAsUnreachable(this.getDeviceIdentifiersFromDevices( // decisionPoint.setDevicesAsUnreachable(this.getDeviceIdentifiersFromDevices(
// new ArrayList<>(deviceToMarkUnreachable.values()))); // new ArrayList<>(deviceToMarkUnreachable.values())));
// } // }

@ -46,7 +46,6 @@ public class PolicyManagerImpl implements PolicyManager {
private ProfileDAO profileDAO; private ProfileDAO profileDAO;
private FeatureDAO featureDAO; private FeatureDAO featureDAO;
private ProfileManager profileManager; private ProfileManager profileManager;
private PolicyCacheManager policyCacheManager;
private static Log log = LogFactory.getLog(PolicyManagerImpl.class); private static Log log = LogFactory.getLog(PolicyManagerImpl.class);
public PolicyManagerImpl() { public PolicyManagerImpl() {
@ -105,6 +104,9 @@ public class PolicyManagerImpl implements PolicyManager {
policyDAO.addPolicyCriteriaProperties(policy.getPolicyCriterias()); policyDAO.addPolicyCriteriaProperties(policy.getPolicyCriterias());
} }
if(policy.isActive()){
policyDAO.activatePolicy(policy.getId());
}
PolicyManagementDAOFactory.commitTransaction(); PolicyManagementDAOFactory.commitTransaction();
} catch (PolicyManagerDAOException e) { } catch (PolicyManagerDAOException e) {

Loading…
Cancel
Save