Removed repeated classes and implemented code to already existing classes and divided code into sub methods to limit repetitive code and increase readability. And the response messages were change in order to give users a better understating of the responses they get when calling the api endpoints.
Permanent delete DAO fix
## Purpose
Fix issue in deleting duplicate deviceIds from tables
## Security checks
* Followed secure coding standards? yes
* Ran FindSecurityBugs plugin and verified report? no
* Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? yes
See merge request entgra/carbon-device-mgt!302
Fix Permanent delete for multiple enrollments
## Purpose
To enable permanent deletion of a sinlge device with multiple enroolmemts
## Goals
> (Goals achieved by feature)
## Approach
## Documentation
## Automation tests
## Security checks
- Followed secure coding standards? (yes/no)
- Ran FindSecurityBugs plugin and verified report? (yes/no)
- Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? (yes/no)
## Related MRs
## Test environment
## Learning
See merge request entgra/carbon-device-mgt!296
The cause of the issue is not passing the newly introduced parameter 'policyType' in the policy edit payload. This parameter is marked @NotNull. Hence throwing an error.
This fix sets the policyType parameter from the existing payload (Doesn't allow to edit as there is no UI interface to edit this parameter ATM
Fixes: entgra/product-iots#175
Permanent delete API modification
## Purpose
> Delete multple devices from one API call.
## Goals
> Avoid invoking the API multiple times to delete a set of devices.
## Approach
> Delete the records of the devices as batch operations in the core level via a DEeviceDAO object and in the plugin level by creating a DeviceManager object for each device type.
## Documentation
> N/A
## Automation tests
- Unit tests
> None
- Integration tests
> None
## Security checks
- Followed secure coding standards? (yes)
- Ran FindSecurityBugs plugin and verified report? (no)
- Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets? (yes)
## Related MRs
> https://gitlab.com/entgra/carbon-device-mgt/merge_requests/198
## Test environment
> N/A
## Learning
> N/A
See merge request entgra/carbon-device-mgt!241