diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mssql.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mssql.sql index d16e4688..6419446c 100644 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mssql.sql +++ b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mssql.sql @@ -35,7 +35,7 @@ CREATE TABLE OB_NOTIFICATION_SUBSCRIPTION ( PRIMARY KEY (SUBSCRIPTION_ID) ); -CREATE TABLE OB_NOTIFICATION_SUBSCRIPTION_EVENTS ( +CREATE TABLE OB_NOTIFICATION_SUBSCRIBED_EVENTS ( SUBSCRIPTION_ID varchar(36) NOT NULL, EVENT_TYPE varchar(255) NOT NULL, PRIMARY KEY (SUBSCRIPTION_ID, EVENT_TYPE), diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mysql.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mysql.sql index 4a47d580..fbbfa516 100644 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mysql.sql +++ b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/mysql.sql @@ -41,7 +41,7 @@ CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIPTION ( ) ENGINE=InnoDB; -CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIPTION_EVENTS ( +CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIBED_EVENTS ( SUBSCRIPTION_ID varchar(36) NOT NULL, EVENT_TYPE varchar(255) NOT NULL, PRIMARY KEY (SUBSCRIPTION_ID, EVENT_TYPE), diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/oracle.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/oracle.sql index a3e0c467..176c0d97 100644 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/oracle.sql +++ b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/oracle.sql @@ -46,7 +46,7 @@ CREATE TABLE OB_NOTIFICATION_SUBSCRIPTION ( PRIMARY KEY (SUBSCRIPTION_ID) ); -CREATE TABLE OB_NOTIFICATION_SUBSCRIPTION_EVENTS ( +CREATE TABLE OB_NOTIFICATION_SUBSCRIBED_EVENTS ( SUBSCRIPTION_ID varchar(36) NOT NULL, EVENT_TYPE varchar(255) NOT NULL, PRIMARY KEY (SUBSCRIPTION_ID, EVENT_TYPE), diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/postgresql.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/postgresql.sql index bdea8f05..971e6487 100644 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/postgresql.sql +++ b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/open-banking/event-notifications/postgresql.sql @@ -36,7 +36,7 @@ CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIPTION ( PRIMARY KEY (SUBSCRIPTION_ID) ); -CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIPTION_EVENTS ( +CREATE TABLE IF NOT EXISTS OB_NOTIFICATION_SUBSCRIBED_EVENTS ( SUBSCRIPTION_ID varchar(36) NOT NULL, EVENT_TYPE varchar(255) NOT NULL, PRIMARY KEY (SUBSCRIPTION_ID, EVENT_TYPE), diff --git a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/dao/EventSubscriptionSqlStatements.java b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/dao/EventSubscriptionSqlStatements.java index 0e052546..855cbde9 100644 --- a/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/dao/EventSubscriptionSqlStatements.java +++ b/open-banking-accelerator/components/event-notifications/com.wso2.openbanking.accelerator.event.notifications.service/src/main/java/com/wso2/openbanking/accelerator/event/notifications/service/dao/EventSubscriptionSqlStatements.java @@ -24,48 +24,48 @@ public class EventSubscriptionSqlStatements { public String storeEventSubscriptionQuery() { - return "INSERT INTO NOTIFICATION_SUBSCRIPTION (SUBSCRIPTION_ID, CLIENT_ID, CALLBACK_URL, TIMESTAMP, " + + return "INSERT INTO OB_NOTIFICATION_SUBSCRIPTION (SUBSCRIPTION_ID, CLIENT_ID, CALLBACK_URL, TIMESTAMP, " + "SPEC_VERSION, STATUS, REQUEST) VALUES (?,?,?,?,?,?,?)"; } public String storeSubscribedEventTypesQuery() { - return "INSERT INTO NOTIFICATION_SUBSCRIPTION_EVENTS (SUBSCRIPTION_ID, EVENT_TYPE) VALUES (?,?)"; + return "INSERT INTO OB_NOTIFICATION_SUBSCRIBED_EVENTS (SUBSCRIPTION_ID, EVENT_TYPE) VALUES (?,?)"; } public String getEventSubscriptionBySubscriptionIdQuery() { return "SELECT ns.SUBSCRIPTION_ID, ns.CLIENT_ID, ns.REQUEST, ns.CALLBACK_URL, ns.TIMESTAMP, ns.SPEC_VERSION, " + - "ns.STATUS, nse.EVENT_TYPE FROM NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + - "NOTIFICATION_SUBSCRIPTION_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + + "ns.STATUS, nse.EVENT_TYPE FROM OB_NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + + "OB_NOTIFICATION_SUBSCRIBED_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + "ns.SUBSCRIPTION_ID = ? AND ns.STATUS = 'CREATED'"; } public String getEventSubscriptionsByClientIdQuery() { return "SELECT ns.SUBSCRIPTION_ID, ns.CLIENT_ID, ns.REQUEST, ns.CALLBACK_URL, ns.TIMESTAMP, ns.SPEC_VERSION, " + - "ns.STATUS, nse.EVENT_TYPE FROM NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + - "NOTIFICATION_SUBSCRIPTION_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + + "ns.STATUS, nse.EVENT_TYPE FROM OB_NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + + "OB_NOTIFICATION_SUBSCRIBED_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + "ns.CLIENT_ID = ? AND ns.STATUS = 'CREATED'"; } public String getEventSubscriptionsByEventTypeQuery() { return "SELECT ns.SUBSCRIPTION_ID, ns.CLIENT_ID, ns.REQUEST, ns.CALLBACK_URL, ns.TIMESTAMP, ns.SPEC_VERSION, " + - "ns.STATUS, nse.EVENT_TYPE FROM NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + - "NOTIFICATION_SUBSCRIPTION_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + - "ns.SUBSCRIPTION_ID IN (SELECT ns.SUBSCRIPTION_ID FROM NOTIFICATION_SUBSCRIPTION ns LEFT " + - "JOIN NOTIFICATION_SUBSCRIPTION_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + + "ns.STATUS, nse.EVENT_TYPE FROM OB_NOTIFICATION_SUBSCRIPTION ns LEFT JOIN " + + "OB_NOTIFICATION_SUBSCRIBED_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + + "ns.SUBSCRIPTION_ID IN (SELECT ns.SUBSCRIPTION_ID FROM OB_NOTIFICATION_SUBSCRIPTION ns LEFT " + + "JOIN OB_NOTIFICATION_SUBSCRIBED_EVENTS nse ON ns.SUBSCRIPTION_ID = nse.SUBSCRIPTION_ID WHERE " + "nse.EVENT_TYPE = ? AND ns.STATUS = 'CREATED')"; } public String updateEventSubscriptionQuery() { - return "UPDATE NOTIFICATION_SUBSCRIPTION SET CALLBACK_URL = ?, TIMESTAMP = ?, REQUEST = ?" + + return "UPDATE OB_NOTIFICATION_SUBSCRIPTION SET CALLBACK_URL = ?, TIMESTAMP = ?, REQUEST = ?" + "WHERE SUBSCRIPTION_ID = ?"; } public String updateEventSubscriptionStatusQuery() { - return "UPDATE NOTIFICATION_SUBSCRIPTION SET STATUS = ? WHERE SUBSCRIPTION_ID = ? && STATUS = 'CREATED'"; + return "UPDATE OB_NOTIFICATION_SUBSCRIPTION SET STATUS = ? WHERE SUBSCRIPTION_ID = ? && STATUS = 'CREATED'"; } public String deleteSubscribedEventTypesQuery() { - return "DELETE FROM NOTIFICATION_SUBSCRIPTION_EVENTS WHERE SUBSCRIPTION_ID = ?"; + return "DELETE FROM OB_NOTIFICATION_SUBSCRIBED_EVENTS WHERE SUBSCRIPTION_ID = ?"; } }