From d7512c2a3f3d3e14dc14c7b7577f5843f8326a7a Mon Sep 17 00:00:00 2001 From: Ashan Thamara Palihakkara <75057725+ashanthamara@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:42:34 +0530 Subject: [PATCH 1/2] Rename IDN_ACTION_ENDPOINT table to IDN_ACTION_PROPERTIES --- .../src/test/resources/dbscripts/h2.sql | 2 +- .../resources/dbscripts/db2.sql | 4 ++-- .../resources/dbscripts/h2.sql | 4 ++-- .../resources/dbscripts/mssql.sql | 6 +++--- .../resources/dbscripts/mysql-cluster.sql | 4 ++-- .../resources/dbscripts/mysql.sql | 4 ++-- .../resources/dbscripts/oracle.sql | 4 ++-- .../resources/dbscripts/oracle_rac.sql | 4 ++-- .../resources/dbscripts/postgresql.sql | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql index 776921371a60..9bf8470be8e8 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/dbscripts/h2.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS IDN_ACTION ( PRIMARY KEY (UUID) ); -CREATE TABLE IF NOT EXISTS IDN_ACTION_ENDPOINT ( +CREATE TABLE IF NOT EXISTS IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql index b33683b07ed7..e75cc05b5f8b 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql @@ -2092,7 +2092,7 @@ CREATE TABLE IDN_ACTION ( PRIMARY KEY (UUID) ) / -CREATE TABLE IDN_ACTION_ENDPOINT ( +CREATE TABLE IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -2276,7 +2276,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); / -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); / -- CERTIFICATE -- diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql index 0e0f2b263ed2..437ba45ddbef 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql @@ -1371,7 +1371,7 @@ CREATE TABLE IF NOT EXISTS IDN_ACTION ( PRIMARY KEY (UUID) ); -CREATE TABLE IF NOT EXISTS IDN_ACTION_ENDPOINT ( +CREATE TABLE IF NOT EXISTS IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -1496,7 +1496,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); -- CERTIFICATE -- CREATE INDEX IDX_IDN_CERTIFICATE_ID_TID ON IDN_CERTIFICATE (ID, TENANT_ID); diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql index 3f19a65f3979..04f2181996a8 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql @@ -1519,8 +1519,8 @@ CREATE TABLE IDN_ACTION ( PRIMARY KEY (UUID) ); -IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_ACTION_ENDPOINT]') AND TYPE in (N'U')) -CREATE TABLE IDN_ACTION_ENDPOINT ( +IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_ACTION_PROPERTIES]') AND TYPE in (N'U')) +CREATE TABLE IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -1647,7 +1647,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); -- CERTIFICATE -- CREATE INDEX IDX_IDN_CERTIFICATE_ID_TID ON IDN_CERTIFICATE (ID, TENANT_ID); diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql index f96be70a8a07..a08513b13e90 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql @@ -1534,7 +1534,7 @@ CREATE TABLE IF NOT EXISTS IDN_ACTION ( PRIMARY KEY (UUID) )ENGINE NDB; -CREATE TABLE IF NOT EXISTS IDN_ACTION_ENDPOINT ( +CREATE TABLE IF NOT EXISTS IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -1688,7 +1688,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); -- CERTIFICATE -- CREATE INDEX IDX_IDN_CERTIFICATE_ID_TID ON IDN_CERTIFICATE (ID, TENANT_ID); diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql index e50b75883b45..34ec2b9e5918 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql @@ -1402,7 +1402,7 @@ CREATE TABLE IF NOT EXISTS IDN_ACTION ( PRIMARY KEY (UUID) )DEFAULT CHARACTER SET latin1 ENGINE INNODB; -CREATE TABLE IF NOT EXISTS IDN_ACTION_ENDPOINT ( +CREATE TABLE IF NOT EXISTS IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -1524,7 +1524,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); -- CERTIFICATE -- CREATE INDEX IDX_IDN_CERTIFICATE_ID_TID ON IDN_CERTIFICATE (ID, TENANT_ID); diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql index 53dbadc32c62..5c94891b5a4d 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql @@ -2155,7 +2155,7 @@ CREATE TABLE IDN_ACTION ( PRIMARY KEY (UUID) ) / -CREATE TABLE IDN_ACTION_ENDPOINT ( +CREATE TABLE IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -2333,7 +2333,7 @@ CREATE INDEX IDX_CON_FILE_RES_ID ON IDN_CONFIG_FILE (RESOURCE_ID) -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID) / -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID) +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID) / -- CERTIFICATE -- diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql index bb041b427f38..d8b1eb15c5a8 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql @@ -2088,7 +2088,7 @@ CREATE TABLE IDN_ACTION ( PRIMARY KEY (UUID) ) / -CREATE TABLE IDN_ACTION_ENDPOINT ( +CREATE TABLE IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -2238,7 +2238,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME) -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID) / -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID) +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID) / -- CERTIFICATE -- diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql index c131d9a46155..30fc69db8e60 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql @@ -1639,8 +1639,8 @@ CREATE TABLE IF NOT EXISTS IDN_ACTION ( PRIMARY KEY (UUID) ); -DROP TABLE IF EXISTS IDN_ACTION_ENDPOINT; -CREATE TABLE IF NOT EXISTS IDN_ACTION_ENDPOINT ( +DROP TABLE IF EXISTS IDN_ACTION_PROPERTIES; +CREATE TABLE IF NOT EXISTS IDN_ACTION_PROPERTIES ( ACTION_UUID CHAR(36) NOT NULL, PROPERTY_NAME VARCHAR(100) NOT NULL, PROPERTY_VALUE VARCHAR(255) NOT NULL, @@ -1771,7 +1771,7 @@ CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); -- ACTIONS -- CREATE INDEX IDX_IDN_ACTION_TY_TI ON IDN_ACTION (TYPE, TENANT_ID); -CREATE INDEX IDX_IDN_ACTION_ENDPOINT_AU_TI ON IDN_ACTION_ENDPOINT (ACTION_UUID, TENANT_ID); +CREATE INDEX IDX_IDN_ACTION_PROPERTIES_AU_TI ON IDN_ACTION_PROPERTIES (ACTION_UUID, TENANT_ID); -- CERTIFICATE -- CREATE INDEX IDX_IDN_CERTIFICATE_ID_TID ON IDN_CERTIFICATE (ID, TENANT_ID); From 810ef1fddb78cf9739e3f22156ab13c3466dd238 Mon Sep 17 00:00:00 2001 From: Ashan Thamara Palihakkara <75057725+ashanthamara@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:52:32 +0530 Subject: [PATCH 2/2] Remove fallback logic to IDN_ACTION_ENDPOINT table --- .../constant/ActionMgtSQLConstants.java | 16 ----- .../dao/impl/ActionManagementDAOImpl.java | 64 ++++++------------- 2 files changed, 19 insertions(+), 61 deletions(-) diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java index 6fecc776c47d..8f6ae2c77200 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java @@ -27,9 +27,6 @@ private ActionMgtSQLConstants() { } - public static final String IDN_ACTION_PROPERTIES_TABLE = "IDN_ACTION_PROPERTIES"; - public static final String IDN_ACTION_ENDPOINT_TABLE = "IDN_ACTION_ENDPOINT"; - /** * Column Names. */ @@ -81,19 +78,6 @@ public static class Query { "PROPERTY_VALUE = :PROPERTY_VALUE; WHERE ACTION_UUID = :ACTION_UUID; AND " + "TENANT_ID = :TENANT_ID; AND PROPERTY_NAME = :PROPERTY_NAME;"; - // TODO: Remove this temporary queries once the IDN_ACTION_PROPERTIES table is created. - public static final String ADD_ACTION_ENDPOINT = "INSERT INTO IDN_ACTION_ENDPOINT (ACTION_UUID, " + - "PROPERTY_NAME, PROPERTY_VALUE, TENANT_ID) VALUES (:ACTION_UUID;, :PROPERTY_NAME;, :PROPERTY_VALUE;, " + - ":TENANT_ID;)"; - public static final String GET_ACTION_ENDPOINT_INFO_BY_ID = "SELECT PROPERTY_NAME, PROPERTY_VALUE FROM " + - "IDN_ACTION_ENDPOINT WHERE ACTION_UUID = :ACTION_UUID; AND TENANT_ID = :TENANT_ID;"; - public static final String DELETE_ACTION_ENDPOINT_PROPERTY = "DELETE FROM IDN_ACTION_ENDPOINT WHERE " + - "PROPERTY_NAME = :PROPERTY_NAME; AND ACTION_UUID = :ACTION_UUID; AND TENANT_ID = :TENANT_ID;"; - public static final String UPDATE_ACTION_ENDPOINT_PROPERTY = "UPDATE IDN_ACTION_ENDPOINT SET " + - "PROPERTY_VALUE = :PROPERTY_VALUE; WHERE ACTION_UUID = :ACTION_UUID; AND " + - "TENANT_ID = :TENANT_ID; AND PROPERTY_NAME = :PROPERTY_NAME;"; - - private Query() { } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java index ad1d425f3183..59850e7efc8d 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java @@ -480,9 +480,7 @@ private void addActionPropertiesToDB(String actionId, Map action NamedJdbcTemplate jdbcTemplate = new NamedJdbcTemplate(IdentityDatabaseUtil.getDataSource()); jdbcTemplate.withTransaction(template -> { - String query = isPropertiesTableExists() ? ActionMgtSQLConstants.Query.ADD_ACTION_PROPERTIES - : ActionMgtSQLConstants.Query.ADD_ACTION_ENDPOINT; - template.executeBatchInsert(query, + template.executeBatchInsert(ActionMgtSQLConstants.Query.ADD_ACTION_PROPERTIES, statement -> { for (Map.Entry property : actionProperties.entrySet()) { statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_UUID, actionId); @@ -511,10 +509,8 @@ private Map getActionPropertiesFromDB(String actionId, Integer t NamedJdbcTemplate jdbcTemplate = new NamedJdbcTemplate(IdentityDatabaseUtil.getDataSource()); Map actionEndpointProperties = new HashMap<>(); try { - String query = isPropertiesTableExists() ? ActionMgtSQLConstants.Query.GET_ACTION_PROPERTIES_INFO_BY_ID - : ActionMgtSQLConstants.Query.GET_ACTION_ENDPOINT_INFO_BY_ID; jdbcTemplate.withTransaction(template -> - template.executeQuery(query, + template.executeQuery(ActionMgtSQLConstants.Query.GET_ACTION_PROPERTIES_INFO_BY_ID, (resultSet, rowNumber) -> { actionEndpointProperties.put( resultSet.getString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_NAME), @@ -527,7 +523,7 @@ private Map getActionPropertiesFromDB(String actionId, Integer t })); return actionEndpointProperties; - } catch (SQLException | TransactionException e) { + } catch (TransactionException e) { throw new ActionMgtServerException("Error while retrieving Action Properties from the system.", e); } } @@ -544,22 +540,19 @@ private void updateActionPropertiesInDB(String actionId, Map upd Integer tenantId) throws TransactionException { NamedJdbcTemplate jdbcTemplate = new NamedJdbcTemplate(IdentityDatabaseUtil.getDataSource()); - jdbcTemplate.withTransaction(template -> { - String query = isPropertiesTableExists() ? ActionMgtSQLConstants.Query.UPDATE_ACTION_PROPERTY - : ActionMgtSQLConstants.Query.UPDATE_ACTION_ENDPOINT_PROPERTY; - return template.executeBatchInsert(query, - statement -> { - for (Map.Entry property : updatingProperties.entrySet()) { - statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_VALUE, - property.getValue()); - statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_NAME, - property.getKey()); - statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_UUID, actionId); - statement.setInt(ActionMgtSQLConstants.Column.TENANT_ID, tenantId); - statement.addBatch(); - } - }, null); - }); + jdbcTemplate.withTransaction(template -> + template.executeBatchInsert(ActionMgtSQLConstants.Query.UPDATE_ACTION_PROPERTY, + statement -> { + for (Map.Entry property : updatingProperties.entrySet()) { + statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_VALUE, + property.getValue()); + statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_NAME, + property.getKey()); + statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_UUID, actionId); + statement.setInt(ActionMgtSQLConstants.Column.TENANT_ID, tenantId); + statement.addBatch(); + } + }, null)); } /** @@ -574,10 +567,8 @@ private void deleteActionPropertiesInDB(String actionId, List deletingPr throws TransactionException { NamedJdbcTemplate jdbcTemplate = new NamedJdbcTemplate(IdentityDatabaseUtil.getDataSource()); - jdbcTemplate.withTransaction(template -> { - String query = isPropertiesTableExists() ? ActionMgtSQLConstants.Query.DELETE_ACTION_PROPERTY - : ActionMgtSQLConstants.Query.DELETE_ACTION_ENDPOINT_PROPERTY; - return template.executeBatchInsert(query, + jdbcTemplate.withTransaction(template -> + template.executeBatchInsert(ActionMgtSQLConstants.Query.DELETE_ACTION_PROPERTY, statement -> { for (String property : deletingProperties) { statement.setString(ActionMgtSQLConstants.Column.ACTION_PROPERTIES_PROPERTY_NAME, @@ -586,8 +577,7 @@ private void deleteActionPropertiesInDB(String actionId, List deletingPr statement.setInt(ActionMgtSQLConstants.Column.TENANT_ID, tenantId); statement.addBatch(); } - }, null); - }); + }, null)); } /** @@ -622,20 +612,4 @@ private ActionDTO changeActionStatus(String actionType, String actionId, String throw new ActionMgtServerException("Error while updating Action Status to " + status, e); } } - - /** - * Check whether the IDN_ACTION_PROPERTIES table exists in the database. - * TODO: Remove this temporary method once the table is created. - * - * @return True if the table exists, False otherwise. - * @throws SQLException If an error occurs while checking the table existence. - */ - private boolean isPropertiesTableExists() throws SQLException { - - try (Connection connection = IdentityDatabaseUtil.getDBConnection(false); - ResultSet resultSet = connection.getMetaData().getTables(null, null, - ActionMgtSQLConstants.IDN_ACTION_PROPERTIES_TABLE, null)) { - return resultSet.next(); - } - } }