From f92e766856980b75ce45a58188def3d2e68b3c8c Mon Sep 17 00:00:00 2001 From: Thameera Date: Fri, 24 Mar 2023 10:50:06 +0530 Subject: [PATCH] add version changes and modifications --- .../pom.xml | 2 +- .../template/dao/OperationTemplateDAO.java | 1 - .../dao/impl/OperationTemplateDAOImpl.java | 37 ------------------- .../dto/OperationTemplateCacheKey.java | 6 +-- .../template/ServiceNegativeTest.java | 4 +- components/operation-template-mgt/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 8 files changed, 9 insertions(+), 47 deletions(-) diff --git a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/pom.xml index 496462c287..729ee868bd 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt operation-template-mgt - 5.0.20-SNAPSHOT + 5.0.21-SNAPSHOT ../pom.xml diff --git a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/OperationTemplateDAO.java b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/OperationTemplateDAO.java index d395c4d54c..358fc9c6af 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/OperationTemplateDAO.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/OperationTemplateDAO.java @@ -36,5 +36,4 @@ public interface OperationTemplateDAO { void deleteOperationTemplate(int subTypeId, String deviceCode, String operationCode) throws OperationTemplateManagementDAOException; - boolean isExistsOperationTemplateBySubtypeIdAndOperationCode(int subTypeId, String deviceType, String operationCode) throws OperationTemplateManagementDAOException; } diff --git a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/impl/OperationTemplateDAOImpl.java b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/impl/OperationTemplateDAOImpl.java index d48a6b4c55..2ad78d9ad7 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/impl/OperationTemplateDAOImpl.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dao/impl/OperationTemplateDAOImpl.java @@ -180,41 +180,4 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO { throw new OperationTemplateManagementDAOException(msg, e); } } - - /** - * @param subTypeId - * @param deviceType - * @param operationCode - * @return - * @throws OperationTemplateManagementDAOException - */ - @Override - public boolean isExistsOperationTemplateBySubtypeIdAndOperationCode(int subTypeId, String deviceType, - String operationCode) throws OperationTemplateManagementDAOException { - try { - String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE SUB_TYPE_ID = ? AND DEVICE_TYPE = ? AND OPERATION_CODE = ?"; - - Connection conn = ConnectionManagerUtils.getDBConnection(); - try (PreparedStatement stmt = conn.prepareStatement(sql)) { - stmt.setInt(1, subTypeId); - stmt.setString(2, deviceType); - stmt.setString(3, operationCode); - - try (ResultSet rs = stmt.executeQuery()) { - if (rs.next()) { - return true; - } - return false; - } - } catch (SQLException e) { - String msg = "Error occurred while loading operation template."; - log.error(e.getMessage()); - throw new OperationTemplateManagementDAOException(msg, e); - } - } catch (DBConnectionException e) { - String msg = "Error occurred while obtaining DB connection to loading operation template."; - log.error(msg); - throw new OperationTemplateManagementDAOException(msg, e); - } - } } diff --git a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dto/OperationTemplateCacheKey.java b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dto/OperationTemplateCacheKey.java index 2bbbf1a22d..7eee362040 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dto/OperationTemplateCacheKey.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/main/java/io/entgra/device/mgt/operation/template/dto/OperationTemplateCacheKey.java @@ -21,9 +21,9 @@ package io.entgra.device.mgt.operation.template.dto; public class OperationTemplateCacheKey { - int subTypeId; - String deviceType; - String operationCode; + private int subTypeId; + private String deviceType; + private String operationCode; public int getSubTypeId() { return subTypeId; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/test/java/io/entgra/device/mgt/operation/template/ServiceNegativeTest.java b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/test/java/io/entgra/device/mgt/operation/template/ServiceNegativeTest.java index fd1e6a5a8d..e5a39b3181 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/test/java/io/entgra/device/mgt/operation/template/ServiceNegativeTest.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.operation.template/src/test/java/io/entgra/device/mgt/operation/template/ServiceNegativeTest.java @@ -50,13 +50,13 @@ public class ServiceNegativeTest extends BaseOperationTemplatePluginTest { @Test(description = "This method tests Add Operation template under negative circumstances while missing " + "required fields", expectedExceptions = {OperationTemplateMgtPluginException.class}, - expectedExceptionsMessageRegExp = "Error occurred while processing insert operation template.") + expectedExceptionsMessageRegExp = "Invalid meter device subtype id: 0") public void testAddOperationTemplates() throws OperationTemplateMgtPluginException { OperationTemplate operationTemplate = new OperationTemplate(); operationTemplate.setDeviceType(TestUtils.deviceType); operationTemplate.setCode(TestUtils.operationCode); - operationTemplate.setSubTypeId(1000); + operationTemplate.setSubTypeId(0); operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode)); operationTemplateService.addOperationTemplate(operationTemplate); } diff --git a/components/operation-template-mgt/pom.xml b/components/operation-template-mgt/pom.xml index f48dc96d93..cb58177047 100644 --- a/components/operation-template-mgt/pom.xml +++ b/components/operation-template-mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.20-SNAPSHOT + 5.0.21-SNAPSHOT ../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.operation.template.feature/pom.xml b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.operation.template.feature/pom.xml index 6150a17198..d72b55db35 100644 --- a/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.operation.template.feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/io.entgra.device.mgt.operation.template.feature/pom.xml @@ -24,7 +24,7 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 5.0.20-SNAPSHOT + 5.0.21-SNAPSHOT ../../../pom.xml diff --git a/features/operation-template-mgt-plugin-feature/pom.xml b/features/operation-template-mgt-plugin-feature/pom.xml index a41df443a7..beb4317f3e 100644 --- a/features/operation-template-mgt-plugin-feature/pom.xml +++ b/features/operation-template-mgt-plugin-feature/pom.xml @@ -24,7 +24,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 5.0.20-SNAPSHOT + 5.0.21-SNAPSHOT ../../pom.xml