merge-requests/7/head
mharindu 10 years ago
commit 7b9dba545a

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

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

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

Loading…
Cancel
Save