From 1dbc1d7b0d35fa276c6891d862cad17749b3c373 Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Tue, 20 Feb 2024 11:32:23 +0530 Subject: [PATCH 01/24] device/group authorization improvement --- .../api/AccessAuthorizationService.java | 181 ++++++++++++++++++ .../impl/AccessAuthorizationServiceImpl.java | 95 +++++++++ .../service/impl/DeviceAgentServiceImpl.java | 13 +- .../impl/DeviceManagementServiceImpl.java | 9 +- .../impl/GroupManagementServiceImpl.java | 1 + .../impl/PolicyManagementServiceImpl.java | 5 +- .../GroupManagementAdminServiceImpl.java | 3 + .../mgt/api/jaxrs/util/DeviceMgtAPIUtils.java | 17 +- .../service/impl/DeviceAgentServiceTest.java | 24 +-- .../impl/DeviceManagementServiceImplTest.java | 2 +- .../DeviceAccessAuthorizationService.java | 46 ----- .../DeviceAuthorizationRequest.java | 68 +++++++ .../GroupAccessAuthorizationException.java | 61 ++++++ .../GroupAccessAuthorizationService.java | 16 ++ .../GroupAuthorizationRequest.java | 58 ++++++ .../GroupAuthorizationResult.java | 56 ++++++ .../DeviceAccessAuthorizationServiceImpl.java | 145 ++++++-------- .../GroupAccessAuthorizationServiceImpl.java | 173 +++++++++++++++++ .../impl/DeviceInformationManagerImpl.java | 5 +- .../internal/DeviceManagementDataHolder.java | 10 + .../DeviceManagementServiceComponent.java | 8 + .../operation/mgt/OperationManagerImpl.java | 9 +- .../mgt/PermissionManagerServiceImpl.java | 13 ++ .../GroupManagementProviderServiceImpl.java | 19 +- .../DeviceAccessAuthorizationServiceTest.java | 8 +- .../authorizer/PermissionAuthorizer.java | 1 + 26 files changed, 884 insertions(+), 162 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AccessAuthorizationService.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AccessAuthorizationServiceImpl.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAuthorizationRequest.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationException.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationRequest.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationResult.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/GroupAccessAuthorizationServiceImpl.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AccessAuthorizationService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AccessAuthorizationService.java new file mode 100644 index 0000000000..1de058f4fc --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AccessAuthorizationService.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; + +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationRequest; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAuthorizationRequest; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAuthorizationResult; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; + +import javax.validation.Valid; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "AccessAuthorizationService"), + @ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/access"), + }) + } + ), + tags = { + @Tag(name = "device_management", description = "") + } +) +@Path("/access") +@Api(value = "AccessAuthorizationService", description = "This API carries all device group management related " + + "access authorization") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface AccessAuthorizationService { + + @POST + @Path("/device") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HTTPConstants.HEADER_GET, + value = "check device access authorization", + notes = "Returns device access acutorization info", + tags = "device_management" + ) + @ApiResponses( + value = { + @ApiResponse( + code = 201, + message = "Created. \n Device group has successfully been created", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the added group."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time" + + ".\n" + "Used by caches, or in conditional requests.") + } + ), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location " + + "header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error.", + response = ErrorResponse.class), + @ApiResponse( + code = 401, + message = "Unauthorized. \n Current logged in user is not authorized for this request", + response = ErrorResponse.class), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported " + + "format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while checking access", + response = ErrorResponse.class) + }) + Response checkDeviceAccess( + @ApiParam( + name = "deviceAccessRequest", + value = "Define the device access request object with data.", + required = true) + @Valid DeviceAuthorizationRequest deviceAuthorizationRequest); + + @POST + @Path("/group") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = HTTPConstants.HEADER_GET, + value = "check device access authorization", + notes = "Returns device access acutorization info", + tags = "device_management" + ) + @ApiResponses( + value = { + @ApiResponse( + code = 201, + message = "Created. \n Device group has successfully been created", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the added group."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time" + + ".\n" + "Used by caches, or in conditional requests.") + } + ), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location " + + "header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error.", + response = ErrorResponse.class), + @ApiResponse( + code = 401, + message = "Unauthorized. \n Current logged in user is not authorized for this request", + response = ErrorResponse.class), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported " + + "format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while checking access", + response = ErrorResponse.class) + }) + Response checkGroupAccess( + @ApiParam( + name = "groupAccessRequest", + value = "Define the group access request object with data.", + required = true) + @Valid GroupAuthorizationRequest request); +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AccessAuthorizationServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AccessAuthorizationServiceImpl.java new file mode 100644 index 0000000000..f6d555a273 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AccessAuthorizationServiceImpl.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; + +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.AccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.authorization.*; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + + +public class AccessAuthorizationServiceImpl implements AccessAuthorizationService { + + private static final Log log = LogFactory.getLog(AccessAuthorizationServiceImpl.class); + @Override + public Response checkDeviceAccess(DeviceAuthorizationRequest deviceAuthorizationRequest) { + + if (StringUtils.isEmpty(deviceAuthorizationRequest.getType())) { + String msg = "device type not specified"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + + if (deviceAuthorizationRequest.getDeviceIds().isEmpty()) { + String msg = "device ids not specified"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + + if (deviceAuthorizationRequest.getPermissions().isEmpty()) { + String msg = "permissions not specified"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + + List deviceIdentifiers = new ArrayList<>(); + for(String id : deviceAuthorizationRequest.getDeviceIds()) { + DeviceIdentifier identifier = new DeviceIdentifier(id, deviceAuthorizationRequest.getType()); + deviceIdentifiers.add(identifier); + } + try { + DeviceAuthorizationResult result = DeviceMgtAPIUtils.getDeviceAccessAuthorizationService() + .isUserAuthorized(deviceIdentifiers, deviceAuthorizationRequest.getUsername(), + deviceAuthorizationRequest.getPermissions().toArray(new String[0])); + return Response.status(Response.Status.OK).entity(result).build(); + } catch (DeviceAccessAuthorizationException e) { + String msg = "Error occurred while checking access info"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + + @Override + public Response checkGroupAccess(GroupAuthorizationRequest request) { + + if (request.getGroupIds().isEmpty()) { + String msg = "group ids not specified"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + + if (request.getPermissions().isEmpty()) { + String msg = "permissions not specified"; + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); + } + + try { + GroupAuthorizationResult result = DeviceMgtAPIUtils.getGroupAccessAuthorizationService() + .isUserAuthorized(request.getGroupIds(), request.getUsername(), + request.getPermissions().toArray(new String[0])); + return Response.status(Response.Status.OK).entity(result).build(); + } catch (GroupAccessAuthorizationException e) { + String msg = "Error occurred while checking access info"; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java index 32313062b6..4231ecc41e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java @@ -21,6 +21,7 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -167,7 +168,9 @@ public class DeviceAgentServiceImpl implements DeviceAgentService { DeviceMgtAPIUtils.getDeviceAccessAuthorizationService(); boolean status; try { - status = deviceAccessAuthorizationService.isUserAuthorized(new DeviceIdentifier(id, type)); + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; + status = deviceAccessAuthorizationService.isUserAuthorized(new DeviceIdentifier(id, type), requiredPermissions); } catch (DeviceAccessAuthorizationException e) { String msg = "Error occurred while modifying enrollment of the Android device that carries the id '" + id + "'"; @@ -229,8 +232,10 @@ public class DeviceAgentServiceImpl implements DeviceAgentService { String msg = "invalid payload structure"; return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } else { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; boolean authorized = DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized - (new DeviceIdentifier(type, deviceId)); + (new DeviceIdentifier(type, deviceId), requiredPermissions); if (!authorized) { String msg = "Does not have permission to access the device."; return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); @@ -329,8 +334,10 @@ public class DeviceAgentServiceImpl implements DeviceAgentService { String msg = "Invalid payload structure"; return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } else { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; boolean authorized = DeviceMgtAPIUtils.getDeviceAccessAuthorizationService().isUserAuthorized - (new DeviceIdentifier(type, deviceId)); + (new DeviceIdentifier(type, deviceId), requiredPermissions); if (!authorized) { String msg = "Does not have permission to access the device."; return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index d8f028c928..58259e19c8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -28,6 +28,7 @@ import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionMan import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DisenrollRequest; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtUtil; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -580,7 +581,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { String authorizedUser = CarbonContext.getThreadLocalCarbonContext().getUsername(); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, type); // check whether the user is authorized - if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, authorizedUser)) { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; + if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, authorizedUser, requiredPermissions)) { String msg = "User '" + authorizedUser + "' is not authorized to retrieve the given device id '" + id + "'"; log.error(msg); return Response.status(Response.Status.UNAUTHORIZED).entity( @@ -716,7 +719,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { } DeviceIdentifier deviceIdentifier = new DeviceIdentifier(id, device.getType()); // check whether the user is authorized - if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, authorizedUser)) { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; + if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, authorizedUser, requiredPermissions)) { String message = "User '" + authorizedUser + "' is not authorized to retrieve the given " + "device id '" + id + "'"; log.error(message); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java index fc8f080b07..f9e7df536d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistEx import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.GroupMgtLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraGroupMgtLoggerImpl; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java index 2a8e6357cc..311b4292a7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -85,7 +86,9 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); String username = threadLocalCarbonContext.getUsername(); try { - if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, username)) { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; + if (!deviceAccessAuthorizationService.isUserAuthorized(deviceIdentifier, username, requiredPermissions)) { return Response.status(Response.Status.UNAUTHORIZED).entity( new ErrorResponse.ErrorResponseBuilder().setMessage ("Current logged in user is not authorized to add policies").build()).build(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java index fe2b5edd78..ec8c3a65f7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java @@ -172,6 +172,9 @@ public class GroupManagementAdminServiceImpl implements GroupManagementAdminServ if (group == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } + if (StringUtils.isEmpty(group.getOwner())) { + group.setOwner(PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername()); + } group.setStatus(DeviceGroupConstants.GroupStatus.ACTIVE); try { DeviceMgtAPIUtils.getGroupManagementProviderService().createGroup(group, DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_PERMISSIONS); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java index 6de5d1d1ca..885d521389 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java @@ -21,7 +21,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.util; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationService; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.axis2.AxisFault; import org.apache.axis2.client.Options; import org.apache.axis2.java.security.SSLProtocolSocketFactory; @@ -342,6 +344,17 @@ public class DeviceMgtAPIUtils { return deviceAccessAuthorizationService; } + public static GroupAccessAuthorizationService getGroupAccessAuthorizationService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + GroupAccessAuthorizationService groupAccessAuthorizationService = + (GroupAccessAuthorizationService) ctx.getOSGiService(GroupAccessAuthorizationService.class, null); + if (groupAccessAuthorizationService == null) { + String msg = "GroupAccessAuthorizationService service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return groupAccessAuthorizationService; + } public static GroupManagementProviderService getGroupManagementProviderService() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); GroupManagementProviderService groupManagementProviderService = @@ -1111,7 +1124,9 @@ public class DeviceMgtAPIUtils { RequestValidationUtil.validateDeviceIdentifier(deviceType, identifier); DeviceIdentifier deviceIdentifier = new DeviceIdentifier(identifier, deviceType); - if (!getDeviceAccessAuthorizationService().isUserAuthorized(deviceIdentifier, authorizedUser)) { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; + if (!getDeviceAccessAuthorizationService().isUserAuthorized(deviceIdentifier, authorizedUser, requiredPermissions)) { String msg = "User '" + authorizedUser + "' is not authorized to retrieve the given device id '" + identifier + "'"; log.error(msg); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java index e32761b0e6..d7ac8671ee 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java @@ -285,7 +285,7 @@ public class DeviceAgentServiceTest { Device testDevice = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER); Mockito.when(this.deviceManagementProviderService .getDevice(Mockito.any(DeviceIdentifier.class), Mockito.any(Boolean.class))).thenReturn(testDevice); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenThrow(new DeviceAccessAuthorizationException()); Response response = deviceAgentService.updateDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER, testDevice); Assert.assertNotNull(response, "Response should not be null"); @@ -305,7 +305,7 @@ public class DeviceAgentServiceTest { Device testDevice = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER); Mockito.when(this.deviceManagementProviderService .getDevice(Mockito.any(DeviceIdentifier.class), Mockito.any(Boolean.class))).thenReturn(testDevice); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(false); Response response = deviceAgentService.updateDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER, testDevice); Assert.assertNotNull(response, "Response should not be null"); @@ -327,7 +327,7 @@ public class DeviceAgentServiceTest { Device testDevice = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER); Mockito.when(this.deviceManagementProviderService .getDevice(Mockito.any(DeviceIdentifier.class), Mockito.any(Boolean.class))).thenReturn(testDevice); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); Mockito.when(this.deviceManagementProviderService.modifyEnrollment(Mockito.any())).thenReturn(false); Response response = deviceAgentService.updateDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER, testDevice); @@ -350,7 +350,7 @@ public class DeviceAgentServiceTest { Device testDevice = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER); Mockito.when(this.deviceManagementProviderService .getDevice(Mockito.any(DeviceIdentifier.class), Mockito.any(Boolean.class))).thenReturn(testDevice); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); Mockito.when(this.deviceManagementProviderService.modifyEnrollment(Mockito.any())) .thenThrow(new DeviceManagementException()); @@ -372,7 +372,7 @@ public class DeviceAgentServiceTest { "getAuthenticatedUser")).toReturn(AUTHENTICATED_USER); Device testDevice = DeviceMgtAPITestHelper.generateDummyDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER); Mockito.when(this.deviceManagementProviderService.getDevice(Mockito.any(DeviceIdentifier.class), Mockito.any(Boolean.class))).thenReturn(testDevice); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); Mockito.when(this.deviceManagementProviderService.modifyEnrollment(Mockito.any())).thenReturn((true)); Response response = deviceAgentService.updateDevice(TEST_DEVICE_TYPE, TEST_DEVICE_IDENTIFIER, testDevice); @@ -408,7 +408,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(false); Mockito.when(this.privilegedCarbonContext.getTenantDomain()) .thenReturn(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); @@ -432,7 +432,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenThrow(new DeviceAccessAuthorizationException()); Mockito.when(this.privilegedCarbonContext.getTenantDomain()) .thenReturn(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); @@ -457,7 +457,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getEventStreamAdminServiceStub")) .toReturn(this.eventStreamAdminServiceStub); @@ -485,7 +485,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getEventStreamAdminServiceStub")) .toThrow(new AxisFault("")); @@ -511,7 +511,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getEventStreamAdminServiceStub")) .toThrow(new RemoteException()); @@ -539,7 +539,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getEventStreamAdminServiceStub")) .toThrow(new JWTClientException()); @@ -567,7 +567,7 @@ public class DeviceAgentServiceTest { .toReturn(this.privilegedCarbonContext); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getDeviceAccessAuthorizationService")).toReturn(this.deviceAccessAuthorizationService); - Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class))) + Mockito.when(this.deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), Mockito.any(String[].class))) .thenReturn(true); PowerMockito.stub(PowerMockito.method(DeviceMgtAPIUtils.class, "getEventStreamAdminServiceStub")) .toThrow(new UserStoreException()); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java index 2ef62073bd..63bb401d61 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java @@ -215,7 +215,7 @@ public class DeviceManagementServiceImplTest { Mockito.when(carbonContext.getTenantId()).thenReturn(-1234); Mockito.when(carbonContext.getUsername()).thenReturn(DEFAULT_USERNAME); Mockito.when(deviceAccessAuthorizationService.isUserAuthorized(Mockito.any(DeviceIdentifier.class), - Mockito.anyString())).thenReturn(true); + Mockito.anyString(), Mockito.any(String[].class))).thenReturn(true); Response response = this.deviceManagementService .getDeviceByID(TEST_DEVICE_IDENTIFIER, ifModifiedSince,true); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAccessAuthorizationService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAccessAuthorizationService.java index 713defbcee..c1d4d50b3f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAccessAuthorizationService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAccessAuthorizationService.java @@ -28,15 +28,6 @@ import java.util.List; * accessing the device information and performing MDM operations on devices. */ public interface DeviceAccessAuthorizationService { - /** - * This method will check whether the currently logged-in user has the access to the device identified by the given - * DeviceIdentifier. - * - * @param deviceIdentifier - DeviceIdentifier of the device to be checked. - * @return Boolean authorization result. - * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. - */ - boolean isUserAuthorized(DeviceIdentifier deviceIdentifier) throws DeviceAccessAuthorizationException; /** * This method will check whether the currently logged-in user has the access to the device identified by the given @@ -50,18 +41,6 @@ public interface DeviceAccessAuthorizationService { boolean isUserAuthorized(DeviceIdentifier deviceIdentifier, String[] groupPermissions) throws DeviceAccessAuthorizationException; - /** - * This method will check whether the currently logged-in user has the access to the devices identified by the given - * DeviceIdentifier list. - * - * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. - * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and - * unauthorized devices. - * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. - */ - DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers) throws - DeviceAccessAuthorizationException; - /** * This method will check whether the currently logged-in user has the access to the devices identified by the given * DeviceIdentifier list. @@ -103,18 +82,6 @@ public interface DeviceAccessAuthorizationService { String[] groupPermissions) throws DeviceAccessAuthorizationException; - /** - * This method will check whether the given user has the access to the device identified by the given - * DeviceIdentifier. - * - * @param deviceIdentifier - DeviceIdentifier of the device to be checked. - * @param username - Username of the user to be checked for authorization. - * @return Boolean authorization result. - * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. - */ - boolean isUserAuthorized(DeviceIdentifier deviceIdentifier, String username) throws - DeviceAccessAuthorizationException; - /** * This method will check whether the authenticated user has the admin permissions. * @@ -122,17 +89,4 @@ public interface DeviceAccessAuthorizationService { * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. */ boolean isDeviceAdminUser() throws DeviceAccessAuthorizationException; - - /** - * This method will check whether the given user has the access to the devices identified by the given - * DeviceIdentifier list. - * - * @param deviceIdentifiers - List of DeviceIdentifiers to be checked for authorization. - * @param username - Username of the user to be checked for authorization. - * @return DeviceAuthorizationResult - Authorization result object including the list of authorized devices and - * unauthorized devices. - * @throws DeviceAccessAuthorizationException if something goes wrong when checking the authorization. - */ - DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String username) throws - DeviceAccessAuthorizationException; } \ No newline at end of file diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAuthorizationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAuthorizationRequest.java new file mode 100644 index 0000000000..92602fe5f4 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/DeviceAuthorizationRequest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.entgra.device.mgt.core.device.mgt.common.authorization; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +@ApiModel(value = "DeviceAuthorizationRequest", description = "") +public class DeviceAuthorizationRequest { + + @ApiModelProperty(name = "type", value = "device type") + private String type; + @ApiModelProperty(name = "deviceIds", value = "list of device ids") + private List deviceIds; + @ApiModelProperty(name = "username", value = "user who is accessing the device") + private String username; + @ApiModelProperty(name = "permissions", value = "list of permissions") + private List permissions; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List getDeviceIds() { + return deviceIds; + } + + public void setDeviceIds(List deviceIds) { + this.deviceIds = deviceIds; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationException.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationException.java new file mode 100644 index 0000000000..22ab4eef62 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationException.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.device.mgt.common.authorization; + +/** + * Custom exception class which wraps exceptions occurred inside GroupAccessAuthorization service. + */ +public class GroupAccessAuthorizationException extends Exception { + + private static final long serialVersionUID = -3151279331929070297L; + + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public GroupAccessAuthorizationException(String msg, Exception nestedEx) { + super(msg, nestedEx); + setErrorMessage(msg); + } + + public GroupAccessAuthorizationException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public GroupAccessAuthorizationException(String msg) { + super(msg); + setErrorMessage(msg); + } + + public GroupAccessAuthorizationException() { + super(); + } + + public GroupAccessAuthorizationException(Throwable cause) { + super(cause); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java new file mode 100644 index 0000000000..15e1079fcf --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java @@ -0,0 +1,16 @@ +package io.entgra.device.mgt.core.device.mgt.common.authorization; + +import java.util.List; + +public interface GroupAccessAuthorizationService { + + public boolean isUserAuthorized(int groupId, String username, String[] groupPermissions) + throws GroupAccessAuthorizationException; + + public boolean isUserAuthorized(int groupId, String[] groupPermissions) + throws GroupAccessAuthorizationException; + + public GroupAuthorizationResult isUserAuthorized(List groupIds, String username, String[] groupPermission) + throws GroupAccessAuthorizationException; + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationRequest.java new file mode 100644 index 0000000000..9cda89c591 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationRequest.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.entgra.device.mgt.core.device.mgt.common.authorization; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +@ApiModel(value = "GroupAuthorizationRequest", description = "") +public class GroupAuthorizationRequest { + + @ApiModelProperty(name = "groupIds", value = "list of group Ids") + private List groupIds; + @ApiModelProperty(name = "username", value = "user who is accessing the device") + private String username; + @ApiModelProperty(name = "permissions", value = "list of permissions") + private List permissions; + + public List getGroupIds() { + return groupIds; + } + + public void setGroupIds(List groupIds) { + this.groupIds = groupIds; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationResult.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationResult.java new file mode 100644 index 0000000000..93608510ad --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAuthorizationResult.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.device.mgt.common.authorization; + +import java.util.ArrayList; +import java.util.List; + +/** + * Represents a GroupAuthorizationResult including a list of authorized groups and a list of unauthorized groups. + */ +public class GroupAuthorizationResult { + + private List authorizedGroupIds = new ArrayList<>(); + private List unauthorizedGroupIds= new ArrayList<>(); + + public List getAuthorizedGroupIds() { + return authorizedGroupIds; + } + + public void setAuthorizedGroupIds(List authorizedGroupIds) { + this.authorizedGroupIds = authorizedGroupIds; + } + + public List getUnauthorizedGroupIds() { + return unauthorizedGroupIds; + } + + public void setUnauthorizedGroupIds(List unauthorizedGroupIds) { + this.unauthorizedGroupIds = unauthorizedGroupIds; + } + + public void addAuthorizedGroupId(int groupId) { + this.authorizedGroupIds.add(groupId); + } + + public void addUnauthorizedGroupId(int groupId) { + this.unauthorizedGroupIds.add(groupId); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java index 287b794c4c..25120a07e0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java @@ -63,41 +63,55 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return !DeviceManagementDataHolder.getInstance().requireDeviceAuthorization(deviceIdentifier.getType()); } //check for admin and ownership permissions - if (isAdmin(username, tenantId) || isDeviceOwner(deviceIdentifier, username)) { + if (isDeviceAdminUser(username, tenantId) || isDeviceOwner(deviceIdentifier, username)) { return true; } //check for group permissions - try { - return isSharedViaGroup(deviceIdentifier, username); - } catch (GroupManagementException | UserStoreException e) { - throw new DeviceAccessAuthorizationException("Unable to authorize the access to device : " + - deviceIdentifier.getId() + " for the user : " + - username, e); - } - } - - private boolean isSharedViaGroup(DeviceIdentifier deviceIdentifier, String username) - throws GroupManagementException, UserStoreException { - List groupsWithDevice = DeviceManagementDataHolder.getInstance() - .getGroupManagementProviderService().getGroups(deviceIdentifier, false); - String[] userRoles = DeviceManagementDataHolder.getInstance().getRealmService() - .getTenantUserRealm(getTenantId()).getUserStoreManager().getRoleListOfUser(username); - for (DeviceGroup deviceGroup : groupsWithDevice) { - List sharingRoles = DeviceManagementDataHolder.getInstance() - .getGroupManagementProviderService().getRoles(deviceGroup.getGroupId()); - for (String role : userRoles) { - if (sharingRoles.contains(role)) { - return true; + if (groupPermissions == null || groupPermissions.length == 0) { + return false; + } else { + // if group permissions specified, check whether that permission is available in shared role + try { + boolean isAuthorized = true; + for (String groupPermission : groupPermissions) { + if (!isAuthorizedViaSharedGroup(deviceIdentifier, username, groupPermission)) { + //if at least one failed, authorizations fails and break the loop + isAuthorized = false; + break; + } } + return isAuthorized; + } catch (DeviceAccessAuthorizationException e) { + throw new DeviceAccessAuthorizationException("Unable to authorize the access to device : " + + deviceIdentifier.getId() + " for the user : " + + username, e); } } - return false; } - @Override - public boolean isUserAuthorized(DeviceIdentifier deviceIdentifier, String username) + + private boolean isAuthorizedViaSharedGroup(DeviceIdentifier deviceIdentifier, String username, String groupPermission) throws DeviceAccessAuthorizationException { - return isUserAuthorized(deviceIdentifier, username, null); + try { + List groupsWithDevice = DeviceManagementDataHolder.getInstance() + .getGroupManagementProviderService().getGroups(deviceIdentifier, false); + UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService() + .getTenantUserRealm(getTenantId()); + String[] userRoles = userRealm.getUserStoreManager().getRoleListOfUser(username); + for (DeviceGroup deviceGroup : groupsWithDevice) { + List sharingRoles = DeviceManagementDataHolder.getInstance() + .getGroupManagementProviderService().getRoles(deviceGroup.getGroupId()); + for (String role : userRoles) { + if (sharingRoles.contains(role) && userRealm.getAuthorizationManager(). + isRoleAuthorized(role, groupPermission, CarbonConstants.UI_PERMISSION_ACTION)) { + return true; + } + } + } + return false; + } catch (GroupManagementException | UserStoreException e) { + throw new DeviceAccessAuthorizationException("unable to authorized via shared role, " + groupPermission); + } } @Override @@ -106,18 +120,13 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return isUserAuthorized(deviceIdentifier, this.getUserName(), groupPermissions); } - @Override - public boolean isUserAuthorized(DeviceIdentifier deviceIdentifier) throws DeviceAccessAuthorizationException { - return isUserAuthorized(deviceIdentifier, this.getUserName(), null); - } - @Override public boolean isDeviceAdminUser() throws DeviceAccessAuthorizationException { String username = this.getUserName(); int tenantId = this.getTenantId(); try { - return isAdminUser(username, tenantId); - } catch (UserStoreException e) { + return isDeviceAdminUser(username, tenantId); + } catch (DeviceAccessAuthorizationException e) { throw new DeviceAccessAuthorizationException("Unable to check the admin permissions of user : " + username + " in tenant : " + tenantId, e); } @@ -132,7 +141,7 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return null; } DeviceAuthorizationResult deviceAuthorizationResult = new DeviceAuthorizationResult(); - if (isAdmin(username, tenantId)) { + if (isDeviceAdminUser(username, tenantId)) { deviceAuthorizationResult.setAuthorizedDevices(deviceIdentifiers); return deviceAuthorizationResult; } @@ -149,7 +158,7 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori //check for group permissions boolean isAuthorized = true; for (String groupPermission : groupPermissions) { - if (!isAuthorizedViaGroup(username, deviceIdentifier, groupPermission)) { + if (!isAuthorizedViaSharedGroup(deviceIdentifier, username, groupPermission)) { //if at least one failed, authorizations fails and break the loop isAuthorized = false; break; @@ -160,7 +169,7 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori } else { deviceAuthorizationResult.addUnauthorizedDevice(deviceIdentifier); } - } catch (GroupManagementException e) { + } catch (DeviceAccessAuthorizationException e) { throw new DeviceAccessAuthorizationException("Unable to authorize the access to device : " + deviceIdentifier.getId() + " for the user : " + username, e); @@ -170,55 +179,12 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori return deviceAuthorizationResult; } - @Override - public DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String username) - throws DeviceAccessAuthorizationException { - return isUserAuthorized(deviceIdentifiers, username, null); - } - - @Override - public DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers) - throws DeviceAccessAuthorizationException { - return isUserAuthorized(deviceIdentifiers, this.getUserName(), null); - } - @Override public DeviceAuthorizationResult isUserAuthorized(List deviceIdentifiers, String[] groupPermissions) throws DeviceAccessAuthorizationException { return isUserAuthorized(deviceIdentifiers, this.getUserName(), groupPermissions); } - private boolean isAdmin(String username, int tenantId) - throws DeviceAccessAuthorizationException { - try { - //Check for admin users. If the user is an admin user we authorize the access to that device. - return (isAdminUser(username, tenantId)); - } catch (UserStoreException e) { - throw new DeviceAccessAuthorizationException("Unable to authorize the access for the user : " + - username, e); - } - } - - private boolean isAuthorizedViaGroup(String username, DeviceIdentifier deviceIdentifier, String groupPermission) - throws GroupManagementException { - List authorizedGroups = - DeviceManagementDataHolder.getInstance().getGroupManagementProviderService() - .getGroups(username, groupPermission, false); - List groupsWithDevice = - DeviceManagementDataHolder.getInstance().getGroupManagementProviderService() - .getGroups(deviceIdentifier, false); - for (DeviceGroup group : authorizedGroups) { - Iterator groupsWithDeviceIterator = groupsWithDevice.iterator(); - while (groupsWithDeviceIterator.hasNext()) { - DeviceGroup deviceGroup = groupsWithDeviceIterator.next(); - if (deviceGroup.getGroupId() == group.getGroupId()) { - return true; - } - } - } - return false; - } - private boolean isDeviceOwner(DeviceIdentifier deviceIdentifier, String username) throws DeviceAccessAuthorizationException { //Check for device ownership. If the user is the owner of the device we allow the access. @@ -232,15 +198,20 @@ public class DeviceAccessAuthorizationServiceImpl implements DeviceAccessAuthori } } - private boolean isAdminUser(String username, int tenantId) throws UserStoreException { - UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId); - if (userRealm != null && userRealm.getAuthorizationManager() != null) { - return userRealm.getAuthorizationManager() - .isUserAuthorized(removeTenantDomain(username), - PermissionUtils.getAbsolutePermissionPath(CDM_ADMIN_PERMISSION), - CarbonConstants.UI_PERMISSION_ACTION); + private boolean isDeviceAdminUser(String username, int tenantId) throws DeviceAccessAuthorizationException { + try { + UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId); + if (userRealm != null && userRealm.getAuthorizationManager() != null) { + return userRealm.getAuthorizationManager() + .isUserAuthorized(removeTenantDomain(username), + PermissionUtils.getAbsolutePermissionPath(CDM_ADMIN_PERMISSION), + CarbonConstants.UI_PERMISSION_ACTION); + } + return false; + } catch (UserStoreException e) { + throw new DeviceAccessAuthorizationException("Unable to authorize the access for the user : " + + username, e); } - return false; } private String getUserName() { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/GroupAccessAuthorizationServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/GroupAccessAuthorizationServiceImpl.java new file mode 100644 index 0000000000..acceb466c1 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/GroupAccessAuthorizationServiceImpl.java @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.device.mgt.core.authorization; + +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationException; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAuthorizationResult; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.opensaml.xmlsec.signature.G; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.user.api.UserRealm; +import org.wso2.carbon.user.api.UserStoreException; + +import javax.persistence.criteria.CriteriaBuilder; +import java.util.List; + +public class GroupAccessAuthorizationServiceImpl implements GroupAccessAuthorizationService { + + private final static String GROUP_ADMIN_PERMISSION = "/device-mgt/devices/any-group/permitted-actions-under-owning-group"; + private final static String GROUP_ADMIN = "Group Management Administrator"; + private static Log log = LogFactory.getLog(DeviceAccessAuthorizationServiceImpl.class); + + public GroupAccessAuthorizationServiceImpl() { + try { + this.addAdminPermissionToRegistry(); + } catch (PermissionManagementException e) { + log.error("Unable to add the group-admin permission to the registry.", e); + } + } + + @Override + public boolean isUserAuthorized(int groupId, String username, String[] groupPermissions) + throws GroupAccessAuthorizationException { + int tenantId = this.getTenantId(); + if (username == null || username.isEmpty()) { + username = this.getUserName(); + } + //check for admin and ownership permissions + if (isGroupAdminUser(username, tenantId) || isGroupOwner(groupId, username)) { + return true; + } + + //check for group permissions + if (groupPermissions == null || groupPermissions.length == 0) { + return false; + } else { + // if group permissions specified, check whether that permission is available in any user role of the group owner + try { + UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService() + .getTenantUserRealm(getTenantId()); + String[] userRoles = userRealm.getUserStoreManager().getRoleListOfUser(username); + boolean isAuthorized = true; + for (String groupPermission : groupPermissions) { + for (String role : userRoles) { + if (!userRealm.getAuthorizationManager(). + isRoleAuthorized(role, groupPermission, CarbonConstants.UI_PERMISSION_ACTION)) { + isAuthorized = false; + break; + } + } + } + return isAuthorized; + } catch (UserStoreException e) { + throw new GroupAccessAuthorizationException("Unable to authorize the access to group : " + + groupId + " for the user : " + + username, e); + } + } + } + + @Override + public GroupAuthorizationResult isUserAuthorized(List groupIds, String username, String[] groupPermission) + throws GroupAccessAuthorizationException { + GroupAuthorizationResult result = new GroupAuthorizationResult(); + for (Integer groupId : groupIds) { + if (isUserAuthorized(groupId, username, groupPermission)) { + result.addAuthorizedGroupId(groupId); + } else { + result.addUnauthorizedGroupId(groupId); + } + } + return result; + } + + + @Override + public boolean isUserAuthorized(int groupId, String[] groupPermissions) + throws GroupAccessAuthorizationException { + return isUserAuthorized(groupId, this.getUserName(), groupPermissions); + } + + private boolean isGroupOwner(int groupId, String username) + throws GroupAccessAuthorizationException { + //Check for group ownership. If the user is the owner of the group we allow the access. + try { + DeviceGroup group = DeviceManagementDataHolder.getInstance(). + getGroupManagementProviderService().getGroup(groupId, false); + return username.equals(group.getOwner()); + } catch (GroupManagementException e) { + throw new GroupAccessAuthorizationException("Unable to authorize the access to group : " + + groupId + " for the user : " + + username, e); + } + } + + private boolean isGroupAdminUser(String username, int tenantId) throws GroupAccessAuthorizationException { + try { + UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId); + if (userRealm != null && userRealm.getAuthorizationManager() != null) { + return userRealm.getAuthorizationManager() + .isUserAuthorized(removeTenantDomain(username), + PermissionUtils.getAbsolutePermissionPath(GROUP_ADMIN_PERMISSION), + CarbonConstants.UI_PERMISSION_ACTION); + } + return false; + } catch (UserStoreException e) { + throw new GroupAccessAuthorizationException("Unable to authorize the access for the user : " + + username, e); + } + } + + private String getUserName() { + String username = CarbonContext.getThreadLocalCarbonContext().getUsername(); + if (username != null && !username.isEmpty()) { + return removeTenantDomain(username); + } + return null; + } + + private String removeTenantDomain(String username) { + String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + if (username.endsWith(tenantDomain)) { + return username.substring(0, username.lastIndexOf("@")); + } + return username; + } + + private int getTenantId() { + return CarbonContext.getThreadLocalCarbonContext().getTenantId(); + } + + private boolean addAdminPermissionToRegistry() throws PermissionManagementException { + Permission permission = new Permission(); + permission.setName(GROUP_ADMIN); + permission.setPath(PermissionUtils.getAbsolutePermissionPath(GROUP_ADMIN_PERMISSION)); + return PermissionUtils.putPermission(permission); + } + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index d3681a43c4..e8a8fa6e89 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -235,10 +236,12 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String username = CarbonContext.getThreadLocalCarbonContext().getUsername(); if (StringUtils.isEmpty(username)) { + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; boolean isUserAuthorized = DeviceManagementDataHolder.getInstance(). getDeviceAccessAuthorizationService().isUserAuthorized( new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()), - device.getEnrolmentInfo().getOwner() + device.getEnrolmentInfo().getOwner(), requiredPermissions ); if (isUserAuthorized) { username = device.getEnrolmentInfo().getOwner(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java index 6736874487..48d573a5fa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.internal; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServices; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationService; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import org.wso2.carbon.context.PrivilegedCarbonContext; @@ -78,6 +79,7 @@ public class DeviceManagementDataHolder { private ConfigurationContextService configurationContextService; private final HashMap requireDeviceAuthorization = new HashMap<>(); private DeviceAccessAuthorizationService deviceAccessAuthorizationService; + private GroupAccessAuthorizationService groupAccessAuthorizationService; private GroupManagementProviderService groupManagementProviderService; private TaskService taskService; private EmailSenderService emailSenderService; @@ -447,4 +449,12 @@ public class DeviceManagementDataHolder { public void setPublisherRESTAPIServices(PublisherRESTAPIServices publisherRESTAPIServices) { this.publisherRESTAPIServices = publisherRESTAPIServices; } + + public GroupAccessAuthorizationService getGroupAccessAuthorizationService() { + return groupAccessAuthorizationService; + } + + public void setGroupAccessAuthorizationService(GroupAccessAuthorizationService groupAccessAuthorizationService) { + this.groupAccessAuthorizationService = groupAccessAuthorizationService; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java index b3bc1f2f0d..b2e1529f40 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -17,7 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.core.internal; +import io.entgra.device.mgt.core.device.mgt.common.authorization.GroupAccessAuthorizationService; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; +import io.entgra.device.mgt.core.device.mgt.core.authorization.GroupAccessAuthorizationServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.DeviceStatusManagementServiceImpl; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import org.apache.commons.logging.Log; @@ -353,6 +355,12 @@ public class DeviceManagementServiceComponent { bundleContext.registerService(DeviceAccessAuthorizationService.class.getName(), deviceAccessAuthorizationService, null); + /* Registering GroupAccessAuthorization Service */ + GroupAccessAuthorizationService groupAccessAuthorizationService = new GroupAccessAuthorizationServiceImpl(); + DeviceManagementDataHolder.getInstance().setGroupAccessAuthorizationService(groupAccessAuthorizationService); + bundleContext.registerService(GroupAccessAuthorizationService.class.getName(), + groupAccessAuthorizationService, null); + /* Registering Geo Service */ GeoLocationProviderService geoService = new GeoLocationProviderServiceImpl(); DeviceManagementDataHolder.getInstance().setGeoLocationProviderService(geoService); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java index c7a86bfb82..049cae776e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.DeviceConnectivityLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceConnectivityLoggerImpl; @@ -561,9 +562,11 @@ public class OperationManagerImpl implements OperationManager { } else { boolean isAuthorized; authorizedDeviceList = new ArrayList<>(); + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; for (DeviceIdentifier devId : deviceIds) { isAuthorized = DeviceManagementDataHolder.getInstance().getDeviceAccessAuthorizationService(). - isUserAuthorized(devId); + isUserAuthorized(devId, requiredPermissions); if (isAuthorized) { authorizedDeviceList.add(devId); } else { @@ -1470,9 +1473,11 @@ public class OperationManagerImpl implements OperationManager { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); String user = this.getUser(); boolean isUserAuthorized; + String requiredPermission = PermissionManagerServiceImpl.getInstance().getRequiredPermission(); + String[] requiredPermissions = new String[] {requiredPermission}; try { isUserAuthorized = DeviceManagementDataHolder.getInstance() - .getDeviceAccessAuthorizationService().isUserAuthorized(deviceId, user); + .getDeviceAccessAuthorizationService().isUserAuthorized(deviceId, user, requiredPermissions); } catch (DeviceAccessAuthorizationException e) { throw new OperationManagementException("Error occurred while checking the device access permissions for '" + deviceId.getType() + "' device carrying the identifier '" + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceImpl.java index 7de2a3a9c9..8b7c9244ad 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceImpl.java @@ -32,6 +32,7 @@ public class PermissionManagerServiceImpl implements PermissionManagerService { private static PermissionManagerServiceImpl registryBasedPermissionManager; private static APIResourcePermissions apiResourcePermissions; + private ThreadLocal requiredPermission = null; private PermissionManagerServiceImpl() { } @@ -64,4 +65,16 @@ public class PermissionManagerServiceImpl implements PermissionManagerService { public List getPermission(String context) throws PermissionManagementException { return apiResourcePermissions.getPermissions(context); } + + public String getRequiredPermission() { + if (requiredPermission == null) { + requiredPermission = new ThreadLocal<>(); + } + return requiredPermission.get(); + } + + public void setRequiredPermission(String permission) { + requiredPermission = new ThreadLocal<>(); + requiredPermission.set(permission); + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 0941d3d3a1..88aad71dcd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -32,6 +32,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.GroupDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -593,10 +594,24 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } else { List allDeviceGroupIdsOfUser = getGroupIds(username); rootGroups = this.getGroups(allDeviceGroupIdsOfUser, tenantId); - if (requireGroupProps) { + try { + GroupManagementDAOFactory.openConnection(); for (DeviceGroup rootGroup : rootGroups) { - populateGroupProperties(rootGroup, tenantId); + parentPath = DeviceManagerUtil.createParentPath(rootGroup); + childrenGroups = groupDAO.getChildrenGroups(parentPath, tenantId); + createGroupWithChildren( + rootGroup, childrenGroups, requireGroupProps, tenantId, request.getDepth(), 0); + if (requireGroupProps) { + populateGroupProperties(rootGroup, tenantId); + } } + } catch (SQLException e) { + String msg = "Error occurred while opening a connection to the data source to retrieve all groups " + + "with hierarchy when username is provided"; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } finally { + GroupManagementDAOFactory.closeConnection(); } } } catch (GroupManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java index 6565a4b029..0e31232a03 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java @@ -193,7 +193,7 @@ public class DeviceAccessAuthorizationServiceTest { public void userAuthDevIdUserName() throws Exception { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); for (DeviceIdentifier deviceId : deviceIds) { - Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId, ADMIN_USER), + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId, ADMIN_USER, new String[]{NON_ADMIN_PERMISSION}), "Device access authorization for admin user failed"); } } @@ -202,7 +202,7 @@ public class DeviceAccessAuthorizationServiceTest { public void userAuthDevIdUserNameResult() throws DeviceAccessAuthorizationException { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. - isUserAuthorized(deviceIds, ADMIN_USER); + isUserAuthorized(deviceIds, ADMIN_USER, new String[]{NON_ADMIN_PERMISSION}); Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, "Expected 5 authorized devices for admin user"); Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, @@ -213,7 +213,7 @@ public class DeviceAccessAuthorizationServiceTest { public void userAuthDevId() throws Exception { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); for (DeviceIdentifier deviceId : deviceIds) { - Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId), + Assert.assertTrue(deviceAccessAuthorizationService.isUserAuthorized(deviceId, new String[]{NON_ADMIN_PERMISSION}), "Authorize user from device identifier failed"); } } @@ -222,7 +222,7 @@ public class DeviceAccessAuthorizationServiceTest { public void userAuthDevIdResult() throws Exception { PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(ADMIN_USER); DeviceAuthorizationResult deviceAuthorizationResult = deviceAccessAuthorizationService. - isUserAuthorized(deviceIds); + isUserAuthorized(deviceIds, new String[]{NON_ADMIN_PERMISSION}); Assert.assertEquals(deviceAuthorizationResult.getAuthorizedDevices().size(), 5, "Expected 5 authorized devices for admin user"); Assert.assertEquals(deviceAuthorizationResult.getUnauthorizedDevices().size(), 0, diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java index 0d509200e4..aed1ecf836 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java @@ -134,6 +134,7 @@ public class PermissionAuthorizer { } if (isUserAuthorized) { + PermissionManagerServiceImpl.getInstance().setRequiredPermission(requiredPermission); return WebappAuthenticator.Status.SUCCESS; } else { return WebappAuthenticator.Status.FAILURE; From 20cf06122ad373780acc0565e4a77a7e7b0522e3 Mon Sep 17 00:00:00 2001 From: "amalka.subasinghe" Date: Tue, 20 Feb 2024 11:41:22 +0530 Subject: [PATCH 02/24] remove unused imports and adding licence headers --- .../impl/GroupManagementServiceImpl.java | 1 - .../GroupAccessAuthorizationService.java | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java index f9e7df536d..fc8f080b07 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -27,7 +27,6 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistEx import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; -import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.GroupMgtLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraGroupMgtLoggerImpl; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java index 15e1079fcf..c9e942cd31 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/authorization/GroupAccessAuthorizationService.java @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package io.entgra.device.mgt.core.device.mgt.common.authorization; import java.util.List; From 6c1286ebad915273a860ac5e61685abce82bffdf Mon Sep 17 00:00:00 2001 From: Pahansith Date: Wed, 3 Apr 2024 12:37:42 +0530 Subject: [PATCH 03/24] Improvements for the reporting data publishing --- ...ApplicationManagerProviderServiceImpl.java | 8 +- .../impl/DeviceInformationManagerImpl.java | 14 ++-- .../report/mgt/ReportingPublisherManager.java | 82 +++++++++++++++++++ .../mgt/core/util/HttpReportingUtil.java | 19 +---- 4 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index fec70931a4..7fa3959d26 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -286,8 +287,11 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem deviceDetailsWrapper.setTenantId(tenantId); deviceDetailsWrapper.setDevice(device); deviceDetailsWrapper.setApplications(newApplications); - HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), - reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT); + ReportingPublisherManager reportingManager = new ReportingPublisherManager(); + reportingManager.publishData(deviceDetailsWrapper, DeviceManagementConstants + .Report.APP_USAGE_ENDPOINT); + /*HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), + reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT);*/ } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index d3681a43c4..e210526a19 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,7 +30,6 @@ import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsW import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; @@ -203,7 +203,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceIdentifier, false); DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setEvents(payload); - return publishEvents(device, deviceDetailsWrapper, eventType); + publishEvents(device, deviceDetailsWrapper, eventType); + return 201; } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Event publishing error. Could not get device " + deviceId; @@ -217,7 +218,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { * @param device Device that is sending event * @param deviceDetailsWrapper Payload to send(example, deviceinfo, applist, raw events) */ - private int publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String + private void publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String eventType) { String reportingHost = HttpReportingUtil.getReportingHost(); if (!StringUtils.isBlank(reportingHost) @@ -252,9 +253,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String eventUrl = reportingHost + DeviceManagementConstants.Report .REPORTING_CONTEXT + DeviceManagementConstants.URL_SEPERATOR + eventType; - return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); - } catch (EventPublishingException e) { - log.error("Error occurred while sending events", e); + ReportingPublisherManager reportingManager = new ReportingPublisherManager(); + reportingManager.publishData(deviceDetailsWrapper, eventUrl); + //return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); } catch (GroupManagementException e) { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { @@ -270,7 +271,6 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { + DeviceManagerUtil.getTenantId()); } } - return 0; } @Override diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java new file mode 100644 index 0000000000..3e72aab7f5 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.device.mgt.core.report.mgt; + +import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.protocol.HTTP; + +import java.io.IOException; +import java.net.ConnectException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class ReportingPublisherManager { + + private static final Log log = LogFactory.getLog(ReportingPublisherManager.class); + private final static ExecutorService executorService; + private DeviceDetailsWrapper payload; + private String endpoint; + private static final PoolingHttpClientConnectionManager poolingManager; + + static { + executorService = Executors.newFixedThreadPool(10); //todo make this configurable + poolingManager = new PoolingHttpClientConnectionManager(); + poolingManager.setMaxTotal(10); //todo make this configurable + poolingManager.setDefaultMaxPerRoute(10); + } + + public void publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { + this.payload = deviceDetailsWrapper; + this.endpoint = eventUrl; + executorService.submit(new ReportingPublisher()); + } + + private class ReportingPublisher implements Runnable { + @Override + public void run() { + try (CloseableHttpClient client = HttpClients.custom().setConnectionManager(poolingManager).build()) { + HttpPost apiEndpoint = new HttpPost(endpoint); + apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); + StringEntity requestEntity = new StringEntity(payload.getJSONString(), ContentType.APPLICATION_JSON); + apiEndpoint.setEntity(requestEntity); + HttpResponse response = client.execute(apiEndpoint); + int statusCode = response.getStatusLine().getStatusCode(); + if (log.isDebugEnabled()) { + log.debug("Published data to the reporting backend: " + endpoint + ", Response code: " + statusCode); + } + } catch (ConnectException e) { + String message = "Connection refused while publishing reporting data to the API: " + endpoint; + log.error(message, e); + } catch (IOException e) { + String message = "Error occurred when publishing reporting data to the API: " + endpoint; + log.error(message, e); + } + } + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java index 288d0c0fc5..ad7a7bf67d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java @@ -27,6 +27,7 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.protocol.HTTP; import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; @@ -49,24 +50,6 @@ public class HttpReportingUtil { return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST); } - public static int invokeApi(String payload, String endpoint) throws EventPublishingException { - try (CloseableHttpClient client = HttpClients.createDefault()) { - HttpPost apiEndpoint = new HttpPost(endpoint); - apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - StringEntity requestEntity = new StringEntity( - payload, ContentType.APPLICATION_JSON); - apiEndpoint.setEntity(requestEntity); - HttpResponse response = client.execute(apiEndpoint); - return response.getStatusLine().getStatusCode(); - } catch (ConnectException e) { - log.error("Connection refused to API endpoint: " + endpoint, e); - return HttpStatus.SC_SERVICE_UNAVAILABLE; - } catch (IOException e) { - throw new EventPublishingException("Error occurred when " + - "invoking API. API endpoint: " + endpoint, e); - } - } - public static boolean isPublishingEnabledForTenant() { Object configuration = DeviceManagerUtil.getConfiguration(IS_EVENT_PUBLISHING_ENABLED); From 97b690b8ef3ca5cef7031033a572a2e2773a4a49 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Wed, 3 Apr 2024 14:37:30 +0530 Subject: [PATCH 04/24] Fix user search by Firstname and Lastname --- .../mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java index 748989879f..43c98523a5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java @@ -574,7 +574,7 @@ public class UserManagementServiceImpl implements UserManagementService { basicUserInfo.setEmailAddress(getClaimValue(user, Constants.USER_CLAIM_EMAIL_ADDRESS)); basicUserInfo.setFirstname(getClaimValue(user, Constants.USER_CLAIM_FIRST_NAME)); basicUserInfo.setLastname(getClaimValue(user, Constants.USER_CLAIM_LAST_NAME)); - basicUserInfo.setRemovable(isUserRemovable(username)); + basicUserInfo.setRemovable(isUserRemovable(user)); filteredUserList.add(basicUserInfo); } } From d3ac0ce5b0199d5f3a15915e7b5d77f638f9031e Mon Sep 17 00:00:00 2001 From: ashvini Date: Thu, 4 Apr 2024 09:39:45 +0530 Subject: [PATCH 05/24] Fix app name duplicating error --- .../mgt/core/impl/ApplicationManagerImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 3b2eb638aa..1c6ddab96f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -2423,21 +2423,22 @@ public class ApplicationManagerImpl implements ApplicationManager { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); ApplicationDTO applicationDTO = getApplication(applicationId); + String sanitizedName = ApplicationManagementUtil.sanitizeName(applicationUpdateWrapper.getName(), + Constants.ApplicationProperties.NAME ); try { ConnectionManagerUtil.beginDBTransaction(); - if (!StringUtils.isEmpty(applicationUpdateWrapper.getName()) && !applicationDTO.getName() - .equals(applicationUpdateWrapper.getName())) { + if (!StringUtils.isEmpty(sanitizedName) && !applicationDTO.getName() + .equals(sanitizedName)) { if (applicationDAO - .isExistingAppName(applicationUpdateWrapper.getName().trim(), applicationDTO.getDeviceTypeId(), + .isExistingAppName(sanitizedName.trim(), applicationDTO.getDeviceTypeId(), tenantId)) { - String msg = "Already an application registered with same name " + applicationUpdateWrapper.getName() + String msg = "Already an application registered with same name " + sanitizedName + ". Hence you can't update the application name from " + applicationDTO.getName() + " to " - + applicationUpdateWrapper.getName(); + + sanitizedName; log.error(msg); throw new BadRequestException(msg); } - applicationDTO.setName(ApplicationManagementUtil.sanitizeName(applicationUpdateWrapper.getName(), - Constants.ApplicationProperties.NAME)); + applicationDTO.setName(sanitizedName); } if (!StringUtils.isEmpty(applicationUpdateWrapper.getSubMethod()) && !applicationDTO.getSubType() .equals(applicationUpdateWrapper.getSubMethod())) { From e9ac11da782879fcb3df02341980d5d7987f1125 Mon Sep 17 00:00:00 2001 From: ashvini Date: Thu, 21 Mar 2024 08:51:39 +0530 Subject: [PATCH 06/24] Create DAO for tenant deletion task Add Application related DAO methods Add application folder delete function Change scope Refactor code Resolve merge conflicts Resolve merge conflict --- .../common/services/ApplicationManager.java | 8 + .../services/ApplicationStorageManager.java | 8 + .../mgt/core/dao/ApplicationDAO.java | 48 + .../mgt/core/dao/ApplicationReleaseDAO.java | 8 + .../mgt/core/dao/LifecycleStateDAO.java | 10 +- .../application/mgt/core/dao/ReviewDAO.java | 8 + .../mgt/core/dao/SPApplicationDAO.java | 16 + .../mgt/core/dao/SubscriptionDAO.java | 48 + .../mgt/core/dao/VisibilityDAO.java | 8 + .../mgt/core/dao/VppApplicationDAO.java | 24 + .../GenericApplicationDAOImpl.java | 155 +++ .../GenericApplicationReleaseDAOImpl.java | 27 +- .../GenericSPApplicationDAOImpl.java | 52 + .../OracleSPApplicationDAOImpl.java | 53 + .../PostgreSQLSPApplicationDAOImpl.java | 53 + .../SQLServerSPApplicationDAOImpl.java | 53 + .../GenericLifecycleStateDAOImpl.java | 25 + .../dao/impl/review/GenericReviewDAOImpl.java | 25 + .../GenericSubscriptionDAOImpl.java | 153 +++ .../visibility/GenericVisibilityDAOImpl.java | 27 + .../vpp/GenericVppApplicationDAOImpl.java | 77 ++ .../mgt/core/impl/ApplicationManagerImpl.java | 73 +- .../impl/ApplicationStorageManagerImpl.java | 14 + .../api/admin/UserManagementAdminService.java | 43 + .../admin/UserManagementAdminServiceImpl.java | 30 + .../core/dao/DeviceManagementDAOFactory.java | 16 + .../core/device/mgt/core/dao/TenantDAO.java | 431 ++++++++ .../mgt/core/dao/impl/TenantDAOImpl.java | 939 ++++++++++++++++++ .../mgt/common/spi/TenantManagerService.java | 2 + .../core/tenant/mgt/core/TenantManager.java | 14 + .../mgt/core/impl/TenantManagerImpl.java | 102 ++ .../core/impl/TenantManagerServiceImpl.java | 10 + .../listener/DeviceMgtTenantListener.java | 8 + .../src/main/resources/conf/mdm-ui-config.xml | 1 + 34 files changed, 2562 insertions(+), 7 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TenantDAO.java create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java index 57890f53eb..cb7cf75684 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java @@ -546,4 +546,12 @@ public interface ApplicationManager { */ void updateAppIconInfo(ApplicationRelease applicationRelease, String oldPackageName) throws ApplicationManagementException; + + /** + * Delete all application related data of a tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementException thrown if an error occurs when deleting data + */ + void deleteApplicationDataOfTenant(int tenantId) throws ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationStorageManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationStorageManager.java index 68b82facbc..698c57f55a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationStorageManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationStorageManager.java @@ -132,4 +132,12 @@ public interface ApplicationStorageManager { * @throws StorageManagementException if errors while generating md5 string */ String getMD5(InputStream inputStream) throws StorageManagementException; + + /** + * Delete the folder containing all the app releases of a tenant + * + * @param tenantId Tenant ID + * @throws ApplicationStorageManagementException thrown if + */ + void deleteAppFolderOfTenant(int tenantId) throws ApplicationStorageManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java index ffa85b260d..3d460fb4db 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java @@ -238,4 +238,52 @@ public interface ApplicationDAO { int getApplicationCount(Filter filter, int deviceTypeId, int tenantId) throws ApplicationManagementDAOException; void deleteApplication(int appId, int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete favourite applications of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteAppFavouritesByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Application category mapping of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteApplicationCategoryMappingByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Application categories of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteApplicationCategoriesByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Application tags mapping of Tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteApplicationTagsMappingByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Application tags of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteApplicationTagsByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Applications of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteApplicationsByTenant(int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java index cd893979dd..8314388798 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java @@ -127,4 +127,12 @@ public interface ApplicationReleaseDAO { */ List getReleaseByPackages(List packages, int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Application releases of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteReleasesByTenant(int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/LifecycleStateDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/LifecycleStateDAO.java index 3f8656f858..ecf8b1e807 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/LifecycleStateDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/LifecycleStateDAO.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao; import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.exception.LifeCycleManagementDAOException; import java.util.List; @@ -75,4 +76,11 @@ public interface LifecycleStateDAO { */ String getAppReleaseCreatedUsername(int appId, String uuid, int tenantId) throws LifeCycleManagementDAOException; - } + /** + * Delete Application lifecycle states of tenant + * + * @param tenantId Tenant ID + * @throws LifeCycleManagementDAOException thrown if an error occurs while deleting data + */ + void deleteAppLifecycleStatesByTenant(int tenantId) throws LifeCycleManagementDAOException; +} diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java index 9a12859b5c..8fcc3abb54 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.application.mgt.core.dao; import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; import java.util.List; @@ -119,4 +120,11 @@ import java.util.List; void deleteAllChildCommentsOfReview(int rootParentId, int tenantId) throws ReviewManagementDAOException; + /** + * Delete reviews of a tenant + * + * @param tenantId Tenant ID + * @throws ReviewManagementDAOException thrown if an error occurs while deleting data + */ + void deleteReviewsByTenant(int tenantId) throws ReviewManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java index 712a0e28b3..aa84543e6f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java @@ -128,4 +128,20 @@ public interface SPApplicationDAO { * @throws ApplicationManagementDAOException if any db error occurred */ void deleteIdentityServer(int id, int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Identity servers of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteIdentityServerByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Service provide mapping details of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteSPApplicationMappingByTenant(int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java index 804a4a29e2..3213db3484 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SubscriptionDAO.java @@ -264,4 +264,52 @@ public interface SubscriptionDAO { * @throws ApplicationManagementDAOException if error occurred while retrieving the app details */ Activity getOperationAppDetails(int operationId, int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Operation mapping details of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteOperationMappingByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete device subscriptions of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteDeviceSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete group subscriptions of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteGroupSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete role subscriptions of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteRoleSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete user subscriptions of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteUserSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete scheduled subscription details of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteScheduledSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VisibilityDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VisibilityDAO.java index 45664a9d61..49290336c4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VisibilityDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VisibilityDAO.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.exception.VisibilityManagementDAOException; import java.util.List; @@ -70,4 +71,11 @@ public interface VisibilityDAO { */ void deleteAppUnrestrictedRoles(int applicationId, int tenantId) throws VisibilityManagementDAOException; + /** + * Delete app unrestricted roles of tenant + * + * @param tenantId Tenant ID + * @throws VisibilityManagementDAOException thrown if an error occurs while deleting data + */ + void deleteAppUnrestrictedRolesByTenant(int tenantId) throws VisibilityManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java index 02aec95174..a9b637ab86 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/VppApplicationDAO.java @@ -43,4 +43,28 @@ public interface VppApplicationDAO { int addAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) throws ApplicationManagementDAOException; VppAssociationDTO updateAssociation(VppAssociationDTO vppAssociationDTO, int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete associations of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteAssociationByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete Vpp users of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteVppUserByTenant(int tenantId) throws ApplicationManagementDAOException; + + /** + * Delete assets of tenant + * + * @param tenantId Tenant ID + * @throws ApplicationManagementDAOException thrown if an error occurs while deleting data + */ + void deleteAssetsByTenant(int tenantId) throws ApplicationManagementDAOException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 09bea80fa5..0d6970b70d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -1884,4 +1884,159 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } } + @Override + public void deleteAppFavouritesByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete app of tenant of id " + tenantId + " from favourites"); + } + String sql = "DELETE FROM AP_APP_FAVOURITES " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing app from favourites of tenant " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing app of tenant of id " + tenantId + " from favourites. " + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationCategoryMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application category mapping of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_CATEGORY_MAPPING " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application category mapping of tenant" + +tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application category mapping of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationCategoriesByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application category of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_CATEGORY " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application category of tenant " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application category of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationTagsMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application tags mapping of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_TAG_MAPPING " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application tags mapping of tenant" + +tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application tags mapping of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationTagsByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application tags of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_TAG " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application tags of tenant" + +tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application tags of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationsByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete applications of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing applications of tenant" + +tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing applications of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java index 400ff9e7ef..9cebf37f41 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java @@ -624,4 +624,29 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements throw new ApplicationManagementDAOException(msg, e); } } -} + + @Override + public void deleteReleasesByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application releases of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_RELEASE " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application release of tenant" + +tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application release of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java index 5a5b130157..0511602f65 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java @@ -484,4 +484,56 @@ public class GenericSPApplicationDAOImpl extends AbstractDAOImpl implements SPAp } } + @Override + public void deleteIdentityServerByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete identity server of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_IDENTITY_SERVER " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteSPApplicationMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete applications of tenant of id " + tenantId + + " from service providers"); + } + String sql = "DELETE FROM AP_IS_SP_APP_MAPPING " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing applications of tenant" + +tenantId+ "from service providers"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing applications of tenant of id " + tenantId + + "from service providers. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java index d190d88296..993e9476f4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java @@ -485,4 +485,57 @@ public class OracleSPApplicationDAOImpl extends AbstractDAOImpl implements SPAp } } + @Override + public void deleteIdentityServerByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete identity server of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_IDENTITY_SERVER " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteSPApplicationMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete applications of tenant of id " + tenantId + + " from service providers"); + } + String sql = "DELETE FROM AP_IS_SP_APP_MAPPING " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing applications of tenant" + +tenantId+ "from service providers"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing applications of tenant of id " + tenantId + + "from service providers. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java index d599d0db69..bc1fc660e9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java @@ -485,4 +485,57 @@ public class PostgreSQLSPApplicationDAOImpl extends AbstractDAOImpl implements S } } + @Override + public void deleteIdentityServerByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete identity server of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_IDENTITY_SERVER " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteSPApplicationMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete applications of tenant of id " + tenantId + + " from service providers"); + } + String sql = "DELETE FROM AP_IS_SP_APP_MAPPING " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing applications of tenant" + +tenantId+ "from service providers"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing applications of tenant of id " + tenantId + + "from service providers. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java index 3061b96a86..5b6b2571ab 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java @@ -485,4 +485,57 @@ public class SQLServerSPApplicationDAOImpl extends AbstractDAOImpl implements S } } + @Override + public void deleteIdentityServerByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete identity server of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_IDENTITY_SERVER " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete an identity server of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteSPApplicationMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete applications of tenant of id " + tenantId + + " from service providers"); + } + String sql = "DELETE FROM AP_IS_SP_APP_MAPPING " + + "WHERE TENANT_ID = ?"; + try { + Connection conn = this.getDBConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing applications of tenant" + +tenantId+ "from service providers"; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing applications of tenant of id " + tenantId + + "from service providers. Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java index f1fdece953..77026bb04a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java @@ -114,6 +114,31 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif } } + @Override + public void deleteAppLifecycleStatesByTenant(int tenantId) throws LifeCycleManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete app lifecycle states of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_LIFECYCLE_STATE " + + "WHERE TENANT_ID = ?"; + try ( Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing app lifecycle states of tenant" + +tenantId; + log.error(msg, e); + throw new LifeCycleManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing app lifecycle states of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new LifeCycleManagementDAOException(msg, e); + } + } + @Override public List getLifecycleStates(int appReleaseId, int tenantId) throws LifeCycleManagementDAOException { try { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java index 075ba6b01f..71323aa868 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java @@ -602,4 +602,29 @@ public class GenericReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO { throw new ReviewManagementDAOException(msg, e); } } + + @Override + public void deleteReviewsByTenant(int tenantId) throws ReviewManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete app reviews of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_APP_REVIEW " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing app reviews of tenant " + + tenantId; + log.error(msg, e); + throw new ReviewManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing app reviews of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ReviewManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 457de13bee..e8a030a01d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -1476,4 +1476,157 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc throw new ApplicationManagementDAOException(msg, e); } } + + @Override + public void deleteOperationMappingByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete operation mapping of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_APP_SUB_OP_MAPPING " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete operation mapping of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete operation mapping of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteRoleSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete role subscription of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_ROLE_SUBSCRIPTION " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete role subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete role subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteUserSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete user subscription of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_USER_SUBSCRIPTION " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete user subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete user subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteGroupSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete user subscription of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_GROUP_SUBSCRIPTION " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete group subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete group subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteScheduledSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete scheduled subscription of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_SCHEDULED_SUBSCRIPTION " + + "WHERE APPLICATION_UUID IN " + + "(SELECT UUID FROM AP_APP_RELEASE WHERE TENANT_ID = ?)"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeBatch(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete scheduled subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete scheduled subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteDeviceSubscriptionByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete device subscription of the tenant of id: " + tenantId); + } + String sql = "DELETE FROM AP_DEVICE_SUBSCRIPTION " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete device subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing SQL to delete device subscription of tenant of id " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java index ea0b0fb758..446a54c706 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java @@ -176,4 +176,31 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil throw new VisibilityManagementDAOException(msg, e); } } + + @Override + public void deleteAppUnrestrictedRolesByTenant(int tenantId) throws VisibilityManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete Application unrestricted roles of tenant of ID " + + tenantId); + } + String sql = "DELETE " + + "FROM AP_UNRESTRICTED_ROLE " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection to delete application unrestricted roles of tenant: " + + tenantId; + log.error(msg, e); + throw new VisibilityManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while executing query to delete application unrestricted roles which of" + + " tenant Id " + tenantId + ". executed query: " + sql; + log.error(msg, e); + throw new VisibilityManagementDAOException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 7ff06c41eb..4b618894b5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -506,4 +506,81 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp throw new ApplicationManagementDAOException(msg, e); } } + + @Override + public void deleteAssetsByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete application releases of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_ASSETS " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing application release of tenant " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing application release of tenant of id " + tenantId + + " Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + } + + @Override + public void deleteVppUserByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete vpp user of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_VPP_USER " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing vpp user of tenant " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing vpp user of tenant of id " + tenantId + + "Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } + + @Override + public void deleteAssociationByTenant(int tenantId) throws ApplicationManagementDAOException { + if (log.isDebugEnabled()) { + log.debug("Request received in DAO Layer to delete association of tenant of id " + tenantId); + } + String sql = "DELETE FROM AP_VPP_ASSOCIATION " + + "WHERE TENANT_ID = ?"; + try (Connection conn = this.getDBConnection()) { + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (DBConnectionException e) { + String msg = "Error occurred while obtaining the DB connection when removing association of tenant" + + tenantId; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } catch (SQLException e) { + String msg = "SQL Error occurred while removing association of tenant of id " + tenantId + + " Executed Query: " + sql; + log.error(msg, e); + throw new ApplicationManagementDAOException(msg, e); + } + + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 3b2eb638aa..c72f61942c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -19,6 +19,8 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.core.dao.*; +import io.entgra.device.mgt.core.application.mgt.core.exception.*; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; @@ -75,11 +77,6 @@ import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.LifecycleStateDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; @@ -128,6 +125,8 @@ public class ApplicationManagerImpl implements ApplicationManager { private SubscriptionDAO subscriptionDAO; private LifecycleStateManager lifecycleStateManager; private SPApplicationDAO spApplicationDAO; + private VppApplicationDAO vppApplicationDAO; + private ReviewDAO reviewDAO; public ApplicationManagerImpl() { initDataAccessObjects(); @@ -141,6 +140,8 @@ public class ApplicationManagerImpl implements ApplicationManager { this.applicationReleaseDAO = ApplicationManagementDAOFactory.getApplicationReleaseDAO(); this.subscriptionDAO = ApplicationManagementDAOFactory.getSubscriptionDAO(); this.spApplicationDAO = ApplicationManagementDAOFactory.getSPApplicationDAO(); + this.vppApplicationDAO = ApplicationManagementDAOFactory.getVppApplicationDAO(); + this.reviewDAO = ApplicationManagementDAOFactory.getCommentDAO(); } @Override @@ -4167,4 +4168,66 @@ public class ApplicationManagerImpl implements ApplicationManager { throw new ApplicationManagementException(msg, e); } } + + @Override + public void deleteApplicationDataOfTenant(int tenantId) throws ApplicationManagementException { + if (log.isDebugEnabled()) { + log.debug("Request is received to delete application related data of tenant with ID: " + tenantId); + } + try { + ConnectionManagerUtil.beginDBTransaction(); + + vppApplicationDAO.deleteAssociationByTenant(tenantId); + vppApplicationDAO.deleteVppUserByTenant(tenantId); + vppApplicationDAO.deleteAssetsByTenant(tenantId); + reviewDAO.deleteReviewsByTenant(tenantId); + subscriptionDAO.deleteOperationMappingByTenant(tenantId); + subscriptionDAO.deleteDeviceSubscriptionByTenant(tenantId); + subscriptionDAO.deleteGroupSubscriptionByTenant(tenantId); + subscriptionDAO.deleteRoleSubscriptionByTenant(tenantId); + subscriptionDAO.deleteUserSubscriptionByTenant(tenantId); + applicationDAO.deleteAppFavouritesByTenant(tenantId); + applicationDAO.deleteApplicationTagsMappingByTenant(tenantId); + applicationDAO.deleteApplicationTagsByTenant(tenantId); + applicationDAO.deleteApplicationCategoryMappingByTenant(tenantId); + applicationDAO.deleteApplicationCategoriesByTenant(tenantId); + subscriptionDAO.deleteScheduledSubscriptionByTenant(tenantId); + lifecycleStateDAO.deleteAppLifecycleStatesByTenant(tenantId); + applicationReleaseDAO.deleteReleasesByTenant(tenantId); + visibilityDAO.deleteAppUnrestrictedRolesByTenant(tenantId); + spApplicationDAO.deleteSPApplicationMappingByTenant(tenantId); + spApplicationDAO.deleteIdentityServerByTenant(tenantId); + applicationDAO.deleteApplicationsByTenant(tenantId); + APIUtil.getApplicationStorageManager().deleteAppFolderOfTenant(tenantId); + + ConnectionManagerUtil.commitDBTransaction(); + } catch (DBConnectionException e) { + String msg = "Error occurred while observing the database connection to delete applications for tenant with ID: " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + String msg = "Database access error is occurred when getting applications for tenant with ID: " + tenantId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (LifeCycleManagementDAOException e) { + String msg = "Error occurred while deleting life-cycle state data of application releases of the tenant" + + " of ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ReviewManagementDAOException e) { + String msg = "Error occurred while deleting reviews of application releases of the applications" + + " of tenant ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationStorageManagementException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while deleting App folder of tenant" + + " of tenant ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java index a79a3d23ee..158361232c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java @@ -310,4 +310,18 @@ public class ApplicationStorageManagerImpl implements ApplicationStorageManager throw new StorageManagementException(msg, e); } } + + @Override + public void deleteAppFolderOfTenant(int tenantId) throws ApplicationStorageManagementException{ + String folderPath = storagePath + File.separator + tenantId; + File folder = new File(folderPath); + if (folder.exists()) { + try { + StorageManagementUtil.delete(folder); + } catch (IOException e) { + throw new ApplicationStorageManagementException( + "Error occurred while deleting App folder of tenant:" + tenantId, e); + } + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java index a62341756e..5d324aeb02 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java @@ -61,6 +61,13 @@ import javax.ws.rs.core.Response; key = "um:admin:users:remove", roles = {"Internal/devicemgt-admin"}, permissions = {"/device-mgt/admin/users/delete"} + ), + @Scope( + name = "Delete Tenant Information", + description = "Delete tenant details", + key = "um:admin:tenants:remove", + roles = {"Internal/devicemgt-admin"}, + permissions = {"/device-mgt/admin/tenants/delete"} ) } ) @@ -258,5 +265,41 @@ public interface UserManagementAdminService { @Size(max = 45) String deviceId); + @DELETE + @Path("/domain/{tenantDomain}") + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "DELETE", + value = "Delete a tenant by tenant domain.", + notes = "This API allows the deletion of a tenant by providing the tenant domain.", + tags = "Tenant details remove", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = Constants.SCOPE, value = "um:admin:tenants:remove") + }) + } + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "OK. \n Tenant has been deleted successfully."), + @ApiResponse( + code = 404, + message = "Not Found. \n The tenant with the provided domain does not exist.", + response = ErrorResponse.class), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while removing the tenant.", + response = ErrorResponse.class) + }) + Response deleteTenantByDomain( + @ApiParam( + name = "tenantDomain", + value = "The domain of the tenant to be deleted.", + required = true) + + @PathParam("tenantDomain") + String tenantDomain); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java index 26cd8c4c54..296bdf5060 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; @@ -25,6 +26,11 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PasswordResetWrapper import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.UserManagementAdminService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.CredentialManagementResponseBuilder; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.stratos.common.exception.StratosException; +import org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService; +import org.wso2.carbon.user.api.UserStoreException; import javax.validation.constraints.Size; import javax.ws.rs.*; @@ -81,4 +87,28 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic } } + @DELETE + @Path("/domain/{tenantDomain}") + @Override + public Response deleteTenantByDomain(@PathParam("tenantDomain") String tenantDomain) { + try { + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + if(tenantId != MultitenantConstants.SUPER_TENANT_ID){ + String msg = "Only super tenants are allowed to delete tenants"; + log.error(msg); + return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); + }else{ + TenantMgtAdminService tenantMgtAdminService = new TenantMgtAdminService(); + tenantMgtAdminService.deleteTenant(tenantDomain); + String msg = "Tenant Deletion process has been initiated for tenant:" + tenantDomain; + return Response.status(Response.Status.OK).entity(msg).build(); + } + + } catch (StratosException | UserStoreException e) { + String msg = "Error deleting tenant: " + tenantDomain; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } + } + } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java index 7b105df14d..b7768f9c52 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java @@ -139,6 +139,22 @@ public class DeviceManagementDAOFactory { throw new IllegalStateException("Database engine has not initialized properly."); } + public static TenantDAO getTenantDAO() { + if (databaseEngine != null) { + switch (databaseEngine) { + case DeviceManagementConstants.DataBaseTypes.DB_TYPE_POSTGRESQL: + case DeviceManagementConstants.DataBaseTypes.DB_TYPE_ORACLE: + case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MSSQL: + case DeviceManagementConstants.DataBaseTypes.DB_TYPE_H2: + case DeviceManagementConstants.DataBaseTypes.DB_TYPE_MYSQL: + return new TenantDAOImpl(); + default: + throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); + } + } + throw new IllegalStateException("Database engine has not initialized properly."); + } + public static TrackerDAO getTrackerDAO() { if (databaseEngine != null) { switch (databaseEngine) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TenantDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TenantDAO.java new file mode 100644 index 0000000000..372df2583a --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TenantDAO.java @@ -0,0 +1,431 @@ +package io.entgra.device.mgt.core.device.mgt.core.dao; + +public interface TenantDAO { + + /** + * Delete device certificates of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceCertificateByTenantId(int tenantId)throws DeviceManagementDAOException; + + /** + * Delete groups of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteGroupByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete role-group mapping data of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteRoleGroupMapByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete devices of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device properties of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDevicePropertiesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete group properties of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteGroupPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device-group mapping details of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceGroupMapByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete operations of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteOperationByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete enrolments of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteEnrolmentByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device statuses of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceStatusByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete enrolment mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteEnrolmentOpMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device operation responses of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceOperationResponseByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete large-device operations responses of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceOperationResponseLargeByTenantId(int tenantId) throws DeviceManagementDAOException; + + // Delete policy related tables + + /** + * Delete applications of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteApplicationByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy compliance features of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyComplianceFeaturesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy change management data of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyChangeManagementByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy compliance statuses of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyComplianceStatusByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy criteria properties of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyCriteriaPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy criteria of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyCriteriaByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete role policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteRolePolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete user policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteUserPolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDevicePolicyAppliedByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete criteria of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteCriteriaByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device type properties of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceTypePolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDevicePolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete profile features of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteProfileFeaturesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete policy corrective actions of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deletePolicyCorrectiveActionByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete profiles of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteProfileByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete app icons of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteAppIconsByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device group policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceGroupPolicyByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete notifications of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteNotificationByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device information of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceInfoByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device location of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceLocationByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device history of last seven days of a tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceHistoryLastSevenDaysByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device details of a tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceDetailByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete metadata of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteMetadataByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete OTP data of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteOTPDataByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete geo fences of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteGeofenceByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete geo fence group mapping data of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteGeofenceGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device events of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceEventByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device event group mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceEventGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete geo fence event mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteGeofenceEventMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete external group mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteExternalGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete External device mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteExternalDeviceMappingByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete external permission mapping of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteExternalPermissionMapping(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete dynamic tasks of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDynamicTaskByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete dynamic task properties of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDynamicTaskPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device subtypes of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceSubTypeByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete traccar unsynced devices of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteTraccarUnsyncedDevicesByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete sub operation templates of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteSubOperationTemplate(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete device organizations of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteDeviceOrganizationByTenantId(int tenantId) throws DeviceManagementDAOException; + + /** + * Delete CEA policies of tenant + * + * @param tenantId Tenant ID + * @throws DeviceManagementDAOException thrown if there is an error when deleting data + */ + void deleteCEAPoliciesByTenantId(int tenantId) throws DeviceManagementDAOException; + +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java new file mode 100644 index 0000000000..69abf756a0 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java @@ -0,0 +1,939 @@ +package io.entgra.device.mgt.core.device.mgt.core.dao.impl; + +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.dao.TenantDAO; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; + + +public class TenantDAOImpl implements TenantDAO { + + private static final Log log = LogFactory.getLog(TenantDAOImpl.class); + + + @Override + public void deleteDeviceCertificateByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_CERTIFICATE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting certificates for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteGroupByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_GROUP WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting groups for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteRoleGroupMapByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_ROLE_GROUP_MAP WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting role group mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting devices for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDevicePropertiesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_PROPERTIES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device properties for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public void deleteGroupPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM GROUP_PROPERTIES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting group properties for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceGroupMapByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_GROUP_MAP WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device group mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteOperationByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_OPERATION WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting operations for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteEnrolmentByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_ENROLMENT WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting enrolment for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceStatusByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_STATUS WHERE ENROLMENT_ID IN " + + "(SELECT ID FROM DM_ENROLMENT WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device status for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteEnrolmentOpMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting enrolment op mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceOperationResponseByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE ID IN " + + "(SELECT ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device operation response for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceOperationResponseLargeByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE_LARGE WHERE EN_OP_MAP_ID IN "+ + "(SELECT ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device operation response large for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteApplicationByTenantId(int tenantId) throws DeviceManagementDAOException{ + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_APPLICATION WHERE DEVICE_ID IN " + + "(SELECT ID FROM DM_DEVICE WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting applications for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + + } + + @Override + public void deletePolicyComplianceFeaturesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_COMPLIANCE_FEATURES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy compliance features for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyChangeManagementByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_CHANGE_MGT WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy change management for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyComplianceStatusByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_COMPLIANCE_STATUS WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy compliance status for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyCriteriaPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_CRITERIA_PROPERTIES WHERE POLICY_CRITERION_ID IN " + + "(SELECT ID FROM DM_POLICY_CRITERIA WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?))"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy criteria properties for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyCriteriaByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_CRITERIA WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy criteria for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteRolePolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_ROLE_POLICY WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting role policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteUserPolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_USER_POLICY WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting user policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDevicePolicyAppliedByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_POLICY_APPLIED WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy applied for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteCriteriaByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_CRITERIA WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting criteria for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceTypePolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_TYPE_POLICY WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device type policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public void deleteDevicePolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_POLICY WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteProfileFeaturesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_PROFILE_FEATURES WHERE PROFILE_ID IN " + + "(SELECT ID FROM DM_PROFILE WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting profile features for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deletePolicyCorrectiveActionByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_POLICY_CORRECTIVE_ACTION WHERE POLICY_ID IN " + + "(SELECT ID FROM DM_POLICY WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting policy corrective action for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteProfileByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_PROFILE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting profile for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteAppIconsByTenantId(int tenantId) throws DeviceManagementDAOException{ + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_APP_ICONS WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting App Icons for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceGroupPolicyByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_GROUP_POLICY WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device group policy for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteNotificationByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_NOTIFICATION WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting notifications for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceInfoByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_INFO WHERE ENROLMENT_ID IN " + + "(SELECT ID FROM DM_ENROLMENT WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device info for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceLocationByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_LOCATION WHERE ENROLMENT_ID IN " + + "(SELECT ID FROM DM_ENROLMENT WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device location for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceHistoryLastSevenDaysByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_HISTORY_LAST_SEVEN_DAYS WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device history for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceDetailByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_DETAIL WHERE ENROLMENT_ID IN " + + "(SELECT ID FROM DM_ENROLMENT WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device detail for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteMetadataByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_METADATA WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting metadata for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteOTPDataByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_OTP_DATA WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting OTP data for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteGeofenceByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_GEOFENCE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting geo fence for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteGeofenceGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_GEOFENCE_GROUP_MAPPING WHERE FENCE_ID IN " + + "(SELECT ID FROM DM_GEOFENCE WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting geo fence group mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceEventByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_EVENT WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device event for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceEventGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_EVENT_GROUP_MAPPING WHERE EVENT_ID IN " + + "(SELECT ID FROM DM_DEVICE_EVENT WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device event group mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteGeofenceEventMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_GEOFENCE_EVENT_MAPPING WHERE FENCE_ID IN " + + "(SELECT ID FROM DM_GEOFENCE WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting geo fence event mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteExternalGroupMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_EXT_GROUP_MAPPING WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting external group mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteExternalDeviceMappingByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_OTP_DATA WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting external device mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteExternalPermissionMapping(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_EXT_PERMISSION_MAPPING WHERE TRACCAR_USER_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting ext permission mapping for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + + } + + @Override + public void deleteDynamicTaskByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DYNAMIC_TASK WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting dynamic task for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDynamicTaskPropertiesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DYNAMIC_TASK_PROPERTIES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting dynamic task properties for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceSubTypeByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_SUB_TYPE WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device sub types for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteTraccarUnsyncedDevicesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_TRACCAR_UNSYNCED_DEVICES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting Traccar unsynced devices for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteSubOperationTemplate(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID IN " + + "(SELECT SUB_TYPE_ID FROM DM_DEVICE_SUB_TYPE WHERE TENANT_ID = ?)"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting sub operation template for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteDeviceOrganizationByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_DEVICE_ORGANIZATION WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting device organization for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } + + @Override + public void deleteCEAPoliciesByTenantId(int tenantId) throws DeviceManagementDAOException { + try { + Connection conn = DeviceManagementDAOFactory.getConnection(); + String sql = "DELETE FROM DM_CEA_POLICIES WHERE TENANT_ID = ?"; + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting CEA policies for Tenant ID " + tenantId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + + } +} diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/src/main/java/io/entgra/device/mgt/core/tenant/mgt/common/spi/TenantManagerService.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/src/main/java/io/entgra/device/mgt/core/tenant/mgt/common/spi/TenantManagerService.java index a43f20f24c..cbc67114ee 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/src/main/java/io/entgra/device/mgt/core/tenant/mgt/common/spi/TenantManagerService.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/src/main/java/io/entgra/device/mgt/core/tenant/mgt/common/spi/TenantManagerService.java @@ -26,4 +26,6 @@ public interface TenantManagerService { void addDefaultAppCategories(TenantInfoBean tenantInfoBean) throws TenantMgtException; void addDefaultDeviceStatusFilters(TenantInfoBean tenantInfoBean) throws TenantMgtException; + void deleteTenantApplicationData(int tenantId) throws TenantMgtException; + void deleteTenantDeviceData(int tenantId) throws TenantMgtException; } \ No newline at end of file diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/TenantManager.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/TenantManager.java index 97eb706be7..ac3ee406f9 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/TenantManager.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/TenantManager.java @@ -43,4 +43,18 @@ public interface TenantManager { * @throws TenantMgtException Throws when error occurred while adding default application categories */ void addDefaultDeviceStatusFilters(TenantInfoBean tenantInfoBean) throws TenantMgtException; + + /** + * Delete Application related details of a tenant + * @param tenantId ID of the tenant + * @throws TenantMgtException Throws when deleting Tenant related application data + */ + void deleteTenantApplicationData(int tenantId) throws TenantMgtException; + + /** + * Delete Device related details of a tenant + * @param tenantId ID of the tenant + * @throws TenantMgtException Throws when deleting Tenant related device data + */ + void deleteTenantDeviceData(int tenantId) throws TenantMgtException; } diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index 5dc2eb7f08..cbac0013b4 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -20,6 +20,9 @@ package io.entgra.device.mgt.core.tenant.mgt.core.impl; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.dao.TenantDAO; import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.tenant.mgt.common.exception.TenantMgtException; import io.entgra.device.mgt.core.tenant.mgt.core.internal.TenantMgtDataHolder; @@ -38,6 +41,7 @@ import io.entgra.device.mgt.core.device.mgt.common.roles.config.Role; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; +import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -46,6 +50,11 @@ import java.util.Map; public class TenantManagerImpl implements TenantManager { private static final Log log = LogFactory.getLog(TenantManagerImpl.class); private static final String PERMISSION_ACTION = "ui.execute"; + TenantDAO tenantDao; + + public TenantManagerImpl() { + this.tenantDao = DeviceManagementDAOFactory.getTenantDAO(); + } @Override public void addDefaultRoles(TenantInfoBean tenantInfoBean) throws TenantMgtException { @@ -113,6 +122,99 @@ public class TenantManagerImpl implements TenantManager { } } + @Override + public void deleteTenantApplicationData(int tenantId) throws TenantMgtException { + try { + TenantMgtDataHolder.getInstance().getApplicationManager(). + deleteApplicationDataOfTenant(tenantId); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while deleting Application related data of Tenant of " + + "tenant Id" + tenantId; + log.error(msg, e); + throw new TenantMgtException(msg, e); + } + } + + @Override + public void deleteTenantDeviceData(int tenantId) throws TenantMgtException { + if (log.isDebugEnabled()) { + log.debug("Request is received to delete Device related data of tenant with ID: " + tenantId); + } + try { + DeviceManagementDAOFactory.openConnection(); + + tenantDao.deleteExternalPermissionMapping(tenantId); + tenantDao.deleteExternalDeviceMappingByTenantId(tenantId); + tenantDao.deleteExternalGroupMappingByTenantId(tenantId); + tenantDao.deleteDeviceOrganizationByTenantId(tenantId); + tenantDao.deleteDeviceHistoryLastSevenDaysByTenantId(tenantId); + tenantDao.deleteDeviceDetailByTenantId(tenantId); + tenantDao.deleteDeviceLocationByTenantId(tenantId); + tenantDao.deleteDeviceInfoByTenantId(tenantId); + tenantDao.deleteNotificationByTenantId(tenantId); + tenantDao.deleteAppIconsByTenantId(tenantId); + tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); + tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); + tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); + tenantDao.deleteGeofenceByTenantId(tenantId); + tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId); + tenantDao.deleteDynamicTaskPropertiesByTenantId(tenantId); + tenantDao.deleteDynamicTaskByTenantId(tenantId); + tenantDao.deleteMetadataByTenantId(tenantId); + tenantDao.deleteOTPDataByTenantId(tenantId); + tenantDao.deleteSubOperationTemplate(tenantId); + tenantDao.deleteDeviceSubTypeByTenantId(tenantId); + tenantDao.deleteCEAPoliciesByTenantId(tenantId); + + tenantDao.deleteApplicationByTenantId(tenantId); + tenantDao.deletePolicyCriteriaPropertiesByTenantId(tenantId); + tenantDao.deletePolicyCriteriaByTenantId(tenantId); + tenantDao.deleteCriteriaByTenantId(tenantId); + tenantDao.deletePolicyChangeManagementByTenantId(tenantId); + tenantDao.deletePolicyComplianceFeaturesByTenantId(tenantId); + tenantDao.deletePolicyComplianceStatusByTenantId(tenantId); + tenantDao.deleteRolePolicyByTenantId(tenantId); + tenantDao.deleteUserPolicyByTenantId(tenantId); + tenantDao.deleteDeviceTypePolicyByTenantId(tenantId); + tenantDao.deleteDevicePolicyAppliedByTenantId(tenantId); + tenantDao.deleteDevicePolicyByTenantId(tenantId); + tenantDao.deletePolicyCorrectiveActionByTenantId(tenantId); + tenantDao.deletePolicyByTenantId(tenantId); + tenantDao.deleteProfileFeaturesByTenantId(tenantId); + tenantDao.deleteProfileByTenantId(tenantId); + + tenantDao.deleteDeviceOperationResponseLargeByTenantId(tenantId); + tenantDao.deleteDeviceOperationResponseByTenantId(tenantId); + tenantDao.deleteEnrolmentOpMappingByTenantId(tenantId); + tenantDao.deleteDeviceStatusByTenantId(tenantId); + tenantDao.deleteEnrolmentByTenantId(tenantId); + tenantDao.deleteOperationByTenantId(tenantId); + tenantDao.deleteDeviceGroupMapByTenantId(tenantId); + tenantDao.deleteGroupPropertiesByTenantId(tenantId); + tenantDao.deleteDevicePropertiesByTenantId(tenantId); + tenantDao.deleteDeviceByTenantId(tenantId); + tenantDao.deleteRoleGroupMapByTenantId(tenantId); + tenantDao.deleteGroupByTenantId(tenantId); + tenantDao.deleteDeviceCertificateByTenantId(tenantId); + + DeviceManagementDAOFactory.commitTransaction(); + } catch (SQLException e){ + DeviceManagementDAOFactory.rollbackTransaction(); + String msg = "Error accessing the database when trying to delete tenant info of '" + tenantId + "'"; + log.error(msg); + throw new TenantMgtException(msg, e); + } catch (DeviceManagementDAOException e) { + String msg = "Error deleting data of tenant of ID: '" + tenantId + "'"; + log.error(msg); + throw new TenantMgtException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + + } + private void initTenantFlow(TenantInfoBean tenantInfoBean) { PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext privilegedCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java index da21a52100..bc82bef3db 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java @@ -38,4 +38,14 @@ public class TenantManagerServiceImpl implements TenantManagerService { public void addDefaultDeviceStatusFilters(TenantInfoBean tenantInfoBean) throws TenantMgtException { TenantMgtDataHolder.getInstance().getTenantManager().addDefaultDeviceStatusFilters(tenantInfoBean); } + + @Override + public void deleteTenantApplicationData(int tenantId) throws TenantMgtException { + TenantMgtDataHolder.getInstance().getTenantManager().deleteTenantApplicationData(tenantId); + } + + @Override + public void deleteTenantDeviceData(int tenantId) throws TenantMgtException { + TenantMgtDataHolder.getInstance().getTenantManager().deleteTenantDeviceData(tenantId); + } } diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java index 978e69b0e4..257206f84f 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java @@ -88,5 +88,13 @@ public class DeviceMgtTenantListener implements TenantMgtListener { @Override public void onPreDelete(int i) throws StratosException { // Any work to be performed before a tenant is deleted + TenantManager tenantManager = TenantMgtDataHolder.getInstance().getTenantManager(); + try{ + tenantManager.deleteTenantDeviceData(i); + tenantManager.deleteTenantApplicationData(i); + } catch (TenantMgtException e) { + String msg = "Error occurred while deleting tenant data"; + log.error(msg, e); + } } } diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml index f5208c958f..6df8455797 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/mdm-ui-config.xml @@ -289,6 +289,7 @@ um:users:update um:users:invite um:admin:users:view + um:admin:tenants:remove dm:admin:enrollment:update gm:devices:view gm:groups:update From b74dc5796b2d391b33952ec07f84b9f8b6743fa4 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Fri, 5 Apr 2024 09:56:04 +0530 Subject: [PATCH 07/24] Make the executor Callable and retrieve the response --- ...ApplicationManagerProviderServiceImpl.java | 2 -- .../details/mgt/DeviceInformationManager.java | 1 - .../impl/DeviceInformationManagerImpl.java | 32 ++++++++++++++++--- .../report/mgt/ReportingPublisherManager.java | 13 +++++--- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 7fa3959d26..368157ca48 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -290,8 +290,6 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem ReportingPublisherManager reportingManager = new ReportingPublisherManager(); reportingManager.publishData(deviceDetailsWrapper, DeviceManagementConstants .Report.APP_USAGE_ENDPOINT); - /*HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), - reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT);*/ } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java index fdf98a86a5..911fafdd59 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java @@ -107,7 +107,6 @@ public interface DeviceInformationManager { * @param deviceType device type of an device * @param payload payload of the event * @param eventType Event type being sent - * @return Http status code if a call is made and if failed to make a call 0 * @throws DeviceDetailsMgtException */ int publishEvents(String deviceId, String deviceType, String payload, String eventType) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index e210526a19..0facad3b30 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -54,6 +54,8 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; public class DeviceInformationManagerImpl implements DeviceInformationManager { @@ -86,6 +88,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setDeviceInfo(deviceInfo); + //Asynchronous call to publish the device information to the reporting service. Hence, response is ignored. publishEvents(device, deviceDetailsWrapper, DeviceManagementConstants.Report.DEVICE_INFO_PARAM); DeviceManagementDAOFactory.beginTransaction(); @@ -203,13 +206,32 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceIdentifier, false); DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setEvents(payload); - publishEvents(device, deviceDetailsWrapper, eventType); - return 201; + Future apiCallback = publishEvents(device, deviceDetailsWrapper, eventType); + if (null != apiCallback) { + while(!apiCallback.isDone()) { + if (log.isDebugEnabled()) { + log.debug("Waiting for the response from the API for the reporting data " + + "publishing for the device " + deviceId + ". Event payload: " + payload); + } + } + return apiCallback.get(); + } + return 0; // If the event publishing is disabled. } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Event publishing error. Could not get device " + deviceId; log.error(msg, e); throw new DeviceDetailsMgtException(msg, e); + } catch (ExecutionException e) { + String message = "Failed while publishing device information data to the reporting service for the device " + + deviceId; + log.error(message, e); + throw new DeviceDetailsMgtException(message, e); + } catch (InterruptedException e) { + String message = "Failed while publishing device information data to the reporting service. Thread " + + "interrupted while waiting for the response from the API for the Device " + deviceId; + log.error(message, e); + throw new DeviceDetailsMgtException(message, e); } } @@ -218,7 +240,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { * @param device Device that is sending event * @param deviceDetailsWrapper Payload to send(example, deviceinfo, applist, raw events) */ - private void publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String + private Future publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String eventType) { String reportingHost = HttpReportingUtil.getReportingHost(); if (!StringUtils.isBlank(reportingHost) @@ -254,8 +276,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String eventUrl = reportingHost + DeviceManagementConstants.Report .REPORTING_CONTEXT + DeviceManagementConstants.URL_SEPERATOR + eventType; ReportingPublisherManager reportingManager = new ReportingPublisherManager(); - reportingManager.publishData(deviceDetailsWrapper, eventUrl); - //return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); + return reportingManager.publishData(deviceDetailsWrapper, eventUrl); } catch (GroupManagementException e) { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { @@ -271,6 +292,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { + DeviceManagerUtil.getTenantId()); } } + return null; } @Override diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java index 3e72aab7f5..b6e3bf5ae1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java @@ -33,8 +33,10 @@ import org.apache.http.protocol.HTTP; import java.io.IOException; import java.net.ConnectException; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.Future; public class ReportingPublisherManager { @@ -51,15 +53,15 @@ public class ReportingPublisherManager { poolingManager.setDefaultMaxPerRoute(10); } - public void publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { + public Future publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { this.payload = deviceDetailsWrapper; this.endpoint = eventUrl; - executorService.submit(new ReportingPublisher()); + return executorService.submit(new ReportingPublisher()); } - private class ReportingPublisher implements Runnable { + private class ReportingPublisher implements Callable { @Override - public void run() { + public Integer call() throws EventPublishingException { try (CloseableHttpClient client = HttpClients.custom().setConnectionManager(poolingManager).build()) { HttpPost apiEndpoint = new HttpPost(endpoint); apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); @@ -70,12 +72,15 @@ public class ReportingPublisherManager { if (log.isDebugEnabled()) { log.debug("Published data to the reporting backend: " + endpoint + ", Response code: " + statusCode); } + return statusCode; } catch (ConnectException e) { String message = "Connection refused while publishing reporting data to the API: " + endpoint; log.error(message, e); + throw new EventPublishingException(message, e); } catch (IOException e) { String message = "Error occurred when publishing reporting data to the API: " + endpoint; log.error(message, e); + throw new EventPublishingException(message, e); } } } From 0071e1369297e57ad8f4706d655cbfb11f27b6b3 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Fri, 5 Apr 2024 04:28:15 +0000 Subject: [PATCH 08/24] revert b74dc5796b2d391b33952ec07f84b9f8b6743fa4 revert Make the executor Callable and retrieve the response --- ...ApplicationManagerProviderServiceImpl.java | 2 ++ .../details/mgt/DeviceInformationManager.java | 1 + .../impl/DeviceInformationManagerImpl.java | 32 +++---------------- .../report/mgt/ReportingPublisherManager.java | 13 +++----- 4 files changed, 12 insertions(+), 36 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 368157ca48..7fa3959d26 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -290,6 +290,8 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem ReportingPublisherManager reportingManager = new ReportingPublisherManager(); reportingManager.publishData(deviceDetailsWrapper, DeviceManagementConstants .Report.APP_USAGE_ENDPOINT); + /*HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), + reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT);*/ } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java index 911fafdd59..fdf98a86a5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java @@ -107,6 +107,7 @@ public interface DeviceInformationManager { * @param deviceType device type of an device * @param payload payload of the event * @param eventType Event type being sent + * @return Http status code if a call is made and if failed to make a call 0 * @throws DeviceDetailsMgtException */ int publishEvents(String deviceId, String deviceType, String payload, String eventType) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index 0facad3b30..e210526a19 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -54,8 +54,6 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; public class DeviceInformationManagerImpl implements DeviceInformationManager { @@ -88,7 +86,6 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setDeviceInfo(deviceInfo); - //Asynchronous call to publish the device information to the reporting service. Hence, response is ignored. publishEvents(device, deviceDetailsWrapper, DeviceManagementConstants.Report.DEVICE_INFO_PARAM); DeviceManagementDAOFactory.beginTransaction(); @@ -206,32 +203,13 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceIdentifier, false); DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setEvents(payload); - Future apiCallback = publishEvents(device, deviceDetailsWrapper, eventType); - if (null != apiCallback) { - while(!apiCallback.isDone()) { - if (log.isDebugEnabled()) { - log.debug("Waiting for the response from the API for the reporting data " + - "publishing for the device " + deviceId + ". Event payload: " + payload); - } - } - return apiCallback.get(); - } - return 0; // If the event publishing is disabled. + publishEvents(device, deviceDetailsWrapper, eventType); + return 201; } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Event publishing error. Could not get device " + deviceId; log.error(msg, e); throw new DeviceDetailsMgtException(msg, e); - } catch (ExecutionException e) { - String message = "Failed while publishing device information data to the reporting service for the device " - + deviceId; - log.error(message, e); - throw new DeviceDetailsMgtException(message, e); - } catch (InterruptedException e) { - String message = "Failed while publishing device information data to the reporting service. Thread " + - "interrupted while waiting for the response from the API for the Device " + deviceId; - log.error(message, e); - throw new DeviceDetailsMgtException(message, e); } } @@ -240,7 +218,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { * @param device Device that is sending event * @param deviceDetailsWrapper Payload to send(example, deviceinfo, applist, raw events) */ - private Future publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String + private void publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String eventType) { String reportingHost = HttpReportingUtil.getReportingHost(); if (!StringUtils.isBlank(reportingHost) @@ -276,7 +254,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String eventUrl = reportingHost + DeviceManagementConstants.Report .REPORTING_CONTEXT + DeviceManagementConstants.URL_SEPERATOR + eventType; ReportingPublisherManager reportingManager = new ReportingPublisherManager(); - return reportingManager.publishData(deviceDetailsWrapper, eventUrl); + reportingManager.publishData(deviceDetailsWrapper, eventUrl); + //return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); } catch (GroupManagementException e) { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { @@ -292,7 +271,6 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { + DeviceManagerUtil.getTenantId()); } } - return null; } @Override diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java index b6e3bf5ae1..3e72aab7f5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java @@ -33,10 +33,8 @@ import org.apache.http.protocol.HTTP; import java.io.IOException; import java.net.ConnectException; -import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.Future; public class ReportingPublisherManager { @@ -53,15 +51,15 @@ public class ReportingPublisherManager { poolingManager.setDefaultMaxPerRoute(10); } - public Future publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { + public void publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { this.payload = deviceDetailsWrapper; this.endpoint = eventUrl; - return executorService.submit(new ReportingPublisher()); + executorService.submit(new ReportingPublisher()); } - private class ReportingPublisher implements Callable { + private class ReportingPublisher implements Runnable { @Override - public Integer call() throws EventPublishingException { + public void run() { try (CloseableHttpClient client = HttpClients.custom().setConnectionManager(poolingManager).build()) { HttpPost apiEndpoint = new HttpPost(endpoint); apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); @@ -72,15 +70,12 @@ public class ReportingPublisherManager { if (log.isDebugEnabled()) { log.debug("Published data to the reporting backend: " + endpoint + ", Response code: " + statusCode); } - return statusCode; } catch (ConnectException e) { String message = "Connection refused while publishing reporting data to the API: " + endpoint; log.error(message, e); - throw new EventPublishingException(message, e); } catch (IOException e) { String message = "Error occurred when publishing reporting data to the API: " + endpoint; log.error(message, e); - throw new EventPublishingException(message, e); } } } From ea5373490145c32e4777495661beb8203d98cba3 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Fri, 5 Apr 2024 04:30:12 +0000 Subject: [PATCH 09/24] revert 6c1286ebad915273a860ac5e61685abce82bffdf revert Improvements for the reporting data publishing --- ...ApplicationManagerProviderServiceImpl.java | 8 +- .../impl/DeviceInformationManagerImpl.java | 14 ++-- .../report/mgt/ReportingPublisherManager.java | 82 ------------------- .../mgt/core/util/HttpReportingUtil.java | 19 ++++- 4 files changed, 27 insertions(+), 96 deletions(-) delete mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 7fa3959d26..fec70931a4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; import com.google.gson.Gson; -import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -287,11 +286,8 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem deviceDetailsWrapper.setTenantId(tenantId); deviceDetailsWrapper.setDevice(device); deviceDetailsWrapper.setApplications(newApplications); - ReportingPublisherManager reportingManager = new ReportingPublisherManager(); - reportingManager.publishData(deviceDetailsWrapper, DeviceManagementConstants - .Report.APP_USAGE_ENDPOINT); - /*HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), - reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT);*/ + HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), + reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT); } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index e210526a19..d3681a43c4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl; -import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -30,6 +29,7 @@ import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsW import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; @@ -203,8 +203,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceIdentifier, false); DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setEvents(payload); - publishEvents(device, deviceDetailsWrapper, eventType); - return 201; + return publishEvents(device, deviceDetailsWrapper, eventType); } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Event publishing error. Could not get device " + deviceId; @@ -218,7 +217,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { * @param device Device that is sending event * @param deviceDetailsWrapper Payload to send(example, deviceinfo, applist, raw events) */ - private void publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String + private int publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String eventType) { String reportingHost = HttpReportingUtil.getReportingHost(); if (!StringUtils.isBlank(reportingHost) @@ -253,9 +252,9 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String eventUrl = reportingHost + DeviceManagementConstants.Report .REPORTING_CONTEXT + DeviceManagementConstants.URL_SEPERATOR + eventType; - ReportingPublisherManager reportingManager = new ReportingPublisherManager(); - reportingManager.publishData(deviceDetailsWrapper, eventUrl); - //return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); + return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); + } catch (EventPublishingException e) { + log.error("Error occurred while sending events", e); } catch (GroupManagementException e) { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { @@ -271,6 +270,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { + DeviceManagerUtil.getTenantId()); } } + return 0; } @Override diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java deleted file mode 100644 index 3e72aab7f5..0000000000 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.entgra.device.mgt.core.device.mgt.core.report.mgt; - -import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.protocol.HTTP; - -import java.io.IOException; -import java.net.ConnectException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class ReportingPublisherManager { - - private static final Log log = LogFactory.getLog(ReportingPublisherManager.class); - private final static ExecutorService executorService; - private DeviceDetailsWrapper payload; - private String endpoint; - private static final PoolingHttpClientConnectionManager poolingManager; - - static { - executorService = Executors.newFixedThreadPool(10); //todo make this configurable - poolingManager = new PoolingHttpClientConnectionManager(); - poolingManager.setMaxTotal(10); //todo make this configurable - poolingManager.setDefaultMaxPerRoute(10); - } - - public void publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { - this.payload = deviceDetailsWrapper; - this.endpoint = eventUrl; - executorService.submit(new ReportingPublisher()); - } - - private class ReportingPublisher implements Runnable { - @Override - public void run() { - try (CloseableHttpClient client = HttpClients.custom().setConnectionManager(poolingManager).build()) { - HttpPost apiEndpoint = new HttpPost(endpoint); - apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - StringEntity requestEntity = new StringEntity(payload.getJSONString(), ContentType.APPLICATION_JSON); - apiEndpoint.setEntity(requestEntity); - HttpResponse response = client.execute(apiEndpoint); - int statusCode = response.getStatusLine().getStatusCode(); - if (log.isDebugEnabled()) { - log.debug("Published data to the reporting backend: " + endpoint + ", Response code: " + statusCode); - } - } catch (ConnectException e) { - String message = "Connection refused while publishing reporting data to the API: " + endpoint; - log.error(message, e); - } catch (IOException e) { - String message = "Error occurred when publishing reporting data to the API: " + endpoint; - log.error(message, e); - } - } - } -} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java index ad7a7bf67d..288d0c0fc5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java @@ -27,7 +27,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.protocol.HTTP; import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; @@ -50,6 +49,24 @@ public class HttpReportingUtil { return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST); } + public static int invokeApi(String payload, String endpoint) throws EventPublishingException { + try (CloseableHttpClient client = HttpClients.createDefault()) { + HttpPost apiEndpoint = new HttpPost(endpoint); + apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); + StringEntity requestEntity = new StringEntity( + payload, ContentType.APPLICATION_JSON); + apiEndpoint.setEntity(requestEntity); + HttpResponse response = client.execute(apiEndpoint); + return response.getStatusLine().getStatusCode(); + } catch (ConnectException e) { + log.error("Connection refused to API endpoint: " + endpoint, e); + return HttpStatus.SC_SERVICE_UNAVAILABLE; + } catch (IOException e) { + throw new EventPublishingException("Error occurred when " + + "invoking API. API endpoint: " + endpoint, e); + } + } + public static boolean isPublishingEnabledForTenant() { Object configuration = DeviceManagerUtil.getConfiguration(IS_EVENT_PUBLISHING_ENABLED); From c05d4e0b2cdc77cddb3990cd696e98734117fd85 Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Fri, 5 Apr 2024 05:33:23 +0000 Subject: [PATCH 10/24] Add improvements for the reporting data publishing Co-authored-by: Pahansith Gunathilake Co-committed-by: Pahansith Gunathilake --- ...ApplicationManagerProviderServiceImpl.java | 6 +- .../impl/DeviceInformationManagerImpl.java | 38 ++++++-- .../report/mgt/ReportingPublisherManager.java | 87 +++++++++++++++++++ .../mgt/core/util/HttpReportingUtil.java | 19 +--- 4 files changed, 123 insertions(+), 27 deletions(-) create mode 100644 components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index fec70931a4..368157ca48 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -286,8 +287,9 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem deviceDetailsWrapper.setTenantId(tenantId); deviceDetailsWrapper.setDevice(device); deviceDetailsWrapper.setApplications(newApplications); - HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), - reportingHost + DeviceManagementConstants.Report.APP_USAGE_ENDPOINT); + ReportingPublisherManager reportingManager = new ReportingPublisherManager(); + reportingManager.publishData(deviceDetailsWrapper, DeviceManagementConstants + .Report.APP_USAGE_ENDPOINT); } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index d3681a43c4..f298db68d4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.core.report.mgt.ReportingPublisherManager; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -29,7 +30,6 @@ import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsW import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; @@ -54,6 +54,8 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; public class DeviceInformationManagerImpl implements DeviceInformationManager { @@ -86,6 +88,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setDeviceInfo(deviceInfo); + //Asynchronous call to publish the device information to the reporting service. Hence, response is ignored. publishEvents(device, deviceDetailsWrapper, DeviceManagementConstants.Report.DEVICE_INFO_PARAM); DeviceManagementDAOFactory.beginTransaction(); @@ -203,12 +206,34 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { getDeviceManagementProvider().getDevice(deviceIdentifier, false); DeviceDetailsWrapper deviceDetailsWrapper = new DeviceDetailsWrapper(); deviceDetailsWrapper.setEvents(payload); - return publishEvents(device, deviceDetailsWrapper, eventType); + Future apiCallback = publishEvents(device, deviceDetailsWrapper, eventType); + if (null != apiCallback) { + boolean isDebugEnabled = log.isDebugEnabled(); + while(!apiCallback.isDone()) { + if (isDebugEnabled) { + log.debug("Waiting for the response from the API for the reporting data " + + "publishing for the device " + deviceId + ". Event payload: " + payload); + } + } + return apiCallback.get(); + } + return 0; // If the event publishing is disabled. } catch (DeviceManagementException e) { DeviceManagementDAOFactory.rollbackTransaction(); String msg = "Event publishing error. Could not get device " + deviceId; log.error(msg, e); throw new DeviceDetailsMgtException(msg, e); + } catch (ExecutionException e) { + //Exceptions thrown in ReportingPublisherManager will be wrapped under this exception + String message = "Failed while publishing device information data to the reporting service for the device " + + deviceId; + log.error(message, e); + throw new DeviceDetailsMgtException(message, e); + } catch (InterruptedException e) { + String message = "Failed while publishing device information data to the reporting service. Thread " + + "interrupted while waiting for the response from the API for the Device " + deviceId; + log.error(message, e); + throw new DeviceDetailsMgtException(message, e); } } @@ -217,7 +242,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { * @param device Device that is sending event * @param deviceDetailsWrapper Payload to send(example, deviceinfo, applist, raw events) */ - private int publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String + private Future publishEvents(Device device, DeviceDetailsWrapper deviceDetailsWrapper, String eventType) { String reportingHost = HttpReportingUtil.getReportingHost(); if (!StringUtils.isBlank(reportingHost) @@ -252,9 +277,8 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { String eventUrl = reportingHost + DeviceManagementConstants.Report .REPORTING_CONTEXT + DeviceManagementConstants.URL_SEPERATOR + eventType; - return HttpReportingUtil.invokeApi(deviceDetailsWrapper.getJSONString(), eventUrl); - } catch (EventPublishingException e) { - log.error("Error occurred while sending events", e); + ReportingPublisherManager reportingManager = new ReportingPublisherManager(); + return reportingManager.publishData(deviceDetailsWrapper, eventUrl); } catch (GroupManagementException e) { log.error("Error occurred while getting group list", e); } catch (UserStoreException e) { @@ -270,7 +294,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager { + DeviceManagerUtil.getTenantId()); } } - return 0; + return null; } @Override diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java new file mode 100644 index 0000000000..b6e3bf5ae1 --- /dev/null +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportingPublisherManager.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2018 - 2024, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.device.mgt.core.report.mgt; + +import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.protocol.HTTP; + +import java.io.IOException; +import java.net.ConnectException; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class ReportingPublisherManager { + + private static final Log log = LogFactory.getLog(ReportingPublisherManager.class); + private final static ExecutorService executorService; + private DeviceDetailsWrapper payload; + private String endpoint; + private static final PoolingHttpClientConnectionManager poolingManager; + + static { + executorService = Executors.newFixedThreadPool(10); //todo make this configurable + poolingManager = new PoolingHttpClientConnectionManager(); + poolingManager.setMaxTotal(10); //todo make this configurable + poolingManager.setDefaultMaxPerRoute(10); + } + + public Future publishData(DeviceDetailsWrapper deviceDetailsWrapper, String eventUrl) { + this.payload = deviceDetailsWrapper; + this.endpoint = eventUrl; + return executorService.submit(new ReportingPublisher()); + } + + private class ReportingPublisher implements Callable { + @Override + public Integer call() throws EventPublishingException { + try (CloseableHttpClient client = HttpClients.custom().setConnectionManager(poolingManager).build()) { + HttpPost apiEndpoint = new HttpPost(endpoint); + apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); + StringEntity requestEntity = new StringEntity(payload.getJSONString(), ContentType.APPLICATION_JSON); + apiEndpoint.setEntity(requestEntity); + HttpResponse response = client.execute(apiEndpoint); + int statusCode = response.getStatusLine().getStatusCode(); + if (log.isDebugEnabled()) { + log.debug("Published data to the reporting backend: " + endpoint + ", Response code: " + statusCode); + } + return statusCode; + } catch (ConnectException e) { + String message = "Connection refused while publishing reporting data to the API: " + endpoint; + log.error(message, e); + throw new EventPublishingException(message, e); + } catch (IOException e) { + String message = "Error occurred when publishing reporting data to the API: " + endpoint; + log.error(message, e); + throw new EventPublishingException(message, e); + } + } + } +} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java index 288d0c0fc5..ad7a7bf67d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java @@ -27,6 +27,7 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.protocol.HTTP; import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; @@ -49,24 +50,6 @@ public class HttpReportingUtil { return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST); } - public static int invokeApi(String payload, String endpoint) throws EventPublishingException { - try (CloseableHttpClient client = HttpClients.createDefault()) { - HttpPost apiEndpoint = new HttpPost(endpoint); - apiEndpoint.setHeader(HTTP.CONTENT_TYPE, ContentType.APPLICATION_JSON.toString()); - StringEntity requestEntity = new StringEntity( - payload, ContentType.APPLICATION_JSON); - apiEndpoint.setEntity(requestEntity); - HttpResponse response = client.execute(apiEndpoint); - return response.getStatusLine().getStatusCode(); - } catch (ConnectException e) { - log.error("Connection refused to API endpoint: " + endpoint, e); - return HttpStatus.SC_SERVICE_UNAVAILABLE; - } catch (IOException e) { - throw new EventPublishingException("Error occurred when " + - "invoking API. API endpoint: " + endpoint, e); - } - } - public static boolean isPublishingEnabledForTenant() { Object configuration = DeviceManagerUtil.getConfiguration(IS_EVENT_PUBLISHING_ENABLED); From bd021ff8357cfd47c311d2f54ec3ffc51eeaebce Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Fri, 5 Apr 2024 14:41:35 +0530 Subject: [PATCH 11/24] Add Content and Package URI changes --- .../mgt/core/impl/ApplicationManagerImpl.java | 1 + .../application/mgt/core/util/APIUtil.java | 25 +++++--- .../core/util/ApplicationManagementUtil.java | 58 +++++++++++++++++++ .../management/ApplicationManagementTest.java | 3 +- 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 3daa959aee..cfa8404375 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -509,6 +509,7 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg, e); throw new ApplicationManagementException(msg, e); } + ApplicationManagementUtil.addInstallerPathToMetadata(releaseDTO); applicationDTO.getApplicationReleaseDTOs().clear(); applicationDTO.getApplicationReleaseDTOs().add(releaseDTO); return applicationDTO; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 789ac3de0a..7c2034eb11 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -496,7 +496,6 @@ public class APIUtil { List screenshotPaths = new ArrayList<>(); ApplicationRelease applicationRelease = new ApplicationRelease(); - UrlValidator urlValidator = new UrlValidator(); applicationRelease.setDescription(applicationReleaseDTO.getDescription()); applicationRelease.setVersion(applicationReleaseDTO.getVersion()); @@ -519,13 +518,8 @@ public class APIUtil { .getBannerName()); } - if (urlValidator.isValid(applicationReleaseDTO.getInstallerName())) { - applicationRelease.setInstallerPath(applicationReleaseDTO.getInstallerName()); - } else { - applicationRelease.setInstallerPath( - basePath + Constants.APP_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO - .getInstallerName()); - } + applicationRelease.setInstallerPath(constructInstallerPath(applicationReleaseDTO.getInstallerName(), + applicationReleaseDTO.getAppHashValue())); if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) { screenshotPaths @@ -546,6 +540,21 @@ public class APIUtil { return applicationRelease; } + /** + * Construct installer path + * @param installerName Installer name + * @param appHash Application hash + * @return Constructed installer path value + * @throws ApplicationManagementException Throws when error encountered while constructing installer path + */ + public static String constructInstallerPath(String installerName, String appHash) throws ApplicationManagementException { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + UrlValidator urlValidator = new UrlValidator(); + String basePath = getArtifactDownloadBaseURL() + tenantId + Constants.FORWARD_SLASH + appHash + Constants.FORWARD_SLASH; + return urlValidator.isValid(installerName) ? installerName + : basePath + Constants.APP_ARTIFACT + Constants.FORWARD_SLASH + installerName; + } + public static String getArtifactDownloadBaseURL() throws ApplicationManagementException { String host = System.getProperty(Constants.IOT_CORE_HOST); MDMConfig mdmConfig = ConfigurationManager.getInstance().getConfiguration().getMdmConfig(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index b3b2d65f0a..390e706d8e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -17,11 +17,16 @@ */ package io.entgra.device.mgt.core.application.mgt.core.util; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; import io.entgra.device.mgt.core.application.mgt.common.FileDataHolder; import io.entgra.device.mgt.core.application.mgt.common.FileDescriptor; import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ItuneAppDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.FileDownloaderServiceException; @@ -60,6 +65,7 @@ import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.MetadataManagementServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jetbrains.annotations.NotNull; import java.io.ByteArrayOutputStream; import java.io.File; @@ -80,6 +86,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.TreeMap; /** @@ -649,4 +656,55 @@ public class ApplicationManagementUtil { } return releaseWrappers; } + + /** + * Add installer path metadata value to windows applications + * @param applicationReleaseDTO {@link ApplicationReleaseDTO} + * @throws ApplicationManagementException Throws when error encountered while updating the app metadata + */ + public static void addInstallerPathToMetadata(ApplicationReleaseDTO applicationReleaseDTO) + throws ApplicationManagementException { + if (applicationReleaseDTO.getMetaData() == null) return; + Gson gson = new Gson(); + String installerPath = APIUtil.constructInstallerPath(applicationReleaseDTO.getInstallerName(), applicationReleaseDTO.getAppHashValue()); + String[] fileNameSegments = extractNameSegments(applicationReleaseDTO, installerPath); + String extension = fileNameSegments[fileNameSegments.length - 1]; + if (!Objects.equals(extension, "appx") && !Objects.equals(extension, "msi")) { + return; + } + + String installerPaths = "[ {" + + "\"key\": \"Content_Uri\", " + + "\"value\" : \"" + installerPath + "\"" + + "}]"; + + if (Objects.equals(extension, "appx")) { + installerPaths = "[ {" + + "\"key\": \"Package_Uri\", " + + "\"value\" : \"" + installerPath + "\"" + + "}]"; + } + + JsonArray parsedMetadataList = gson.fromJson(applicationReleaseDTO.getMetaData(), JsonArray.class); + JsonArray installerPathsArray = gson.fromJson(installerPaths, JsonArray.class); + parsedMetadataList.addAll(installerPathsArray); + applicationReleaseDTO.setMetaData(gson.toJson(parsedMetadataList)); + } + + private static String[] extractNameSegments(ApplicationReleaseDTO applicationReleaseDTO, String installerPath) + throws ApplicationManagementException { + String []installerPathSegments = installerPath.split("/"); + if (installerPathSegments.length == 0) { + throw new ApplicationManagementException("Received malformed url for installer path of the app : " + + applicationReleaseDTO.getInstallerName()); + } + String fullQualifiedName = installerPathSegments[installerPathSegments.length - 1]; + String []fileNameSegments = fullQualifiedName.split("\\.(?=[^.]+$)"); + if (fileNameSegments.length != 2) { + throw new ApplicationManagementException("Received malformed url for installer path of the app : " + + applicationReleaseDTO.getInstallerName()); + } + return fileNameSegments; + } + } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java index e78b6196d0..2e37d49410 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java @@ -107,7 +107,7 @@ public class ApplicationManagementTest extends BaseTestCase { EntAppReleaseWrapper releaseWrapper = new EntAppReleaseWrapper(); releaseWrapper.setDescription("First release"); releaseWrapper.setIsSharedWithAllTenants(false); - releaseWrapper.setMetaData("Just meta data"); + releaseWrapper.setMetaData("[{\"key\": \"Just a metadata\"}]"); releaseWrapper.setReleaseType("free"); releaseWrapper.setPrice(5.7); releaseWrapper.setSupportedOsVersions("4.0-7.0"); @@ -174,6 +174,7 @@ public class ApplicationManagementTest extends BaseTestCase { releaseWrapper.setArtifactLink(apkTransferLink.getDirectTransferLink() + "/sample.apk"); releaseWrapper.setRemoteStatus(false); + entAppReleaseWrappers.add(releaseWrapper); applicationWrapper.setEntAppReleaseWrappers(entAppReleaseWrappers); From 49577411739da88f1dca068ed470ba550ec3688b Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Fri, 5 Apr 2024 15:28:50 +0530 Subject: [PATCH 12/24] Refactored the code --- .../mgt/core/util/ApplicationManagementUtil.java | 7 +++++++ .../mgt/core/management/ApplicationManagementTest.java | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 390e706d8e..b8a5d98596 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -691,6 +691,13 @@ public class ApplicationManagementUtil { applicationReleaseDTO.setMetaData(gson.toJson(parsedMetadataList)); } + /** + * Extract name segments from installer path + * @param applicationReleaseDTO {@link ApplicationReleaseDTO} + * @param installerPath Installer path + * @return Extracted file name segments + * @throws ApplicationManagementException Throws when error encountered while extracting name segments from installer path + */ private static String[] extractNameSegments(ApplicationReleaseDTO applicationReleaseDTO, String installerPath) throws ApplicationManagementException { String []installerPathSegments = installerPath.split("/"); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java index 2e37d49410..793b28d0f9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java @@ -174,7 +174,6 @@ public class ApplicationManagementTest extends BaseTestCase { releaseWrapper.setArtifactLink(apkTransferLink.getDirectTransferLink() + "/sample.apk"); releaseWrapper.setRemoteStatus(false); - entAppReleaseWrappers.add(releaseWrapper); applicationWrapper.setEntAppReleaseWrappers(entAppReleaseWrappers); From 00022b17cf93e325f6a89de3bf2bc397ea6186d5 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Sat, 6 Apr 2024 08:32:07 +0530 Subject: [PATCH 13/24] Fix remote meta descriptor resolving issue --- .../impl/FileDownloaderServiceProvider.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java index 73facdc367..d63a297956 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java @@ -111,7 +111,8 @@ public class FileDownloaderServiceProvider { throw new FileDownloaderServiceException("Unexpected response code received for the remote url " + downloadUrl); } String contentDisposition = response.header("Content-Disposition"); - String[] fileNameSegments = getFileNameSegments(contentDisposition); + String contentType = response.header("Content-Type"); + String[] fileNameSegments = getFileNameSegments(contentDisposition, contentType); FileMetaEntry fileMetaEntry = new FileMetaEntry(); fileMetaEntry.setSize(Long.parseLong(Objects.requireNonNull(response.header("Content-Length")))); fileMetaEntry.setFileName(fileNameSegments[0] + "-" + UUID.randomUUID()); @@ -123,15 +124,25 @@ public class FileDownloaderServiceProvider { } /** - * Extract file name segments(filename & extensions) from content disposition header + * Extract file name segments(filename & extensions) from content disposition header and content type header * @param contentDisposition Content disposition header value + * @param contentType Content type header value * @return Array of name segments * @throws FileDownloaderServiceException Throws when error occurred while extracting name segments */ - private static String[] getFileNameSegments(String contentDisposition) throws FileDownloaderServiceException { - if (contentDisposition == null) { + private static String[] getFileNameSegments(String contentDisposition, String contentType) throws FileDownloaderServiceException { + if (contentDisposition == null && contentType == null) { throw new FileDownloaderServiceException("Cannot determine the file name for the remote file"); } + + if (contentDisposition == null) { + String []contentTypeSegments = contentType.split("/"); + if (contentTypeSegments.length != 2) { + throw new FileDownloaderServiceException("Encountered wrong content type header value"); + } + return new String[]{ UUID.randomUUID().toString(), contentTypeSegments[contentTypeSegments.length - 1]}; + } + String []contentDispositionSegments = contentDisposition.split("="); if (contentDispositionSegments.length != 2) { throw new FileDownloaderServiceException("Error encountered when constructing file name"); From 8c75b30378c5876c4d5ff0473f82417f19168eaf Mon Sep 17 00:00:00 2001 From: ashvini Date: Sat, 6 Apr 2024 06:47:03 +0530 Subject: [PATCH 14/24] Fix AutoCommit issue in Tenant Deletion Set autocommit to false Fix error message Fix data not deleting issue Fix error message --- .../application/GenericApplicationDAOImpl.java | 18 ++++++++++++------ .../GenericApplicationReleaseDAOImpl.java | 3 ++- .../GenericSPApplicationDAOImpl.java | 3 ++- .../GenericLifecycleStateDAOImpl.java | 3 ++- .../dao/impl/review/GenericReviewDAOImpl.java | 3 ++- .../GenericSubscriptionDAOImpl.java | 18 ++++++++++++------ .../visibility/GenericVisibilityDAOImpl.java | 3 ++- .../impl/vpp/GenericVppApplicationDAOImpl.java | 9 ++++++--- .../pom.xml | 1 + .../mgt/core/impl/TenantManagerImpl.java | 9 +++++---- 10 files changed, 46 insertions(+), 24 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 0d6970b70d..7c71880fa6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -1891,7 +1891,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP_FAVOURITES " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1917,7 +1918,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP_CATEGORY_MAPPING " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1943,7 +1945,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP_CATEGORY " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1969,7 +1972,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP_TAG_MAPPING " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1995,7 +1999,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP_TAG " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -2021,7 +2026,8 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic } String sql = "DELETE FROM AP_APP " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java index 9cebf37f41..70ad2f4e17 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java @@ -632,7 +632,8 @@ public class GenericApplicationReleaseDAOImpl extends AbstractDAOImpl implements } String sql = "DELETE FROM AP_APP_RELEASE " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java index 0511602f65..0b4d14073b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java @@ -491,7 +491,8 @@ public class GenericSPApplicationDAOImpl extends AbstractDAOImpl implements SPAp } String sql = "DELETE FROM AP_IDENTITY_SERVER " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java index 77026bb04a..c32afcd79a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java @@ -121,7 +121,8 @@ public class GenericLifecycleStateDAOImpl extends AbstractDAOImpl implements Lif } String sql = "DELETE FROM AP_APP_LIFECYCLE_STATE " + "WHERE TENANT_ID = ?"; - try ( Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java index 71323aa868..e31db113ef 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java @@ -610,7 +610,8 @@ public class GenericReviewDAOImpl extends AbstractDAOImpl implements ReviewDAO { } String sql = "DELETE FROM AP_APP_REVIEW " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index e8a030a01d..79e7b76660 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -1484,7 +1484,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } String sql = "DELETE FROM AP_APP_SUB_OP_MAPPING " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1509,7 +1510,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } String sql = "DELETE FROM AP_ROLE_SUBSCRIPTION " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1535,7 +1537,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } String sql = "DELETE FROM AP_USER_SUBSCRIPTION " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1561,7 +1564,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } String sql = "DELETE FROM AP_GROUP_SUBSCRIPTION " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -1587,7 +1591,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc String sql = "DELETE FROM AP_SCHEDULED_SUBSCRIPTION " + "WHERE APPLICATION_UUID IN " + "(SELECT UUID FROM AP_APP_RELEASE WHERE TENANT_ID = ?)"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeBatch(); @@ -1612,7 +1617,8 @@ public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements Subsc } String sql = "DELETE FROM AP_DEVICE_SUBSCRIPTION " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java index 446a54c706..1033af9bef 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java @@ -186,7 +186,8 @@ public class GenericVisibilityDAOImpl extends AbstractDAOImpl implements Visibil String sql = "DELETE " + "FROM AP_UNRESTRICTED_ROLE " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java index 4b618894b5..8cc62b4dbc 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/vpp/GenericVppApplicationDAOImpl.java @@ -514,7 +514,8 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } String sql = "DELETE FROM AP_ASSETS " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -539,7 +540,8 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } String sql = "DELETE FROM AP_VPP_USER " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); @@ -565,7 +567,8 @@ public class GenericVppApplicationDAOImpl extends AbstractDAOImpl implements Vp } String sql = "DELETE FROM AP_VPP_ASSOCIATION " + "WHERE TENANT_ID = ?"; - try (Connection conn = this.getDBConnection()) { + try { + Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 413d88d949..7cb910b6d9 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -66,6 +66,7 @@ io.entgra.device.mgt.core.device.mgt.common.roles.config, io.entgra.device.mgt.core.device.mgt.core.metadata.mgt, io.entgra.device.mgt.core.device.mgt.core.config, + io.entgra.device.mgt.core.device.mgt.core.dao.*, org.wso2.carbon.user.core.service, org.wso2.carbon.context diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index cbac0013b4..791723ebe3 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.tenant.mgt.core.impl; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.TenantDAO; @@ -200,13 +201,13 @@ public class TenantManagerImpl implements TenantManager { tenantDao.deleteDeviceCertificateByTenantId(tenantId); DeviceManagementDAOFactory.commitTransaction(); - } catch (SQLException e){ + } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); - String msg = "Error accessing the database when trying to delete tenant info of '" + tenantId + "'"; + String msg = "Error deleting data of tenant of ID: '" + tenantId + "'"; log.error(msg); throw new TenantMgtException(msg, e); - } catch (DeviceManagementDAOException e) { - String msg = "Error deleting data of tenant of ID: '" + tenantId + "'"; + } catch (SQLException e) { + String msg = "Error accessing the database when trying to delete tenant info of '" + tenantId + "'"; log.error(msg); throw new TenantMgtException(msg, e); } finally { From dfdf2611a13add8da83ff73bab957e022401da4b Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Sun, 7 Apr 2024 20:52:12 +0530 Subject: [PATCH 15/24] Fix extension resolving issue when content-disposition unavailable --- .../impl/FileDownloaderServiceProvider.java | 65 +++++++++++++++++-- .../application/mgt/core/util/Constants.java | 10 +++ 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java index d63a297956..f8fe6f2f94 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/FileDownloaderServiceProvider.java @@ -27,6 +27,7 @@ import io.entgra.device.mgt.core.application.mgt.common.exception.FileTransferSe import io.entgra.device.mgt.core.application.mgt.common.services.FileDownloaderService; import io.entgra.device.mgt.core.application.mgt.common.services.FileTransferService; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -112,10 +113,17 @@ public class FileDownloaderServiceProvider { } String contentDisposition = response.header("Content-Disposition"); String contentType = response.header("Content-Type"); - String[] fileNameSegments = getFileNameSegments(contentDisposition, contentType); + String[] fileNameSegments = extractFileNameSegmentsFromUrl(downloadUrl); + + // if the url parsing failed to resolve the file name segments + // falling to remote file name segment resolving + if (fileNameSegments == null) { + fileNameSegments = getFileNameSegments(contentDisposition, contentType); + } + FileMetaEntry fileMetaEntry = new FileMetaEntry(); fileMetaEntry.setSize(Long.parseLong(Objects.requireNonNull(response.header("Content-Length")))); - fileMetaEntry.setFileName(fileNameSegments[0] + "-" + UUID.randomUUID()); + fileMetaEntry.setFileName(fileNameSegments[0]); fileMetaEntry.setExtension(fileNameSegments[1]); return fileMetaEntry; } catch (IOException e) { @@ -123,6 +131,38 @@ public class FileDownloaderServiceProvider { } } + /** + * Extracting file name segments by parsing the URL + * @param url Remote URL to extract file name segments + * @return Array containing file name segments or null when failed to extract + */ + public static String[] extractFileNameSegmentsFromUrl(URL url) { + if (url == null) { + if (log.isDebugEnabled()) { + log.debug("Null received as the remote URL"); + } + return null; + } + + String []urlSegments = url.toString().split("/"); + if (urlSegments.length < 1) { + if (log.isDebugEnabled()) { + log.debug("Cannot determine the file name for the remote file"); + } + return null; + } + + String fullQualifiedName = urlSegments[urlSegments.length - 1]; + String []fileNameSegments = fullQualifiedName.split("\\.(?=[^.]+$)"); + if (fileNameSegments.length != 2) { + if (log.isDebugEnabled()) { + log.debug("Error encountered when constructing file name"); + } + return null; + } + return fileNameSegments; + } + /** * Extract file name segments(filename & extensions) from content disposition header and content type header * @param contentDisposition Content disposition header value @@ -136,11 +176,24 @@ public class FileDownloaderServiceProvider { } if (contentDisposition == null) { - String []contentTypeSegments = contentType.split("/"); - if (contentTypeSegments.length != 2) { - throw new FileDownloaderServiceException("Encountered wrong content type header value"); + String extension; + if (contentType.equals(Constants.MIME_TYPE_VND_ANDROID_PACKAGE_ARCHIVE)) { + extension = Constants.EXTENSION_APK; + } else if (contentType.equals(Constants.MIME_TYPE_OCTET_STREAM)) { + extension = Constants.EXTENSION_IPA; + } else if (contentType.equals(Constants.MIME_TYPE_VND_APPX)) { + extension = Constants.EXTENSION_APPX; + } else if (contentType.equals(Constants.MIME_TYPE_X_MS_INSTALLER) + || contentType.equals(Constants.MIME_TYPE_VND_MS_WINDOWS_MSI)) { + extension = Constants.EXTENSION_MSI; + } else { + String []contentTypeSegments = contentType.split("/"); + if (contentTypeSegments.length != 2) { + throw new FileDownloaderServiceException("Encountered wrong content type header value"); + } + extension = contentTypeSegments[contentTypeSegments.length - 1]; } - return new String[]{ UUID.randomUUID().toString(), contentTypeSegments[contentTypeSegments.length - 1]}; + return new String[]{ UUID.randomUUID().toString(), extension}; } String []contentDispositionSegments = contentDisposition.split("="); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java index b96fd66058..b5b5fd5154 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/Constants.java @@ -220,4 +220,14 @@ public class Constants { */ public static final int MAX_APP_NAME_CHARACTERS = 350; public static final String APP_NAME_REGEX = "[^a-zA-Z0-9.\\s-]"; + + public static final String EXTENSION_APK = ".apk"; + public static final String EXTENSION_IPA = ".ipa"; + public static final String EXTENSION_MSI = ".msi"; + public static final String EXTENSION_APPX = ".appx"; + public static final String MIME_TYPE_OCTET_STREAM = "application/octet-stream"; + public static final String MIME_TYPE_VND_ANDROID_PACKAGE_ARCHIVE = "application/vnd.android.package-archive"; + public static final String MIME_TYPE_VND_MS_WINDOWS_MSI = "application/vnd.ms-windows.msi"; + public static final String MIME_TYPE_X_MS_INSTALLER = "application/x-ms-installer"; + public static final String MIME_TYPE_VND_APPX = "application/vnd.appx"; } From f86a16220c604652810fcaa7d7b63c743d2de441 Mon Sep 17 00:00:00 2001 From: Rajitha Kumara Date: Mon, 8 Apr 2024 09:20:23 +0530 Subject: [PATCH 16/24] Fix appx app installation issue --- .../application/mgt/core/util/ApplicationManagementUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index b8a5d98596..846777c794 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -680,7 +680,7 @@ public class ApplicationManagementUtil { if (Objects.equals(extension, "appx")) { installerPaths = "[ {" + - "\"key\": \"Package_Uri\", " + + "\"key\": \"Package_Url\", " + "\"value\" : \"" + installerPath + "\"" + "}]"; } From 2f1271f3be7d6229c29b7e1ab13e424ffcd43de4 Mon Sep 17 00:00:00 2001 From: navodzoysa Date: Mon, 8 Apr 2024 18:03:15 +0530 Subject: [PATCH 17/24] Revert Windows Content and Package URI changes --- .../core/application/mgt/core/impl/ApplicationManagerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index cfa8404375..d9b736d769 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -509,7 +509,8 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg, e); throw new ApplicationManagementException(msg, e); } - ApplicationManagementUtil.addInstallerPathToMetadata(releaseDTO); + // TODO: artifact URLs are not working for Windows AppX installations https://roadmap.entgra.net/issues/11010 + //ApplicationManagementUtil.addInstallerPathToMetadata(releaseDTO); applicationDTO.getApplicationReleaseDTOs().clear(); applicationDTO.getApplicationReleaseDTOs().add(releaseDTO); return applicationDTO; From 159f603605bfc70174419d7453d6eb40fb1352e8 Mon Sep 17 00:00:00 2001 From: ashvini Date: Mon, 8 Apr 2024 18:07:31 +0530 Subject: [PATCH 18/24] Delete tenant data Refactor code Add begin transaction Refactor code --- .../common/services/ApplicationManager.java | 1 + .../pom.xml | 5 + .../mgt/core/impl/ApplicationManagerImpl.java | 81 ++++++++++++++++ .../admin/UserManagementAdminServiceImpl.java | 15 ++- .../DeviceManagementProviderService.java | 1 + .../DeviceManagementProviderServiceImpl.java | 94 ++++++++++++++++++- .../mgt/core/impl/TenantManagerImpl.java | 9 +- 7 files changed, 199 insertions(+), 7 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java index be04851402..4a1be2ea1e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java @@ -546,4 +546,5 @@ public interface ApplicationManager { * @throws ApplicationManagementException thrown if an error occurs when deleting data */ void deleteApplicationDataOfTenant(int tenantId) throws ApplicationManagementException; + void deleteApplicationDataByTenantDomain(String tenantDomain) throws ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index dc417eb255..87e6688f13 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -384,6 +384,11 @@ com.squareup.okio okio + + org.wso2.carbon.multitenancy + org.wso2.carbon.tenant.mgt + compile + diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index cfa8404375..ef852f5ff4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -96,6 +96,8 @@ import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementEx import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.stratos.common.beans.TenantInfoBean; +import org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; @@ -4427,15 +4429,18 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg, e); throw new ApplicationManagementException(msg, e); } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); String msg = "Database access error is occurred when getting applications for tenant with ID: " + tenantId; log.error(msg, e); throw new ApplicationManagementException(msg, e); } catch (LifeCycleManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); String msg = "Error occurred while deleting life-cycle state data of application releases of the tenant" + " of ID: " + tenantId ; log.error(msg, e); throw new ApplicationManagementException(msg, e); } catch (ReviewManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); String msg = "Error occurred while deleting reviews of application releases of the applications" + " of tenant ID: " + tenantId ; log.error(msg, e); @@ -4450,4 +4455,80 @@ public class ApplicationManagerImpl implements ApplicationManager { ConnectionManagerUtil.closeDBConnection(); } } + + @Override + public void deleteApplicationDataByTenantDomain(String tenantDomain) throws ApplicationManagementException { + int tenantId; + try{ + TenantMgtAdminService tenantMgtAdminService = new TenantMgtAdminService(); + TenantInfoBean tenantInfoBean = tenantMgtAdminService.getTenant(tenantDomain); + tenantId = tenantInfoBean.getTenantId(); + + } catch (Exception e) { + String msg = "Error getting tenant ID from domain: " + + tenantDomain; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + + try { + ConnectionManagerUtil.beginDBTransaction(); + + vppApplicationDAO.deleteAssociationByTenant(tenantId); + vppApplicationDAO.deleteVppUserByTenant(tenantId); + vppApplicationDAO.deleteAssetsByTenant(tenantId); + reviewDAO.deleteReviewsByTenant(tenantId); + subscriptionDAO.deleteOperationMappingByTenant(tenantId); + subscriptionDAO.deleteDeviceSubscriptionByTenant(tenantId); + subscriptionDAO.deleteGroupSubscriptionByTenant(tenantId); + subscriptionDAO.deleteRoleSubscriptionByTenant(tenantId); + subscriptionDAO.deleteUserSubscriptionByTenant(tenantId); + applicationDAO.deleteAppFavouritesByTenant(tenantId); + applicationDAO.deleteApplicationTagsMappingByTenant(tenantId); + applicationDAO.deleteApplicationTagsByTenant(tenantId); + applicationDAO.deleteApplicationCategoryMappingByTenant(tenantId); + applicationDAO.deleteApplicationCategoriesByTenant(tenantId); + subscriptionDAO.deleteScheduledSubscriptionByTenant(tenantId); + lifecycleStateDAO.deleteAppLifecycleStatesByTenant(tenantId); + applicationReleaseDAO.deleteReleasesByTenant(tenantId); + visibilityDAO.deleteAppUnrestrictedRolesByTenant(tenantId); + spApplicationDAO.deleteSPApplicationMappingByTenant(tenantId); + spApplicationDAO.deleteIdentityServerByTenant(tenantId); + applicationDAO.deleteApplicationsByTenant(tenantId); + APIUtil.getApplicationStorageManager().deleteAppFolderOfTenant(tenantId); + + ConnectionManagerUtil.commitDBTransaction(); + } catch (DBConnectionException e) { + String msg = "Error occurred while observing the database connection to delete applications for tenant with ID: " + + tenantId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Database access error is occurred when getting applications for tenant with ID: " + tenantId; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (LifeCycleManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while deleting life-cycle state data of application releases of the tenant" + + " of ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ReviewManagementDAOException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while deleting reviews of application releases of the applications" + + " of tenant ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (ApplicationStorageManagementException e) { + ConnectionManagerUtil.rollbackDBTransaction(); + String msg = "Error occurred while deleting App folder of tenant" + + " of tenant ID: " + tenantId ; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } finally { + ConnectionManagerUtil.closeDBConnection(); + } + + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java index 296bdf5060..d4f34d8e4a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -93,11 +94,13 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic public Response deleteTenantByDomain(@PathParam("tenantDomain") String tenantDomain) { try { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - if(tenantId != MultitenantConstants.SUPER_TENANT_ID){ + if (tenantId != MultitenantConstants.SUPER_TENANT_ID){ String msg = "Only super tenants are allowed to delete tenants"; log.error(msg); return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); - }else{ + } else { + DeviceMgtAPIUtils.getApplicationManager().deleteApplicationDataByTenantDomain(tenantDomain); + DeviceMgtAPIUtils.getDeviceManagementService().deleteDeviceDataByTenantDomain(tenantDomain); TenantMgtAdminService tenantMgtAdminService = new TenantMgtAdminService(); tenantMgtAdminService.deleteTenant(tenantDomain); String msg = "Tenant Deletion process has been initiated for tenant:" + tenantDomain; @@ -108,6 +111,14 @@ public class UserManagementAdminServiceImpl implements UserManagementAdminServic String msg = "Error deleting tenant: " + tenantDomain; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch (ApplicationManagementException e) { + String msg = "Error deleting application data of tenant: " + tenantDomain; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); + } catch (DeviceManagementException e) { + String msg = "Error deleting device data of tenant: " + tenantDomain; + log.error(msg, e); + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java index 44f6fe15dd..683971472b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java @@ -1070,4 +1070,5 @@ public interface DeviceManagementProviderService { List getInstalledApplicationsOnDevice(Device device) throws DeviceManagementException; List getEnrolledDevicesSince(Date since) throws DeviceManagementException; List getEnrolledDevicesPriorTo(Date before) throws DeviceManagementException; + void deleteDeviceDataByTenantDomain(String tenantDomain) throws DeviceManagementException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 5c8a8eb28e..3477fc2589 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.core.service; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.DeviceStatusManagementService; +import io.entgra.device.mgt.core.device.mgt.core.dao.TenantDAO; import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; import io.entgra.device.mgt.core.notification.logger.DeviceEnrolmentLogContext; import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceEnrolmentLoggerImpl; @@ -160,7 +161,6 @@ import java.sql.Timestamp; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.*; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; public class DeviceManagementProviderServiceImpl implements DeviceManagementProviderService, @@ -178,6 +178,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv private final ApplicationDAO applicationDAO; private MetadataDAO metadataDAO; private final DeviceStatusDAO deviceStatusDAO; + private final TenantDAO tenantDao; int count = 0; public DeviceManagementProviderServiceImpl() { @@ -188,6 +189,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv this.enrollmentDAO = DeviceManagementDAOFactory.getEnrollmentDAO(); this.metadataDAO = MetadataManagementDAOFactory.getMetadataDAO(); this.deviceStatusDAO = DeviceManagementDAOFactory.getDeviceStatusDAO(); + this.tenantDao = DeviceManagementDAOFactory.getTenantDAO(); /* Registering a listener to retrieve events when some device management service plugin is installed after * the component is done getting initialized */ @@ -5187,4 +5189,94 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv } return devices; } + + @Override + public void deleteDeviceDataByTenantDomain(String tenantDomain) throws DeviceManagementException { + int tenantId; + try{ + TenantMgtAdminService tenantMgtAdminService = new TenantMgtAdminService(); + TenantInfoBean tenantInfoBean = tenantMgtAdminService.getTenant(tenantDomain); + tenantId = tenantInfoBean.getTenantId(); + + } catch (Exception e) { + String msg = "Error getting tenant ID from domain: " + + tenantDomain; + log.error(msg); + throw new DeviceManagementException(msg, e); + } + + try { + DeviceManagementDAOFactory.beginTransaction(); + + tenantDao.deleteExternalPermissionMapping(tenantId); + tenantDao.deleteExternalDeviceMappingByTenantId(tenantId); + tenantDao.deleteExternalGroupMappingByTenantId(tenantId); + // TODO: Check whether deleting DM_DEVICE_ORGANIZATION table data is necessary +// tenantDao.deleteDeviceOrganizationByTenantId(tenantId); + tenantDao.deleteDeviceHistoryLastSevenDaysByTenantId(tenantId); + tenantDao.deleteDeviceDetailByTenantId(tenantId); + tenantDao.deleteDeviceLocationByTenantId(tenantId); + tenantDao.deleteDeviceInfoByTenantId(tenantId); + tenantDao.deleteNotificationByTenantId(tenantId); + tenantDao.deleteAppIconsByTenantId(tenantId); + tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); + tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); + tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); + tenantDao.deleteGeofenceByTenantId(tenantId); + tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId); + tenantDao.deleteDynamicTaskPropertiesByTenantId(tenantId); + tenantDao.deleteDynamicTaskByTenantId(tenantId); + tenantDao.deleteMetadataByTenantId(tenantId); + tenantDao.deleteOTPDataByTenantId(tenantId); + tenantDao.deleteSubOperationTemplate(tenantId); + tenantDao.deleteDeviceSubTypeByTenantId(tenantId); + tenantDao.deleteCEAPoliciesByTenantId(tenantId); + + tenantDao.deleteApplicationByTenantId(tenantId); + tenantDao.deletePolicyCriteriaPropertiesByTenantId(tenantId); + tenantDao.deletePolicyCriteriaByTenantId(tenantId); + tenantDao.deleteCriteriaByTenantId(tenantId); + tenantDao.deletePolicyChangeManagementByTenantId(tenantId); + tenantDao.deletePolicyComplianceFeaturesByTenantId(tenantId); + tenantDao.deletePolicyComplianceStatusByTenantId(tenantId); + tenantDao.deleteRolePolicyByTenantId(tenantId); + tenantDao.deleteUserPolicyByTenantId(tenantId); + tenantDao.deleteDeviceTypePolicyByTenantId(tenantId); + tenantDao.deleteDevicePolicyAppliedByTenantId(tenantId); + tenantDao.deleteDevicePolicyByTenantId(tenantId); + tenantDao.deletePolicyCorrectiveActionByTenantId(tenantId); + tenantDao.deletePolicyByTenantId(tenantId); + tenantDao.deleteProfileFeaturesByTenantId(tenantId); + tenantDao.deleteProfileByTenantId(tenantId); + + tenantDao.deleteDeviceOperationResponseLargeByTenantId(tenantId); + tenantDao.deleteDeviceOperationResponseByTenantId(tenantId); + tenantDao.deleteEnrolmentOpMappingByTenantId(tenantId); + tenantDao.deleteDeviceStatusByTenantId(tenantId); + tenantDao.deleteEnrolmentByTenantId(tenantId); + tenantDao.deleteOperationByTenantId(tenantId); + tenantDao.deleteDeviceGroupMapByTenantId(tenantId); + tenantDao.deleteGroupPropertiesByTenantId(tenantId); + tenantDao.deleteDevicePropertiesByTenantId(tenantId); + tenantDao.deleteDeviceByTenantId(tenantId); + tenantDao.deleteRoleGroupMapByTenantId(tenantId); + tenantDao.deleteGroupByTenantId(tenantId); + tenantDao.deleteDeviceCertificateByTenantId(tenantId); + + DeviceManagementDAOFactory.commitTransaction(); + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + String msg = "Error deleting data of tenant of ID: '" + tenantId + "'"; + log.error(msg); + throw new DeviceManagementException(msg, e); + } catch (TransactionManagementException e) { + String msg = "Error while initiating transaction when trying to delete tenant info of '" + tenantId + "'"; + log.error(msg); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } } diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index 791723ebe3..bd7351d5f8 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -142,12 +142,13 @@ public class TenantManagerImpl implements TenantManager { log.debug("Request is received to delete Device related data of tenant with ID: " + tenantId); } try { - DeviceManagementDAOFactory.openConnection(); + DeviceManagementDAOFactory.beginTransaction(); tenantDao.deleteExternalPermissionMapping(tenantId); tenantDao.deleteExternalDeviceMappingByTenantId(tenantId); tenantDao.deleteExternalGroupMappingByTenantId(tenantId); - tenantDao.deleteDeviceOrganizationByTenantId(tenantId); + // TODO: Check whether deleting DM_DEVICE_ORGANIZATION table data is necessary +// tenantDao.deleteDeviceOrganizationByTenantId(tenantId); tenantDao.deleteDeviceHistoryLastSevenDaysByTenantId(tenantId); tenantDao.deleteDeviceDetailByTenantId(tenantId); tenantDao.deleteDeviceLocationByTenantId(tenantId); @@ -206,8 +207,8 @@ public class TenantManagerImpl implements TenantManager { String msg = "Error deleting data of tenant of ID: '" + tenantId + "'"; log.error(msg); throw new TenantMgtException(msg, e); - } catch (SQLException e) { - String msg = "Error accessing the database when trying to delete tenant info of '" + tenantId + "'"; + } catch (TransactionManagementException e) { + String msg = "Error initializing transaction when trying to delete tenant info of '" + tenantId + "'"; log.error(msg); throw new TenantMgtException(msg, e); } finally { From 16199a7311bea0b4674607553e1b8d6c8bcc5bdd Mon Sep 17 00:00:00 2001 From: ashvini Date: Tue, 9 Apr 2024 00:10:15 +0530 Subject: [PATCH 19/24] Fix DAO error in Tenant Deletion Fix errors Fix errors --- .../mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java | 4 ++-- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 2 +- .../mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java index 69abf756a0..5aec24752b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java @@ -207,7 +207,7 @@ public class TenantDAOImpl implements TenantDAO { public void deleteDeviceOperationResponseByTenantId(int tenantId) throws DeviceManagementDAOException { try { Connection conn = DeviceManagementDAOFactory.getConnection(); - String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE ID IN " + + String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE EN_OP_MAP_ID IN " + "(SELECT ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ?)"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); @@ -786,7 +786,7 @@ public class TenantDAOImpl implements TenantDAO { public void deleteExternalDeviceMappingByTenantId(int tenantId) throws DeviceManagementDAOException { try { Connection conn = DeviceManagementDAOFactory.getConnection(); - String sql = "DELETE FROM DM_OTP_DATA WHERE TENANT_ID = ?"; + String sql = "DELETE FROM DM_EXT_DEVICE_MAPPING WHERE TENANT_ID = ?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 3477fc2589..7aad6f8f2e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -5221,8 +5221,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv tenantDao.deleteAppIconsByTenantId(tenantId); tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); - tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); tenantDao.deleteGeofenceByTenantId(tenantId); tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index bd7351d5f8..00cdc801be 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -157,8 +157,8 @@ public class TenantManagerImpl implements TenantManager { tenantDao.deleteAppIconsByTenantId(tenantId); tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); - tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); tenantDao.deleteGeofenceByTenantId(tenantId); tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId); From ff8147db5e8c85c03f00cc0ae1c0c0a66c3938d4 Mon Sep 17 00:00:00 2001 From: builder Date: Tue, 9 Apr 2024 10:35:36 +0530 Subject: [PATCH 20/24] [maven-release-plugin] prepare release v5.0.41 --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.common/pom.xml | 2 +- .../cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml | 2 +- components/cea-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/cea-mgt-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 146 files changed, 148 insertions(+), 148 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index c9f5407e89..e521d2306d 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index d59249ee1b..c014aca23b 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 9d518c2f07..2d7ab401e2 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 6604c333c9..805443c135 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index 2527b4a26d..c0637bb0ab 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index 873de0a444..f7546a3271 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index 21d7a55e99..a61b7f4a52 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 9dea6b0aa3..ed3ca1db7b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index 87f1e5ae16..ea36157796 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index df83bd339a..3d428fcbbd 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index 526744e2ed..cbcce8ed10 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 071c6e7f63..c25846b3bc 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 74f7954857..470c6112c1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 94bf6dc1bc..83f4845c23 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index d23e140f7a..fe83a56641 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index 87e6688f13..240848640f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index fa161d4500..6a3c07ea70 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml index 0fcb0039f1..424b9633dc 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml index 2a0a4eea20..78606b4e29 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml index 77cb92489d..1e644edd9c 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml index 8c3ed4c63c..c3edaad53a 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/cea-mgt/pom.xml b/components/cea-mgt/pom.xml index 0164f1703e..70eeb0fe08 100644 --- a/components/cea-mgt/pom.xml +++ b/components/cea-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index 151bb29dd4..c3a3768693 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 15181403d8..3a81058794 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index b6dce37a13..d91cbce3ba 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 138f8e3b17..8a0bd1e773 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 9d9580d203..8f5ac0e563 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml index d28ffb8b94..35d43cbc79 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml index 2aa594ec89..ae53ca6b66 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index fc3f0fbc06..2fb22c1b55 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 729cfca98a..57717c826b 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index f2c5c88d31..c2aa68e40e 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 2296ef71e3..dbf09a009b 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 166daf727e..7ed09e6a9d 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 07996a400b..0bd35b7553 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index f020ccbbb1..634e67a379 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 29fa228111..31bba8dc34 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index 5204eec39a..68ec5e3450 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 6059343d83..9589820df2 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 089107bd7f..295273040a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index 28f10fec95..9fe280a9f2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 735dc54d6d..b3c3771da1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index 72db2b7d49..af700edd6e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 3a254255a2..cf08001d74 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index d2f58a949d..127d617b21 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 118fc75e51..8b3bae632c 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index ac400e3630..c0c7cec656 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index d30eddcd04..b5518be01a 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 62440f8010..4f26658002 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 751ebbd569..ee1304fbeb 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 1af80b96bc..8142ef5550 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index a3514dc270..a51abc5019 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.41-SNAPSHOT + 5.0.41 io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 7bc7f8cb87..047e313ec8 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index e17f7f4e0a..953f64e00d 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index f0b861c909..cfe0e94161 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index 06ae599d6e..df8195d2cb 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index 8b5a83ec5c..b374d807d5 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 3a3a6db097..6cd9cd0043 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 3c0fabec4b..5ea8b5b266 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 77d6d7d101..50518d0aae 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 6dd2cd8a2f..47bebc6b2e 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 492d35162c..771111a32b 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index f6e60da0e1..d1f394ccbc 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 22778ee388..1a654a9512 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index 09bcea13b7..5ae3324be4 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index a74dafdd10..aed1518465 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index 7cf2dfd1af..65975f91a5 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index f075b06b9c..39460505b7 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 0fe678ebb1..d51dd85d69 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 7cb910b6d9..7182100e83 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index b5addd2794..d5c6b5b375 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 685fab620e..2dbc913679 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 24d0866e4e..64dfae9ba8 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index cf83a5a86d..516b93fd78 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index cb9826b78e..030e4f349d 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 15190aee11..5150d211e7 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index 9deac3dc50..be0732efca 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index 10c48a75ec..e8c7afaa50 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 1cef468e96..368b32340e 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index 0c6244c963..dae15573de 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 3da7785970..56e64b3125 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 8cd92c6bd3..df615b4203 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index 5ee2379a0c..fcd71ee151 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index 22396e9043..f8ac91dcdd 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index f8dffca5f7..a740be46bf 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 28c032bfc2..9d027d4248 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index 77a6b7c55c..a8351e048b 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index 96c0fcf364..36abb9979c 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 7e97d37e80..1882ed6fb4 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index 0735dde1b8..ea2d46ef5d 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index 201259a689..f63ab0c490 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index e8445e248b..44f5eabec8 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 5e023a221d..0157681da9 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index cc19155edf..51fdad0633 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml index ec1828cb6c..b23dd9ef17 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml index fa0608b760..80da01e102 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/cea-mgt-feature/pom.xml b/features/cea-mgt-feature/pom.xml index 5641cfe43c..6ee04628b3 100644 --- a/features/cea-mgt-feature/pom.xml +++ b/features/cea-mgt-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index db8d9a6ab3..709010c62f 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index 9b995d1f34..9d49f8eedb 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index ce1b6b9059..d2f335c42c 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 8b0656bdb5..048f57a7d9 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index 76b1f58f1e..138b4430e3 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml index 028e2d7249..63afefaef5 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 4.0.0 diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml index 4486e06cdd..5180e9b2fd 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index dfedede26e..c78b1a7e8c 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index fd6bd72c73..9d61047ec2 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 28a3b66da2..2bdbb473cc 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 0983252c6a..da8a614af0 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 26c03188a9..2a47308946 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index fb348ee8d3..7ad441a97e 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index 0eb091bfc9..61741bbdfb 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index b15e6b8148..cbaf79b280 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index d0d4ccd68c..576f818030 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index d8f24a9759..bcf563f0ed 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index b862a19654..30c50734fa 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 9ff456a387..30c2d38aa6 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index e8835dddd0..0eb8761d1a 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index efd9801efd..de9f714801 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 2149f050ef..13d8068f94 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index 89cf0a2a10..2ee6847e3a 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 52bf889e4c..16630a12b9 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index 9072639ce2..2994f26837 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 38b5dd52af..71b717cd8e 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index 5062f0ddb1..123348a395 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index ddf8e91e8d..e6720a1177 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index 15ba6a9c06..8768748ce8 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index 3a29bf350c..de1b9b473f 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index 233a27afd3..f2c81a46ae 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index 4980bdcc92..a75cdb544c 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index d5acfbbeb0..7d7bdbcdc0 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 7c8b555c8a..071ebf4808 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index c2de0d9937..8e80325d1c 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index 16b841f8dc..28d35451cc 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index a72d9174fd..2465d3ca94 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index 28e985f832..d8ce15d083 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index 2841cacaf2..dd6be1da74 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index 42659ed683..f505824292 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index cf5f83d5c3..e535d0cd39 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index c6204f96eb..c285e2b2e2 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index cbe26f3040..2a229c2e05 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index 52c2807727..5a015b36be 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index ac3a9b3cf9..97f4dc8711 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 0628bc0b09..2a4d4ce514 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index bd6e9a7fdd..a60597af9b 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.41-SNAPSHOT + 5.0.41 ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 40ff6344e8..09f1a305fa 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41-SNAPSHOT + 5.0.41 ../../pom.xml diff --git a/pom.xml b/pom.xml index 5c3be7d83f..db9106e956 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.41-SNAPSHOT + 5.0.41 WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1923,7 +1923,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - HEAD + v5.0.41 @@ -2128,7 +2128,7 @@ 1.2.11.wso2v10 - 5.0.41-SNAPSHOT + 5.0.41 4.7.35 From 487c576ab20a4c121bd99bde4fe53f346305a9b7 Mon Sep 17 00:00:00 2001 From: builder Date: Tue, 9 Apr 2024 10:35:40 +0530 Subject: [PATCH 21/24] [maven-release-plugin] prepare for next development iteration --- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/analytics-mgt/grafana-mgt/pom.xml | 2 +- components/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.apimgt.annotations/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.application.mgt.core/pom.xml | 2 +- components/application-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.common/pom.xml | 2 +- .../cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml | 2 +- components/cea-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.api/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.certificate.mgt.core/pom.xml | 2 +- components/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.config.api/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.core/pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.extensions/pom.xml | 2 +- .../pom.xml | 2 +- components/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/identity-extensions/pom.xml | 2 +- .../io.entgra.device.mgt.core.notification.logger/pom.xml | 2 +- components/logger/pom.xml | 2 +- .../io.entgra.device.mgt.core.operation.template/pom.xml | 2 +- components/operation-template-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.decision.point/pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.policy.mgt.core/pom.xml | 2 +- components/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt/pom.xml | 2 +- components/subtype-mgt/pom.xml | 2 +- components/task-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.core/pom.xml | 2 +- components/task-mgt/task-manager/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.watcher/pom.xml | 2 +- components/task-mgt/task-watcher/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.common/pom.xml | 2 +- .../io.entgra.device.mgt.core.tenant.mgt.core/pom.xml | 2 +- components/tenant-mgt/pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/email-sender/pom.xml | 2 +- components/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- components/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- components/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- components/webapp-authenticator-framework/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/analytics-mgt/grafana-mgt/pom.xml | 2 +- features/analytics-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/apimgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- features/application-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/cea-mgt-feature/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/certificate-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt-extensions/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../io.entgra.device.mgt.core.device.mgt.feature/pom.xml | 2 +- .../pom.xml | 2 +- features/device-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/heartbeat-management/pom.xml | 2 +- .../pom.xml | 2 +- features/jwt-client/pom.xml | 2 +- .../pom.xml | 2 +- features/logger/pom.xml | 2 +- .../pom.xml | 2 +- features/operation-template-mgt-plugin-feature/pom.xml | 2 +- .../pom.xml | 2 +- features/policy-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml | 2 +- features/subtype-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.task.mgt.feature/pom.xml | 2 +- features/task-mgt/pom.xml | 2 +- .../pom.xml | 2 +- features/tenant-mgt/pom.xml | 2 +- .../io.entgra.device.mgt.core.email.sender.feature/pom.xml | 2 +- features/transport-mgt/email-sender/pom.xml | 2 +- features/transport-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- features/transport-mgt/sms-handler/pom.xml | 2 +- .../pom.xml | 2 +- features/ui-request-interceptor/pom.xml | 2 +- .../pom.xml | 2 +- features/webapp-authenticator-framework/pom.xml | 2 +- pom.xml | 6 +++--- 146 files changed, 148 insertions(+), 148 deletions(-) diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml index e521d2306d..c8011c08f3 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index c014aca23b..ad2b76aea8 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 2d7ab401e2..2d708f2e34 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/grafana-mgt/pom.xml b/components/analytics-mgt/grafana-mgt/pom.xml index 805443c135..1687efce72 100644 --- a/components/analytics-mgt/grafana-mgt/pom.xml +++ b/components/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/analytics-mgt/pom.xml b/components/analytics-mgt/pom.xml index c0637bb0ab..00d4c90659 100644 --- a/components/analytics-mgt/pom.xml +++ b/components/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index f7546a3271..062250c578 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -20,7 +20,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index a61b7f4a52..e3f137438d 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index ed3ca1db7b..fb993c89e1 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index ea36157796..9715d49004 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 3d428fcbbd..153009c3e8 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index cbcce8ed10..3a0bbffa59 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT 4.0.0 diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index c25846b3bc..9d9fc52a3c 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -21,7 +21,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 470c6112c1..10bfbf4145 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -22,7 +22,7 @@ apimgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 83f4845c23..8120dc4f6a 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index fe83a56641..ffb8a053df 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index 240848640f..ed00b9b0f9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core application-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 6a3c07ea70..360dad0a6c 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml index 424b9633dc..254c6ad535 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.admin.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml index 78606b4e29..2e6e9efc5b 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.common/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml index 1e644edd9c..ec906b7507 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml index c3edaad53a..09822882ff 100644 --- a/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml +++ b/components/cea-mgt/io.entgra.device.mgt.core.cea.mgt.enforce/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/cea-mgt/pom.xml b/components/cea-mgt/pom.xml index 70eeb0fe08..665b30df0c 100644 --- a/components/cea-mgt/pom.xml +++ b/components/cea-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index c3a3768693..29bef57226 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 3a81058794..03b8374637 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index d91cbce3ba..53c8057109 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core certificate-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 8a0bd1e773..62ba9f87aa 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 8f5ac0e563..07e7b949c5 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml index 35d43cbc79..55aea2d343 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml index ae53ca6b66..92cbacef55 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index 2fb22c1b55..cce520cc68 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 57717c826b..34427cb7de 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -21,7 +21,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index c2aa68e40e..90e4d05ed7 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index dbf09a009b..ffb529ef29 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 7ed09e6a9d..8909230131 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 0bd35b7553..167b1dcc67 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 634e67a379..6546e5d8f2 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 31bba8dc34..efe179f503 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index 68ec5e3450..4c0f550469 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 9589820df2..5912b6f830 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 295273040a..d975ad3715 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index 9fe280a9f2..a472beedad 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index b3c3771da1..115bdc04a6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index af700edd6e..9827ec7084 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index cf08001d74..5d5d3d252f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -22,7 +22,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index 127d617b21..a99497bcb7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -23,7 +23,7 @@ device-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 8b3bae632c..e3ff16a185 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index c0c7cec656..d4a1423579 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heartbeat-management - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/heartbeat-management/pom.xml b/components/heartbeat-management/pom.xml index b5518be01a..144a391a6f 100644 --- a/components/heartbeat-management/pom.xml +++ b/components/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index 4f26658002..f9e469335b 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index ee1304fbeb..3c44fc89af 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core identity-extensions - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 8142ef5550..9d9d13a9eb 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index a51abc5019..26e29d584d 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger - 5.0.41 + 5.0.42-SNAPSHOT io.entgra.device.mgt.core.notification.logger diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 047e313ec8..28f050bcd1 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 953f64e00d..a1f8fd8ca1 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core operation-template-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index cfe0e94161..57d6048b31 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index df8195d2cb..e979327e53 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index b374d807d5..f9d89bdcab 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index 6cd9cd0043..7e6c53db05 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 5ea8b5b266..1b25b8d1d1 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core policy-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index 50518d0aae..44c54eddd7 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 47bebc6b2e..69bce27091 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core subtype-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/subtype-mgt/pom.xml b/components/subtype-mgt/pom.xml index 771111a32b..51dc884b45 100644 --- a/components/subtype-mgt/pom.xml +++ b/components/subtype-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/pom.xml b/components/task-mgt/pom.xml index d1f394ccbc..4b447f0e38 100755 --- a/components/task-mgt/pom.xml +++ b/components/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index 1a654a9512..3f47201bf8 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -20,7 +20,7 @@ task-manager io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index 5ae3324be4..583e05bfeb 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-manager - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-manager/pom.xml b/components/task-mgt/task-manager/pom.xml index aed1518465..6904bc1898 100755 --- a/components/task-mgt/task-manager/pom.xml +++ b/components/task-mgt/task-manager/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index 65975f91a5..9b3679a880 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-watcher - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/task-mgt/task-watcher/pom.xml b/components/task-mgt/task-watcher/pom.xml index 39460505b7..9fe0b11e7c 100755 --- a/components/task-mgt/task-watcher/pom.xml +++ b/components/task-mgt/task-watcher/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core task-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index d51dd85d69..2dd5078116 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 7182100e83..7eafae8b99 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -20,7 +20,7 @@ tenant-mgt io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/tenant-mgt/pom.xml b/components/tenant-mgt/pom.xml index d5c6b5b375..b4e13f6292 100644 --- a/components/tenant-mgt/pom.xml +++ b/components/tenant-mgt/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index 2dbc913679..7e2afe4f69 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 64dfae9ba8..1b663db64e 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/pom.xml b/components/transport-mgt/pom.xml index 516b93fd78..e28aeb6f30 100644 --- a/components/transport-mgt/pom.xml +++ b/components/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index 030e4f349d..c911c571a4 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 5150d211e7..eec782a9aa 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index be0732efca..740d1b7ae5 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/transport-mgt/sms-handler/pom.xml b/components/transport-mgt/sms-handler/pom.xml index e8c7afaa50..63db59b599 100644 --- a/components/transport-mgt/sms-handler/pom.xml +++ b/components/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml index 368b32340e..83f664e143 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT 4.0.0 diff --git a/components/ui-request-interceptor/pom.xml b/components/ui-request-interceptor/pom.xml index dae15573de..cc51666724 100644 --- a/components/ui-request-interceptor/pom.xml +++ b/components/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 56e64b3125..b52526e02a 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index df615b4203..0ede892b7f 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml index fcd71ee151..8f1745bb78 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml index f8ac91dcdd..4b128c1cb3 100644 --- a/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml +++ b/features/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core grafana-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/grafana-mgt/pom.xml b/features/analytics-mgt/grafana-mgt/pom.xml index a740be46bf..46349cd1ae 100644 --- a/features/analytics-mgt/grafana-mgt/pom.xml +++ b/features/analytics-mgt/grafana-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core analytics-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/analytics-mgt/pom.xml b/features/analytics-mgt/pom.xml index 9d027d4248..569422c9de 100644 --- a/features/analytics-mgt/pom.xml +++ b/features/analytics-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml index a8351e048b..3f06938008 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension.feature/pom.xml @@ -20,7 +20,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index 36abb9979c..ea792fb1f6 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml index 1882ed6fb4..ca37184ea3 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index ea2d46ef5d..f96d462b4e 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index f63ab0c490..2f015d97d3 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core apimgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 44f5eabec8..ef44e37db0 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml index 0157681da9..514dfdd2f4 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core application-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index 51fdad0633..f639dbdaf4 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml index b23dd9ef17..14e01f52b4 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml index 80da01e102..8d8397ae01 100644 --- a/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml +++ b/features/cea-mgt-feature/io.entgra.device.mgt.core.cea.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core cea-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/cea-mgt-feature/pom.xml b/features/cea-mgt-feature/pom.xml index 6ee04628b3..ddfd8381c9 100644 --- a/features/cea-mgt-feature/pom.xml +++ b/features/cea-mgt-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index 709010c62f..54dec9a0a7 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index 9d49f8eedb..a4cd54ecb8 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index d2f335c42c..c29d15d221 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core certificate-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 048f57a7d9..3ed731f10e 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml index 138b4430e3..d9b0d5fedc 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml index 63afefaef5..49509d8695 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT 4.0.0 diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml index 5180e9b2fd..37e9e2ac4a 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index c78b1a7e8c..94d691700b 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml index 9d61047ec2..a8ea392725 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 2bdbb473cc..d4ba060b68 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index da8a614af0..399761b3f0 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 2a47308946..2e9351f5ca 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index 7ad441a97e..a04e0a0933 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml index 61741bbdfb..66ac3b6eb8 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml index cbaf79b280..bc35f8e7c1 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.userstore.role.mapper/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-extensions-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index 576f818030..240077996f 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index bcf563f0ed..3baff87eb1 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 30c50734fa..6f21b990a7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index 30c2d38aa6..2e69e4991e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index 0eb8761d1a..ca7591b012 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index de9f714801..fecbd4b026 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core device-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 13d8068f94..dd09fa4aae 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml index 2ee6847e3a..92cc4ed0a6 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core heart-beat-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/heartbeat-management/pom.xml b/features/heartbeat-management/pom.xml index 16630a12b9..77db508369 100644 --- a/features/heartbeat-management/pom.xml +++ b/features/heartbeat-management/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index 2994f26837..47d3eba794 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core jwt-client-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 71b717cd8e..13352c3ac9 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index 123348a395..13dfee7c04 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core logger-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/logger/pom.xml b/features/logger/pom.xml index e6720a1177..d618a48143 100644 --- a/features/logger/pom.xml +++ b/features/logger/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml index 8768748ce8..51e22389d6 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.core.operation.template.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core operation-template-mgt-plugin-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index de1b9b473f..6eaf76b03a 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index f2c81a46ae..27e6f9f338 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core policy-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index a75cdb544c..b8ad61c8c1 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml index 7d7bdbcdc0..545cbf5983 100644 --- a/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml +++ b/features/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../../pom.xml diff --git a/features/subtype-mgt/pom.xml b/features/subtype-mgt/pom.xml index 071ebf4808..1d9a686b44 100644 --- a/features/subtype-mgt/pom.xml +++ b/features/subtype-mgt/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index 8e80325d1c..910eb1dd01 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../../pom.xml diff --git a/features/task-mgt/pom.xml b/features/task-mgt/pom.xml index 28d35451cc..847891c371 100755 --- a/features/task-mgt/pom.xml +++ b/features/task-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 2465d3ca94..11c9910d26 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ tenant-mgt-feature io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/tenant-mgt/pom.xml b/features/tenant-mgt/pom.xml index d8ce15d083..1905e1c77f 100644 --- a/features/tenant-mgt/pom.xml +++ b/features/tenant-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index dd6be1da74..5fdfd06406 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core email-sender-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index f505824292..3a8cad8254 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/pom.xml b/features/transport-mgt/pom.xml index e535d0cd39..d8ef07065e 100644 --- a/features/transport-mgt/pom.xml +++ b/features/transport-mgt/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml index c285e2b2e2..ba79eec348 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml index 2a229c2e05..8a8d12575f 100644 --- a/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml +++ b/features/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core sms-handler-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/transport-mgt/sms-handler/pom.xml b/features/transport-mgt/sms-handler/pom.xml index 5a015b36be..29a6377f7a 100644 --- a/features/transport-mgt/sms-handler/pom.xml +++ b/features/transport-mgt/sms-handler/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core transport-mgt-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml index 97f4dc8711..4695bfd1a7 100644 --- a/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml +++ b/features/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor.feature/pom.xml @@ -21,7 +21,7 @@ ui-request-interceptor-feature io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT 4.0.0 diff --git a/features/ui-request-interceptor/pom.xml b/features/ui-request-interceptor/pom.xml index 2a4d4ce514..af85499d51 100644 --- a/features/ui-request-interceptor/pom.xml +++ b/features/ui-request-interceptor/pom.xml @@ -21,7 +21,7 @@ io.entgra.device.mgt.core.parent io.entgra.device.mgt.core - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index a60597af9b..ad5a36dc35 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core webapp-authenticator-framework-feature - 5.0.41 + 5.0.42-SNAPSHOT ../pom.xml diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index 09f1a305fa..b790add82e 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -22,7 +22,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent - 5.0.41 + 5.0.42-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index db9106e956..680a4ced22 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.parent pom - 5.0.41 + 5.0.42-SNAPSHOT WSO2 Carbon - Device Management - Parent http://wso2.org WSO2 Connected Device Manager Components @@ -1923,7 +1923,7 @@ https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git scm:git:https://repository.entgra.net/community/device-mgt-core.git - v5.0.41 + HEAD @@ -2128,7 +2128,7 @@ 1.2.11.wso2v10 - 5.0.41 + 5.0.42-SNAPSHOT 4.7.35 From 10d70ddd82aa18dc0a5f5459aabbcf14a7644b5d Mon Sep 17 00:00:00 2001 From: ashvini Date: Tue, 16 Apr 2024 10:30:31 +0530 Subject: [PATCH 22/24] Resolve inability to edit app related data --- .../application/mgt/core/impl/ApplicationManagerImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 56567155ed..efb55e60cb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -2619,8 +2619,11 @@ public class ApplicationManagerImpl implements ApplicationManager { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); ApplicationDTO applicationDTO = getApplication(applicationId); - String sanitizedName = ApplicationManagementUtil.sanitizeName(applicationUpdateWrapper.getName(), - Constants.ApplicationProperties.NAME ); + String sanitizedName = ""; + if (!StringUtils.isEmpty(applicationUpdateWrapper.getName())) { + sanitizedName = ApplicationManagementUtil.sanitizeName(applicationUpdateWrapper.getName(), + Constants.ApplicationProperties.NAME ); + } try { ConnectionManagerUtil.beginDBTransaction(); if (!StringUtils.isEmpty(sanitizedName) && !applicationDTO.getName() From 64189a400d271c35e8e7ab22ccbb1ea437f57142 Mon Sep 17 00:00:00 2001 From: Gimhan Wijayawardana Date: Tue, 16 Apr 2024 07:45:53 +0000 Subject: [PATCH 23/24] Implement multi value (status) filtering for getting activity details Co-authored-by: Gimhan Wijayawardana Co-committed-by: Gimhan Wijayawardana --- .../api/ActivityInfoProviderService.java | 4 +- .../impl/ActivityProviderServiceImpl.java | 21 +++-- .../impl/ActivityProviderServiceImplTest.java | 6 +- .../mgt/common/ActivityPaginationRequest.java | 10 +-- .../mgt/dao/impl/GenericOperationDAOImpl.java | 79 +++++++++++++------ 5 files changed, 79 insertions(+), 41 deletions(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index 7cc2aaf0bf..27d855b3b1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -491,7 +491,7 @@ public interface ActivityInfoProviderService { name = "status", value = "Operation response status to filter" ) - @QueryParam("status") String status, + @QueryParam("status") List statuses, @ApiParam( name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time\n." + @@ -615,7 +615,7 @@ public interface ActivityInfoProviderService { name = "status", value = "Operation response status to filter" ) - @QueryParam("status") String status, + @QueryParam("status") List statuses, @ApiParam( name = "If-Modified-Since", value = "Checks if the requested variant was modified, since the specified date-time\n." + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index 2fca4e46f3..a4148f07a8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -50,6 +50,7 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -259,7 +260,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService @QueryParam("deviceType") String deviceType, @QueryParam("deviceId") List deviceIds, @QueryParam("type") String type, - @QueryParam("status") String status, + @QueryParam("status") List statuses, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("startTimestamp") long startTimestamp, @QueryParam("endTimestamp") long endTimestamp) { @@ -336,8 +337,12 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService if (type != null && !type.isEmpty()) { activityPaginationRequest.setType(Operation.Type.valueOf(type.toUpperCase())); } - if (status != null && !status.isEmpty()) { - activityPaginationRequest.setStatus(Operation.Status.valueOf(status.toUpperCase())); + if (statuses != null && !statuses.isEmpty()) { + List statusEnums = new ArrayList<>(); + for (String status : statuses) { + statusEnums.add(Operation.Status.valueOf(status.toUpperCase())); + } + activityPaginationRequest.setStatuses(statusEnums); } if (timestamp > 0) { activityPaginationRequest.setSince(timestamp); @@ -382,7 +387,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService @QueryParam("deviceType") String deviceType, @QueryParam("deviceId") List deviceIds, @QueryParam("type") String type, - @QueryParam("status") String status, + @QueryParam("status") List statuses, @HeaderParam("If-Modified-Since") String ifModifiedSince, @QueryParam("startTimestamp") long startTimestamp, @QueryParam("endTimestamp") long endTimestamp) { @@ -457,8 +462,12 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService if (type != null && !type.isEmpty()) { activityPaginationRequest.setType(Operation.Type.valueOf(type.toUpperCase())); } - if (status != null && !status.isEmpty()) { - activityPaginationRequest.setStatus(Operation.Status.valueOf(status.toUpperCase())); + if (statuses != null && !statuses.isEmpty()) { + List statusEnums = new ArrayList<>(); + for (String status : statuses) { + statusEnums.add(Operation.Status.valueOf(status.toUpperCase())); + } + activityPaginationRequest.setStatuses(statusEnums); } if (timestamp > 0) { activityPaginationRequest.setSince(timestamp); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java index 5a6d9d0983..59baa18242 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java @@ -132,7 +132,7 @@ public class ActivityProviderServiceImplTest { activityPaginationRequest.setDeviceType(DEVICE_TYPE_2); activityPaginationRequest.setOperationId(OPERATION_ID); activityPaginationRequest.setInitiatedBy(INITIATED_BY); - activityPaginationRequest.setStatus(STATUS); + activityPaginationRequest.setStatuses(Collections.singletonList(STATUS)); activityPaginationRequest.setType(TYPE); activityPaginationRequest.setStartTimestamp(0); activityPaginationRequest.setEndTimestamp(0); @@ -226,7 +226,7 @@ public class ActivityProviderServiceImplTest { Mockito.when(this.deviceManagementProviderService.getActivities(Mockito.any())).thenReturn(activities); Response response = this.activityInfoProviderService.getActivities( OFFSET, LIMIT, SINCE, INITIATED_BY, OPERATION_CODE, OPERATION_ID, - DEVICE_TYPE_2, Collections.singletonList(DEVICE_ID), TYPE.toString(), STATUS.toString(), null, 0, 0); + DEVICE_TYPE_2, Collections.singletonList(DEVICE_ID), TYPE.toString(), Collections.singletonList(STATUS.toString()), null, 0, 0); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); Assert.assertNotNull(response); @@ -258,7 +258,7 @@ public class ActivityProviderServiceImplTest { Mockito.when(this.deviceManagementProviderService.getDeviceActivities(Mockito.any())).thenReturn(deviceActivities); Response response = this.activityInfoProviderService.getDeviceActivities( OFFSET, LIMIT, SINCE, INITIATED_BY, OPERATION_CODE, OPERATION_ID, - DEVICE_TYPE_2, Collections.singletonList(DEVICE_ID), TYPE.toString(), STATUS.toString(), null, 0, 0); + DEVICE_TYPE_2, Collections.singletonList(DEVICE_ID), TYPE.toString(), Collections.singletonList(STATUS.toString()), null, 0, 0); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); Assert.assertNotNull(response); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java index 058b82dd2f..77161d7036 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/ActivityPaginationRequest.java @@ -36,7 +36,7 @@ public class ActivityPaginationRequest { private String initiatedBy; private long since; private Operation.Type type; - private Operation.Status status; + private List statuses; private long startTimestamp; private long endTimestamp; @@ -110,12 +110,12 @@ public class ActivityPaginationRequest { this.type = type; } - public Operation.Status getStatus() { - return status; + public List getStatuses() { + return statuses; } - public void setStatus(Operation.Status status) { - this.status = status; + public void setStatuses(List statuses) { + this.statuses = statuses; } public long getStartTimestamp() { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 319e2d09f8..4a96d6606a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -2272,7 +2272,7 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getDeviceType() != null || (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || activityPaginationRequest.getSince() != 0 || - activityPaginationRequest.getStatus() != null) { + activityPaginationRequest.getStatuses() != null) { sql.append("(SELECT DISTINCT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING eom WHERE TENANT_ID = ? "); @@ -2305,8 +2305,12 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { sql.append("AND TYPE = ? "); } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + sql.append("AND STATUS IN ("); + for (int i = 0; i < activityPaginationRequest.getStatuses().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); } sql.append("ORDER BY OPERATION_ID ASC limit ? , ? ) eom_ordered " + @@ -2360,8 +2364,12 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { sql.append("AND eom.TYPE = ? "); } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND eom.STATUS = ? "); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + sql.append("AND eom.STATUS IN ("); + for (int i = 0; i < activityPaginationRequest.getStatuses().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); } sql.append("ORDER BY eom.OPERATION_ID, eom.UPDATED_TIMESTAMP"); @@ -2372,7 +2380,7 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getDeviceType() != null || (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || activityPaginationRequest.getSince() != 0 || - activityPaginationRequest.getStatus() != null) { + activityPaginationRequest.getStatuses() != null) { if (activityPaginationRequest.getDeviceType() != null) { stmt.setString(index++, activityPaginationRequest.getDeviceType()); @@ -2401,8 +2409,10 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { stmt.setString(index++, activityPaginationRequest.getType().name()); } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + for (io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation.Status status : activityPaginationRequest.getStatuses()) { + stmt.setString(index++, status.name()); + } } stmt.setInt(index++, activityPaginationRequest.getOffset()); @@ -2463,8 +2473,10 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { stmt.setString(index++, activityPaginationRequest.getType().name()); } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index, activityPaginationRequest.getStatus().name()); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + for (io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation.Status status : activityPaginationRequest.getStatuses()) { + stmt.setString(index++, status.name()); + } } try (ResultSet rs = stmt.executeQuery()) { @@ -2496,7 +2508,7 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getDeviceType() != null || (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || activityPaginationRequest.getSince() != 0 || - activityPaginationRequest.getStatus() != null) { + activityPaginationRequest.getStatuses() != null) { sql.append("SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT " + "FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? "); @@ -2526,8 +2538,12 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { sql.append("AND TYPE = ? "); } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + sql.append("AND STATUS IN ("); + for (int i = 0; i < activityPaginationRequest.getStatuses().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); } } else { @@ -2555,7 +2571,7 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getDeviceType() != null || (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) || activityPaginationRequest.getSince() != 0 || - activityPaginationRequest.getStatus() != null) { + activityPaginationRequest.getStatuses() != null) { if (activityPaginationRequest.getDeviceType() != null) { stmt.setString(index++, activityPaginationRequest.getDeviceType()); } @@ -2579,8 +2595,10 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { stmt.setString(index++, activityPaginationRequest.getType().name()); } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + for (io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation.Status status : activityPaginationRequest.getStatuses()) { + stmt.setString(index++, status.name()); + } } } else { if (activityPaginationRequest.getOperationCode() != null) { @@ -2662,8 +2680,12 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { sql.append("AND TYPE = ? "); } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + sql.append("AND STATUS IN ("); + for (int i = 0; i < activityPaginationRequest.getStatuses().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); } sql.append("ORDER BY ID ASC limit ? , ? ) eom " + @@ -2700,8 +2722,10 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { stmt.setString(index++, activityPaginationRequest.getType().name()); } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + for (io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation.Status status : activityPaginationRequest.getStatuses()) { + stmt.setString(index++, status.name()); + } } stmt.setInt(index++, activityPaginationRequest.getOffset()); @@ -2744,7 +2768,6 @@ public class GenericOperationDAOImpl implements OperationDAO { int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(); StringBuilder sql = new StringBuilder(); - sql.append("SELECT count(DISTINCT ID) AS ACTIVITY_COUNT " + "FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? "); @@ -2773,8 +2796,12 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { sql.append("AND TYPE = ? "); } - if (activityPaginationRequest.getStatus() != null) { - sql.append("AND STATUS = ? "); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + sql.append("AND STATUS IN ("); + for (int i = 0; i < activityPaginationRequest.getStatuses().size() - 1; i++) { + sql.append("?, "); + } + sql.append("?) "); } if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) { @@ -2808,8 +2835,10 @@ public class GenericOperationDAOImpl implements OperationDAO { if (activityPaginationRequest.getType() != null) { stmt.setString(index++, activityPaginationRequest.getType().name()); } - if (activityPaginationRequest.getStatus() != null) { - stmt.setString(index++, activityPaginationRequest.getStatus().name()); + if (activityPaginationRequest.getStatuses() != null && !activityPaginationRequest.getStatuses().isEmpty()) { + for (io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation.Status status : activityPaginationRequest.getStatuses()) { + stmt.setString(index++, status.name()); + } } if (isTimeDurationFilteringProvided) { From 62722718f2793a7a464c253b5ba294b3e829c0d5 Mon Sep 17 00:00:00 2001 From: Charitha Goonetilleke Date: Thu, 18 Apr 2024 04:05:04 +0000 Subject: [PATCH 24/24] Fix issues with handling OPERATION_DETAILS and OPERATION_PROPERTIES This is to fix incorrectly handled operation details retrieval and operation properties handling. Need following migration for existing data. ``` ALTER TABLE `DM_DB`.`DM_OPERATION` ADD COLUMN `OPERATION_PROPERTIES` BLOB NULL DEFAULT NULL AFTER `OPERATION_DETAILS`; ALTER TABLE `ARCHIVAL_DB`.`DM_OPERATION_ARCH` ADD COLUMN `OPERATION_PROPERTIES` BLOB NULL DEFAULT NULL AFTER `OPERATION_DETAILS`; UPDATE DM_OPERATION SET OPERATION_DETAILS = null; UPDATE DM_ENROLMENT_OP_MAPPING SET STATUS = 'ERROR' WHERE STATUS = 'PENDING' OR STATUS = 'IN_PROGRESS' OR STATUS = 'NOTNOW'; ``` Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/371 Co-authored-by: Charitha Goonetilleke Co-committed-by: Charitha Goonetilleke --- .../carbon-home/dbscripts/dm-db-h2.sql | 1 + .../src/test/resources/sql/h2.sql | 1 + .../archival/dao/impl/ArchivalDAOImpl.java | 5 +- .../operation/mgt/OperationManagerImpl.java | 120 ++++++------- .../core/operation/mgt/dao/OperationDAO.java | 2 +- .../mgt/dao/impl/GenericOperationDAOImpl.java | 167 +++++------------- .../mgt/dao/util/OperationDAOUtil.java | 57 ++++++ .../impl/DynamicPartitionedScheduleTask.java | 4 +- .../src/test/resources/sql/h2.sql | 1 + .../src/test/resources/sql-files/h2.sql | 36 +--- .../carbon-home/dbscripts/dm-db-h2.sql | 1 + .../src/test/resources/sql/CreateH2TestDB.sql | 1 + .../task/mgt/watcher/IoTSStartupHandler.java | 100 +++++++++-- .../dbscripts/cdm/archival/mysql.sql | 1 + .../dbscripts/cdm/archival/postgresql.sql | 1 + .../src/main/resources/dbscripts/cdm/h2.sql | 1 + .../main/resources/dbscripts/cdm/mssql.sql | 1 + .../main/resources/dbscripts/cdm/mysql.sql | 1 + .../main/resources/dbscripts/cdm/oracle.sql | 1 + .../resources/dbscripts/cdm/postgresql.sql | 1 + .../dbscripts/cleanup-scripts/mysql.sql | 5 +- 21 files changed, 266 insertions(+), 242 deletions(-) diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql index 158615a137..046e93de83 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql @@ -116,6 +116,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (ID) ); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/sql/h2.sql b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/sql/h2.sql index b4d2bde228..c079d1e214 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/sql/h2.sql +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/resources/sql/h2.sql @@ -140,6 +140,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java index 183447be7b..2efe723785 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java @@ -547,8 +547,9 @@ public class ArchivalDAOImpl implements ArchivalDAO { String sql = "INSERT INTO " + DESTINATION_DB + ".DM_OPERATION_ARCH " + "SELECT OPR.ID, OPR.TYPE, OPR.CREATED_TIMESTAMP, OPR.RECEIVED_TIMESTAMP, " + - "OPR.OPERATION_CODE, OPR.INITIATED_BY, OPR.OPERATION_DETAILS, OPR.ENABLED, NOW() " + - "FROM " + SOURCE_DB + ".DM_OPERATION OPR " + + "OPR.OPERATION_CODE, OPR.INITIATED_BY, OPR.OPERATION_DETAILS, OPR.OPERATION_PROPERTIES, " + + "OPR.ENABLED, NOW() " + + "FROM " + SOURCE_DB + ".DM_OPERATION OPR " + "WHERE OPR.ID NOT IN (SELECT DISTINCT OPERATION_ID FROM " + SOURCE_DB + ".DM_ENROLMENT_OP_MAPPING)"; long startTime = System.currentTimeMillis(); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java index 049cae776e..8cf4630f0a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -222,7 +222,7 @@ public class OperationManagerImpl implements OperationManager { if (operationDto.getControl() == io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT) { Map pendingOperationIDs = operationDAO - .getExistingOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); + .getExistingNotExecutedOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); for (Integer enrolmentId : pendingOperationIDs.keySet()) { operation.setId(pendingOperationIDs.get(enrolmentId)); device = enrolments.get(enrolmentId); @@ -294,7 +294,7 @@ public class OperationManagerImpl implements OperationManager { if (operationDto.getControl() == io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT) { Map pendingOperationIDs = operationDAO - .getExistingOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); + .getExistingNotExecutedOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); Device device; for (Integer enrolmentId : pendingOperationIDs.keySet()) { operation.setId(pendingOperationIDs.get(enrolmentId)); @@ -368,7 +368,7 @@ public class OperationManagerImpl implements OperationManager { if (operationDto.getControl() == io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT) { Map pendingOperationIDs = operationDAO - .getExistingOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); + .getExistingNotExecutedOperationIDs(enrolments.keySet().toArray(new Integer[0]), operationCode); Device device; for (Integer enrolmentId : pendingOperationIDs.keySet()) { operation.setId(pendingOperationIDs.get(enrolmentId)); @@ -841,23 +841,23 @@ public class OperationManagerImpl implements OperationManager { } if (dtoOperation != null) { - if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType() - )) { - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; - commandOperation = - (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. - getOperation(dtoOperation.getId()); - dtoOperation.setEnabled(commandOperation.isEnabled()); - } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG.equals(dtoOperation. - getType())) { - dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); - } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE.equals(dtoOperation. - getType())) { - dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); - } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY.equals(dtoOperation. - getType())) { - dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); - } +// if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND.equals(dtoOperation.getType() +// )) { +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; +// commandOperation = +// (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. +// getOperation(dtoOperation.getId()); +// dtoOperation.setEnabled(commandOperation.isEnabled()); +// } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG.equals(dtoOperation. +// getType())) { +// dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); +// } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE.equals(dtoOperation. +// getType())) { +// dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); +// } else if (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY.equals(dtoOperation. +// getType())) { +// dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); +// } operation = OperationDAOUtil.convertOperation(dtoOperation); } } catch (OperationManagementDAOException e) { @@ -1050,29 +1050,29 @@ public class OperationManagerImpl implements OperationManager { io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation deviceSpecificOperation = operationDAO. getOperationByDeviceAndId(enrolmentInfo.getId(), operationId); - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation dtoOperation = deviceSpecificOperation; - if (deviceSpecificOperation.getType(). - equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; - commandOperation = - (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. - getOperation(deviceSpecificOperation.getId()); - dtoOperation.setEnabled(commandOperation.isEnabled()); - } else if (deviceSpecificOperation.getType(). - equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { - dtoOperation = configOperationDAO.getOperation(deviceSpecificOperation.getId()); - } else if (deviceSpecificOperation.getType().equals( - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) { - dtoOperation = profileOperationDAO.getOperation(deviceSpecificOperation.getId()); - } else if (deviceSpecificOperation.getType().equals( - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) { - dtoOperation = policyOperationDAO.getOperation(deviceSpecificOperation.getId()); - } - if (dtoOperation == null) { - throw new OperationManagementException("Operation not found for operation Id:" + operationId + - " device id:" + deviceId.getId()); - } - dtoOperation.setStatus(deviceSpecificOperation.getStatus()); +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation dtoOperation = deviceSpecificOperation; +// if (deviceSpecificOperation.getType(). +// equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; +// commandOperation = +// (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. +// getOperation(deviceSpecificOperation.getId()); +// dtoOperation.setEnabled(commandOperation.isEnabled()); +// } else if (deviceSpecificOperation.getType(). +// equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { +// dtoOperation = configOperationDAO.getOperation(deviceSpecificOperation.getId()); +// } else if (deviceSpecificOperation.getType().equals( +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) { +// dtoOperation = profileOperationDAO.getOperation(deviceSpecificOperation.getId()); +// } else if (deviceSpecificOperation.getType().equals( +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) { +// dtoOperation = policyOperationDAO.getOperation(deviceSpecificOperation.getId()); +// } +// if (dtoOperation == null) { +// throw new OperationManagementException("Operation not found for operation Id:" + operationId + +// " device id:" + deviceId.getId()); +// } +// dtoOperation.setStatus(deviceSpecificOperation.getStatus()); operation = OperationDAOUtil.convertOperation(deviceSpecificOperation); } catch (OperationManagementDAOException e) { throw new OperationManagementException("Error occurred while retrieving the list of " + @@ -1155,23 +1155,23 @@ public class OperationManagerImpl implements OperationManager { throw new OperationManagementException("Operation not found for given Id:" + operationId); } - if (dtoOperation.getType() - .equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { - io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; - commandOperation = - (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. - getOperation(dtoOperation.getId()); - dtoOperation.setEnabled(commandOperation.isEnabled()); - } else if (dtoOperation.getType(). - equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { - dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); - } else if (dtoOperation.getType().equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type. - PROFILE)) { - dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); - } else if (dtoOperation.getType().equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type. - POLICY)) { - dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); - } +// if (dtoOperation.getType() +// .equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) { +// io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation; +// commandOperation = +// (io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO. +// getOperation(dtoOperation.getId()); +// dtoOperation.setEnabled(commandOperation.isEnabled()); +// } else if (dtoOperation.getType(). +// equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) { +// dtoOperation = configOperationDAO.getOperation(dtoOperation.getId()); +// } else if (dtoOperation.getType().equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type. +// PROFILE)) { +// dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId()); +// } else if (dtoOperation.getType().equals(io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation.Type. +// POLICY)) { +// dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId()); +// } operation = OperationDAOUtil.convertOperation(dtoOperation); } catch (OperationManagementDAOException e) { throw new OperationManagementException("Error occurred while retrieving the operation with operation Id '" + diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java index 4fe22494c6..4abaf40022 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationDAO.java @@ -62,7 +62,7 @@ public interface OperationDAO { void updateEnrollmentOperationsStatus(int enrolmentId, String operationCode, Operation.Status existingStatus, Operation.Status newStatus) throws OperationManagementDAOException; - Map getExistingOperationIDs(Integer[] enrolmentIds, String operationCode) + Map getExistingNotExecutedOperationIDs(Integer[] enrolmentIds, String operationCode) throws OperationManagementDAOException; OperationResponseMeta addOperationResponse(int enrolmentId, io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation operation, String deviceId) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index 4a96d6606a..ddb77a24a4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -59,6 +59,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -75,15 +76,16 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection connection = OperationManagementDAOFactory.getConnection(); String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " + - "INITIATED_BY, OPERATION_DETAILS, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)"; + "INITIATED_BY, OPERATION_DETAILS, OPERATION_PROPERTIES, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); stmt.setLong(3, 0); stmt.setString(4, operation.getCode()); stmt.setString(5, operation.getInitiatedBy()); - stmt.setObject(6, operation); - stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + stmt.setObject(6, operation.getPayLoad()); + stmt.setObject(7, operation.getProperties()); + stmt.setInt(8, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); @@ -164,7 +166,7 @@ public class GenericOperationDAOImpl implements OperationDAO { } @Override - public Map getExistingOperationIDs(Integer[] enrolmentIds, String operationCode) + public Map getExistingNotExecutedOperationIDs(Integer[] enrolmentIds, String operationCode) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; @@ -576,7 +578,7 @@ public class GenericOperationDAOImpl implements OperationDAO { + "dor.ID AS OP_RES_ID, de.DEVICE_ID, d.DEVICE_IDENTIFICATION, d.DEVICE_TYPE_ID, " + "dt.NAME AS DEVICE_TYPE_NAME, eom.STATUS, eom.CREATED_TIMESTAMP, " + "eom.UPDATED_TIMESTAMP, op.OPERATION_CODE, op.TYPE AS OPERATION_TYPE, " - + "dor.OPERATION_RESPONSE, op.INITIATED_BY, dor.RECEIVED_TIMESTAMP, dor.IS_LARGE_RESPONSE FROM " + + "dor.OPERATION_RESPONSE, op.INITIATED_BY, dor.RECEIVED_TIMESTAMP, dor.IS_LARGE_RESPONSE FROM " + "DM_ENROLMENT_OP_MAPPING eom INNER JOIN DM_OPERATION op " + "ON op.ID=eom.OPERATION_ID INNER JOIN DM_ENROLMENT de " + "ON de.ID=eom.ENROLMENT_ID INNER JOIN DM_DEVICE d ON d.ID=de.DEVICE_ID " @@ -1189,24 +1191,14 @@ public class GenericOperationDAOImpl implements OperationDAO { Operation operation = null; try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY FROM " + - "DM_OPERATION WHERE id = ?"; + String sql = "SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY, " + + "OPERATION_DETAILS, OPERATION_PROPERTIES FROM DM_OPERATION WHERE id = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, id); rs = stmt.executeQuery(); if (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); - if (rs.getLong("RECEIVED_TIMESTAMP") == 0) { - operation.setReceivedTimeStamp(""); - } else { - operation.setReceivedTimeStamp(new Timestamp(rs.getLong("RECEIVED_TIMESTAMP") * 1000L).toString()); - } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); + operation = OperationDAOUtil.getOperation(rs); } } catch (SQLException e) { @@ -1219,16 +1211,19 @@ public class GenericOperationDAOImpl implements OperationDAO { } @Override - public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException { + public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) + throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; Operation operation = null; try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, om.STATUS, " + - "o.OPERATION_CODE, o.INITIATED_BY, om.ID AS OM_MAPPING_ID, " + - "om.UPDATED_TIMESTAMP FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP," + - "OPERATION_CODE, INITIATED_BY FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " + + "o.OPERATION_CODE, o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, " + + "om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP, om.STATUS FROM " + + "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP," + + "OPERATION_CODE, INITIATED_BY, OPERATION_DETAILS, OPERATION_PROPERTIES FROM DM_OPERATION " + + "WHERE id = ?) o INNER JOIN (SELECT * FROM " + "DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " + "ON o.ID = om.OPERATION_ID "; stmt = conn.prepareStatement(sql); @@ -1238,20 +1233,14 @@ public class GenericOperationDAOImpl implements OperationDAO { rs = stmt.executeQuery(); if (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); - operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); + operation = OperationDAOUtil.getOperation(rs); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); + operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); } } catch (SQLException e) { throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " + @@ -1272,7 +1261,8 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " + - "o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + + "o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, om.ID AS OM_MAPPING_ID, " + + "om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC"; stmt = conn.prepareStatement(sql); @@ -1281,20 +1271,14 @@ public class GenericOperationDAOImpl implements OperationDAO { rs = stmt.executeQuery(); while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); + operation.setStatus(status); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); - operation.setStatus(status); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } } catch (SQLException e) { @@ -1317,7 +1301,8 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.OPERATION_CODE, " + - "o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + + "o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, om.ID AS OM_MAPPING_ID, " + + "om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " + "o.CREATED_TIMESTAMP DESC LIMIT ?,?"; @@ -1329,20 +1314,15 @@ public class GenericOperationDAOImpl implements OperationDAO { rs = stmt.executeQuery(); while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); + operation.setStatus(status); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); operation.setStatus(status); - OperationDAOUtil.setActivityId(operation, rs.getInt("OM_MAPPING_ID")); operations.add(operation); } } catch (SQLException e) { @@ -1364,7 +1344,8 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " + - "o.OPERATION_CODE, o.INITIATED_BY, om.STATUS, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP " + + "o.OPERATION_CODE, o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, om.STATUS, " + + "om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP " + "FROM DM_OPERATION o INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID " + "ORDER BY o.CREATED_TIMESTAMP DESC, o.ID DESC"; @@ -1373,18 +1354,13 @@ public class GenericOperationDAOImpl implements OperationDAO { rs = stmt.executeQuery(); while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); operations.add(operation); } @@ -1428,6 +1404,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "o.OPERATION_CODE, " + "o.INITIATED_BY, " + "o.OPERATION_DETAILS, " + + "o.OPERATION_PROPERTIES, " + "om.STATUS, " + "om.ID AS OM_MAPPING_ID, " + "om.UPDATED_TIMESTAMP " + @@ -1514,36 +1491,14 @@ public class GenericOperationDAOImpl implements OperationDAO { stmt.setInt(paramIndex, request.getRowCount()); try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); - if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { - byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); - try (ByteArrayInputStream bais = new ByteArrayInputStream(operationDetails); - ObjectInputStream ois = new ObjectInputStream(bais)) { - profileOperation = (ProfileOperation) ois.readObject(); - operation.setPayLoad(profileOperation.getPayLoad()); - } catch (IOException e) { - String msg = "IO Error occurred while retrieving app data of operation "; - log.error(msg, e); - throw new OperationManagementDAOException(msg, e); - } catch (ClassNotFoundException e) { - String msg = "Class not found error occurred while retrieving app data of operation "; - log.error(msg, e); - throw new OperationManagementDAOException(msg, e); - } - } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } } @@ -1562,7 +1517,6 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); String createdTo = null; String createdFrom = null; - ProfileOperation profileOperation = null; DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); boolean isCreatedDayProvided = false; boolean isUpdatedDayProvided = false; //updated day = received day @@ -1586,6 +1540,7 @@ public class GenericOperationDAOImpl implements OperationDAO { "o.OPERATION_CODE, " + "o.INITIATED_BY, " + "o.OPERATION_DETAILS, " + + "o.OPERATION_PROPERTIES, " + "om.STATUS, " + "om.ID AS OM_MAPPING_ID, " + "om.UPDATED_TIMESTAMP " + @@ -1672,36 +1627,14 @@ public class GenericOperationDAOImpl implements OperationDAO { stmt.setInt(paramIndex, request.getRowCount()); try (ResultSet rs = stmt.executeQuery()) { while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); - if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) { - byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); - try (ByteArrayInputStream bais = new ByteArrayInputStream(operationDetails); - ObjectInputStream ois = new ObjectInputStream(bais)) { - profileOperation = (ProfileOperation) ois.readObject(); - operation.setPayLoad(profileOperation.getPayLoad()); - } catch (IOException e) { - String msg = "IO Error occurred while retrieving app data of operation "; - log.error(msg, e); - throw new OperationManagementDAOException(msg, e); - } catch (ClassNotFoundException e) { - String msg = "Class not found error occurred while retrieving app data of operation "; - log.error(msg, e); - throw new OperationManagementDAOException(msg, e); - } - } operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS"))); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } } @@ -1932,7 +1865,8 @@ public class GenericOperationDAOImpl implements OperationDAO { try { Connection connection = OperationManagementDAOFactory.getConnection(); stmt = connection.prepareStatement("SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, " + - "o.OPERATION_CODE, o.INITIATED_BY, om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + + "o.OPERATION_CODE, o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, " + + "om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM DM_OPERATION o " + "INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " + "ORDER BY om.UPDATED_TIMESTAMP ASC, om.ID ASC LIMIT 1"); @@ -1942,21 +1876,14 @@ public class GenericOperationDAOImpl implements OperationDAO { Operation operation = null; if (rs.next()) { - operation = new Operation(); - operation.setType(OperationDAOUtil.getType(rs.getString("TYPE"))); - operation.setId(rs.getInt("ID")); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); - + operation = OperationDAOUtil.getOperation(rs); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); operation.setStatus(Operation.Status.PENDING); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); } return operation; } catch (SQLException e) { @@ -1975,8 +1902,9 @@ public class GenericOperationDAOImpl implements OperationDAO { List operations = new ArrayList<>(); try { Connection conn = OperationManagementDAOFactory.getConnection(); - String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE, o.INITIATED_BY," + - " om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM " + + String sql = "SELECT o.ID, TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, OPERATION_CODE, " + + "o.INITIATED_BY, o.OPERATION_DETAILS, o.OPERATION_PROPERTIES, " + + "om.ID AS OM_MAPPING_ID, om.UPDATED_TIMESTAMP FROM " + "(SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY " + "FROM DM_OPERATION o WHERE o.TYPE = ?) o INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " + "WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP ASC"; @@ -1988,19 +1916,14 @@ public class GenericOperationDAOImpl implements OperationDAO { rs = stmt.executeQuery(); while (rs.next()) { - operation = new Operation(); - operation.setId(rs.getInt("ID")); - operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); - operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + operation = OperationDAOUtil.getOperation(rs); + operation.setStatus(status); if (rs.getLong("UPDATED_TIMESTAMP") == 0) { operation.setReceivedTimeStamp(""); } else { operation.setReceivedTimeStamp( new Timestamp((rs.getLong("UPDATED_TIMESTAMP") * 1000)).toString()); } - operation.setCode(rs.getString("OPERATION_CODE")); - operation.setInitiatedBy(rs.getString("INITIATED_BY")); - OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); operations.add(operation); } } catch (SQLException e) { @@ -2013,7 +1936,8 @@ public class GenericOperationDAOImpl implements OperationDAO { } @Override - public Map> getOperationMappingsByStatus(Operation.Status opStatus, Operation.PushNotificationStatus pushNotificationStatus, + public Map> getOperationMappingsByStatus(Operation.Status opStatus, + Operation.PushNotificationStatus pushNotificationStatus, int limit) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; @@ -2059,7 +1983,8 @@ public class GenericOperationDAOImpl implements OperationDAO { @Override public Map> getAllocatedOperationMappingsByStatus(Operation.Status opStatus, - Operation.PushNotificationStatus pushNotificationStatus, int limit, int activeServerCount, int serverIndex) + Operation.PushNotificationStatus pushNotificationStatus, + int limit, int activeServerCount, int serverIndex) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index e36828233f..6561868060 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -44,6 +44,7 @@ import java.util.Date; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.TreeMap; public class OperationDAOUtil { @@ -330,4 +331,60 @@ public class OperationDAOUtil { deviceActivity.setUpdatedTimestamp(new Date(rs.getLong(("UPDATED_TIMESTAMP")) * 1000).toString()); return deviceActivity; } + + public static Operation getOperation(ResultSet rs) throws OperationManagementDAOException, SQLException { + Operation operation = new Operation(); + operation.setId(rs.getInt("ID")); + operation.setType(Operation.Type.valueOf(rs.getString("TYPE"))); + operation.setCreatedTimeStamp(new Timestamp(rs.getLong("CREATED_TIMESTAMP") * 1000L).toString()); + if (rs.getLong("RECEIVED_TIMESTAMP") == 0) { + operation.setReceivedTimeStamp(""); + } else { + operation.setReceivedTimeStamp( + new Timestamp((rs.getLong("RECEIVED_TIMESTAMP") * 1000)).toString()); + } + operation.setCode(rs.getString("OPERATION_CODE")); + operation.setInitiatedBy(rs.getString("INITIATED_BY")); + byte[] operationDetails = rs.getBytes("OPERATION_DETAILS"); + if (!rs.wasNull()) { + try (ByteArrayInputStream bais = new ByteArrayInputStream(operationDetails); + ObjectInputStream ois = new ObjectInputStream(bais)) { + operation.setPayLoad(ois.readObject()); + } catch (IOException e) { + String msg = "IO Error occurred while retrieving operation details"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (ClassNotFoundException e) { + String msg = "Class not found error occurred while retrieving operation details"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (Exception e) { + String msg = "Error occurred while retrieving operation details"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } + } + byte[] operationProperties = rs.getBytes("OPERATION_PROPERTIES"); + if (!rs.wasNull()) { + try (ByteArrayInputStream bais = new ByteArrayInputStream(operationProperties); + ObjectInputStream ois = new ObjectInputStream(bais)) { + operation.setProperties((Properties) ois.readObject()); + } catch (IOException e) { + String msg = "IO Error occurred while retrieving operation properties"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (ClassNotFoundException e) { + String msg = "Class not found error occurred while retrieving operation properties"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } catch (Exception e) { + String msg = "Error occurred while retrieving operation properties"; + log.error(msg, e); + throw new OperationManagementDAOException(msg, e); + } + } + OperationDAOUtil.setActivityId(operation, rs.getInt("ID")); + return operation; + } + } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java index 6ca728cd13..65379945e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java @@ -86,13 +86,13 @@ public abstract class DynamicPartitionedScheduleTask implements Task { if (localHashIndex.equals(String.valueOf(taskContext.getServerHashIndex()))) { if (log.isDebugEnabled()) { log.debug("Executing dynamically scheduled task (" + getTaskName() + - ") for current server hash index: " + localHashIndex); + ") for current server hash index: " + taskContext.getServerHashIndex()); } executeDynamicTask(); } else { if (log.isDebugEnabled()) { log.debug("Ignoring execution of task (" + getTaskName() + - ") not belonging to current serer hash index: " + localHashIndex); + ") not belonging to current server hash index: " + taskContext.getServerHashIndex()); } } } else { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql index 94c94106b5..00c3c804a2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/resources/sql/h2.sql @@ -140,6 +140,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql index b282aa59ce..3dae0cb261 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/resources/sql-files/h2.sql @@ -70,46 +70,12 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); -CREATE TABLE IF NOT EXISTS DM_CONFIG_OPERATION ( - OPERATION_ID INTEGER NOT NULL, - OPERATION_CONFIG BLOB DEFAULT NULL, - ENABLED BOOLEAN NOT NULL DEFAULT FALSE, - PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_config FOREIGN KEY (OPERATION_ID) REFERENCES - DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION -); - -CREATE TABLE IF NOT EXISTS DM_COMMAND_OPERATION ( - OPERATION_ID INTEGER NOT NULL, - ENABLED BOOLEAN NOT NULL DEFAULT FALSE, - PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_command FOREIGN KEY (OPERATION_ID) REFERENCES - DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION -); - -CREATE TABLE IF NOT EXISTS DM_POLICY_OPERATION ( - OPERATION_ID INTEGER NOT NULL, - ENABLED INTEGER NOT NULL DEFAULT 0, - OPERATION_DETAILS BLOB DEFAULT NULL, - PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_policy FOREIGN KEY (OPERATION_ID) REFERENCES - DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION -); - -CREATE TABLE IF NOT EXISTS DM_PROFILE_OPERATION ( - OPERATION_ID INTEGER NOT NULL, - ENABLED INTEGER NOT NULL DEFAULT 0, - OPERATION_DETAILS BLOB DEFAULT NULL, - PRIMARY KEY (OPERATION_ID), - CONSTRAINT fk_dm_operation_profile FOREIGN KEY (OPERATION_ID) REFERENCES - DM_OPERATION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION -); - CREATE TABLE IF NOT EXISTS DM_ENROLMENT ( ID INTEGER AUTO_INCREMENT NOT NULL, DEVICE_ID INTEGER NOT NULL, diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql index c2f33227b7..0c547b11a4 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/resources/carbon-home/dbscripts/dm-db-h2.sql @@ -89,6 +89,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index 2570e7dd7f..2a2d497eb8 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -89,6 +89,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java index 5b1945e686..aed0d3dc8b 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java @@ -45,8 +45,11 @@ import java.util.Timer; import java.util.TimerTask; public class IoTSStartupHandler implements ServerStartupObserver { + private static final Log log = LogFactory.getLog(IoTSStartupHandler.class); + private static int lastHashIndex = -1; + @Override public void completingServerStartup() { } @@ -80,6 +83,22 @@ public class IoTSStartupHandler implements ServerStartupObserver { Map> tenantedDynamicTasks = TaskWatcherDataHolder.getInstance() .getTaskManagementService().getDynamicTasksForAllTenants(); + int serverHashIdx; + try { + serverHashIdx = TaskWatcherDataHolder.getInstance().getHeartBeatService() + .getServerCtxInfo().getLocalServerHashIdx(); + } catch (HeartBeatManagementException e) { + String msg = "Failed to get server hash index."; + log.error(msg, e); + throw new TaskManagementException(msg, e); + } + + if (serverHashIdx != lastHashIndex) { + log.info("Server hash index changed. Old: " + lastHashIndex + ", new: " + serverHashIdx); + deleteAllDynamicNTasks(nTaskService, tenantedDynamicTasks, serverHashIdx); + lastHashIndex = serverHashIdx; + } + scheduleMissingTasks(nTaskService, tenantedDynamicTasks); deleteObsoleteTasks(nTaskService, tenantedDynamicTasks); @@ -96,7 +115,45 @@ public class IoTSStartupHandler implements ServerStartupObserver { } - private static void scheduleMissingTasks(TaskService nTaskService, Map> tenantedDynamicTasks, int serverHashIdx) throws TaskException { + List tenants = getAllTenants(); + + TaskManager taskManager; + + for (Tenant tenant : tenants) { + if (tenantedDynamicTasks.get(tenant.getId()) == null) { + if (log.isTraceEnabled()) { + log.trace("Dynamic tasks not running for tenant: [" + tenant.getId() + "] " + + tenant.getDomain()); + } + continue; + } + PrivilegedCarbonContext.startTenantFlow(); + PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenant.getId(), true); + if (!nTaskService.getRegisteredTaskTypes().contains(TaskMgtConstants.Task.DYNAMIC_TASK_TYPE)) { + nTaskService.registerTaskType(TaskMgtConstants.Task.DYNAMIC_TASK_TYPE); + } + taskManager = nTaskService.getTaskManager(TaskMgtConstants.Task.DYNAMIC_TASK_TYPE); + List tasks = taskManager.getAllTasks(); + // Remove all applicable dynamic tasks from the nTask core + for (TaskInfo taskInfo : tasks) { + for (DynamicTask dt : tenantedDynamicTasks.get(tenant.getId())) { + if (tenant.getId() == dt.getTenantId() + && taskInfo.getName() + .equals(TaskManagementUtil.generateNTaskName(dt.getDynamicTaskId(), serverHashIdx))) { + taskManager.deleteTask(taskInfo.getName()); + if (log.isDebugEnabled()) { + log.debug("Task '" + taskInfo.getName() + "' deleted as server hash changed."); + } + } + } + } + PrivilegedCarbonContext.endTenantFlow(); + } + } + + private void scheduleMissingTasks(TaskService nTaskService, Map> tenantedDynamicTasks) throws TaskException, TaskManagementException { @@ -187,26 +244,10 @@ public class IoTSStartupHandler implements ServerStartupObserver { } } - private static void deleteObsoleteTasks(TaskService nTaskService, - Map> tenantedDynamicTasks) + private void deleteObsoleteTasks(TaskService nTaskService, + Map> tenantedDynamicTasks) throws TaskManagementException, TaskException { - List tenants = new ArrayList<>(); - try { - RealmService realmService = TaskWatcherDataHolder.getInstance().getRealmService(); - Tenant[] tenantArray = realmService.getTenantManager().getAllTenants(); - if (tenantArray != null && tenantArray.length != 0) { - tenants.addAll(Arrays.asList(tenantArray)); - } - Tenant superTenant = new Tenant(); - superTenant.setId(-1234); - tenants.add(superTenant); - } catch (UserStoreException e) { - String msg = "Unable to load tenants"; - log.error(msg, e); - return; - } - TaskManager taskManager; Set hashIds; try { @@ -217,6 +258,8 @@ public class IoTSStartupHandler implements ServerStartupObserver { throw new TaskManagementException(msg, e); } + List tenants = getAllTenants(); + for (Tenant tenant : tenants) { if (tenantedDynamicTasks.get(tenant.getId()) == null) { if (log.isTraceEnabled()) { @@ -258,4 +301,23 @@ public class IoTSStartupHandler implements ServerStartupObserver { } } + private List getAllTenants() { + List tenants = new ArrayList<>(); + try { + RealmService realmService = TaskWatcherDataHolder.getInstance().getRealmService(); + Tenant[] tenantArray = realmService.getTenantManager().getAllTenants(); + if (tenantArray != null && tenantArray.length != 0) { + tenants.addAll(Arrays.asList(tenantArray)); + } + Tenant superTenant = new Tenant(); + superTenant.setId(-1234); + tenants.add(superTenant); + return tenants; + } catch (UserStoreException e) { + String msg = "Unable to load tenants"; + log.error(msg, e); + return new ArrayList<>(); + } + } + } diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql index 7854ee1181..d7cf6837bc 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql @@ -7,6 +7,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION_ARCH ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, ARCHIVED_AT TIMESTAMP DEFAULT NOW() )ENGINE = InnoDB; diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/postgresql.sql index 726f5b9a7c..ec4513bf5b 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/postgresql.sql @@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION_ARCH ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BYTEA DEFAULT NULL, + OPERATION_PROPERTIES BYTEA DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, ARCHIVED_AT TIMESTAMP(0) DEFAULT NOW() ); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index b6dcb7d5be..072ce0a81d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -91,6 +91,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INT NOT NULL, PRIMARY KEY (ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index cee731c034..6c7aa649fd 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -125,6 +125,7 @@ CREATE TABLE DM_OPERATION ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS VARBINARY(MAX) DEFAULT NULL, + OPERATION_PROPERTIES VARBINARY(MAX) DEFAULT NULL, ENABLED BIT NOT NULL DEFAULT 0, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 7ddaf22af6..065862a36b 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -106,6 +106,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INT NOT NULL, PRIMARY KEY (ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index 6e99bb43ee..eccc831141 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -181,6 +181,7 @@ CREATE TABLE DM_OPERATION ( INITIATED_BY VARCHAR2(100) NULL, ENABLED NUMBER(10) DEFAULT 0 NOT NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, TENANT_ID INTEGER NOT NULL, CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID) ) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 5d5c7446e6..371baa0763 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -99,6 +99,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BYTEA DEFAULT NULL, + OPERATION_PROPERTIES BYTEA DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, TENANT_ID INTEGER NOT NULL, PRIMARY KEY (ID) diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cleanup-scripts/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cleanup-scripts/mysql.sql index df58b1cf84..5a43717800 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cleanup-scripts/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cleanup-scripts/mysql.sql @@ -157,6 +157,7 @@ CREATE TABLE NEW_DM_OPERATION ( OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, + OPERATION_PROPERTIES BLOB DEFAULT NULL, ENABLED BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (ID) ); @@ -218,8 +219,8 @@ SELECT CONCAT(NOW(), ': Inserted ', ROW_COUNT(),' records to DM_ENROLMENT_OP_MAP Insert data into NEW_DM_OPERATION from DM_OPERATION only with the OPERATION_IDs from DM_ENROLMENT_OP_MAPPING */ SELECT CONCAT(NOW(), ': Inserting data into DM_OPERATION FROM OLD_DM_OPERATION.') AS ''; -INSERT INTO DM_OPERATION (ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY, OPERATION_DETAILS, ENABLED) -SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY, OPERATION_DETAILS, ENABLED +INSERT INTO DM_OPERATION (ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY, OPERATION_DETAILS, OPERATION_PROPERTIES, ENABLED) +SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, INITIATED_BY, OPERATION_DETAILS, OPERATION_PROPERTIES, ENABLED FROM OLD_DM_OPERATION WHERE ID IN(SELECT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING); SELECT CONCAT(NOW(), ': Inserted ', ROW_COUNT(),' records to DM_OPERATION.') AS '';