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 0732bb0290..f4a947f883 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 @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.beans.SuccessResponse; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.util.DeviceOrgAPIUtils; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.dto.DeviceNodeResult; @@ -68,7 +69,9 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe } DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean resp = deviceOrganizationService.addDeviceOrganization(deviceOrganizationRequest); - return Response.status(Response.Status.OK).entity(resp).build(); + SuccessResponse response = new SuccessResponse(); + response.setSuccess(resp); + return Response.status(Response.Status.OK).entity(response).build(); } catch (DeviceOrganizationMgtPluginException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } @@ -167,7 +170,9 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe } else { exists = deviceOrganizationService.isDeviceOrganizationExist(deviceId, Integer.valueOf(parentDeviceId)); } - return Response.status(Response.Status.OK).entity(exists).build(); + SuccessResponse response = new SuccessResponse(); + response.setSuccess(exists); + return Response.status(Response.Status.OK).entity(response).build(); } catch (DeviceOrganizationMgtPluginException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } @@ -200,7 +205,9 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe try { DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean resp = deviceOrganizationService.updateDeviceOrganization(deviceOrganization); - return Response.status(Response.Status.OK).entity(resp).build(); + SuccessResponse response = new SuccessResponse(); + response.setSuccess(resp); + return Response.status(Response.Status.OK).entity(response).build(); } catch (DeviceOrganizationMgtPluginException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } @@ -213,7 +220,9 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe try { DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean resp = deviceOrganizationService.deleteDeviceOrganizationByID(organizationId); - return Response.status(Response.Status.OK).entity(resp).build(); + SuccessResponse response = new SuccessResponse(); + response.setSuccess(resp); + return Response.status(Response.Status.OK).entity(response).build(); } catch (DeviceOrganizationMgtPluginException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } @@ -226,7 +235,9 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe try { DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean resp = deviceOrganizationService.deleteDeviceAssociations(deviceId); - return Response.status(Response.Status.OK).entity(resp).build(); + SuccessResponse response = new SuccessResponse(); + response.setSuccess(resp); + return Response.status(Response.Status.OK).entity(response).build(); } catch (DeviceOrganizationMgtPluginException e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); } 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/beans/SuccessResponse.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/beans/SuccessResponse.java new file mode 100644 index 0000000000..f52615806f --- /dev/null +++ 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/beans/SuccessResponse.java @@ -0,0 +1,14 @@ +package io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.beans; + +public class SuccessResponse { + + private boolean isSuccess; + + public boolean isSuccess() { + return isSuccess; + } + + public void setSuccess(boolean success) { + isSuccess = success; + } +}