Add multiple devices assign to multiple groups functionality#69
Open
sulaiman2909 wants to merge 2 commits into
Open
Add multiple devices assign to multiple groups functionality#69sulaiman2909 wants to merge 2 commits into
sulaiman2909 wants to merge 2 commits into
Conversation
R4JxF60
reviewed
May 23, 2025
| @@ -0,0 +1,53 @@ | |||
| /* | |||
| * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. | |||
Contributor
There was a problem hiding this comment.
Update year of the license header.
R4JxF60
reviewed
May 23, 2025
| policyManagerService.getEffectivePolicy(deviceIdentifier); | ||
| } | ||
| } | ||
| pap.publishChanges(); |
Contributor
There was a problem hiding this comment.
Publish changes only group assignments are exist.
R4JxF60
reviewed
May 23, 2025
| for(DeviceIdentifier deviceIdentifier : deviceIdentifiers) { | ||
| Device device = dms.getDevice(deviceIdentifier, false); | ||
| if(!device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.REMOVED)) { | ||
| GroupManagementProviderService groupManagementProviderService = DeviceMgtAPIUtils.getGroupManagementProviderService(); |
Contributor
There was a problem hiding this comment.
Assignment of these services can move after validation check.
R4JxF60
reviewed
May 23, 2025
| for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) { | ||
| List<DeviceGroup> existingGroups = groupManagementProviderService.getGroups(deviceIdentifier, false); | ||
| List<Integer> existingGroupIds = new ArrayList<>(); | ||
| for (DeviceGroup group : existingGroups) { |
Contributor
There was a problem hiding this comment.
Can move existingGroupIds variable declaration and assignment outside the loop and then you can use existingGroupIds.clear().
List l = new ArrayList();
for (condition) {
l.clear();
l.add();
}
This approach will ensure followings,
- Low GC pressure hence one object reused throughout.
- Memory reuse is efficient hence avoids unnecessary heap allocation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, separate endpoints were used for different assignment scenarios — such as assigning a single device to multiple groups, or multiple devices to a single group. This update replaces all those with a single generalized endpoint capable of handling assignments of multiple devices to multiple groups.
Ticket: https://roadmap.entgra.net/issues/12707