|
|
|
@ -304,6 +304,9 @@ public class PolicyManagerUtil {
|
|
|
|
|
if (PolicyManagementConstants.POLICY_CORRECTIVE_ACTION_TYPE
|
|
|
|
|
.equals(correctiveAction.getActionType())) {
|
|
|
|
|
correctivePolicyIdSet.add(correctiveAction.getPolicyId());
|
|
|
|
|
} else if (PolicyManagementConstants.EMAIL_CORRECTIVE_ACTION_TYPE
|
|
|
|
|
.equals(correctiveAction.getActionType())) {
|
|
|
|
|
createEmailCorrectiveActions(correctiveProfileOperation);
|
|
|
|
|
}
|
|
|
|
|
//Add check for another action type in future implementation
|
|
|
|
|
}
|
|
|
|
@ -328,6 +331,20 @@ public class PolicyManagerUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void createEmailCorrectiveActions(ProfileOperation correctiveProfileOperation) {
|
|
|
|
|
ProfileOperation profileOperation = new ProfileOperation();
|
|
|
|
|
profileOperation.setId(PolicyManagementConstants.EMAIL_ACTION_ID);
|
|
|
|
|
profileOperation.setCode(PolicyManagementConstants.EMAIL_FEATURE_CODE);
|
|
|
|
|
profileOperation.setEnabled(true);
|
|
|
|
|
profileOperation.setStatus(Operation.Status.PENDING);
|
|
|
|
|
profileOperation.setType(Operation.Type.PROFILE);
|
|
|
|
|
List<ProfileOperation> profileOperations = new ArrayList<>();
|
|
|
|
|
profileOperation.setPayLoad(profileOperations);
|
|
|
|
|
List<ProfileOperation> payLoad = new ArrayList<>();
|
|
|
|
|
payLoad.add(profileOperation);
|
|
|
|
|
correctiveProfileOperation.setPayLoad(payLoad);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This method is using for generate profile operations list which to be sent to the device.
|
|
|
|
|
* this method is only using multiple corrective actions
|
|
|
|
@ -376,15 +393,23 @@ public class PolicyManagerUtil {
|
|
|
|
|
if (profileOperation.getReactiveActionIds() == null) {
|
|
|
|
|
profileOperation.setReactiveActionIds(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (correctiveAction.getActionType().equals(PolicyManagementConstants.EMAIL_CORRECTIVE_ACTION_TYPE)) {
|
|
|
|
|
profileOperation.getReactiveActionIds().add(PolicyManagementConstants.EMAIL_ACTION_ID);
|
|
|
|
|
} else if (correctiveAction.getActionType().equals(PolicyManagementConstants.POLICY_CORRECTIVE_ACTION_TYPE)){
|
|
|
|
|
profileOperation.getReactiveActionIds().add(correctiveAction.getPolicyId());
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (profileOperation.getCorrectiveActionIds() == null) {
|
|
|
|
|
profileOperation.setCorrectiveActionIds(new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
if (correctiveAction.getActionType().equals(PolicyManagementConstants.EMAIL_CORRECTIVE_ACTION_TYPE)) {
|
|
|
|
|
profileOperation.getCorrectiveActionIds().add(PolicyManagementConstants.EMAIL_ACTION_ID);
|
|
|
|
|
} else if (correctiveAction.getActionType().equals(PolicyManagementConstants.POLICY_CORRECTIVE_ACTION_TYPE)){
|
|
|
|
|
profileOperation.getCorrectiveActionIds().add(correctiveAction.getPolicyId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
profileOperations.add(profileOperation);
|
|
|
|
|
}
|
|
|
|
|
return profileOperations;
|
|
|
|
|