From f6054795bc1ce1b520f55fd97086c19263bb0c7a Mon Sep 17 00:00:00 2001 From: isuri Date: Fri, 3 Nov 2023 10:14:24 +0530 Subject: [PATCH] device org imports optimize --- .../api/DeviceOrganizationMgtServiceImpl.java | 1 - .../api/DeviceOrganizationRequest.java | 75 ------------------- .../dao/DeviceOrganizationDAO.java | 10 +-- .../dao/DeviceOrganizationDAOFactory.java | 1 + .../dao/impl/DeviceOrganizationDAOImpl.java | 5 -- .../dao/util/ConnectionManagerUtil.java | 8 +- .../dao/util/DeviceOrganizationDaoUtil.java | 2 + .../ApplicationManagementException.java | 47 ------------ .../exception/BadRequestDaoException.java | 2 +- .../DeviceOrganizationMgtDAOException.java | 4 +- .../DeviceOrganizationMgtPluginException.java | 4 +- .../IllegalTransactionStateException.java | 39 ---------- .../TransactionManagementException.java | 39 ---------- ...DeviceOrganizationMgtServiceComponent.java | 2 - .../device/organization/DAONegativeTest.java | 5 -- 15 files changed, 17 insertions(+), 227 deletions(-) delete mode 100644 components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationRequest.java delete mode 100644 components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/ApplicationManagementException.java delete mode 100644 components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/IllegalTransactionStateException.java delete mode 100644 components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/TransactionManagementException.java diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java index 68e249e3f5..333498a8ed 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationMgtServiceImpl.java @@ -142,7 +142,6 @@ public class DeviceOrganizationMgtServiceImpl implements DeviceOrganizationMgtSe DeviceOrganizationService deviceOrganizationService = DeviceOrgAPIUtils.getDeviceOrganizationService(); boolean exists; if (parentDeviceId.equals("null")) { - log.info("inside if"); exists = deviceOrganizationService.isDeviceOrganizationExist(deviceId, null); } else { exists = deviceOrganizationService.isDeviceOrganizationExist(deviceId, Integer.valueOf(parentDeviceId)); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationRequest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationRequest.java deleted file mode 100644 index 0342334924..0000000000 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization.api/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/api/DeviceOrganizationRequest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, 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.extensions.device.organization.api; - -import org.codehaus.jackson.annotate.JsonIgnoreProperties; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.Date; - -@XmlRootElement - -@JsonIgnoreProperties(ignoreUnknown = true) -public class DeviceOrganizationRequest { - - @XmlElement - private int organizationId; - - @XmlElement - private int deviceId; - - @XmlElement - private Integer parentDeviceId; - - @XmlElement - private Date updateTime; - - public int getOrganizationId() { - return organizationId; - } - - public void setOrganizationId(int organizationId) { - this.organizationId = organizationId; - } - - public int getDeviceId() { - return deviceId; - } - - public void setDeviceId(int deviceId) { - this.deviceId = deviceId; - } - - public Integer getParentDeviceId() { - return parentDeviceId; - } - - public void setParentDeviceId(Integer parentDeviceId) { - this.parentDeviceId = parentDeviceId; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } -} diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAO.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAO.java index 1afab6aee1..411243fa4c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAO.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAO.java @@ -31,8 +31,8 @@ public interface DeviceOrganizationDAO { /** * Retrieves child devices per particular device ID * - * @param node The device node for which child devices are retrieved. - * @param maxDepth The maximum depth to traverse when fetching child devices. + * @param node The device node for which child devices are retrieved. + * @param maxDepth The maximum depth to traverse when fetching child devices. * @param includeDevice Flag to indicate whether to include the parent device in the result. * @return A list of child device nodes. * @throws DeviceOrganizationMgtDAOException If an error occurs while retrieving child devices. @@ -42,8 +42,8 @@ public interface DeviceOrganizationDAO { /** * Retrieves parent devices for a given device node. * - * @param node The device node for which parent devices are retrieved. - * @param maxDepth The maximum depth to traverse when fetching parent devices. + * @param node The device node for which parent devices are retrieved. + * @param maxDepth The maximum depth to traverse when fetching parent devices. * @param includeDevice Flag to indicate whether to include the current device node in the result. * @return A list of parent device nodes. * @throws DeviceOrganizationMgtDAOException If an error occurs while retrieving parent devices. @@ -80,7 +80,7 @@ public interface DeviceOrganizationDAO { /** * Get a device organization by the CHILD_PARENT_COMP_KEY unique key. * - * @param deviceId The ID of the child device. + * @param deviceId The ID of the child device. * @param parentDeviceId The ID of the parent device. * @return The DeviceOrganization object if found, null otherwise. * @throws DeviceOrganizationMgtDAOException if an error occurs while accessing the database. diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAOFactory.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAOFactory.java index c8deeb3263..b1c3c442a6 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAOFactory.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/DeviceOrganizationDAOFactory.java @@ -50,6 +50,7 @@ public class DeviceOrganizationDAOFactory { public static final class DataBaseTypes { private DataBaseTypes() { } + public static final String DB_TYPE_MYSQL = "MySQL"; public static final String DB_TYPE_ORACLE = "Oracle"; public static final String DB_TYPE_MSSQL = "Microsoft SQL Server"; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/impl/DeviceOrganizationDAOImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/impl/DeviceOrganizationDAOImpl.java index 4e47e00959..fe9d690438 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/impl/DeviceOrganizationDAOImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/impl/DeviceOrganizationDAOImpl.java @@ -31,7 +31,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; -import java.sql.Types; import java.util.ArrayList; import java.util.Calendar; import java.util.HashSet; @@ -300,10 +299,8 @@ public class DeviceOrganizationDAOImpl implements DeviceOrganizationDAO { Connection conn = ConnectionManagerUtil.getDBConnection(); if (parentDeviceId != null) { - // If parentDeviceId is not null, use it in the query. sql = "SELECT * FROM DM_DEVICE_ORGANIZATION WHERE DEVICE_ID = ? AND PARENT_DEVICE_ID = ?"; } else { - // If parentDeviceId is null, use a query that checks for null values. sql = "SELECT * FROM DM_DEVICE_ORGANIZATION WHERE DEVICE_ID = ? AND PARENT_DEVICE_ID IS NULL"; } @@ -340,10 +337,8 @@ public class DeviceOrganizationDAOImpl implements DeviceOrganizationDAO { Connection conn = ConnectionManagerUtil.getDBConnection(); if (parentDeviceId != null) { - // If parentDeviceId is not null, use it in the query. sql = "SELECT * FROM DM_DEVICE_ORGANIZATION WHERE DEVICE_ID = ? AND PARENT_DEVICE_ID = ?"; } else { - // If parentDeviceId is null, use a query that checks for null values. sql = "SELECT * FROM DM_DEVICE_ORGANIZATION WHERE DEVICE_ID = ? AND PARENT_DEVICE_ID IS NULL"; } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/ConnectionManagerUtil.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/ConnectionManagerUtil.java index e8c3012347..beb20c037c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/ConnectionManagerUtil.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/ConnectionManagerUtil.java @@ -100,7 +100,7 @@ public class ConnectionManagerUtil { /** * Ends the current database transaction by setting auto-commit mode to true. * - * @throws DBConnectionException If an error occurs while ending the transaction. + * @throws DBConnectionException If an error occurs while ending the transaction. * @throws IllegalTransactionStateException If there is no active transaction to end. */ public static void endDBTransaction() throws DBConnectionException { @@ -248,8 +248,8 @@ public class ConnectionManagerUtil { /** * Lookup a data source using the given data source name and JNDI properties. * - * @param dataSourceName The JNDI name of the data source to lookup. - * @param jndiProperties Optional JNDI properties used for the lookup. + * @param dataSourceName The JNDI name of the data source to lookup. + * @param jndiProperties Optional JNDI properties used for the lookup. * @return A data source object representing the looked-up data source. * @throws RuntimeException If an error occurs during the lookup process. */ @@ -273,7 +273,7 @@ public class ConnectionManagerUtil { * Get the name of the database product to which the current connection belongs. * * @return A string representing the name of the database product. - * Returns null if an error occurs during the retrieval process. + * Returns null if an error occurs during the retrieval process. */ public static String getDatabaseType() { try { diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/DeviceOrganizationDaoUtil.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/DeviceOrganizationDaoUtil.java index d1d8b2bd39..9414ac22f4 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/DeviceOrganizationDaoUtil.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/dao/util/DeviceOrganizationDaoUtil.java @@ -19,6 +19,7 @@ public class DeviceOrganizationDaoUtil { /** * Helper method to create a Device Organization object from a ResultSet + * * @param rs The ResultSet containing the organization data. * @return A DeviceOrganization object. * @throws SQLException If there's an issue reading data from the ResultSet. @@ -39,6 +40,7 @@ public class DeviceOrganizationDaoUtil { /** * Helper method to create a DeviceNode object from a ResultSet + * * @param rs The ResultSet containing device data. * @return A DeviceNode object. * @throws SQLException If there's an issue reading data from the ResultSet. diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/ApplicationManagementException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/ApplicationManagementException.java deleted file mode 100644 index 431900feb2..0000000000 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/ApplicationManagementException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, 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.extensions.device.organization.exception; - -/** - * Represents the exception thrown during application management. - */ -public class ApplicationManagementException extends Exception { - private String message; - - public ApplicationManagementException(String message, Throwable throwable) { - super(message, throwable); - setMessage(message); - } - - public ApplicationManagementException(String message) { - super(message); - setMessage(message); - } - - public ApplicationManagementException() { - - } - @Override - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/BadRequestDaoException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/BadRequestDaoException.java index d453449c4e..e99ef3059a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/BadRequestDaoException.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/BadRequestDaoException.java @@ -4,7 +4,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.organization.exce * This exception is thrown when a bad request is encountered in the Device Organization Management DAO layer. * It typically indicates issues with the input parameters or data during DAO operations. */ -public class BadRequestDaoException extends DeviceOrganizationMgtDAOException{ +public class BadRequestDaoException extends DeviceOrganizationMgtDAOException { private static final long serialVersionUID = -6275360486437601206L; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtDAOException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtDAOException.java index 16502d05a6..2f728aa833 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtDAOException.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtDAOException.java @@ -47,8 +47,8 @@ public class DeviceOrganizationMgtDAOException extends Exception { /** * Constructs a new `DeviceOrganizationMgtDAOException` with a specified detail message and a nested exception. * - * @param msg The detail message that describes the exception. - * @param nestedEx The nested exception. + * @param msg The detail message that describes the exception. + * @param nestedEx The nested exception. */ public DeviceOrganizationMgtDAOException(String msg, Exception nestedEx) { super(msg, nestedEx); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtPluginException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtPluginException.java index a4ca5b9355..98a95e4d41 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtPluginException.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/DeviceOrganizationMgtPluginException.java @@ -48,8 +48,8 @@ public class DeviceOrganizationMgtPluginException extends Exception { /** * Constructs a new `DeviceOrganizationMgtPluginException` with a specified detail message and a nested exception. * - * @param msg The detail message that describes the exception. - * @param nestedEx The nested exception. + * @param msg The detail message that describes the exception. + * @param nestedEx The nested exception. */ public DeviceOrganizationMgtPluginException(String msg, Exception nestedEx) { super(msg, nestedEx); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/IllegalTransactionStateException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/IllegalTransactionStateException.java deleted file mode 100644 index b72d9213a9..0000000000 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/IllegalTransactionStateException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, 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.extensions.device.organization.exception; - -/** - * Exception thrown due to an issue in database transactions. - */ -public class IllegalTransactionStateException extends RuntimeException { - - private static final long serialVersionUID = -3151279331929070297L; - - public IllegalTransactionStateException(String msg, Exception nestedEx) { - super(msg, nestedEx); - } - - public IllegalTransactionStateException(String message, Throwable cause) { - super(message, cause); - } - - public IllegalTransactionStateException(String msg) { - super(msg); - } - -} diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/TransactionManagementException.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/TransactionManagementException.java deleted file mode 100644 index 30565d834d..0000000000 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/exception/TransactionManagementException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, 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.extensions.device.organization.exception; - -/** - * Exception thrown due to an issue in TransactionManagement of Database. - */ -public class TransactionManagementException extends ApplicationManagementException { - - private static final long serialVersionUID = -3151279321929070297L; - - public TransactionManagementException(String msg, Exception nestedEx) { - super(msg, nestedEx); - } - - public TransactionManagementException(String message, Throwable cause) { - super(message, cause); - } - - public TransactionManagementException(String msg) { - super(msg); - } - -} diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java index 3114348e44..b7a84ca31a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/internal/DeviceOrganizationMgtServiceComponent.java @@ -113,8 +113,6 @@ public class DeviceOrganizationMgtServiceComponent { * @param dataSourceService */ protected void setDataSourceService(DataSourceService dataSourceService) { - /* This is to avoid mobile device management component getting initialized before the underlying datasources - are registered */ if (log.isDebugEnabled()) { log.debug("Data source service set to Device Organization Mgt component"); } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/DAONegativeTest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/DAONegativeTest.java index f663b6af37..1dc9ab198d 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/DAONegativeTest.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.organization/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/organization/DAONegativeTest.java @@ -2,15 +2,10 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.organization; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.dao.DeviceOrganizationDAO; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.dao.DeviceOrganizationDAOFactory; -import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.dao.util.ConnectionManagerUtil; -import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.dto.DeviceOrganization; -import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.exception.DeviceOrganizationMgtDAOException; import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.mock.BaseDeviceOrganizationTest; -import io.entgra.device.mgt.core.device.mgt.extensions.device.organization.exception.DBConnectionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; public class DAONegativeTest extends BaseDeviceOrganizationTest {