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 496462c2874..729ee868bda 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 d395c4d54c9..358fc9c6afc 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 d48a6b4c55c..2ad78d9ad7f 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 2bbbf1a22d5..7eee362040d 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 fd1e6a5a8d6..e5a39b31811 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 f48dc96d938..cb581770478 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 6150a17198b..d72b55db359 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 a41df443a7d..beb4317f3e6 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