diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java index 3761a157d9..699bf81370 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtService.java @@ -433,7 +433,7 @@ public interface DeviceOrganizationMgtService { * @return A response containing a list of root device organizations. */ @GET - @Path("roots-children") + @Path("roots/children") @ApiOperation( produces = MediaType.APPLICATION_JSON, httpMethod = "GET", diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java index ab029ed3f5..6b801d1fe7 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java @@ -158,7 +158,7 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe } @GET - @Path("roots-children") + @Path("roots/children") @Override public Response getDeviceOrganizationChildrenForRoots( @DefaultValue("0") @QueryParam("offset") int offset, diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/impl/DeviceOrganizationServiceImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/impl/DeviceOrganizationServiceImpl.java index 179803b827..999ce4cc3c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/impl/DeviceOrganizationServiceImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/impl/DeviceOrganizationServiceImpl.java @@ -177,22 +177,15 @@ public class DeviceOrganizationServiceImpl implements DeviceOrganizationService PaginationRequest paginationRequest = new PaginationRequest(request.getOffSet(), request.getLimit()); List roots = getDeviceOrganizationRoots(paginationRequest); - if (roots == null || roots.isEmpty()) { - log.warn("No root device organizations found."); - return allDeviceOrganizations; // Return an empty list - } - // Iterate over each root and fetch its children for (DeviceOrganization root : roots) { DeviceNodeResult childrenResult = getChildrenOfDeviceNode(root.getDeviceId(), request.getMaxDepth(), request.isIncludeDevice()); if (childrenResult != null) { allDeviceOrganizations.add(childrenResult); - } else { - log.warn("no children found for roots."); } } return allDeviceOrganizations; - } catch (NullPointerException | DeviceOrganizationMgtPluginException e) { + } catch (DeviceOrganizationMgtPluginException e) { String msg = "Error occurred while retrieving all device organizations for roots."; log.error(msg, e); throw new DeviceOrganizationMgtPluginException(msg, e);