Fixing bugs

4.x.x
geethkokila 10 years ago
parent a9d3d15438
commit e07d917ad6

@ -86,28 +86,31 @@ public class PolicyManagerServiceImpl implements PolicyManagerService {
Policy policy = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint(). Policy policy = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint().
getEffectivePolicy(deviceIdentifier); getEffectivePolicy(deviceIdentifier);
List<ProfileFeature> effectiveFeatures =policy.getProfile().getProfileFeaturesList(); if (policy != null) {
PolicyOperation policyOperation = new PolicyOperation(); List<ProfileFeature> effectiveFeatures = policy.getProfile().getProfileFeaturesList();
List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>(); PolicyOperation policyOperation = new PolicyOperation();
for (ProfileFeature feature : effectiveFeatures) {
ProfileOperation operation = new ProfileOperation();
operation.setCode(feature.getFeatureCode()); List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>();
operation.setPayLoad(feature.getContent()); for (ProfileFeature feature : effectiveFeatures) {
profileOperationList.add(operation); ProfileOperation operation = new ProfileOperation();
}
policyOperation.setProfileOperations(profileOperationList);
policyOperation.setCode(PolicyManagementConstants.POLICY_BUNDLE);
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
deviceIdentifiers.add(deviceIdentifier);
PolicyManagementDataHolder.getInstance().getDeviceManagementService(). operation.setCode(feature.getFeatureCode());
addOperation(policyOperation, deviceIdentifiers); operation.setPayLoad(feature.getContent());
profileOperationList.add(operation);
}
policyOperation.setProfileOperations(profileOperationList);
policyOperation.setCode(PolicyManagementConstants.POLICY_BUNDLE);
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
deviceIdentifiers.add(deviceIdentifier);
PolicyManagementDataHolder.getInstance().getDeviceManagementService().
addOperation(policyOperation, deviceIdentifiers);
} else {
return null;
}
return policy; return policy;
} catch (PolicyEvaluationException e) { } catch (PolicyEvaluationException e) {
@ -131,24 +134,28 @@ public class PolicyManagerServiceImpl implements PolicyManagerService {
List<ProfileFeature> effectiveFeatures = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint(). List<ProfileFeature> effectiveFeatures = PolicyManagementDataHolder.getInstance().getPolicyEvaluationPoint().
getEffectiveFeatures(deviceIdentifier); getEffectiveFeatures(deviceIdentifier);
PolicyOperation policyOperation = new PolicyOperation(); if (!effectiveFeatures.isEmpty()) {
PolicyOperation policyOperation = new PolicyOperation();
List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>(); List<ProfileOperation> profileOperationList = new ArrayList<ProfileOperation>();
for (ProfileFeature feature : effectiveFeatures) { for (ProfileFeature feature : effectiveFeatures) {
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(feature.getFeatureCode()); operation.setCode(feature.getFeatureCode());
operation.setPayLoad(feature.getContent()); operation.setPayLoad(feature.getContent());
profileOperationList.add(operation); profileOperationList.add(operation);
} }
policyOperation.setProfileOperations(profileOperationList); policyOperation.setProfileOperations(profileOperationList);
policyOperation.setCode(PolicyManagementConstants.POLICY_BUNDLE); policyOperation.setCode(PolicyManagementConstants.POLICY_BUNDLE);
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>(); List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
deviceIdentifiers.add(deviceIdentifier); deviceIdentifiers.add(deviceIdentifier);
PolicyManagementDataHolder.getInstance().getDeviceManagementService(). PolicyManagementDataHolder.getInstance().getDeviceManagementService().
addOperation(policyOperation, deviceIdentifiers); addOperation(policyOperation, deviceIdentifiers);
} else {
return null;
}
return effectiveFeatures; return effectiveFeatures;
} catch (PolicyEvaluationException e) { } catch (PolicyEvaluationException e) {

@ -39,6 +39,9 @@ public class PolicyFilterImpl implements PolicyFilter {
for (Policy policy : policies) { for (Policy policy : policies) {
List<String> tempRoles = policy.getRoles(); List<String> tempRoles = policy.getRoles();
if (tempRoles != null) {
continue;
}
if (PolicyManagementConstants.ANY.equalsIgnoreCase(tempRoles.get(0))) { if (PolicyManagementConstants.ANY.equalsIgnoreCase(tempRoles.get(0))) {
temp.add(policy); temp.add(policy);
continue; continue;

@ -55,8 +55,11 @@ public class SimpleEvaluationImpl implements SimpleEvaluation {
policyList = policyInformationPoint.getRelatedPolicies(pipDevice); policyList = policyInformationPoint.getRelatedPolicies(pipDevice);
sortPolicies(); sortPolicies();
policy = policyList.get(0); if(!policyList.isEmpty()) {
policy = policyList.get(0);
} else {
return null;
}
//TODO : UNCOMMENT THE FOLLOWING CASE //TODO : UNCOMMENT THE FOLLOWING CASE
// policyAdministratorPoint = policyManagerService.getPAP(); // policyAdministratorPoint = policyManagerService.getPAP();
// policyAdministratorPoint.setPolicyUsed(deviceIdentifier, policy); // policyAdministratorPoint.setPolicyUsed(deviceIdentifier, policy);

Loading…
Cancel
Save