Adding changes for the grouping and ownership changes

revert-70aa11f8
geethkokila 8 years ago
parent 1a1ca1587f
commit 20ca76640d

@ -76,7 +76,7 @@ public class PolicyFilterImpl implements PolicyFilter {
continue;
} else {
for (DeviceGroupWrapper deviceGroupWrapper : wrappers) {
if (groupMap.containsKey(deviceGroupWrapper.getId()) && policyMap.containsKey(policy.getId())) {
if (groupMap.containsKey(deviceGroupWrapper.getId()) && !policyMap.containsKey(policy.getId())) {
temp.add(policy);
policyMap.put(policy.getId(), policy);
}
@ -140,6 +140,9 @@ public class PolicyFilterImpl implements PolicyFilter {
@Override
public List<Policy> filterOwnershipTypeBasedPolicies(String ownershipType, List<Policy> policies) {
if (ownershipType == null) {
return policies;
}
if (log.isDebugEnabled()) {
log.debug("No of policies went in to filterOwnershipTypeBasedPolicies : " + policies.size());
log.debug("Ownership type : " + ownershipType);
@ -150,7 +153,7 @@ public class PolicyFilterImpl implements PolicyFilter {
List<Policy> temp = new ArrayList<Policy>();
for (Policy policy : policies) {
if (ownershipType.equalsIgnoreCase(policy.getOwnershipType()) ||
if (policy.getOwnershipType() == null || ownershipType.equalsIgnoreCase(policy.getOwnershipType()) ||
PolicyManagementConstants.ANY.equalsIgnoreCase(policy.getOwnershipType())) {
temp.add(policy);
}

@ -128,6 +128,12 @@ public class PolicyInformationPointImpl implements PolicyInformationPoint {
}
if (pipDevice.getDeviceGroups() != null && !pipDevice.getDeviceGroups().isEmpty()) {
Map<Integer, DeviceGroup> groupMap = new HashMap<>();
List<DeviceGroup> groups = pipDevice.getDeviceGroups();
for(DeviceGroup gr: groups){
groupMap.put(gr.getGroupId(), gr);
}
policies = policyFilter.filterDeviceGroupsPolicies(groupMap, policies);
}
if (log.isDebugEnabled()) {

Loading…
Cancel
Save