fixed policy conflicts

This commit is contained in:
Supun94 2016-11-04 22:01:51 +05:30
parent cc5d9012c1
commit c91da9219d
2 changed files with 16 additions and 4 deletions

View File

@ -91,11 +91,18 @@ public class PolicyManagerServiceImpl implements PolicyManagerService {
@Override
public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws PolicyManagementException {
try {
Policy policy = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint().
getEffectivePolicy(deviceIdentifier);
PolicyEvaluationPoint policyEvaluationPoint = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint();
Policy policy;
if (policy == null) {
return null;
if (policyEvaluationPoint != null) {
policy = policyEvaluationPoint.
getEffectivePolicy(deviceIdentifier);
if (policy == null) {
return null;
}
} else {
throw new PolicyEvaluationException("Error occurred while getting the policy evaluation point " +
deviceIdentifier.getId() + " - " + deviceIdentifier.getType());
}
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
deviceIdentifiers.add(deviceIdentifier);

View File

@ -72,6 +72,11 @@ public class SimpleEvaluationPoint implements PolicyEvaluationPoint {
@Override
public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws PolicyEvaluationException {
if (policyManagerService == null || policyList.size() == 0) {
return null;
}
Policy policy = new Policy();
Profile profile = new Profile();
profile.setProfileFeaturesList(getEffectiveFeatures(deviceIdentifier));