diff --git a/.gitignore b/.gitignore index 2bcb56e7..dcb739b8 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,8 @@ plugins/ios.json www/ $RECYCLE.BIN/ node_modules/ +**/webapps + #mac diff --git a/open-banking-accelerator/accelerators/ob-apim/README.md b/financial-services-accelerator/accelerators/ob-apim/README.md similarity index 100% rename from open-banking-accelerator/accelerators/ob-apim/README.md rename to financial-services-accelerator/accelerators/ob-apim/README.md diff --git a/open-banking-accelerator/accelerators/ob-apim/bin/configure.ps1 b/financial-services-accelerator/accelerators/ob-apim/bin/configure.ps1 similarity index 99% rename from open-banking-accelerator/accelerators/ob-apim/bin/configure.ps1 rename to financial-services-accelerator/accelerators/ob-apim/bin/configure.ps1 index e5264d46..84f16ca1 100644 --- a/open-banking-accelerator/accelerators/ob-apim/bin/configure.ps1 +++ b/financial-services-accelerator/accelerators/ob-apim/bin/configure.ps1 @@ -1,4 +1,4 @@ - # Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except diff --git a/open-banking-accelerator/accelerators/ob-apim/bin/configure.sh b/financial-services-accelerator/accelerators/ob-apim/bin/configure.sh similarity index 99% rename from open-banking-accelerator/accelerators/ob-apim/bin/configure.sh rename to financial-services-accelerator/accelerators/ob-apim/bin/configure.sh index b25a58d2..f04cb235 100755 --- a/open-banking-accelerator/accelerators/ob-apim/bin/configure.sh +++ b/financial-services-accelerator/accelerators/ob-apim/bin/configure.sh @@ -1,5 +1,5 @@ #!/bin/bash - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except diff --git a/open-banking-accelerator/accelerators/ob-apim/bin/merge.ps1 b/financial-services-accelerator/accelerators/ob-apim/bin/merge.ps1 similarity index 98% rename from open-banking-accelerator/accelerators/ob-apim/bin/merge.ps1 rename to financial-services-accelerator/accelerators/ob-apim/bin/merge.ps1 index a9846f8a..d49d9dc0 100644 --- a/open-banking-accelerator/accelerators/ob-apim/bin/merge.ps1 +++ b/financial-services-accelerator/accelerators/ob-apim/bin/merge.ps1 @@ -1,4 +1,4 @@ - # Copyright (c) 2023-2024, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except diff --git a/open-banking-accelerator/accelerators/ob-apim/bin/merge.sh b/financial-services-accelerator/accelerators/ob-apim/bin/merge.sh similarity index 96% rename from open-banking-accelerator/accelerators/ob-apim/bin/merge.sh rename to financial-services-accelerator/accelerators/ob-apim/bin/merge.sh index ad775161..c44f298b 100755 --- a/open-banking-accelerator/accelerators/ob-apim/bin/merge.sh +++ b/financial-services-accelerator/accelerators/ob-apim/bin/merge.sh @@ -1,5 +1,5 @@ #!/bin/bash - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except diff --git a/open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/conf/open-banking.xml b/financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/conf/financial-services.xml similarity index 97% rename from open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/conf/open-banking.xml rename to financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/conf/financial-services.xml index c474002e..11fbbf2d 100644 --- a/open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/conf/open-banking.xml +++ b/financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/conf/financial-services.xml @@ -1,6 +1,6 @@ - + com.wso2.openbanking.accelerator.gateway.executor.core.DefaultRequestRouter diff --git a/open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml b/financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml similarity index 93% rename from open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml rename to financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml index 151214d0..018efe5f 100644 --- a/open-banking-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml +++ b/financial-services-accelerator/accelerators/ob-apim/carbon-home/repository/deployment/server/synapse-configs/default/sequences/jsonConverter.xml @@ -1,5 +1,5 @@ - + diff --git a/open-banking-accelerator/accelerators/ob-apim/pom.xml b/financial-services-accelerator/accelerators/ob-apim/pom.xml similarity index 80% rename from open-banking-accelerator/accelerators/ob-apim/pom.xml rename to financial-services-accelerator/accelerators/ob-apim/pom.xml index 5dff7c99..637aa483 100644 --- a/open-banking-accelerator/accelerators/ob-apim/pom.xml +++ b/financial-services-accelerator/accelerators/ob-apim/pom.xml @@ -1,6 +1,6 @@ + dir="../../components/org.wso2.financial.services.accelerator.common/target"> + regex="org.wso2.financial.services.accelerator.common-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.gateway/target"> + regex="org.wso2.financial.services.accelerator.gateway-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.data.publisher/org.wso2.financial.services.accelerator.data.publisher.common/target"> + regex="org.wso2.financial.services.accelerator.data.publisher.common-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.keymanager/target"> + regex="org.wso2.financial.services.accelerator.keymanager-(\d.*?)\.jar$"/> + dir="../../internal-apis/internal-webapps/org.wso2.financial.services.accelerator.demo.backend/target"> + regex="api#financialservices#backend.war$"/> diff --git a/open-banking-accelerator/accelerators/ob-apim/repository/conf/configure.properties b/financial-services-accelerator/accelerators/ob-apim/repository/conf/configure.properties similarity index 83% rename from open-banking-accelerator/accelerators/ob-apim/repository/conf/configure.properties rename to financial-services-accelerator/accelerators/ob-apim/repository/conf/configure.properties index 800c21db..7a75ed4c 100644 --- a/open-banking-accelerator/accelerators/ob-apim/repository/conf/configure.properties +++ b/financial-services-accelerator/accelerators/ob-apim/repository/conf/configure.properties @@ -1,4 +1,4 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except @@ -20,8 +20,8 @@ IS_HOSTNAME=localhost BI_HOSTNAME=localhost # Specify the deployment.toml file containing the required configurations based on the APIM version being used -# As an example if APIM 4.1.0 version is used change the file name to wso2am-4.1.0-deployment.toml in the same file path -PRODUCT_CONF_PATH=repository/resources/wso2am-4.2.0-deployment.toml +# As an example if APIM 4.3.0 version is used change the file name to wso2am-4.3.0-deployment.toml in the same file path +PRODUCT_CONF_PATH=repository/resources/wso2am-4.3.0-deployment.toml # Configure databases related properties DB_TYPE=mysql diff --git a/open-banking-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/account-info-swagger.yaml b/financial-services-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/account-info-swagger.yaml similarity index 100% rename from open-banking-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/account-info-swagger.yaml rename to financial-services-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/account-info-swagger.yaml diff --git a/open-banking-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml b/financial-services-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml similarity index 96% rename from open-banking-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml rename to financial-services-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml index eddbbc20..54919e9f 100644 --- a/open-banking-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml +++ b/financial-services-accelerator/accelerators/ob-apim/repository/resources/apis/Accounts/accounts-dynamic-endpoint-insequence.xml @@ -1,5 +1,5 @@ + dir="../../components/org.wso2.financial.services.accelerator.identity/target"> + regex="org.wso2.financial.services.accelerator.identity-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.common/target"> + regex="org.wso2.financial.services.accelerator.common-(\d.*?)\.jar$"/> + dir="../../components/consent-management/org.wso2.financial.services.accelerator.consent.mgt.service/target"> + regex="org.wso2.financial.services.accelerator.consent.service-(\d.*?)\.jar$"/> + dir="../../components/consent-management/org.wso2.financial.services.accelerator.consent.extensions/target"> + regex="org.wso2.financial.services.accelerator.consent.extensions-(\d.*?)\.jar$"/> + dir="../../components/consent-management/org.wso2.financial.services.accelerator.consent.mgt.dao/target"> + regex="org.wso2.financial.services.accelerator.consent.dao-(\d.*?)\.jar$"/> + dir="../../components/ob-throttler/org.wso2.financial.services.accelerator.throttler.dao/target"> + regex="org.wso2.financial.services.accelerator.throttler.dao-(\d.*?)\.jar$"/> + dir="../../components/ob-throttler/org.wso2.financial.services.accelerator.throttler.service/target"> + regex="org.wso2.financial.services.accelerator.throttler.service-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.data.publisher/org.wso2.financial.services.accelerator.data.publisher.common/target"> + regex="org.wso2.financial.services.accelerator.data.publisher.common-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.data.publisher/org.wso2.financial.services.accelerator.authentication.data.publisher/target"> + regex="org.wso2.financial.services.accelerator.authentication.data.publisher-(\d.*?)\.jar$"/> + dir="../../components/org.wso2.financial.services.accelerator.runtime/org.wso2.financial.services.accelerator.runtime.identity.authn.filter/target"> + regex="org.wso2.financial.services.accelerator.runtime.identity.authn.filter-(\d.*?)\.jar$"/> - - - + + - + - + @@ -182,8 +182,8 @@ - - + + diff --git a/open-banking-accelerator/accelerators/ob-is/repository/conf/configure.properties b/financial-services-accelerator/accelerators/ob-is/repository/conf/configure.properties similarity index 83% rename from open-banking-accelerator/accelerators/ob-is/repository/conf/configure.properties rename to financial-services-accelerator/accelerators/ob-is/repository/conf/configure.properties index 9d2399b3..52bd4ac5 100644 --- a/open-banking-accelerator/accelerators/ob-is/repository/conf/configure.properties +++ b/financial-services-accelerator/accelerators/ob-is/repository/conf/configure.properties @@ -1,4 +1,4 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + # Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). # # WSO2 LLC. licenses this file to you under the Apache License, # Version 2.0 (the "License"); you may not use this file except @@ -18,13 +18,13 @@ IS_HOSTNAME=localhost APIM_HOSTNAME=localhost BI_HOSTNAME=localhost -IS_PRODUCT=wso2is-5.11.0 +IS_PRODUCT=wso2is-7.0.0 ISKM_CONNECTOR=wso2is-km-connector-1.0.16 ISKM_CONNECTOR_FOLDER=wso2is-extensions-1.0.16 # Specify the deployment.toml file containing the required configurations based on the IS version being used -# As an example if IS 6.0.0 version is used change the file name to wso2is-6.0.0-deployment.toml in the same file path -PRODUCT_CONF_PATH=repository/resources/wso2is-6.1.0-deployment.toml +# As an example if IS 7.0.0 version is used change the file name to wso2is-7.0.0-deployment.toml in the same file path +PRODUCT_CONF_PATH=repository/resources/wso2is-7.0.0-deployment.toml # Configure databases related properties DB_TYPE=mysql diff --git a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml similarity index 99% rename from open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml rename to financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml index 2058ab3d..7082984a 100644 --- a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml +++ b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-5.11.0-deployment.toml @@ -378,7 +378,7 @@ ciphers="TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA2 name="userPostSelfRegistration" subscriptions=["POST_ADD_USER"] -#================configs related to open-banking.xml============= +#================configs related to financial-services.xml============= [open_banking] username="$ref{super_admin.username}" diff --git a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml similarity index 99% rename from open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml rename to financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml index 2160f0ac..5a711401 100644 --- a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml +++ b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.0.0-deployment.toml @@ -378,7 +378,7 @@ ciphers="TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA2 name="userPostSelfRegistration" subscriptions=["POST_ADD_USER"] -#================configs related to open-banking.xml============= +#================configs related to financial-services.xml============= [open_banking] username="$ref{super_admin.username}" diff --git a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml similarity index 99% rename from open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml rename to financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml index 1c5792ec..518bb49c 100644 --- a/open-banking-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml +++ b/financial-services-accelerator/accelerators/ob-is/repository/resources/wso2is-6.1.0-deployment.toml @@ -378,7 +378,7 @@ ciphers="TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA2 name="userPostSelfRegistration" subscriptions=["POST_ADD_USER"] -#================configs related to open-banking.xml============= +#================configs related to financial-services.xml============= [open_banking] username="$ref{super_admin.username}" diff --git a/open-banking-accelerator/accelerators/ob-apim/src/assembly/bin.xml b/financial-services-accelerator/accelerators/ob-is/src/assembly/bin.xml similarity index 89% rename from open-banking-accelerator/accelerators/ob-apim/src/assembly/bin.xml rename to financial-services-accelerator/accelerators/ob-is/src/assembly/bin.xml index debe465d..15b23107 100644 --- a/open-banking-accelerator/accelerators/ob-apim/src/assembly/bin.xml +++ b/financial-services-accelerator/accelerators/ob-is/src/assembly/bin.xml @@ -1,5 +1,5 @@ diff --git a/open-banking-accelerator/accelerators/ob-bi/README.md b/open-banking-accelerator/accelerators/ob-bi/README.md deleted file mode 100644 index 92684c4a..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/README.md +++ /dev/null @@ -1,23 +0,0 @@ -### **WSO2 Open Banking BI Accelerator 3.0.0** - -**Try Locally:** - -Prerequisites: -1. Download WSO2 Streaming Integrator product -2. Build the repository completely using the below command to create accelerator zip files. - mvn clean install -PSolution -3. Locate the Accelerator Zip file (wso2-obbi-accelerator-3.0.0.zip) from - the target folder in this directory -3. Setup MySQL database server -4. Install Java on your local machine - -Below are the simplified steps to install the WSO2 Open Banking Accelerator. For more information, -please refer to [Quick Start Guide](https://ob.docs.wso2.com/en/latest/get-started/quick-start-guide/) or -to [ Complete install and Setup Guide ](https://ob.docs.wso2.com/en/latest/install-and-setup/) - -Steps: -1. Extract the Base product (WSO2 Streaming Integrator product) to a preferred location () -2. Extract WSO2 OB BI Accelerator (wso2-obbi-accelerator-3.0.0.zip) to WSO2_BI_HOME -3. Run /bin/merge.sh. This will copy the artifacts to the WSO2 SI -4. Run /bin/configure.sh. This will configure the server and create databases. -5. Run /bin/server.sh to start the server diff --git a/open-banking-accelerator/accelerators/ob-bi/bin/configure.ps1 b/open-banking-accelerator/accelerators/ob-bi/bin/configure.ps1 deleted file mode 100644 index a8334483..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/bin/configure.ps1 +++ /dev/null @@ -1,120 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# command to execute -# ./configure.ps1 - -$Props = convertfrom-stringdata (get-content ./../repository/conf/configure.properties -raw) -$WSO2_OB_BI_HOME = $args[0] - -# set accelerator home -Set-Location ../ -$ACCELERATOR_HOME = $pwd.path -Write-Output "Accelerator Home: $ACCELERATOR_HOME" - -# set product home -if ($null -eq $WSO2_OB_BI_HOME) -{ - Set-Location ../ - $WSO2_OB_BI_HOME = $pwd.path - Write-Output "Product Home: $WSO2_OB_BI_HOME" -} - -# validate product home -if (-NOT(Test-Path "$WSO2_OB_BI_HOME/deployment/siddhi-files")) -{ - Write-Output "`n`aERROR:specified product path is not a valid carbon product path`n" - exit 2 -} -else -{ - Write-Output "`nValid carbon product path.`n" -} - -# read deployment.yaml file -$DEPLOYMENT_YAML_FILE = "$ACCELERATOR_HOME/repository/resources/deployment.yaml" -Copy-Item -Path "$ACCELERATOR_HOME/$( $Props.'PRODUCT_CONF_PATH' )" $DEPLOYMENT_YAML_FILE - -Function Configure-Datasources -{ - if ($Props.'DB_TYPE' -eq "mysql") - { - # BI - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_OB_REPORTING_URL", "jdbc:mysql://$( $Props.'DB_HOST' ):3306/$( $Props.'DB_OB_REPORTING' )?autoReconnect=true&useSSL=false" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_OB_REPORTING_SUMMARIZED_URL", "jdbc:mysql://$( $Props.'DB_HOST' ):3306/$( $Props.'DB_OB_REPORTING_SUMMARIZED' )?autoReconnect=true&useSSL=false" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_USER", "$( $Props.'DB_USER' )" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_PASS", "$( $Props.'DB_PASS' )" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_DRIVER", "$( $Props.'DB_DRIVER' )" }) - } - else - { - # BI - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_OB_REPORTING_URL", "jdbc:sqlserver://$( $Props.'DB_HOST' ):1433;databaseName=$( $Props.'DB_OB_REPORTING' );encrypt=false" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_OB_REPORTING_SUMMARIZED_URL", "jdbc:sqlserver://$( $Props.'DB_HOST' ):1433;databaseName=$( $Props.'DB_OB_REPORTING_SUMMARIZED' );encrypt=false" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_USER", "$( $Props.'DB_USER' )" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_PASS", "$( $Props.'DB_PASS' )" }) - Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "DB_DRIVER", "$( $Props.'DB_DRIVER' )" }) - } -} - -Function Create-Databases -{ - if ($Props.'DB_TYPE' -eq "mysql") - { - if ($Props.'DB_PASS' -eq "") - { - $DB_MYSQL_PASS = "" - } - else - { - $DB_MYSQL_PASS = $Props.'DB_PASS' - } - - Write-Output "`nCreating MySQL databases" - Write-Output "================================================`n" - Create-Mysql-Databases - - } - else - { - Write-Output "`nAssume MSSQL/Oracle databases have already created manually" - } -} - -Function Create-Mysql-Databases -{ - mysql -u"$( $Props.'DB_USER' )" -p"$DB_MYSQL_PASS" -h"$( $Props.'DB_HOST' )" -e"DROP DATABASE IF EXISTS $( $Props.'DB_OB_REPORTING' ); CREATE DATABASE $( $Props.'DB_OB_REPORTING' ); ALTER DATABASE $( $Props.'DB_OB_REPORTING' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci"; - Write-Output "Database Created: $( $Props.'DB_OB_REPORTING' )"; - mysql -u"$( $Props.'DB_USER' )" -p"$DB_MYSQL_PASS" -h"$( $Props.'DB_HOST' )" -e"DROP DATABASE IF EXISTS $( $Props.'DB_OB_REPORTING_SUMMARIZED' ); CREATE DATABASE $( $Props.'DB_OB_REPORTING_SUMMARIZED' ); ALTER DATABASE $( $Props.'DB_OB_REPORTING_SUMMARIZED' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci"; - Write-Output "Database Created: $( $Props.'DB_OB_REPORTING_SUMMARIZED' )"; -} - -Write-Output "`nReplace hostnames `n" -Write-Output "================================================`n" -Set-Content -Path $DEPLOYMENT_YAML_FILE -Value (get-content $DEPLOYMENT_YAML_FILE | ForEach-Object{ $_ -replace "APIM_HOSTNAME", "$( $Props.'APIM_HOSTNAME' )" }) - -Write-Output "`nConfigure datasources `n" -Write-Output "================================================`n" -Configure-Datasources - -Write-Output "`nCreate databases" -Write-Output "================================================`n" -Create-Databases - -Write-Output "`nCopy deployment.yaml file to conf/server `n" -Write-Output "================================================`n" -Copy-Item $DEPLOYMENT_YAML_FILE $WSO2_OB_BI_HOME/conf/server/ -Remove-Item $DEPLOYMENT_YAML_FILE diff --git a/open-banking-accelerator/accelerators/ob-bi/bin/configure.sh b/open-banking-accelerator/accelerators/ob-bi/bin/configure.sh deleted file mode 100755 index 71dba79f..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/bin/configure.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# command to execute -# ./configure.sh - -source $(pwd)/../repository/conf/configure.properties -WSO2_OB_BI_HOME=$1 - -# set accelerator home -cd ../ -ACCELERATOR_HOME=$(pwd) -echo "Accelerator Home: ${ACCELERATOR_HOME}" - -# set product home -if [ "${WSO2_OB_BI_HOME}" == "" ] - then - cd ../ - WSO2_OB_BI_HOME=$(pwd) - echo "Product home is: ${WSO2_OB_BI_HOME}" -fi - -# validate product home -if [ ! -d "${WSO2_OB_BI_HOME}/deployment/siddhi-files" ]; then - echo -e "\n\aERROR:specified product path is not a valid carbon product path\n"; - exit 2; -else - echo -e "\nValid carbon product path.\n"; -fi - -# read deployment.toml file -DEPLOYMENT_YAML_FILE=${ACCELERATOR_HOME}/repository/resources/deployment.yaml; -cp ${ACCELERATOR_HOME}/${PRODUCT_CONF_PATH} ${DEPLOYMENT_YAML_FILE}; - - -configure_datasources() { - if [ "${DB_TYPE}" == "mysql" ] - then - # BI - sed -i -e 's|DB_OB_REPORTING_URL|jdbc:mysql://'${DB_HOST}':3306/'${DB_OB_REPORTING}'?autoReconnect=true\&useSSL=false|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_OB_REPORTING_SUMMARIZED_URL|jdbc:mysql://'${DB_HOST}':3306/'${DB_OB_REPORTING_SUMMARIZED}'?autoReconnect=true\&useSSL=false|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_USER|'${DB_USER}'|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_PASS|'${DB_PASS}'|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_DRIVER|'${DB_DRIVER}'|g' ${DEPLOYMENT_YAML_FILE} - - else - # BI - sed -i -e 's|DB_OB_REPORTING_URL|jdbc:sqlserver://'${DB_HOST}':1433;databaseName='${DB_OB_REPORTING}';encrypt=false|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_OB_REPORTING_SUMMARIZED_URL|jdbc:sqlserver://'${DB_HOST}':1433;databaseName='${DB_OB_REPORTING_SUMMARIZED}';encrypt=false|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_USER|'${DB_USER}'|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_PASS|'${DB_PASS}'|g' ${DEPLOYMENT_YAML_FILE} - sed -i -e 's|DB_DRIVER|'${DB_DRIVER}'|g' ${DEPLOYMENT_YAML_FILE} - fi -} - -create_databases() { - if [ "${DB_TYPE}" == "mysql" ] - then - if [ "${DB_PASS}" == "" ] - then - DB_MYSQL_PASS="" - else - DB_MYSQL_PASS="-p${DB_PASS}" - fi - - echo -e "\nCreating MySQL databases" - echo -e "================================================\n" - create_mysql_databases; - - else - echo -e "\nAssume MSSQL/Oracle databases have already created manually" - fi -} - -create_mysql_databases() { - mysql -u${DB_USER} ${DB_MYSQL_PASS} -h${DB_HOST} -e "DROP DATABASE IF EXISTS ${DB_OB_REPORTING}; CREATE DATABASE ${DB_OB_REPORTING}; - ALTER DATABASE ${DB_OB_REPORTING} CHARACTER SET latin1 COLLATE latin1_swedish_ci"; - echo "Database Created: ${DB_OB_REPORTING}"; - mysql -u${DB_USER} ${DB_MYSQL_PASS} -h${DB_HOST} -e "DROP DATABASE IF EXISTS ${DB_OB_REPORTING_SUMMARIZED}; CREATE DATABASE ${DB_OB_REPORTING_SUMMARIZED}; - ALTER DATABASE ${DB_OB_REPORTING_SUMMARIZED} CHARACTER SET latin1 COLLATE latin1_swedish_ci"; - echo "Database Created: ${DB_OB_REPORTING_SUMMARIZED}"; -}; - -echo -e "\nReplace hostnames \n" -echo -e "================================================\n" -sed -i -e 's|APIM_HOSTNAME|'${APIM_HOSTNAME}'|g' ${DEPLOYMENT_YAML_FILE} - -echo -e "\nConfigure datasources \n" -echo -e "================================================\n" -configure_datasources; - -echo -e "\nCreate databases" -echo -e "================================================\n" -create_databases; - -echo -e "\nCopy deployment.yaml file to conf/server \n" -echo -e "================================================\n" -cp ${DEPLOYMENT_YAML_FILE} ${WSO2_OB_BI_HOME}/conf/server/ -rm ${DEPLOYMENT_YAML_FILE} -rm -f ${DEPLOYMENT_YAML_FILE}-e diff --git a/open-banking-accelerator/accelerators/ob-bi/bin/merge.bat b/open-banking-accelerator/accelerators/ob-bi/bin/merge.bat deleted file mode 100644 index 4bf0d31a..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/bin/merge.bat +++ /dev/null @@ -1,47 +0,0 @@ - REM Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - REM - REM WSO2 LLC. licenses this file to you under the Apache License, - REM Version 2.0 (the "License"); you may not use this file except - REM in compliance with the License. - REM You may obtain a copy of the License at - REM - REM http://www.apache.org/licenses/LICENSE-2.0 - REM - REM Unless required by applicable law or agreed to in writing, - REM software distributed under the License is distributed on an - REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - REM KIND, either express or implied. See the License for the - REM specific language governing permissions and limitations - REM under the License. - -REM merge.bat script copy the WSO2 OB BI accelerator artifacts on top of WSO2 SI base product - -REM merge.bat - -@echo off - -SET SI_HOME=%1 - -REM set accelerator home -cd %CD%..\.. -SET OB_BI_ACCELERATOR_HOME=%CD% -echo "Accelerator home is: %OB_BI_ACCELERATOR_HOME%" - -REM set product home -if "%SI_HOME%" == "" ( - cd %CD%..\.. - SET SI_HOME=%CD% - echo "Product home is: %SI_HOME%" -) -REM validate product home -if not exist %SI_HOME%\deployment\siddhi-files ( - echo "ERROR:specified product path is not a valid carbon product path" -) else ( - echo "Valid carbon product path." -) - -echo "Copying open banking artifacts" -echo ================================================ - -robocopy %OB_BI_ACCELERATOR_HOME%\carbon-home /e %SI_HOME% -echo "Complete!" diff --git a/open-banking-accelerator/accelerators/ob-bi/bin/merge.sh b/open-banking-accelerator/accelerators/ob-bi/bin/merge.sh deleted file mode 100755 index 8dc3adf7..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/bin/merge.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# merge.sh script copy the WSO2 OB BI accelerator artifacts on top of WSO2 SI base product -# -# merge.sh - -WSO2_OB_BI_HOME=$1 - -# set accelerator home -cd ../ -ACCELERATOR_HOME=$(pwd) -echo "Accelerator home is: ${ACCELERATOR_HOME}" - -# set product home -if [ "${WSO2_OB_BI_HOME}" == "" ]; - then - cd ../ - WSO2_OB_BI_HOME=$(pwd) - echo "Product home is: ${WSO2_OB_BI_HOME}" -fi - -# validate product home -if [ ! -d "${WSO2_OB_BI_HOME}/deployment/siddhi-files" ]; then - echo -e "\n\aERROR:specified product path is not a valid carbon product path\n"; - exit 2; -else - echo -e "\nValid carbon product path.\n"; -fi - -echo -e "\nCopying open banking artifacts\n" -echo -e "================================================\n" -cp -r ${ACCELERATOR_HOME}/carbon-home/* "${WSO2_OB_BI_HOME}"/ -echo -e "\nComplete!\n" diff --git a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APILatencyRawDataApp.siddhi b/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APILatencyRawDataApp.siddhi deleted file mode 100644 index 6a2c5e77..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APILatencyRawDataApp.siddhi +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@App:name("APILatencyRawDataApp") - -@source(type='wso2event', @map(type='wso2event')) -define stream APILatencyInputStream(MESSAGE_ID string, REQUEST_TIMESTAMP string, BACKEND_LATENCY long, - REQUEST_MEDIATION_LATENCY long, RESPONSE_LATENCY long, RESPONSE_MEDIATION_LATENCY long); - -@primaryKey('ID','MESSAGE_ID') -@store(type='rdbms', datasource='OB_REPORTING_DB') -define table API_LATENCY_RAW_DATA(ID string, MESSAGE_ID string, REQUEST_TIMESTAMP string, BACKEND_LATENCY long, - REQUEST_MEDIATION_LATENCY long, RESPONSE_LATENCY long, RESPONSE_MEDIATION_LATENCY long); - -from APILatencyInputStream -select UUID() as ID, MESSAGE_ID, REQUEST_TIMESTAMP, BACKEND_LATENCY, REQUEST_MEDIATION_LATENCY, RESPONSE_LATENCY, - RESPONSE_MEDIATION_LATENCY -insert into API_LATENCY_RAW_DATA; diff --git a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APIRawDataSubmissionApp.siddhi b/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APIRawDataSubmissionApp.siddhi deleted file mode 100644 index eac66b4a..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/APIRawDataSubmissionApp.siddhi +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@App:name("APIRawDataSubmissionApp") - -@source(type='wso2event', @map(type='wso2event')) -define stream APIInputStream(CONSENT_ID string, CONSUMER_ID string, CLIENT_ID string, USER_AGENT string, - STATUS_CODE int, HTTP_METHOD string, RESPONSE_PAYLOAD_SIZE long, ELECTED_RESOURCE string, - API_NAME string, API_SPEC_VERSION string, TIMESTAMP long, MESSAGE_ID string); - -@primaryKey('ID','ELECTED_RESOURCE') -@store(type='rdbms', datasource='OB_REPORTING_DB') -define table API_INVOCATION_RAW_DATA(ID string, CONSENT_ID string, CONSUMER_ID string, CLIENT_ID string, - USER_AGENT string, STATUS_CODE int, HTTP_METHOD string, RESPONSE_PAYLOAD_SIZE long, - ELECTED_RESOURCE string, API_NAME string, API_SPEC_VERSION string, TIMESTAMP long, - MESSAGE_ID string); - -from APIInputStream -select UUID() as ID, CONSENT_ID, CONSUMER_ID, CLIENT_ID, USER_AGENT, STATUS_CODE, HTTP_METHOD, RESPONSE_PAYLOAD_SIZE, - ELECTED_RESOURCE, API_NAME, API_SPEC_VERSION, TIMESTAMP, MESSAGE_ID -insert into API_INVOCATION_RAW_DATA; diff --git a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AccessTokenRawDataApp.siddhi b/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AccessTokenRawDataApp.siddhi deleted file mode 100644 index b1f6984d..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AccessTokenRawDataApp.siddhi +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@App:name("AccessTokenRawDataApp") - -@source(type='wso2event', @map(type='wso2event')) -define stream AccessTokenInputStream(ACCESS_TOKEN_ID string); - -@primaryKey('ACCESS_TOKEN_ID') -@store(type='rdbms', datasource='OB_REPORTING_DB') -define table ACCESS_TOKEN_RAW_DATA(ACCESS_TOKEN_ID string, TIMESTAMP long); - -from AccessTokenInputStream -select ACCESS_TOKEN_ID, time:timestampInMilliseconds()/1000 as TIMESTAMP -insert into ACCESS_TOKEN_RAW_DATA; diff --git a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AuthenticationDataSubmissionApp.siddhi b/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AuthenticationDataSubmissionApp.siddhi deleted file mode 100644 index 3db2a5cf..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/AuthenticationDataSubmissionApp.siddhi +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@App:name("AuthenticationDataSubmissionApp") - -@source(type='wso2event', @map(type='wso2event')) -define stream AuthenticationInputStream(USER_ID string, AUTHENTICATION_STEP string, AUTHENTICATION_STATUS string, - AUTHENTICATION_APPROACH string, PSU_CHANNEL string, TIMESTAMP long); - -@primaryKey('ID','TIMESTAMP') -@store(type='rdbms', datasource='OB_REPORTING_DB') -define table AUTHENTICATION_RAW_DATA(ID string, USER_ID string, AUTHENTICATION_STEP string, - AUTHENTICATION_STATUS string, AUTHENTICATION_APPROACH string, PSU_CHANNEL string, TIMESTAMP long); - - -from AuthenticationInputStream -select UUID() as ID, USER_ID, AUTHENTICATION_STEP, AUTHENTICATION_STATUS, AUTHENTICATION_APPROACH, PSU_CHANNEL, - TIMESTAMP -insert into AUTHENTICATION_RAW_DATA; diff --git a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/DisputeResolutionImplementationApp.siddhi b/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/DisputeResolutionImplementationApp.siddhi deleted file mode 100644 index 93f24cc1..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/carbon-home/deployment/siddhi-files/DisputeResolutionImplementationApp.siddhi +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@App:name("DisputeResolutionImplementationApp") - -@source(type='wso2event', @map(type='wso2event')) -define stream DisputeResolutionStream(STATUS_CODE int, HTTP_METHOD string, TIMESTAMP long, - REQUEST_BODY string, RESPONSE_BODY string, ELECTED_RESOURCE string, - HEADERS string); - -@primaryKey('ID') -@store(type='rdbms', datasource='OB_REPORTING_DB', field.length="REQUEST_BODY:4096, RESPONSE_BODY:4096, HEADERS:2048") -define table DISPUTE_RESOLUTION_DATA(ID string, STATUS_CODE int, HTTP_METHOD string, TIMESTAMP long, - REQUEST_BODY string, RESPONSE_BODY string, ELECTED_RESOURCE string, - HEADERS string); - - -from DisputeResolutionStream -select UUID() as ID, STATUS_CODE, HTTP_METHOD, TIMESTAMP, REQUEST_BODY, RESPONSE_BODY, ELECTED_RESOURCE, HEADERS -insert into DISPUTE_RESOLUTION_DATA; - diff --git a/open-banking-accelerator/accelerators/ob-bi/pom.xml b/open-banking-accelerator/accelerators/ob-bi/pom.xml deleted file mode 100644 index 98bd09f8..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - 4.0.0 - - - com.wso2.openbanking.accelerator - open-banking - 3.2.0-SNAPSHOT - ../pom.xml - - - wso2-obbi-accelerator - pom - WSO2 Open Banking - Business Intelligence Accelerator Module - http://wso2.org - - - ${basedir} - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - package - - single - - - false - - src/assembly/bin.xml - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-bi/repository/conf/configure.properties b/open-banking-accelerator/accelerators/ob-bi/repository/conf/configure.properties deleted file mode 100644 index 445d1765..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/repository/conf/configure.properties +++ /dev/null @@ -1,39 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# Specify the hostname you want to configure -BI_HOSTNAME=localhost -APIM_HOSTNAME=localhost - -# Specify the deployment.toml file containing the required configurations -PRODUCT_CONF_PATH=repository/resources/wso2si-4.2.0-deployment.yaml - - -# Configure databases related properties -DB_TYPE=mysql -DB_USER=root -DB_PASS=root -DB_HOST=localhost -DB_DRIVER=com.mysql.jdbc.Driver - -DB_APIMGT=openbank_apimgtdb -DB_USER_STORE=openbank_userdb -DB_AM_CONFIG=openbank_am_configdb -DB_GOV=openbank_govdb -DB_IS_CONFIG=openbank_iskm_configdb -DB_OPEN_BANKING_STORE=openbank_openbankingdb -DB_OB_REPORTING=openbank_ob_reporting_statsdb -DB_OB_REPORTING_SUMMARIZED=openbank_ob_reporting_summarizeddb diff --git a/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.0.0-deployment.yaml b/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.0.0-deployment.yaml deleted file mode 100644 index 3b7e9bb1..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.0.0-deployment.yaml +++ /dev/null @@ -1,503 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# Carbon Configuration Parameters -wso2.carbon: - # value to uniquely identify a server - id: wso2-si - # server name - name: WSO2 Streaming Integrator - # server type - type: wso2-si - # ports used by this server - ports: - # port offset - offset: 1 - -wso2.transport.http: - transportProperties: - - - name: "server.bootstrap.socket.timeout" - value: 60 - - - name: "client.bootstrap.socket.timeout" - value: 60 - - - name: "latency.metrics.enabled" - value: true - - listenerConfigurations: - - - id: "default" - host: "0.0.0.0" - port: 9091 - - - id: "msf4j-https" - host: "0.0.0.0" - port: 9443 - scheme: https - keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks" - keyStorePassword: wso2carbon - certPass: wso2carbon - - senderConfigurations: - - - id: "http-sender" - -siddhi.stores.query.api: - transportProperties: - - - name: "server.bootstrap.socket.timeout" - value: 60 - - - name: "client.bootstrap.socket.timeout" - value: 60 - - - name: "latency.metrics.enabled" - value: true - - listenerConfigurations: - - - id: "default" - host: "0.0.0.0" - port: 7071 - - - id: "msf4j-https" - host: "0.0.0.0" - port: 7444 - scheme: https - keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks" - keyStorePassword: wso2carbon - certPass: wso2carbon - - # Configuration used for the databridge communication -databridge.config: - # No of worker threads to consume events - # THIS IS A MANDATORY FIELD - workerThreads: 10 - # Maximum amount of messages that can be queued internally in MB - # THIS IS A MANDATORY FIELD - maxEventBufferCapacity: 10000000 - # Queue size; the maximum number of events that can be stored in the queue - # THIS IS A MANDATORY FIELD - eventBufferSize: 2000 - # Keystore file path - # THIS IS A MANDATORY FIELD - keyStoreLocation : ${sys:carbon.home}/resources/security/wso2carbon.jks - # Keystore password - # THIS IS A MANDATORY FIELD - keyStorePassword : wso2carbon - # Session Timeout value in mins - # THIS IS A MANDATORY FIELD - clientTimeoutMin: 30 - # Data receiver configurations - # THIS IS A MANDATORY FIELD - dataReceivers: - - - # Data receiver configuration - dataReceiver: - # Data receiver type - # THIS IS A MANDATORY FIELD - type: Thrift - # Data receiver properties - properties: - tcpPort: '7611' - sslPort: '7711' - - - - # Data receiver configuration - dataReceiver: - # Data receiver type - # THIS IS A MANDATORY FIELD - type: Binary - # Data receiver properties - properties: - tcpPort: '9611' - sslPort: '9711' - tcpReceiverThreadPoolSize: '100' - sslReceiverThreadPoolSize: '100' - hostName: 0.0.0.0 - - # Configuration of the Data Agents - to publish events through databridge -data.agent.config: - # Data agent configurations - # THIS IS A MANDATORY FIELD - agents: - - - # Data agent configuration - agentConfiguration: - # Data agent name - # THIS IS A MANDATORY FIELD - name: Thrift - # Data endpoint class - # THIS IS A MANDATORY FIELD - dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint - # Data publisher strategy - publishingStrategy: async - # Trust store path - trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks' - # Trust store password - trustStorePassword: 'wso2carbon' - # Queue Size - queueSize: 32768 - # Batch Size - batchSize: 200 - # Core pool size - corePoolSize: 1 - # Socket timeout in milliseconds - socketTimeoutMS: 30000 - # Maximum pool size - maxPoolSize: 1 - # Keep alive time in pool - keepAliveTimeInPool: 20 - # Reconnection interval - reconnectionInterval: 30 - # Max transport pool size - maxTransportPoolSize: 250 - # Max idle connections - maxIdleConnections: 250 - # Eviction time interval - evictionTimePeriod: 5500 - # Min idle time in pool - minIdleTimeInPool: 5000 - # Secure max transport pool size - secureMaxTransportPoolSize: 250 - # Secure max idle connections - secureMaxIdleConnections: 250 - # secure eviction time period - secureEvictionTimePeriod: 5500 - # Secure min idle time in pool - secureMinIdleTimeInPool: 5000 - # SSL enabled protocols - sslEnabledProtocols: TLSv1.1,TLSv1.2 - # Ciphers - ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - - - # Data agent configuration - agentConfiguration: - # Data agent name - # THIS IS A MANDATORY FIELD - name: Binary - # Data endpoint class - # THIS IS A MANDATORY FIELD - dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint - # Data publisher strategy - publishingStrategy: async - # Trust store path - trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks' - # Trust store password - trustStorePassword: 'wso2carbon' - # Queue Size - queueSize: 32768 - # Batch Size - batchSize: 200 - # Core pool size - corePoolSize: 1 - # Socket timeout in milliseconds - socketTimeoutMS: 30000 - # Maximum pool size - maxPoolSize: 1 - # Keep alive time in pool - keepAliveTimeInPool: 20 - # Reconnection interval - reconnectionInterval: 30 - # Max transport pool size - maxTransportPoolSize: 250 - # Max idle connections - maxIdleConnections: 250 - # Eviction time interval - evictionTimePeriod: 5500 - # Min idle time in pool - minIdleTimeInPool: 5000 - # Secure max transport pool size - secureMaxTransportPoolSize: 250 - # Secure max idle connections - secureMaxIdleConnections: 250 - # secure eviction time period - secureEvictionTimePeriod: 5500 - # Secure min idle time in pool - secureMinIdleTimeInPool: 5000 - # SSL enabled protocols - sslEnabledProtocols: TLSv1.1,TLSv1.2 - # Ciphers - ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - -# This is the main configuration for metrics -wso2.metrics: - # Enable Metrics - enabled: false - reporting: - console: - - # The name for the Console Reporter - name: Console - - # Enable Console Reporter - enabled: false - - # Polling Period in seconds. - # This is the period for polling metrics from the metric registry and printing in the console - pollingPeriod: 5 - -wso2.metrics.jdbc: - # Data Source Configurations for JDBC Reporters - dataSource: - # Default Data Source Configuration - - &JDBC01 - # JNDI name of the data source to be used by the JDBC Reporter. - # This data source should be defined in a *-datasources.xml file in conf/datasources directory. - dataSourceName: java:comp/env/jdbc/WSO2MetricsDB - # Schedule regular deletion of metrics data older than a set number of days. - # It is recommended that you enable this job to ensure your metrics tables do not get extremely large. - # Deleting data older than seven days should be sufficient. - scheduledCleanup: - # Enable scheduled cleanup to delete Metrics data in the database. - enabled: true - - # The scheduled job will cleanup all data older than the specified days - daysToKeep: 3 - - # This is the period for each cleanup operation in seconds. - scheduledCleanupPeriod: 86400 - - # The JDBC Reporter is in the Metrics JDBC Core feature - reporting: - # The JDBC Reporter configurations will be ignored if the Metrics JDBC Core feature is not available in runtime - jdbc: - - # The name for the JDBC Reporter - name: JDBC - - # Enable JDBC Reporter - enabled: true - - # Source of Metrics, which will be used to identify each metric in database --> - # Commented to use the hostname by default - # source: Carbon - - # Alias referring to the Data Source configuration - dataSource: *JDBC01 - - # Polling Period in seconds. - # This is the period for polling metrics from the metric registry and updating the database with the values - pollingPeriod: 60 - - # Deployment configuration parameters -wso2.artifact.deployment: - # Scheduler update interval - updateInterval: 5 - - # Periodic Persistence Configuration -state.persistence: - enabled: false - intervalInMin: 1 - revisionsToKeep: 2 - persistenceStore: org.wso2.carbon.streaming.integrator.core.persistence.FileSystemPersistenceStore - config: - location: siddhi-app-persistence - - # Siddhi Error Store Configuration -error.store: - enabled: false - - # Size of the buffer which is used in publishing erroneous events to the error store. Must be a power of 2. - bufferSize: 1024 - - # Whether to drop erroneous events when the buffer is full. - dropWhenBufferFull: true - - # Class that has the implementation of the error store. - errorStore: org.wso2.carbon.streaming.integrator.core.siddhi.error.handler.DBErrorStore - - config: - datasource: WSO2_CARBON_DB - table: SIDDHI_ERROR_STORE_TABLE - - # Secure Vault Configuration -wso2.securevault: - secretRepository: - type: org.wso2.carbon.secvault.repository.DefaultSecretRepository - parameters: - privateKeyAlias: wso2carbon - keystoreLocation: ${sys:carbon.home}/resources/security/securevault.jks - secretPropertiesFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/secrets.properties - masterKeyReader: - type: org.wso2.carbon.secvault.reader.DefaultMasterKeyReader - parameters: - masterKeyReaderFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/master-keys.yaml - - # Datasource Configurations -wso2.datasources: - dataSources: - - - name: WSO2_CLUSTER_DB - description: "The datasource used by cluster coordinators in HA deployment" - definition: - type: RDBMS - configuration: - connectionTestQuery: "SELECT 1" - driverClassName: org.h2.Driver - idleTimeout: 60000 - isAutoCommit: false - jdbcUrl: "jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/WSO2_CLUSTER_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000;AUTO_SERVER=TRUE" - maxPoolSize: 10 - password: wso2carbon - username: wso2carbon - validationTimeout: 30000 - - - name: WSO2_PERMISSIONS_DB - description: The datasource used for permission feature - jndiConfig: - name: jdbc/PERMISSION_DB - useJndiReference: true - definition: - type: RDBMS - configuration: - jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/PERMISSION_DB;IFEXISTS=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000;MVCC=TRUE' - username: wso2carbon - password: wso2carbon - driverClassName: org.h2.Driver - maxPoolSize: 10 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - validationTimeout: 30000 - isAutoCommit: false - # carbon metrics data source - - name: WSO2_METRICS_DB - description: The datasource used for dashboard feature - jndiConfig: - name: jdbc/WSO2MetricsDB - definition: - type: RDBMS - configuration: - jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/metrics;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000;' - username: wso2carbon - password: wso2carbon - driverClassName: org.h2.Driver - maxPoolSize: 30 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - validationTimeout: 30000 - isAutoCommit: false - - name: OB_REPORTING_DB - description: The datasource used to store statistics for OB Reporting module - jndiConfig: - name: jdbc/OB_REPORTING_DB - definition: - type: RDBMS - configuration: - jdbcUrl: 'DB_OB_REPORTING_URL' - username: 'DB_USER' - password: 'DB_PASS' - driverClassName: 'DB_DRIVER' - maxPoolSize: 20 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - # Use below for oracle database - # connectionTestQuery: SELECT 1 FROM DUAL - validationTimeout: 30000 - isAutoCommit: false - - name: OB_REPORTING_SUMMARIZED_DB - description: The datasource used to store statistics for OB Reporting module - jndiConfig: - name: jdbc/OB_REPORTING_SUMMARIZED_DB - definition: - type: RDBMS - configuration: - jdbcUrl: 'DB_OB_REPORTING_SUMMARIZED_URL' - username: 'DB_USER' - password: 'DB_PASS' - driverClassName: 'DB_DRIVER' - maxPoolSize: 20 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - # Use below for oracle database - # connectionTestQuery: SELECT 1 FROM DUAL - validationTimeout: 30000 - isAutoCommit: false - # Cluster Configuration -cluster.config: - enabled: false - groupId: si - coordinationStrategyClass: org.wso2.carbon.cluster.coordinator.rdbms.RDBMSCoordinationStrategy - strategyConfig: - datasource: WSO2_CLUSTER_DB - heartbeatInterval: 3000 - heartbeatMaxRetry: 3 - eventPollingInterval: 3000 - -# Authentication configuration -auth.configs: - type: 'local' # Type of the IdP client used - userManager: - adminRole: admin # Admin role which is granted all permissions - userStore: # User store - users: - - - user: - username: admin@wso2.com@carbon.super - password: d3NvMjEyMw== - roles: 1 - roles: - - - role: - id: 1 - displayName: admin - -# Async API service catalogue configuration -async.api.configs: - enabled: false - hostname: "APIM_HOSTNAME" - port: 9443 - username: admin@wso2.com@carbon.super - password: d3NvMjEyMw== - - # Sample of deployment.config for Two node HA -#deployment.config: -# type: ha -# passiveNodeDetailsWaitTimeOutMillis: 300000 -# passiveNodeDetailsRetrySleepTimeMillis: 500 -# eventSyncServer: -# host: localhost -# port: 9893 -# advertisedHost: localhost -# advertisedPort: 9893 -# bossThreads: 10 -# workerThreads: 10 -# eventSyncClientPool: -# maxActive: 10 -# maxTotal: 10 -# maxIdle: 10 -# maxWait: 60000 -# minEvictableIdleTimeMillis: 120000 - - # Sample of deployment.config for Distributed deployment -#deployment.config: -# type: distributed -# isReceiverNode: false -# httpsInterface: -# host: 192.168.1.3 -# port: 9443 -# username: admin -# password: admin -# leaderRetryInterval: 10000 -# resourceManagers: -# - host: 192.168.1.1 -# port: 9543 -# username: admin -# password: admin -# - host: 192.168.1.2 -# port: 9543 -# username: admin -# password: admin diff --git a/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.2.0-deployment.yaml b/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.2.0-deployment.yaml deleted file mode 100644 index 8548759a..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/repository/resources/wso2si-4.2.0-deployment.yaml +++ /dev/null @@ -1,503 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -# Carbon Configuration Parameters -wso2.carbon: - # value to uniquely identify a server - id: wso2-si - # server name - name: WSO2 Streaming Integrator - # server type - type: wso2-si - # ports used by this server - ports: - # port offset - offset: 1 - -wso2.transport.http: - transportProperties: - - - name: "server.bootstrap.socket.timeout" - value: 60 - - - name: "client.bootstrap.socket.timeout" - value: 60 - - - name: "latency.metrics.enabled" - value: true - - listenerConfigurations: - - - id: "default" - host: "0.0.0.0" - port: 9091 - - - id: "msf4j-https" - host: "0.0.0.0" - port: 9443 - scheme: https - keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks" - keyStorePassword: wso2carbon - certPass: wso2carbon - - senderConfigurations: - - - id: "http-sender" - -siddhi.stores.query.api: - transportProperties: - - - name: "server.bootstrap.socket.timeout" - value: 60 - - - name: "client.bootstrap.socket.timeout" - value: 60 - - - name: "latency.metrics.enabled" - value: true - - listenerConfigurations: - - - id: "default" - host: "0.0.0.0" - port: 7071 - - - id: "msf4j-https" - host: "0.0.0.0" - port: 7444 - scheme: https - keyStoreFile: "${carbon.home}/resources/security/wso2carbon.jks" - keyStorePassword: wso2carbon - certPass: wso2carbon - - # Configuration used for the databridge communication -databridge.config: - # No of worker threads to consume events - # THIS IS A MANDATORY FIELD - workerThreads: 10 - # Maximum amount of messages that can be queued internally in MB - # THIS IS A MANDATORY FIELD - maxEventBufferCapacity: 10000000 - # Queue size; the maximum number of events that can be stored in the queue - # THIS IS A MANDATORY FIELD - eventBufferSize: 2000 - # Keystore file path - # THIS IS A MANDATORY FIELD - keyStoreLocation : ${sys:carbon.home}/resources/security/wso2carbon.jks - # Keystore password - # THIS IS A MANDATORY FIELD - keyStorePassword : wso2carbon - # Session Timeout value in mins - # THIS IS A MANDATORY FIELD - clientTimeoutMin: 30 - # Data receiver configurations - # THIS IS A MANDATORY FIELD - dataReceivers: - - - # Data receiver configuration - dataReceiver: - # Data receiver type - # THIS IS A MANDATORY FIELD - type: Thrift - # Data receiver properties - properties: - tcpPort: '7611' - sslPort: '7711' - - - - # Data receiver configuration - dataReceiver: - # Data receiver type - # THIS IS A MANDATORY FIELD - type: Binary - # Data receiver properties - properties: - tcpPort: '9611' - sslPort: '9711' - tcpReceiverThreadPoolSize: '100' - sslReceiverThreadPoolSize: '100' - hostName: 0.0.0.0 - - # Configuration of the Data Agents - to publish events through databridge -data.agent.config: - # Data agent configurations - # THIS IS A MANDATORY FIELD - agents: - - - # Data agent configuration - agentConfiguration: - # Data agent name - # THIS IS A MANDATORY FIELD - name: Thrift - # Data endpoint class - # THIS IS A MANDATORY FIELD - dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.thrift.ThriftDataEndpoint - # Data publisher strategy - publishingStrategy: async - # Trust store path - trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks' - # Trust store password - trustStorePassword: 'wso2carbon' - # Queue Size - queueSize: 32768 - # Batch Size - batchSize: 200 - # Core pool size - corePoolSize: 1 - # Socket timeout in milliseconds - socketTimeoutMS: 30000 - # Maximum pool size - maxPoolSize: 1 - # Keep alive time in pool - keepAliveTimeInPool: 20 - # Reconnection interval - reconnectionInterval: 30 - # Max transport pool size - maxTransportPoolSize: 250 - # Max idle connections - maxIdleConnections: 250 - # Eviction time interval - evictionTimePeriod: 5500 - # Min idle time in pool - minIdleTimeInPool: 5000 - # Secure max transport pool size - secureMaxTransportPoolSize: 250 - # Secure max idle connections - secureMaxIdleConnections: 250 - # secure eviction time period - secureEvictionTimePeriod: 5500 - # Secure min idle time in pool - secureMinIdleTimeInPool: 5000 - # SSL enabled protocols - sslEnabledProtocols: TLSv1.1,TLSv1.2 - # Ciphers - ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - - - # Data agent configuration - agentConfiguration: - # Data agent name - # THIS IS A MANDATORY FIELD - name: Binary - # Data endpoint class - # THIS IS A MANDATORY FIELD - dataEndpointClass: org.wso2.carbon.databridge.agent.endpoint.binary.BinaryDataEndpoint - # Data publisher strategy - publishingStrategy: async - # Trust store path - trustStorePath: '${sys:carbon.home}/resources/security/client-truststore.jks' - # Trust store password - trustStorePassword: 'wso2carbon' - # Queue Size - queueSize: 32768 - # Batch Size - batchSize: 200 - # Core pool size - corePoolSize: 1 - # Socket timeout in milliseconds - socketTimeoutMS: 30000 - # Maximum pool size - maxPoolSize: 1 - # Keep alive time in pool - keepAliveTimeInPool: 20 - # Reconnection interval - reconnectionInterval: 30 - # Max transport pool size - maxTransportPoolSize: 250 - # Max idle connections - maxIdleConnections: 250 - # Eviction time interval - evictionTimePeriod: 5500 - # Min idle time in pool - minIdleTimeInPool: 5000 - # Secure max transport pool size - secureMaxTransportPoolSize: 250 - # Secure max idle connections - secureMaxIdleConnections: 250 - # secure eviction time period - secureEvictionTimePeriod: 5500 - # Secure min idle time in pool - secureMinIdleTimeInPool: 5000 - # SSL enabled protocols - sslEnabledProtocols: TLSv1.1,TLSv1.2 - # Ciphers - ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 - -# This is the main configuration for metrics -wso2.metrics: - # Enable Metrics - enabled: false - reporting: - console: - - # The name for the Console Reporter - name: Console - - # Enable Console Reporter - enabled: false - - # Polling Period in seconds. - # This is the period for polling metrics from the metric registry and printing in the console - pollingPeriod: 5 - -wso2.metrics.jdbc: - # Data Source Configurations for JDBC Reporters - dataSource: - # Default Data Source Configuration - - &JDBC01 - # JNDI name of the data source to be used by the JDBC Reporter. - # This data source should be defined in a *-datasources.xml file in conf/datasources directory. - dataSourceName: java:comp/env/jdbc/WSO2MetricsDB - # Schedule regular deletion of metrics data older than a set number of days. - # It is recommended that you enable this job to ensure your metrics tables do not get extremely large. - # Deleting data older than seven days should be sufficient. - scheduledCleanup: - # Enable scheduled cleanup to delete Metrics data in the database. - enabled: true - - # The scheduled job will cleanup all data older than the specified days - daysToKeep: 3 - - # This is the period for each cleanup operation in seconds. - scheduledCleanupPeriod: 86400 - - # The JDBC Reporter is in the Metrics JDBC Core feature - reporting: - # The JDBC Reporter configurations will be ignored if the Metrics JDBC Core feature is not available in runtime - jdbc: - - # The name for the JDBC Reporter - name: JDBC - - # Enable JDBC Reporter - enabled: true - - # Source of Metrics, which will be used to identify each metric in database --> - # Commented to use the hostname by default - # source: Carbon - - # Alias referring to the Data Source configuration - dataSource: *JDBC01 - - # Polling Period in seconds. - # This is the period for polling metrics from the metric registry and updating the database with the values - pollingPeriod: 60 - - # Deployment configuration parameters -wso2.artifact.deployment: - # Scheduler update interval - updateInterval: 5 - - # Periodic Persistence Configuration -state.persistence: - enabled: false - intervalInMin: 1 - revisionsToKeep: 2 - persistenceStore: org.wso2.carbon.streaming.integrator.core.persistence.FileSystemPersistenceStore - config: - location: siddhi-app-persistence - - # Siddhi Error Store Configuration -error.store: - enabled: false - - # Size of the buffer which is used in publishing erroneous events to the error store. Must be a power of 2. - bufferSize: 1024 - - # Whether to drop erroneous events when the buffer is full. - dropWhenBufferFull: true - - # Class that has the implementation of the error store. - errorStore: org.wso2.carbon.streaming.integrator.core.siddhi.error.handler.DBErrorStore - - config: - datasource: WSO2_CARBON_DB - table: SIDDHI_ERROR_STORE_TABLE - - # Secure Vault Configuration -wso2.securevault: - secretRepository: - type: org.wso2.carbon.secvault.repository.DefaultSecretRepository - parameters: - privateKeyAlias: wso2carbon - keystoreLocation: ${sys:carbon.home}/resources/security/securevault.jks - secretPropertiesFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/secrets.properties - masterKeyReader: - type: org.wso2.carbon.secvault.reader.DefaultMasterKeyReader - parameters: - masterKeyReaderFile: ${sys:carbon.home}/conf/${sys:wso2.runtime}/master-keys.yaml - - # Datasource Configurations -wso2.datasources: - dataSources: - - - name: WSO2_CLUSTER_DB - description: "The datasource used by cluster coordinators in HA deployment" - definition: - type: RDBMS - configuration: - connectionTestQuery: "SELECT 1" - driverClassName: org.h2.Driver - idleTimeout: 60000 - isAutoCommit: false - jdbcUrl: "jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/WSO2_CLUSTER_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000" - maxPoolSize: 10 - password: wso2carbon - username: wso2carbon - validationTimeout: 30000 - - - name: WSO2_PERMISSIONS_DB - description: The datasource used for permission feature - jndiConfig: - name: jdbc/PERMISSION_DB - useJndiReference: true - definition: - type: RDBMS - configuration: - jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/PERMISSION_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000' - username: wso2carbon - password: wso2carbon - driverClassName: org.h2.Driver - maxPoolSize: 10 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - validationTimeout: 30000 - isAutoCommit: false - # carbon metrics data source - - name: WSO2_METRICS_DB - description: The datasource used for dashboard feature - jndiConfig: - name: jdbc/WSO2MetricsDB - definition: - type: RDBMS - configuration: - jdbcUrl: 'jdbc:h2:${sys:carbon.home}/wso2/${sys:wso2.runtime}/database/metrics;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000;' - username: wso2carbon - password: wso2carbon - driverClassName: org.h2.Driver - maxPoolSize: 30 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - validationTimeout: 30000 - isAutoCommit: false - - name: OB_REPORTING_DB - description: The datasource used to store statistics for OB Reporting module - jndiConfig: - name: jdbc/OB_REPORTING_DB - definition: - type: RDBMS - configuration: - jdbcUrl: 'DB_OB_REPORTING_URL' - username: 'DB_USER' - password: 'DB_PASS' - driverClassName: 'DB_DRIVER' - maxPoolSize: 20 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - # Use below for oracle database - # connectionTestQuery: SELECT 1 FROM DUAL - validationTimeout: 30000 - isAutoCommit: false - - name: OB_REPORTING_SUMMARIZED_DB - description: The datasource used to store statistics for OB Reporting module - jndiConfig: - name: jdbc/OB_REPORTING_SUMMARIZED_DB - definition: - type: RDBMS - configuration: - jdbcUrl: 'DB_OB_REPORTING_SUMMARIZED_URL' - username: 'DB_USER' - password: 'DB_PASS' - driverClassName: 'DB_DRIVER' - maxPoolSize: 20 - idleTimeout: 60000 - connectionTestQuery: SELECT 1 - # Use below for oracle database - # connectionTestQuery: SELECT 1 FROM DUAL - validationTimeout: 30000 - isAutoCommit: false - # Cluster Configuration -cluster.config: - enabled: false - groupId: si - coordinationStrategyClass: org.wso2.carbon.cluster.coordinator.rdbms.RDBMSCoordinationStrategy - strategyConfig: - datasource: WSO2_CLUSTER_DB - heartbeatInterval: 3000 - heartbeatMaxRetry: 3 - eventPollingInterval: 3000 - -# Authentication configuration -auth.configs: - type: 'local' # Type of the IdP client used - userManager: - adminRole: admin # Admin role which is granted all permissions - userStore: # User store - users: - - - user: - username: admin@wso2.com@carbon.super - password: d3NvMjEyMw== - roles: 1 - roles: - - - role: - id: 1 - displayName: admin - -# Async API service catalogue configuration -async.api.configs: - enabled: false - hostname: "APIM_HOSTNAME" - port: 9443 - username: admin@wso2.com@carbon.super - password: d3NvMjEyMw== - - # Sample of deployment.config for Two node HA -#deployment.config: -# type: ha -# passiveNodeDetailsWaitTimeOutMillis: 300000 -# passiveNodeDetailsRetrySleepTimeMillis: 500 -# eventSyncServer: -# host: localhost -# port: 9893 -# advertisedHost: localhost -# advertisedPort: 9893 -# bossThreads: 10 -# workerThreads: 10 -# eventSyncClientPool: -# maxActive: 10 -# maxTotal: 10 -# maxIdle: 10 -# maxWait: 60000 -# minEvictableIdleTimeMillis: 120000 - - # Sample of deployment.config for Distributed deployment -#deployment.config: -# type: distributed -# isReceiverNode: false -# httpsInterface: -# host: 192.168.1.3 -# port: 9443 -# username: admin -# password: admin -# leaderRetryInterval: 10000 -# resourceManagers: -# - host: 192.168.1.1 -# port: 9543 -# username: admin -# password: admin -# - host: 192.168.1.2 -# port: 9543 -# username: admin -# password: admin diff --git a/open-banking-accelerator/accelerators/ob-bi/src/assembly/bin.xml b/open-banking-accelerator/accelerators/ob-bi/src/assembly/bin.xml deleted file mode 100644 index 4e277b3b..00000000 --- a/open-banking-accelerator/accelerators/ob-bi/src/assembly/bin.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - ob.bi.accelerator - true - wso2-obbi-accelerator-${project.version} - - - zip - - - - ${project.basedir}/bin - - - ${project.basedir}/repository - - - ${project.basedir}/carbon-home - - - - - ${project.basedir}/README.md - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-cleanup-script.sql deleted file mode 100644 index dc16ad1e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-cleanup-script.sql +++ /dev/null @@ -1,614 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ -CREATE OR ALTER PROCEDURE WSO2_OB_CONSENT_CLEANUP_SP ( - @consentTypes VARCHAR(1024), - @clientIds VARCHAR(4096), - @consentStatuses VARCHAR(1024), - @purgeConsentsOlderThanXNumberOfDays INT, - @lastUpdatedTime BIGINT, - @backupTables BIT, - @enableAudit BIT, - @rebuildIndexes BIT, - @updateStats BIT, - @enableDataRetention BIT -) -AS - -BEGIN - --- ------------------------------------------ --- DECLARE VARIABLES --- ------------------------------------------ -DECLARE @batchSize INT; -DECLARE @chunkSize INT; -DECLARE @checkCount INT; -DECLARE @sleepTime AS VARCHAR(12); -DECLARE @rowCount INT; -DECLARE @cleaupCount INT; -DECLARE @enableLog BIT; -DECLARE @logLevel VARCHAR(10); -DECLARE @cusrBackupTable VARCHAR(100); -DECLARE @SQL NVARCHAR(MAX); -DECLARE @backupTable VARCHAR(100); -DECLARE @chunkCount INT; -DECLARE @batchCount INT; -DECLARE @deleteCount INT; -DECLARE @olderThanTimePeriodForPurging bigint; - - -- Data retention variables -DECLARE @enableDataRetentionForAuthResourceAndMapping BIT; -DECLARE @enableDataRetentionForObConsentFile BIT; -DECLARE @enableDataRetentionForObConsentAttribute BIT; -DECLARE @enableDataRetentionForObConsentStatusAudit BIT; - -DECLARE backupTablesCursor CURSOR FOR -SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME IN ('OB_CONSENT','OB_CONSENT_AUTH_RESOURCE','OB_CONSENT_MAPPING','OB_CONSENT_FILE','OB_CONSENT_ATTRIBUTE','OB_CONSENT_STATUS_AUDIT') - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET @batchSize = 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] -SET @chunkSize = 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFULT : 500000] -SET @checkCount = 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE CONSENT COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] -SET @sleepTime = '00:00:02.000'; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -SET @enableLog = 'TRUE'; -- ENABLE LOGGING [DEFAULT : FALSE] -SET @logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - -SET @enableDataRetentionForAuthResourceAndMapping = 'TRUE'; -SET @enableDataRetentionForObConsentFile = 'TRUE'; -SET @enableDataRetentionForObConsentAttribute = 'TRUE'; -SET @enableDataRetentionForObConsentStatusAudit = 'TRUE'; - -IF (@enableDataRetention IS NULL) -BEGIN -SET @enableDataRetention = 'FALSE'; -- SET TRUE FOR ENABLE DATA RETENTION (ARCHIVE PURGED DATA) [DEFAULT : FALSE] -END; - -IF (@backupTables IS NULL) -BEGIN -SET @backupTables = 'TRUE'; -- SET IF CONSENT TABLE NEEDS TO BACKUP BEFORE DELETE [DEFAULT : TRUE] , WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION -END; - -IF (@enableAudit IS NULL) -BEGIN -SET @enableAudit = 'FALSE'; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED CONSENT USING A TABLE [DEFAULT : FALSE] [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] -END; - -IF (@rebuildIndexes IS NULL) -BEGIN -SET @rebuildIndexes = 'FALSE'; -- SET TRUE FOR REBUILD INDEXES TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] -END; - -IF (@updateStats IS NULL) -BEGIN -SET @updateStats = 'FALSE'; -- SET TRUE FOR GATHER TABLE STATS TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] -END; - --- ------------------------------------------ --- CONSENT DATA PURGING CONFIGS --- ------------------------------------------ - -IF (@consentTypes IS NULL) -BEGIN -SET @consentTypes = ''; -- SET CONSENT_TYPES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'accounts,payments', LEAVE AS EMPTY TO SKIP) -END; - -IF (@clientIds IS NULL) -BEGIN -SET @clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) -END; - -IF (@consentStatuses IS NULL) -BEGIN -SET @consentStatuses = ''; -- SET CONSENT_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'expired,revoked', LEAVE AS EMPTY TO SKIP) -END; - -IF (@purgeConsentsOlderThanXNumberOfDays IS NULL) - BEGIN - SET @olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE CONSENTS OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - END -ELSE - BEGIN - SET @olderThanTimePeriodForPurging = 60 * 60 * 24 * @purgeConsentsOlderThanXNumberOfDays; - END; - -IF (@lastUpdatedTime IS NULL) -BEGIN -SET @lastUpdatedTime = DATEDIFF(SECOND,'1970-01-01', GETUTCDATE()) - @olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF CONSENT'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) -END; - --- HERE IF WE WISH TO PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeConsentsOlderThanXNumberOfDays_in = 31 , FOR PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeConsentsOlderThanXNumberOfDays_in --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_CONSENT_CLEANUP_SP STARTED ... !' AS 'INFO LOG'; -END; - -IF (@enableAudit = 1) -BEGIN -SET @backupTables = 'TRUE'; -- BACKUP TABLES IS REQUIRED BE TRUE, HENCE THE AUDIT IS ENABLED. -END; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- BACKUP TABLES --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@backupTables = 1) -BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] TABLE BACKUP STARTED ... !' AS 'INFO LOG'; - END; - - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - SELECT @backupTable = 'BAK_'+@cusrBackupTable; - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @backupTable)) - BEGIN - SELECT @SQL = 'DROP TABLE dbo.' +@backupTable; - EXEC sp_executesql @SQL; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT @SQL = 'SELECT ''BACKING UP '+@cusrBackupTable+' INTO '+@backupTable+' STARTED WITH : '' as ''DEBUG LOG'', COUNT_BIG(*) as ''COUNT'' FROM dbo.'+@cusrBackupTable; - EXEC sp_executesql @SQL; - END - - SELECT @SQL = 'SELECT * INTO '+@backupTable+' FROM dbo.' +@cusrBackupTable; - EXEC sp_executesql @SQL; - - IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) - BEGIN - SELECT @SQL = 'SELECT ''BACKING UP '+@cusrBackupTable+' INTO '+@backupTable+' COMPLETED WITH : '' as ''DEBUG LOG'', COUNT_BIG(*) as ''COUNT'' FROM dbo.'+@backupTable; - EXEC sp_executesql @SQL; - END - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -END - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDIT TABLES FOR CONSENT DELETION FOR THE FIRST TIME RUN --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@enableAudit = 1) -BEGIN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'AUDITLOG_OB_CONSENT_CLEANUP')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP .. !'; - END - Select * into dbo.AUDITLOG_OB_CONSENT_CLEANUP from dbo.OB_CONSENT where 1 =2; - ALTER TABLE AUDITLOG_OB_CONSENT_CLEANUP ADD AUDIT_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP; - END - ELSE - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] USING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP ..!'; - END - END -END - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING RETENTION TABLES IF NOT EXISTS --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@enableDataRetention = 1) -BEGIN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT .. !'; - END - Select * into dbo.RET_OB_CONSENT from dbo.OB_CONSENT where 1 =2; - END - - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_AUTH_RESOURCE')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT_AUTH_RESOURCE .. !'; - END - Select * into dbo.RET_OB_CONSENT_AUTH_RESOURCE from dbo.OB_CONSENT_AUTH_RESOURCE where 1 =2; - END - - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_MAPPING')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT_MAPPING .. !'; - END - Select * into dbo.RET_OB_CONSENT_MAPPING from dbo.OB_CONSENT_MAPPING where 1 =2; - END - - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_FILE')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT_FILE .. !'; - END - Select * into dbo.RET_OB_CONSENT_FILE from dbo.OB_CONSENT_FILE where 1 =2; - END - - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_ATTRIBUTE')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT_ATTRIBUTE .. !'; - END - Select * into dbo.RET_OB_CONSENT_ATTRIBUTE from dbo.OB_CONSENT_ATTRIBUTE where 1 =2; - END - - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_STATUS_AUDIT')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING RETENTION TABLE RET_OB_CONSENT_STATUS_AUDIT .. !'; - END - Select * into dbo.RET_OB_CONSENT_STATUS_AUDIT from dbo.OB_CONSENT_STATUS_AUDIT where 1 =2; - END -END - ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- CALCULATING CONSENTS IN OB_CONSENT TABLE ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@enableLog = 1) -BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CALCULATING CONSENTS IN OB_CONSENT TABLE .... !'; - - IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) - BEGIN - SELECT @rowcount = COUNT(1) FROM OB_CONSENT; - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL CONSENTS ON OB_CONSENT TABLE BEFORE DELETE :'+CAST(@rowCount as varchar); - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT @cleaupCount = COUNT(1) FROM OB_CONSENT WHERE (@consentStatuses = '' OR CHARINDEX( ',' + LOWER(CURRENT_STATUS) + ',', LOWER(',' + @consentStatuses + ',')) > 0) AND - (@consentTypes = '' OR CHARINDEX(',' + LOWER(CONSENT_TYPE) + ',', LOWER(',' + @consentTypes + ',')) > 0) AND - (@clientIds = '' OR CHARINDEX(',' + LOWER(CLIENT_ID) + ',', LOWER(',' + @clientIds + ',')) > 0) AND UPDATED_TIME < @lastUpdatedTime; - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL CONSENTS SHOULD BE DELETED FROM OB_CONSENT : '+ CAST(@cleaupCount as varchar); - SELECT '[' + convert(varchar, getdate(), 121) + '] NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - select @rowcount = (@rowcount - @cleaupCount); - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL CONSENTS SHOULD BE RETAIN IN OB_CONSENT : '+CAST(@rowCount as varchar); - END -END - ----- ------------------------------------------------------ ----- BATCH DELETE CONSENT DATA ----- ------------------------------------------------------ - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CONSENT PURGING STARTED .... !'; -END - - -WHILE (1=1) -BEGIN - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CHUNK_OB_CONSENT')) - BEGIN - DROP TABLE CHUNK_OB_CONSENT; - END - - CREATE TABLE CHUNK_OB_CONSENT (CONSENT_ID VARCHAR (255),CONSTRAINT CHUNK_OB_CONSENT_PRI PRIMARY KEY (CONSENT_ID)); - - INSERT INTO CHUNK_OB_CONSENT (CONSENT_ID) SELECT TOP (@chunkSize) CONSENT_ID FROM OB_CONSENT WHERE - (@consentStatuses = '' OR CHARINDEX(',' + LOWER(CURRENT_STATUS) + ',', LOWER(',' + @consentStatuses + ',')) > 0) AND - (@consentTypes = '' OR CHARINDEX(',' + LOWER(CONSENT_TYPE) + ',', LOWER(',' + @consentTypes + ',')) > 0) AND - (@clientIds = '' OR CHARINDEX(',' + LOWER(CLIENT_ID) + ',', LOWER(',' + @clientIds + ',')) > 0) AND UPDATED_TIME < @lastUpdatedTime; - SELECT @chunkCount = @@rowcount; - - IF (@chunkCount < @checkCount) - BEGIN - BREAK; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CHUNK TABLE CHUNK_OB_CONSENT CREATED WITH : '+CAST(@chunkCount as varchar); - END - - IF (@enableAudit=1) - BEGIN - INSERT INTO dbo.AUDITLOG_OB_CONSENT_CLEANUP SELECT OBC.*, CURRENT_TIMESTAMP FROM OB_CONSENT OBC , CHUNK_OB_CONSENT CHK WHERE OBC.CONSENT_ID=CHK.CONSENT_ID; - END - - WHILE (1=1) - BEGIN - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'BATCH_OB_CONSENT')) - BEGIN - DROP TABLE BATCH_OB_CONSENT; - END - - CREATE TABLE BATCH_OB_CONSENT (CONSENT_ID VARCHAR (255),CONSTRAINT BATCH_OB_CONSENT_PRI PRIMARY KEY (CONSENT_ID)); - - INSERT INTO BATCH_OB_CONSENT (CONSENT_ID) SELECT TOP (@batchSize) CONSENT_ID FROM CHUNK_OB_CONSENT ; - SELECT @batchCount = @@rowcount; - - IF(@batchCount = 0) - BEGIN - BREAK; - END - - IF ((@batchCount > 0)) - BEGIN - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE START ON CONSENT TABLES WITH BATCH COUNT : '+CAST(@batchCount as varchar); - END - - IF (@enableDataRetention = 1) - BEGIN - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT DATA TO RET_OB_CONSENT TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT SELECT * FROM OB_CONSENT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - - -- STORE OB_CONSENT_AUTH_RESOURCE AND OB_CONSENT_MAPPING RETENTION DATA IF ENABLED. - IF (@enableDataRetentionForAuthResourceAndMapping = 1) - BEGIN - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT_AUTH_RESOURCE DATA TO RET_OB_CONSENT_AUTH_RESOURCE TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT_AUTH_RESOURCE SELECT * FROM OB_CONSENT_AUTH_RESOURCE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT_MAPPING DATA TO RET_OB_CONSENT_MAPPING TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT_MAPPING SELECT * FROM OB_CONSENT_MAPPING WHERE MAPPING_ID IN ( SELECT MAPPING_ID FROM OB_CONSENT_MAPPING OBCM - INNER JOIN OB_CONSENT_AUTH_RESOURCE OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN BATCH_OB_CONSENT B ON OBAR.CONSENT_ID = B.CONSENT_ID); - END - - -- STORE OB_CONSENT_STATUS_AUDIT RETENTION DATA IF ENABLED. - IF (@enableDataRetentionForObConsentStatusAudit = 1) - BEGIN - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT_STATUS_AUDIT DATA TO RET_OB_CONSENT_STATUS_AUDIT TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT_STATUS_AUDIT SELECT * FROM OB_CONSENT_STATUS_AUDIT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - END - - -- STORE OB_CONSENT_FILE RETENTION DATA IF ENABLED. - IF (@enableDataRetentionForObConsentFile = 1) - BEGIN - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT_FILE DATA TO RET_OB_CONSENT_FILE TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT_FILE SELECT * FROM OB_CONSENT_FILE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - END - - -- STORE OB_CONSENT_ATTRIBUTE RETENTION DATA IF ENABLED. - IF (@enableDataRetentionForObConsentAttribute = 1) - BEGIN - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INSERTING OB_CONSENT_ATTRIBUTE DATA TO RET_OB_CONSENT_ATTRIBUTE TABLE !'; - END - INSERT INTO dbo.RET_OB_CONSENT_ATTRIBUTE SELECT * FROM OB_CONSENT_ATTRIBUTE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - END - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_ATTRIBUTE - -- ------------------------------------------------------ - - DELETE OB_CONSENT_ATTRIBUTE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT_ATTRIBUTE WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_FILE - -- ------------------------------------------------------ - - DELETE OB_CONSENT_FILE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT_FILE WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_STATUS_AUDIT - -- ------------------------------------------------------ - - DELETE OB_CONSENT_STATUS_AUDIT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT_STATUS_AUDIT WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_MAPPING - -- ------------------------------------------------------ - - DELETE OB_CONSENT_MAPPING WHERE MAPPING_ID IN ( SELECT MAPPING_ID FROM OB_CONSENT_MAPPING OBCM - INNER JOIN OB_CONSENT_AUTH_RESOURCE OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN BATCH_OB_CONSENT B ON OBAR.CONSENT_ID = B.CONSENT_ID); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT_MAPPING WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_AUTH_RESOURCE - -- ------------------------------------------------------ - - DELETE OB_CONSENT_AUTH_RESOURCE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT_AUTH_RESOURCE WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT - -- ------------------------------------------------------ - - DELETE OB_CONSENT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_CONSENT WITH : '+CAST(@deleteCount as varchar); - END - - DELETE CHUNK_OB_CONSENT WHERE CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT); - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] DELETED BATCH ON CHUNK_OB_CONSENT !'; - END - - IF ((@deleteCount > 0)) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] SLEEPING ...'; - WAITFOR DELAY @sleepTime; - END - END - END -END - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CONSENTS DELETE ON TABLES COMPLETED .... !'; -END - -IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) -BEGIN -SELECT @rowcount = COUNT(1) FROM OB_CONSENT; -SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL CONSENTS ON OB_CONSENT TABLE AFTER DELETE :'+CAST(@rowCount as varchar); -END - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ - -IF (@rebuildIndexes = 1) -BEGIN - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING STARTED ...!'; -END - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING FOR TABLE :'+@cusrBackupTable; - END - - SELECT @SQL = 'ALTER INDEX ALL ON '+@cusrBackupTable+' REBUILD WITH (ONLINE = ON)'; - EXEC sp_executesql @SQL; - - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING FINISHED ...!'; -END - -END - --- ------------------------------------------------------ --- UPDATE TABLE STATS --- ------------------------------------------------------ - -IF (@updateStats = 1) -BEGIN - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE DATABASE STATISTICS JOB STARTED ...!'; - -END - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE TABLE STATICTICS :'+@cusrBackupTable; - END - - SELECT @SQL = 'UPDATE STATISTICS '+@cusrBackupTable; - EXEC sp_executesql @SQL; - - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE DATABASE STATISTICS JOB FINISHED ...!'; -END - -END - -deallocate backupTablesCursor; - -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_CONSENT_CLEANUP_SP COMPLETED .... !' AS 'INFO LOG'; -END - -END diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-restore-script.sql deleted file mode 100644 index 54b07172..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/mssql-consent-restore-script.sql +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR ALTER PROCEDURE WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP -AS - -BEGIN - -DECLARE @rowCount INT; -DECLARE @enableLog BIT; -DECLARE @logLevel VARCHAR(10); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET @enableLog = 'TRUE'; -- ENABLE LOGGING [DEFAULT : TRUE] -SET @logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (@enableLog = 1) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP STARTED .... !'; -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT TABLE !'; -END -INSERT INTO dbo.OB_CONSENT SELECT A.* FROM dbo.BAK_OB_CONSENT AS A LEFT JOIN dbo.OB_CONSENT AS B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT_ATTRIBUTE'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_ATTRIBUTE TABLE !'; -END -INSERT INTO dbo.OB_CONSENT_ATTRIBUTE SELECT A.* FROM dbo.BAK_OB_CONSENT_ATTRIBUTE AS A LEFT JOIN dbo.OB_CONSENT_ATTRIBUTE AS B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_ATTRIBUTE WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT_FILE'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_FILE TABLE !'; -END -INSERT INTO dbo.OB_CONSENT_FILE SELECT A.* FROM dbo.BAK_OB_CONSENT_FILE AS A LEFT JOIN dbo.OB_CONSENT_FILE AS B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_FILE WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT_STATUS_AUDIT'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_STATUS_AUDIT TABLE !'; -END -INSERT INTO dbo.OB_CONSENT_STATUS_AUDIT SELECT A.* FROM dbo.BAK_OB_CONSENT_STATUS_AUDIT AS A LEFT JOIN dbo.OB_CONSENT_STATUS_AUDIT AS B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_STATUS_AUDIT WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT_AUTH_RESOURCE'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_AUTH_RESOURCE TABLE !'; -END -INSERT INTO dbo.OB_CONSENT_AUTH_RESOURCE SELECT A.* FROM dbo.BAK_OB_CONSENT_AUTH_RESOURCE AS A LEFT JOIN dbo.OB_CONSENT_AUTH_RESOURCE AS B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_AUTH_RESOURCE WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_CONSENT_MAPPING'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_MAPPING TABLE !'; -END -INSERT INTO dbo.OB_CONSENT_MAPPING SELECT A.* FROM dbo.BAK_OB_CONSENT_MAPPING AS A LEFT JOIN dbo.OB_CONSENT_MAPPING AS B ON A.MAPPING_ID = B.MAPPING_ID WHERE B.MAPPING_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_AUTH_RESOURCE WITH '+CAST(@rowCount as varchar) -END -END - -IF (@enableLog = 1) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'; -END - -END diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/readme.MD deleted file mode 100644 index adb7a395..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mssql/readme.MD +++ /dev/null @@ -1,44 +0,0 @@ -## **HOW TO RUN** - -**>> mssql-consent-cleanup-script.sql** - -**Compile the stored procedure** - -First - Compile the stored procedure using a MSSQL client by selecting the whole script at once and execute from the MSSQL client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -**Execute the stored procedure.** - -Then execute the compiled store procedure by using the EXEC function in the MSSQL client. Following is a sample. - - -- consentTypes `VARCHAR` -- clientIds `VARCHAR` -- consentStatuses `VARCHAR` -- purgeConsentsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- rebuildIndexes `BOOLEAN` -- updateStats `BOOLEAN` -- enableDataRetention `BOOLEAN` - -``` -Ex: - ->> EXEC WSO2_OB_CONSENT_CLEANUP_SP @consentTypes='accounts,payments', @clientIds='clientId1,clientId2', - @consentStatuses='expired,revoked', @purgeConsentsOlderThanXNumberOfDays=31, - @lastUpdatedTime=1631867692, @backupTables=TRUE, @enableAudit=TRUE, @rebuildIndexes=TRUE, - @updateStats=TRUE, @enableDataRetention=FALSE; -``` - - -**Execute the restore from backup procedure.** - -``` -EXEC WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP; -``` - -- Note : If data retention feature is enabled, temporary retention tables will be created and stored the purged consents - until the server job (can run periodical or invoke via API) sync the temporary data to retention database. - - Note: When running backup procedure (consent-cleanup-restore.sql) to restore back the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-cleanup-script.sql deleted file mode 100644 index 86d27b60..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-cleanup-script.sql +++ /dev/null @@ -1,499 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ -DROP PROCEDURE IF EXISTS `WSO2_OB_CONSENT_CLEANUP_SP`; - -DELIMITER $$ - -CREATE PROCEDURE `WSO2_OB_CONSENT_CLEANUP_SP`( - IN consentTypes VARCHAR(1024), - IN clientIds VARCHAR(4096), - IN consentStatuses VARCHAR(1024), - IN purgeConsentsOlderThanXNumberOfDays INT, - IN lastUpdatedTime BIGINT, - IN backupTables BOOLEAN, - IN enableAudit BOOLEAN, - IN analyzeTables BOOLEAN, - IN enableDataRetention BOOLEAN -) -BEGIN - --- ------------------------------------------ --- DECLARE VARIABLES --- ------------------------------------------ - DECLARE batchSize INT; - DECLARE chunkSize INT; - DECLARE checkCount INT; - DECLARE sleepTime FLOAT; - DECLARE rowCount INT; - DECLARE enableLog BOOLEAN; - DECLARE logLevel VARCHAR(10); - DECLARE cursorTable VARCHAR(255); - DECLARE BACKUP_TABLE VARCHAR(255); - DECLARE cursorLoopFinished INTEGER DEFAULT 0; - - -- Data retention variables - DECLARE enableDataRetentionForAuthResourceAndMapping BOOLEAN; - DECLARE enableDataRetentionForObConsentFile BOOLEAN; - DECLARE enableDataRetentionForObConsentAttribute BOOLEAN; - DECLARE enableDataRetentionForObConsentStatusAudit BOOLEAN; - - -- Consent Data Purging Parameters - DECLARE olderThanTimePeriodForPurging BIGINT; - - DECLARE backupTablesCursor CURSOR FOR - SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA in (SELECT DATABASE()) AND - TABLE_NAME IN ('OB_CONSENT','OB_CONSENT_AUTH_RESOURCE','OB_CONSENT_MAPPING','OB_CONSENT_FILE','OB_CONSENT_ATTRIBUTE','OB_CONSENT_STATUS_AUDIT'); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET cursorLoopFinished = 1; - --- ----------------------------------------- --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ - SET batchSize = 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] - SET chunkSize = 500000; -- SET TEMP TABLE CHUNK SIZE FOR AVOID TABLE LOCKS [DEFAULT : 1000000] - SET checkCount = 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE CONSENTS COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] - SET sleepTime = 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] - SET rowCount=0; - SET enableLog = TRUE; -- ENABLE LOGGING [DEFAULT : FALSE] - SET logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - - CASE WHEN (backupTables IS NULL) - THEN SET backupTables = TRUE; -- SET IF CONSENT TABLE NEEDS TO BACKUP BEFORE DELETE [DEFAULT : TRUE] , WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION - ELSE BEGIN END; - END CASE; - - CASE WHEN (enableAudit IS NULL) - THEN SET enableAudit = FALSE; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED CONSENTS USING A TABLE [DEFAULT : FALSE] [IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] - ELSE BEGIN END; - END CASE; - - CASE WHEN (analyzeTables IS NULL) - THEN SET analyzeTables = FALSE; -- SET TRUE FOR Analyze the tables TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE BEGIN END; - END CASE; - - -- Data Retention Configs (Configure if data retention is enabled) - - CASE WHEN (enableDataRetention IS NULL) - THEN SET enableDataRetention = FALSE; -- SET TRUE FOR ENABLE DATA RETENTION (ARCHIVE PURGED DATA) [DEFAULT : FALSE] - ELSE BEGIN END; - END CASE; - - SET enableDataRetentionForAuthResourceAndMapping = TRUE; -- ENABLE STORING AUTH RESOURCE AND CONSENT MAPPING TABLES FOR RETENTION DATA. - SET enableDataRetentionForObConsentFile = TRUE; -- ENABLE STORING OB_CONSENT_FILE TABLE FOR RETENTION DATA. - SET enableDataRetentionForObConsentAttribute = TRUE; -- ENABLE STORING OB_CONSENT_ATTRIBUTE TABLE FOR RETENTION DATA. - SET enableDataRetentionForObConsentStatusAudit = TRUE; -- ENABLE STORING OB_CONSENT_STATUS_AUDIT TABLE FOR RETENTION DATA. - - - -- Consent Data Purging Configs - - CASE WHEN (consentTypes IS NULL) - THEN SET consentTypes = ''; -- SET CONSENT_TYPES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'accounts,payments', LEAVE AS EMPTY TO SKIP) - ELSE BEGIN END; - END CASE; - - CASE WHEN (clientIds IS NULL) - THEN SET clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) - ELSE BEGIN END; - END CASE; - - CASE WHEN (consentStatuses IS NULL) - THEN SET consentStatuses = ''; -- SET CONSENT_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'expired,revoked' LEAVE AS EMPTY TO SKIP) - ELSE BEGIN END; - END CASE; - - CASE WHEN (purgeConsentsOlderThanXNumberOfDays IS NULL) - THEN SET olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE CONSENTS OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - ELSE SET olderThanTimePeriodForPurging = 60 * 60 * 24 * purgeConsentsOlderThanXNumberOfDays; - END CASE; - - CASE WHEN (lastUpdatedTime IS NULL) - THEN SET lastUpdatedTime = unix_timestamp() - olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF CONSENT'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE BEGIN END; - END CASE; - --- HERE IF WE WISH TO PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeConsentsOlderThanXNumberOfDays_in = 31 , FOR PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeConsentsOlderThanXNumberOfDays_in --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - - IF (enableLog) - THEN - SELECT 'WSO2_OB_CONSENT_CLEANUP_SP STARTED ... !' AS 'INFO LOG'; - END IF; - - IF (enableAudit) - THEN - SET backupTables = TRUE; -- BACKUP TABLES IS REQUIRED HENCE THE AUDIT IS ENABLED. - END IF; - - - IF (backupTables) - THEN - IF (enableLog) - THEN - SELECT 'TABLE BACKUP STARTED ... !' AS 'INFO LOG'; - END IF; - - OPEN backupTablesCursor; - backupLoop: loop - fetch backupTablesCursor into cursorTable; - - IF cursorLoopFinished = 1 THEN - LEAVE backupLoop; - END IF; - - SELECT CONCAT('BAK_', cursorTable) into BACKUP_TABLE; - - SET @dropTab=CONCAT("DROP TABLE IF EXISTS ", BACKUP_TABLE); - PREPARE stmtDrop FROM @dropTab; - EXECUTE stmtDrop; - DEALLOCATE PREPARE stmtDrop; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SET @printstate=CONCAT("SELECT 'BACKING UP ",cursorTable," CONSENTS INTO ", BACKUP_TABLE, " 'AS' TRACE LOG' , COUNT(1) FROM ", cursorTable); - PREPARE stmtPrint FROM @printstate; - EXECUTE stmtPrint; - DEALLOCATE PREPARE stmtPrint; - END IF; - - SET @cretTab=CONCAT("CREATE TABLE ", BACKUP_TABLE," SELECT * FROM ",cursorTable); - PREPARE stmtDrop FROM @cretTab; - EXECUTE stmtDrop; - DEALLOCATE PREPARE stmtDrop; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE') ) - THEN - SET @printstate= CONCAT("SELECT 'BACKING UP ",BACKUP_TABLE," COMPLETED ! ' AS 'DEBUG LOG', COUNT(1) FROM ", BACKUP_TABLE); - PREPARE stmtPrint FROM @printstate; - EXECUTE stmtPrint; - DEALLOCATE PREPARE stmtPrint; - END IF; - END loop backupLoop; - CLOSE backupTablesCursor; - END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDITLOG TABLES FOR DELETING CONSENTS --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IF (enableAudit) - THEN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'AUDITLOG_OB_CONSENT_CLEANUP' and TABLE_SCHEMA in (SELECT DATABASE()))) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP .. !'; - END IF; - CREATE TABLE AUDITLOG_OB_CONSENT_CLEANUP SELECT * FROM OB_CONSENT WHERE 1 = 2; - ALTER TABLE AUDITLOG_OB_CONSENT_CLEANUP ADD COLUMN `AUDIT_TIMESTAMP` TIMESTAMP DEFAULT CURRENT_TIMESTAMP; - ELSE - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'USING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP ..!'; - END IF; - END IF; - END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING RETENTION TABLES IF NOT EXISTS --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IF (enableDataRetention) - THEN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT SELECT * FROM OB_CONSENT WHERE 1 = 2; - END IF; - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_AUTH_RESOURCE' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT_AUTH_RESOURCE .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT_AUTH_RESOURCE SELECT * FROM OB_CONSENT_AUTH_RESOURCE WHERE 1 = 2; - END IF; - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_MAPPING' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT_MAPPING .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT_MAPPING SELECT * FROM OB_CONSENT_MAPPING WHERE 1 = 2; - END IF; - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_FILE' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT_FILE .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT_FILE SELECT * FROM OB_CONSENT_FILE WHERE 1 = 2; - END IF; - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_ATTRIBUTE' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT_ATTRIBUTE .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT_ATTRIBUTE SELECT * FROM OB_CONSENT_ATTRIBUTE WHERE 1 = 2; - END IF; - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'RET_OB_CONSENT_STATUS_AUDIT' and TABLE_SCHEMA in (SELECT DATABASE()))) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING RETENTION TABLE RET_OB_CONSENT_STATUS_AUDIT .. !' AS 'INFO LOG'; - END IF; - CREATE TABLE RET_OB_CONSENT_STATUS_AUDIT SELECT * FROM OB_CONSENT_STATUS_AUDIT WHERE 1 = 2; - END IF; - END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CALCULATING CONSENTS IN OB_CONSENT TABLE --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IF (enableLog) - THEN - SELECT 'CALCULATING CONSENTS IN OB_CONSENT TABLE .... !' AS 'INFO LOG'; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT COUNT(1) into rowcount FROM OB_CONSENT; - SELECT 'TOTAL CONSENTS ON OB_CONSENT TABLE BEFORE DELETE' AS 'DEBUG LOG',rowcount; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SELECT COUNT(1) into @cleanupCount FROM OB_CONSENT WHERE (consentStatuses = '' OR FIND_IN_SET(CURRENT_STATUS, consentStatuses) > 0) AND - (consentTypes = '' OR FIND_IN_SET(CONSENT_TYPE, consentTypes) > 0) AND (clientIds = '' OR FIND_IN_SET(CLIENT_ID, clientIds) > 0) AND UPDATED_TIME < lastUpdatedTime; - SELECT 'TOTAL CONSENTS SHOULD BE DELETED FROM OB_CONSENT' AS 'TRACE LOG', @cleanupCount; - SELECT 'NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !' AS 'TRACE LOG'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - set rowcount = (rowcount - @cleanupCount); - SELECT 'TOTAL CONSENTS SHOULD BE RETAIN IN OB_CONSENT' AS 'TRACE LOG', rowcount; - END IF; - END IF; - --- ------------------------------------------------------ --- BATCH DELETE CONSENT DATA --- ------------------------------------------------------ - IF (enableLog) - THEN - SELECT 'CONSENT PURGING STARTED .... !' AS 'INFO LOG'; - END IF; - - CONSENT_CHUNK_LOOP: REPEAT - - DROP TEMPORARY TABLE IF EXISTS CHUNK_OB_CONSENT; - - CREATE TEMPORARY TABLE CHUNK_OB_CONSENT SELECT CONSENT_ID FROM OB_CONSENT WHERE (consentStatuses = '' OR FIND_IN_SET(CURRENT_STATUS, consentStatuses) > 0) AND - (consentTypes = '' OR FIND_IN_SET(CONSENT_TYPE, consentTypes) > 0) AND (clientIds = '' OR FIND_IN_SET(CLIENT_ID, clientIds) > 0) AND UPDATED_TIME < lastUpdatedTime LIMIT chunkSize; - - SELECT COUNT(1) INTO @chunkCount FROM CHUNK_OB_CONSENT; - - IF (@chunkCount 0)) - THEN - DO SLEEP(sleepTime); - END IF; - UNTIL rowCount=0 END REPEAT; - UNTIL @chunkCount=0 END REPEAT; - - IF (enableLog ) - THEN - SELECT 'CONSENT DELETE ON OB_CONSENT_ATTRIBUTE, OB_CONSENT_FILE, OB_CONSENT_AUTH_RESOURCE, OB_CONSENT_MAPPING, OB_CONSENT_STATUS_AUDIT, OB_CONSENT - COMPLETED .... !' AS 'INFO LOG'; - END IF; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT 'TOTAL CONSENTS ON OB_CONSENT TABLE AFTER DELETE' AS 'DEBUG LOG', COUNT(1) FROM OB_CONSENT; - END IF; - - -- ------------------------------------------------------ - -- OPTIMIZING TABLES FOR BETTER PERFORMANCE - -- ------------------------------------------------------ - - IF (analyzeTables) - THEN - - IF (enableLog) - THEN - SELECT 'TABLE ANALYZING STARTED .... !' AS 'INFO LOG'; - END IF; - - ANALYZE TABLE OB_CONSENT; - ANALYZE TABLE OB_CONSENT_AUTH_RESOURCE; - ANALYZE TABLE OB_CONSENT_MAPPING; - ANALYZE TABLE OB_CONSENT_FILE; - ANALYZE TABLE OB_CONSENT_ATTRIBUTE; - ANALYZE TABLE OB_CONSENT_STATUS_AUDIT; - - END IF; - --- ------------------------------------------------------ - IF (enableLog) - THEN - SELECT 'WSO2_OB_CONSENT_CLEANUP_SP() COMPLETED .... !' AS 'INFO LOG'; - END IF; - -END$$ - -DELIMITER ; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-restore-script.sql deleted file mode 100644 index ea8332e4..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/mysql-consent-restore-script.sql +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ -DROP PROCEDURE IF EXISTS `WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP`; -DELIMITER $$ -CREATE PROCEDURE `WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP`() - -BEGIN - -DECLARE rowCount INT; -DECLARE enableLog BOOLEAN; -DECLARE logLevel VARCHAR(10); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET enableLog = TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -SET logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (enableLog) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED .... !'; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT TABLE !'; -END IF; -INSERT INTO OB_CONSENT SELECT A.* FROM BAK_OB_CONSENT A LEFT JOIN OB_CONSENT B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT WITH %',rowcount; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT_ATTRIBUTE'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_ATTRIBUTE TABLE !'; -END IF; -INSERT INTO OB_CONSENT_ATTRIBUTE SELECT A.* FROM BAK_OB_CONSENT_ATTRIBUTE A LEFT JOIN OB_CONSENT_ATTRIBUTE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_ATTRIBUTE WITH %',rowcount; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT_FILE'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_FILE TABLE !'; -END IF; -INSERT INTO OB_CONSENT_FILE SELECT A.* FROM BAK_OB_CONSENT_FILE A LEFT JOIN OB_CONSENT_FILE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_FILE WITH %',rowcount; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT_STATUS_AUDIT'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_STATUS_AUDIT TABLE !'; -END IF; -INSERT INTO OB_CONSENT_STATUS_AUDIT SELECT A.* FROM BAK_OB_CONSENT_STATUS_AUDIT A LEFT JOIN OB_CONSENT_STATUS_AUDIT B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_STATUS_AUDIT WITH %',rowcount; -END IF; -END IF; - --- -------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT_AUTH_RESOURCE'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_AUTH_RESOURCE TABLE !'; -END IF; -INSERT INTO OB_CONSENT_AUTH_RESOURCE SELECT A.* FROM BAK_OB_CONSENT_AUTH_RESOURCE A LEFT JOIN OB_CONSENT_AUTH_RESOURCE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_AUTH_RESOURCE WITH %',rowcount; -END IF; -END IF; - --- ------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_CONSENT_MAPPING'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_MAPPING TABLE !'; -END IF; -INSERT INTO OB_CONSENT_MAPPING SELECT A.* FROM BAK_OB_CONSENT_MAPPING A LEFT JOIN OB_CONSENT_MAPPING B ON A.MAPPING_ID = B.MAPPING_ID WHERE B.MAPPING_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_MAPPING WITH %',rowcount; -END IF; -END IF; - -IF (enableLog) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED .... !'; -END IF; - - -END$$ - -DELIMITER ; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/readme.MD deleted file mode 100644 index 0a0f8fe9..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/mysql/readme.MD +++ /dev/null @@ -1,70 +0,0 @@ -## **HOW TO RUN** - -**>> mysql-consent-cleanup-script.sql** - - -**Compile the Stored Procedure** - -First - Compile the stored procedure using a mysql client. Following is a sample for CLI based mysql client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -``` -mysql> source \\mysql-consent-cleanup-script.sql; -``` -or -``` -bash:~$ mysql -u yourusername -p yourpassword yourdatabase < \\mysql-consent-cleanup-script.sql -``` - -**Compile the stored procedure** - -Then execute the compiled store procedure by using the call function in the mysql client. Following is a sample for CLI based mysql client. - -- consentTypes `VARCHAR` -- clientIds `VARCHAR` -- consentStatuses `VARCHAR` -- purgeConsentsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- analyzeTables `BOOLEAN` -- enableDataRetention `BOOLEAN` - -``` -WSO2_OB_CONSENT_CLEANUP_SP( consentTypes, clientIds, consentStatuses, purgeConsentsOlderThanXNumberOfDays, - lastUpdatedTime, backupTables, enableAudit, analyzeTables, enableDataRetention ); -``` - -``` -Ex: -mysql> call WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, - TRUE, TRUE, TRUE, FALSE); -``` - - -**Execute the restore from backup procedure.** - -``` -call WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP(); -``` -- Note : If data retention feature is enabled, temporary retention tables will be created and stored the purged consents - until the server job (can run periodical or invoke via API) sync the temporary data to retention database. -- Note: When running backup procedure (consent-cleanup-restore.sql) to restore back the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. - -**You can also schedule a cleanup task that will be automatically run after a given period of time.** - -Ex: For Mysql - -``` -USE 'WSO2_OB_CONSENT_DB'; -DROP EVENT IF EXISTS consent_cleanup; -CREATE EVENT consent_cleanup - ON SCHEDULE - EVERY 1 WEEK STARTS '2015-01-01 00:00.00' - DO - CALL `WSO2_OB_CONSENT_DB`.WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, TRUE, TRUE, TRUE, FALSE); - --- 'Turn on the event_scheduler' -SET GLOBAL event_scheduler = ON; - -``` \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-cleanup-script.sql deleted file mode 100644 index ada28c2b..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-cleanup-script.sql +++ /dev/null @@ -1,653 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ -CREATE OR REPLACE PROCEDURE WSO2_OB_CONSENT_CLEANUP_SP ( - consentTypes_in IN VARCHAR2, - clientIds_in IN VARCHAR2, - consentStatuses_in IN VARCHAR2, - purgeConsentsOlderThanXNumberOfDays_in IN NUMBER, - lastUpdatedTime_in IN NUMBER, - backupTables_in IN BOOLEAN, - enableAudit_in IN BOOLEAN, - enableStsGthrn_in IN BOOLEAN, - enableRebuildIndexes_in IN BOOLEAN, - enableDataRetention_in IN BOOLEAN -) IS - --- ------------------------------------------ --- VARIABLE DECLARATION --- ------------------------------------------ - -systime TIMESTAMP := systimestamp; -utcTime TIMESTAMP := sys_extract_utc(systimestamp); -deleteCount INT := 0; -chunkCount INT := 0; -batchCount INT := 0; -ROWCOUNT INT := 0; -cleaupCount INT := 0; -CURRENT_SCHEMA VARCHAR(100); -backupTable VARCHAR(100); -cursorTable VARCHAR(100); - -CURSOR backupTablesCursor is -SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER = CURRENT_SCHEMA AND -TABLE_NAME IN ('OB_CONSENT','OB_CONSENT_AUTH_RESOURCE','OB_CONSENT_MAPPING','OB_CONSENT_FILE','OB_CONSENT_ATTRIBUTE','OB_CONSENT_STATUS_AUDIT'); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ - -batchSize INT := 10000; -- BATCH WISE DELETE [DEFAULT : 10000] -chunkSize INT := 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFAULT : 500000] -checkCount INT := 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE CONSENTS COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] -sleepTime FLOAT := 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -enableLog BOOLEAN := TRUE ; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel VARCHAR(10) := 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG -enableDataRetentionForAuthResourceAndMapping BOOLEAN := TRUE; -- ENABLE STORING AUTH RESOURCE AND CONSENT MAPPING TABLES FOR RETENTION DATA. -enableDataRetentionForObConsentFile BOOLEAN := TRUE; -- ENABLE STORING OB_CONSENT_FILE TABLE FOR RETENTION DATA. -enableDataRetentionForObConsentAttribute BOOLEAN := TRUE; -- ENABLE STORING OB_CONSENT_ATTRIBUTE TABLE FOR RETENTION DATA. -enableDataRetentionForObConsentStatusAudit BOOLEAN := TRUE; -- ENABLE STORING OB_CONSENT_STATUS_AUDIT TABLE FOR RETENTION DATA. - -backupTables BOOLEAN := TRUE; -enableAudit BOOLEAN := FALSE; -enableStsGthrn BOOLEAN := FALSE; -enableRebuildIndexes BOOLEAN := FALSE; -enableDataRetention BOOLEAN := FALSE; - --- Consent Data Purging Configs -consentTypes VARCHAR(1024) := ''; -clientIds VARCHAR(4096) := ''; -consentStatuses VARCHAR(1024) := ''; -olderThanTimePeriodForPurging NUMBER := 60 * 60 * 24 * 365; -lastUpdatedTime NUMBER := EXTRACT(DAY FROM(utcTime - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(utcTime, 'SSSSS')) - olderThanTimePeriodForPurging; - -BEGIN - -backupTables:= backupTables_in; -- SET IF CONSENTS TABLE NEEDS TO BACKUP BEFORE DELETE, WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION -enableAudit := enableAudit_in; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED CONSENTS USING A TABLE [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] -enableStsGthrn := enableStsGthrn_in; -- SET TRUE FOR GATHER SCHEMA LEVEL STATS TO IMPROVE QUERY PERFORMANCE -enableRebuildIndexes := enableRebuildIndexes_in; -- SET TRUE FOR REBUILD INDEXES TO IMPROVE QUERY PERFORMANCE -enableDataRetention := enableDataRetention_in; -- SET TRUE FOR ENABLE DATA RETENTION (ARCHIVE PURGED DATA) [DEFAULT : FALSE] - --- Consent Data Purging Configs -consentTypes := consentTypes_in; -- SET CONSENT_TYPES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'accounts,payments', LEAVE AS EMPTY TO SKIP) -clientIds := clientIds_in; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) -consentStatuses := consentStatuses_in; -- SET CONSENT_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'expired,revoked', LEAVE AS EMPTY TO SKIP) - -CASE WHEN purgeConsentsOlderThanXNumberOfDays_in IS NOT NULL - THEN olderThanTimePeriodForPurging := 60 * 60 * 24 * purgeConsentsOlderThanXNumberOfDays_in; -- SET TIME PERIOD (SECONDS) TO DELETE CONSENTS OLDER THAN N DAYS (DEFAULT 365). (CHECK BELOW FOR FOR INFO.) - ELSE olderThanTimePeriodForPurging := 60 * 60 * 24 * 365; -END CASE; - -CASE WHEN lastUpdatedTime_in IS NOT NULL - THEN lastUpdatedTime := lastUpdatedTime_in; -- SET LAST_UPDATED_TIME FOR PURGING, (IF CONSENT'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE lastUpdatedTime := EXTRACT(DAY FROM(utcTime - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(utcTime, 'SSSSS')) - olderThanTimePeriodForPurging; -END CASE; - --- HERE IF WE WISH TO PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeConsentsOlderThanXNumberOfDays_in = 31 , FOR PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeConsentsOlderThanXNumberOfDays_in --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - --- ------------------------------------------------------ --- CREATING LOG TABLE FOR DELETING CONSENTS --- ------------------------------------------------------ - -SELECT SYS_CONTEXT( 'USERENV', 'CURRENT_SCHEMA' ) INTO CURRENT_SCHEMA FROM DUAL; - -IF (enableLog) -THEN -SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('LOG_WSO2_OB_CONSENT_CLEANUP_SP'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE LOG_WSO2_OB_CONSENT_CLEANUP_SP'; - COMMIT; - END if; -EXECUTE IMMEDIATE 'CREATE TABLE LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP VARCHAR(250) , LOG VARCHAR(250)) NOLOGGING'; -COMMIT; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''LOG_WSO2_OB_CONSENT_CLEANUP_SP STARTED .... !'')'; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING SCHEMA :'||CURRENT_SCHEMA||''')'; -COMMIT; -END IF; - - -IF (enableAudit) -THEN -backupTables := TRUE; -- BACKUP TABLES IS REQUIRED BE TRUE, HENCE THE AUDIT IS ENABLED. -END IF; - --- ------------------------------------------------------ --- BACKUP TABLES --- ------------------------------------------------------ - - -IF (backupTables) -THEN - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TABLE BACKUP STARTED ... !'')'; - COMMIT; - END IF; - - FOR cursorTable IN backupTablesCursor - LOOP - - SELECT REPLACE(''||cursorTable.TABLE_NAME||'','OB_','BAK_OB_') INTO backupTable FROM DUAL; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BACKING UP '||cursorTable.TABLE_NAME||' INTO '||backupTable||' STARTED '')'; - COMMIT; - END IF; - - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper(backupTable); - IF (ROWCOUNT = 1) - THEN - EXECUTE IMMEDIATE 'DROP TABLE '||backupTable; - COMMIT; - END if; - - EXECUTE IMMEDIATE 'CREATE TABLE '||backupTable||' AS (SELECT * FROM '||cursorTable.TABLE_NAME||')'; - ROWCOUNT:= sql%rowcount; - COMMIT; - - IF (enableLog AND logLevel IN ('TRACE','DEBUG') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BACKING UP '||cursorTable.TABLE_NAME||' COMPLETED WITH : '||ROWCOUNT||''')'; - COMMIT; - END IF; - - END LOOP; - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - - --- ------------------------------------------------------ --- CREATING AUDIT TABLES FOR CONSENTS DELETION FOR THE FIRST TIME RUN --- ------------------------------------------------------ -IF (enableAudit) -THEN - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'AUDITLOG_OB_CONSENT_CLEANUP'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP .. ! '')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE AUDITLOG_OB_CONSENT_CLEANUP as (SELECT * FROM OB_CONSENT WHERE 1 = 2)'; - EXECUTE IMMEDIATE 'ALTER TABLE AUDITLOG_OB_CONSENT_CLEANUP ADD AUDIT_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP'; - COMMIT; - ELSE - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP'')'; - COMMIT; - END IF; - END IF; - - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; - -END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING RETENTION TABLES IF NOT EXISTS --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (enableDataRetention) -THEN - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT as (SELECT * FROM OB_CONSENT WHERE 1 = 2)'; - COMMIT; - END IF; - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT_AUTH_RESOURCE'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT_AUTH_RESOURCE .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT_AUTH_RESOURCE as (SELECT * FROM OB_CONSENT_AUTH_RESOURCE WHERE 1 = 2)'; - COMMIT; - END IF; - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT_MAPPING'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT_MAPPING .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT_MAPPING as (SELECT * FROM OB_CONSENT_MAPPING WHERE 1 = 2)'; - COMMIT; - END IF; - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT_FILE'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT_FILE .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT_FILE as (SELECT * FROM OB_CONSENT_FILE WHERE 1 = 2)'; - COMMIT; - END IF; - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT_ATTRIBUTE'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT_ATTRIBUTE .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT_ATTRIBUTE as (SELECT * FROM OB_CONSENT_ATTRIBUTE WHERE 1 = 2)'; - COMMIT; - END IF; - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'RET_OB_CONSENT_STATUS_AUDIT'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING RETENTION TABLE RET_OB_CONSENT_STATUS_AUDIT .. !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE RET_OB_CONSENT_STATUS_AUDIT as (SELECT * FROM OB_CONSENT_STATUS_AUDIT WHERE 1 = 2)'; - COMMIT; - END IF; - -END IF; - - ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- CALCULATING CONSENTS COUNTS IN OB_CONSENT ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CALCULATING CONSENTS COUNTS IN OB_CONSENT TABLE .... !'')'; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT COUNT(1) INTO ROWCOUNT FROM OB_CONSENT; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL CONSENTS ON OB_CONSENT TABLE BEFORE DELETE : '||ROWCOUNT||''')'; - COMMIT; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SELECT COUNT(1) INTO cleaupCount FROM OB_CONSENT WHERE (consentStatuses IS NULL OR INSTR(LOWER(','||consentStatuses||','), ','||LOWER(CURRENT_STATUS)||',') > 0) AND (consentTypes IS NULL OR INSTR(LOWER(','||consentTypes||','), ','||LOWER(CONSENT_TYPE)||',') > 0) AND (clientIds IS NULL OR INSTR(LOWER(','||clientIds||','), ','||LOWER(CLIENT_ID)||',') > 0) AND UPDATED_TIME < lastUpdatedTime; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL CONSENTS SHOULD BE DELETED FROM OB_CONSENT : '||cleaupCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'')'; - COMMIT; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - ROWCOUNT := (ROWCOUNT - cleaupCount); - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL CONSENTS SHOULD BE RETAIN IN OB_CONSENT : '||ROWCOUNT||''')'; - COMMIT; - END IF; -END IF; - --- ------------------------------------------------------ --- BATCH DELETE CONSENT DATA --- ------------------------------------------------------ -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CONSENT PURGING STARTED ... ! '')'; - COMMIT; -END IF; - -LOOP - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('CHUNK_OB_CONSENT'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE CHUNK_OB_CONSENT'; - COMMIT; - END if; - - EXECUTE IMMEDIATE 'CREATE TABLE CHUNK_OB_CONSENT (CONSENT_ID VARCHAR(255),CONSTRAINT CHNK_CHUNK_OB_CONSENT_PRI PRIMARY KEY (CONSENT_ID)) NOLOGGING'; - COMMIT; - EXECUTE IMMEDIATE q'!INSERT /*+ APPEND */ INTO CHUNK_OB_CONSENT (CONSENT_ID) SELECT CONSENT_ID FROM OB_CONSENT WHERE rownum <= :chunkSize AND ( - (:consentStatuses IS NULL OR INSTR( LOWER( ','||:consentStatuses||','), LOWER( ','||CURRENT_STATUS||',') ) > 0) AND - (:consentTypes IS NULL OR INSTR( LOWER( ','||:consentTypes||','), LOWER( ','||CONSENT_TYPE||',') ) > 0) AND - (:clientIds IS NULL OR INSTR( LOWER( ','||:clientIds||','), LOWER(','||CLIENT_ID||',') ) > 0) AND - UPDATED_TIME < :lastUpdatedTime )!' using chunkSize,consentStatuses,consentStatuses,consentTypes,consentTypes,clientIds,clientIds,lastUpdatedTime; - chunkCount:= sql%Rowcount; - COMMIT; - - EXIT WHEN chunkCount < checkCount ; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CHUNK TABLE CHUNK_OB_CONSENT CREATED WITH : '||chunkCount||''')'; - COMMIT; - END IF; - - IF (enableAudit) - THEN - EXECUTE IMMEDIATE 'INSERT INTO AUDITLOG_OB_CONSENT_CLEANUP SELECT OBC.*, CURRENT_TIMESTAMP FROM OB_CONSENT OBC , CHUNK_OB_CONSENT CHK WHERE OBC.CONSENT_ID=CHK.CONSENT_ID'; - COMMIT; - END IF; - - LOOP - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('BATCH_OB_CONSENT'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE BATCH_OB_CONSENT'; - COMMIT; - END IF; - - EXECUTE IMMEDIATE 'CREATE TABLE BATCH_OB_CONSENT (CONSENT_ID VARCHAR(255),CONSTRAINT BATCH_OB_CONSENT_PRI PRIMARY KEY (CONSENT_ID)) NOLOGGING'; - COMMIT; - - EXECUTE IMMEDIATE 'INSERT /*+ APPEND */ INTO BATCH_OB_CONSENT (CONSENT_ID) SELECT CONSENT_ID FROM CHUNK_OB_CONSENT WHERE rownum <= '||batchSize||''; - batchCount:= sql%rowcount; - COMMIT; - - EXIT WHEN batchCount = 0 ; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE START ON CONSENT TABLES WITH BATCH_COUNT : '||batchCount||''')'; - COMMIT; - END IF; - - -- STORING RETENTION DATA IN RETENTION DB - IF (enableDataRetention) THEN - - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT DATA TO RET_OB_CONSENT TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT SELECT * FROM OB_CONSENT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - - -- STORE OB_CONSENT_AUTH_RESOURCE AND OB_CONSENT_MAPPING RETENTION DATA IF ENABLED. - IF (enableDataRetentionForAuthResourceAndMapping) THEN - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT_AUTH_RESOURCE DATA TO RET_OB_CONSENT_AUTH_RESOURCE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT_AUTH_RESOURCE SELECT * FROM OB_CONSENT_AUTH_RESOURCE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT_MAPPING DATA TO RET_OB_CONSENT_MAPPING TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT_MAPPING SELECT * FROM OB_CONSENT_MAPPING WHERE MAPPING_ID IN ( SELECT MAPPING_ID FROM OB_CONSENT_MAPPING OBCM - INNER JOIN OB_CONSENT_AUTH_RESOURCE OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN BATCH_OB_CONSENT B ON OBAR.CONSENT_ID = B.CONSENT_ID)'; - COMMIT; - END IF; - - -- STORE OB_CONSENT_STATUS_AUDIT RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentStatusAudit) THEN - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT_STATUS_AUDIT DATA TO RET_OB_CONSENT_STATUS_AUDIT TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT_STATUS_AUDIT SELECT * FROM OB_CONSENT_STATUS_AUDIT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - END IF; - - -- STORE OB_CONSENT_FILE RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentFile) THEN - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT_FILE DATA TO RET_OB_CONSENT_FILE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT_FILE SELECT * FROM OB_CONSENT_FILE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - END IF; - - -- STORE OB_CONSENT_ATTRIBUTE RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentAttribute) THEN - IF (enableLog AND logLevel IN ('TRACE') ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''INSERTING OB_CONSENT_ATTRIBUTE DATA TO RET_OB_CONSENT_ATTRIBUTE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO RET_OB_CONSENT_ATTRIBUTE SELECT * FROM OB_CONSENT_ATTRIBUTE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - END IF; - - END IF; - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_ATTRIBUTE - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_CONSENT_ATTRIBUTE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT_ATTRIBUTE WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_FILE - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_CONSENT_FILE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT_FILE WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_STATUS_AUDIT - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_CONSENT_STATUS_AUDIT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT_STATUS_AUDIT WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_MAPPING - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE FROM OB_CONSENT_MAPPING WHERE MAPPING_ID IN ( SELECT MAPPING_ID FROM OB_CONSENT_MAPPING OBCM - INNER JOIN OB_CONSENT_AUTH_RESOURCE OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN BATCH_OB_CONSENT B ON OBAR.CONSENT_ID = B.CONSENT_ID)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT_MAPPING WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_AUTH_RESOURCE - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_CONSENT_AUTH_RESOURCE where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT_AUTH_RESOURCE WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_CONSENT where CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_CONSENT WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - EXECUTE IMMEDIATE 'DELETE CHUNK_OB_CONSENT WHERE CONSENT_ID in (select CONSENT_ID from BATCH_OB_CONSENT)'; - COMMIT; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''DELETED BATCH ON CHUNK_OB_CONSENT !'')'; - COMMIT; - END IF; - - EXIT WHEN deleteCount = 0 ; - - IF ((deleteCount > 0)) - THEN - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SLEEPING ...'')'; - COMMIT; - END IF; - DBMS_LOCK.SLEEP(sleepTime); - END IF; - END LOOP; -END LOOP; - -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE ON CONSENT DATA COMPLETED .... !'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; -END IF; -COMMIT; - - -IF (enableLog AND logLevel IN ('DEBUG','TRACE')) -THEN - SELECT COUNT(1) INTO ROWCOUNT FROM OB_CONSENT; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL CONSENTS ON OB_CONSENT TABLE AFTER DELETE :'||ROWCOUNT||''')'; - COMMIT; - - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; -END IF; - - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ - -IF(enableRebuildIndexes) -THEN - FOR cursorTable IN backupTablesCursor - LOOP - FOR INDEX_ENTRY IN (SELECT INDEX_NAME FROM ALL_INDEXES WHERE TABLE_NAME=''||cursorTable.TABLE_NAME||'' AND INDEX_TYPE='NORMAL' AND OWNER = CURRENT_SCHEMA) - LOOP - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''REBUILDING INDEXES ON '||cursorTable.TABLE_NAME||' TABLE : '||INDEX_ENTRY.INDEX_NAME||''')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'ALTER INDEX ' || INDEX_ENTRY.INDEX_NAME || ' REBUILD'; - COMMIT; - END LOOP; - END LOOP; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - END IF; - COMMIT; -END IF; - - --- ------------------------------------------------------ --- STATS GATHERING FOR OPTIMUM PERFORMANCE --- ------------------------------------------------------ - -IF(enableStsGthrn) -THEN - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SCHEMA LEVEL STATS GATHERING JOB STARTED.'')'; - COMMIT; - END IF; - - BEGIN - dbms_stats.gather_schema_stats(CURRENT_SCHEMA,DBMS_STATS.AUTO_SAMPLE_SIZE); - END; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SCHEMA LEVEL STATS GATHERING JOB COMPLETED.'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - -IF (enableLog AND logLevel IN ('DEBUG','TRACE')) -THEN -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_CONSENT_CLEANUP_SP COMPLETED .... !'')'; -COMMIT; -END IF; - -END; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-restore-script.sql deleted file mode 100644 index 2d84446c..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/oracle-consent-restore-script.sql +++ /dev/null @@ -1,167 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR REPLACE PROCEDURE WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP IS - - -rowCount INT; -CURRENT_SCHEMA VARCHAR(100); --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -enableLog BOOLEAN := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel VARCHAR(10):= 'TRACE'; -- SET LOG LEVELS : TRACE - - -BEGIN - -SELECT SYS_CONTEXT( 'USERENV', 'CURRENT_SCHEMA' ) INTO CURRENT_SCHEMA FROM DUAL; - -IF (enableLog) -THEN - SELECT COUNT(*) INTO rowCount from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP'); - IF (rowCount = 1) then - EXECUTE IMMEDIATE 'DROP TABLE LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP'; - COMMIT; - END if; - EXECUTE IMMEDIATE 'CREATE TABLE LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP VARCHAR(250) , LOG VARCHAR(250)) NOLOGGING'; - COMMIT; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_CONSENT_CLEANUP_DATA_RESTORATION_SP STARTED .... !'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING SCHEMA :'||CURRENT_SCHEMA||''')'; - COMMIT; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT SELECT A.* FROM BAK_OB_CONSENT A LEFT JOIN OB_CONSENT B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT_ATTRIBUTE'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_ATTRIBUTE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT_ATTRIBUTE SELECT A.* FROM BAK_OB_CONSENT_ATTRIBUTE A LEFT JOIN OB_CONSENT_ATTRIBUTE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_ATTRIBUTE WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT_FILE'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_FILE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT_FILE SELECT A.* FROM BAK_OB_CONSENT_FILE A LEFT JOIN OB_CONSENT_FILE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_FILE WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT_STATUS_AUDIT'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_STATUS_AUDIT TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT_STATUS_AUDIT SELECT A.* FROM BAK_OB_CONSENT_STATUS_AUDIT A LEFT JOIN OB_CONSENT_STATUS_AUDIT B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_STATUS_AUDIT WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT_AUTH_RESOURCE'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_AUTH_RESOURCE TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT_AUTH_RESOURCE SELECT A.* FROM BAK_OB_CONSENT_AUTH_RESOURCE A LEFT JOIN OB_CONSENT_AUTH_RESOURCE B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_AUTH_RESOURCE WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_CONSENT_MAPPING'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_CONSENT_MAPPING TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_CONSENT_MAPPING SELECT A.* FROM BAK_OB_CONSENT_MAPPING A LEFT JOIN OB_CONSENT_MAPPING B ON A.MAPPING_ID = B.MAPPING_ID WHERE B.MAPPING_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_CONSENT_MAPPING WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'')'; - COMMIT; -END IF; - -END; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/readme.MD deleted file mode 100644 index 226c86ff..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/oracle/readme.MD +++ /dev/null @@ -1,50 +0,0 @@ -## **HOW TO RUN** - -**>> oracle-consent-cleanup-script.sql** - - -**Compile the stored procedure** - -First - Compile the stored procedure using a Oracle client. Following is a sample for CLI based Oracle client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -``` -sqlplus> @\\oracle-consent-cleanup-script.sql; -``` - -**Execute the stored procedure.** - -Then execute the compiled store procedure by using the exec function in the Oracle client. Following is a sample for CLI based Oracle client. - -- consentTypes `VARCHAR2` -- clientIds `VARCHAR2` -- consentStatuses `VARCHAR2` -- purgeConsentsOlderThanXNumberOfDays `NUMBER` -- lastUpdatedTime `NUMBER` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- enableStsGthrn `BOOLEAN` -- enableRebuilddexes `BOOLEAN` -- enableDataRetention `BOOLEAN` - -``` -WSO2_OB_CONSENT_CLEANUP_SP( consentTypes, clientIds, consentStatuses, purgeConsentsOlderThanXNumberOfDays, - lastUpdatedTime, backupTables, enableAudit, enableStsGthrn, enableRebuildIndexes, enableDataRetention ); -``` - -``` -Ex: - -sqlplus> exec WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, - TRUE, TRUE, TRUE, TRUE, FALSE); -``` - -**Execute the restore from backup procedure.** - -``` -EXEC WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP(); -``` - -- Note : If data retention feature is enabled, temporary retention tables will be created and stored the purged consents - until the server job (can run periodical or invoke via API) sync the temporary data to retention database. -- Note: When running backup procedure (consent-cleanup-restore.sql) to restore back the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-cleanup-script.sql deleted file mode 100644 index acf255c7..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-cleanup-script.sql +++ /dev/null @@ -1,585 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR REPLACE PROCEDURE WSO2_OB_CONSENT_CLEANUP_SP( - IN consentTypes VARCHAR(1024), - IN clientIds VARCHAR(4096), - IN consentStatuses VARCHAR(1024), - IN purgeConsentsOlderThanXNumberOfDays INT, - IN lastUpdatedTime BIGINT, - IN backupTables BOOLEAN, - IN enableAudit BOOLEAN, - IN enableReindexing BOOLEAN, - IN enableTblAnalyzing BOOLEAN, - IN enableDataRetention BOOLEAN -) AS $$ -DECLARE - -batchSize int; -chunkSize int; -checkCount int; -sleepTime float; -enableLog boolean; -logLevel VARCHAR(10); -backupTable text; -indexTable text; -notice text; -cusrRecord record; -rowcount bigint :=0; -cleanupCount bigint :=0; -deleteCount INT := 0; -chunkCount INT := 0; -batchCount INT := 0; -olderThanTimePeriodForPurging bigint; - --- Data retention variables -enableDataRetentionForAuthResourceAndMapping boolean; -enableDataRetentionForObConsentFile boolean; -enableDataRetentionForObConsentAttribute boolean; -enableDataRetentionForObConsentStatusAudit boolean; - -tablesCursor CURSOR FOR SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = current_schema() AND -tablename IN ('ob_consent','ob_consent_auth_resource','ob_consent_mapping','ob_consent_file','ob_consent_attribute','ob_consent_status_audit'); - - -BEGIN - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -batchSize := 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] -chunkSize := 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFAULT : 500000] -checkCount := 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE CONSENT COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] - -CASE WHEN (backupTables IS NULL) - THEN backupTables := TRUE; -- SET IF CONSENT TABLE NEEDS TO BACKUP BEFORE DELETE [DEFAULT : TRUE] , WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION - ELSE -END CASE; - -sleepTime := 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -enableLog := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - -CASE WHEN (enableAudit IS NULL) - THEN enableAudit := FALSE; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED CONSENTS USING A TABLE [DEFAULT : FALSE] [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] - ELSE -END CASE; - -CASE WHEN (enableReindexing IS NULL) - THEN enableReindexing := FALSE; -- SET TRUE FOR GATHER SCHEMA LEVEL STATS TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE -END CASE; - -CASE WHEN (enableTblAnalyzing IS NULL) - THEN enableTblAnalyzing := FALSE; -- SET TRUE FOR Rebuild Indexes TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE -END CASE; - --- Data Retention Configs (Configure if data retention is enabled) - -CASE WHEN (enableDataRetention IS NULL) - THEN enableDataRetention := FALSE; -- SET TRUE FOR ENABLE DATA RETENTION (ARCHIVE PURGED DATA) [DEFAULT : FALSE] - ELSE -END CASE; - -enableDataRetentionForAuthResourceAndMapping := TRUE; -- ENABLE STORING AUTH RESOURCE AND CONSENT MAPPING TABLES FOR RETENTION DATA. -enableDataRetentionForObConsentFile := TRUE; -- ENABLE STORING OB_CONSENT_FILE TABLE FOR RETENTION DATA. -enableDataRetentionForObConsentAttribute := TRUE; -- ENABLE STORING OB_CONSENT_ATTRIBUTE TABLE FOR RETENTION DATA. -enableDataRetentionForObConsentStatusAudit := TRUE; -- ENABLE STORING OB_CONSENT_STATUS_AUDIT TABLE FOR RETENTION DATA. - --- ------------------------------------------ --- CONSENT DATA PURGING CONFIGS --- ------------------------------------------ - -CASE WHEN (consentTypes IS NULL) - THEN consentTypes = ''; -- SET CONSENT_TYPES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'accounts,payments', LEAVE AS EMPTY TO SKIP) - ELSE -END CASE; - -CASE WHEN (clientIds IS NULL) - THEN clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) - ELSE -END CASE; - -CASE WHEN (consentStatuses IS NULL) - THEN consentStatuses = ''; -- SET CONSENT_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'expired,revoked', LEAVE AS EMPTY TO SKIP) - ELSE -END CASE; - -CASE WHEN (purgeConsentsOlderThanXNumberOfDays IS NULL) - THEN olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE CONSENTS OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - ELSE olderThanTimePeriodForPurging = 60 * 60 * 24 * purgeConsentsOlderThanXNumberOfDays; -END CASE; - -CASE WHEN (lastUpdatedTime IS NULL) - THEN lastUpdatedTime = cast(extract(epoch from now())as bigint) - olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF CONSENT'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE -END CASE; - - --- HERE IF WE WISH TO PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeConsentsOlderThanXNumberOfDays_in = 31 , FOR PURGE CONSENTS WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeConsentsOlderThanXNumberOfDays_in --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - --- ------------------------------------------------------ --- BACKUP CONSENT TABLES --- ------------------------------------------------------ - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_CONSENT_CLEANUP_SP STARTED .... !'; -RAISE NOTICE ''; -END IF; - -IF (enableAudit) -THEN -backupTables:=TRUE; -END IF; - -IF (backupTables) -THEN - IF (enableLog) THEN - RAISE NOTICE 'TABLE BACKUP STARTED ... !'; - END IF; - - OPEN tablesCursor; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - backupTable := 'bak_'||cusrRecord.tablename; - - EXECUTE 'SELECT count(1) from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename = $1' into rowcount USING backupTable; - IF (rowcount = 1) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ALREADY EXISTS HENCE DROPPING TABLE %',backupTable; - END IF; - EXECUTE 'DROP TABLE '||quote_ident(backupTable); - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE 'SELECT COUNT(1) FROM '||quote_ident(cusrRecord.tablename) INTO rowcount; - notice := cusrRecord.tablename||' NUMBER OF ROWS: '||rowcount; - RAISE NOTICE 'BACKING UP %',notice; - END IF; - - EXECUTE 'CREATE TABLE '||quote_ident(backupTable)||' as SELECT * FROM '||quote_ident(cusrRecord.tablename); - - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - EXECUTE 'SELECT COUNT(1) FROM '||quote_ident(backupTable) INTO rowcount; - notice := cusrRecord.tablename||' TABLE INTO '||backupTable||' TABLE COMPLETED WITH : '||rowcount; - RAISE NOTICE 'BACKING UP %',notice; - RAISE NOTICE ''; - END IF; - END LOOP; - CLOSE tablesCursor; -END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDIT TABLES FOR DELETING --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (enableAudit) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING AUDIT TABLES ... !'; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('auditlog_ob_consent_cleanup'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP .. !'; - END IF; - CREATE TABLE auditlog_ob_consent_cleanup as SELECT * FROM ob_consent WHERE 1 = 2; - ALTER TABLE auditlog_ob_consent_cleanup ADD COLUMN AUDIT_TIMESTAMP TIMESTAMP DEFAULT NOW(); - ELSE - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'USING AUDIT TABLE AUDITLOG_OB_CONSENT_CLEANUP ..!'; - END IF; - END IF; -END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING RETENTION TABLES IF NOT EXISTS --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -IF (enableDataRetention) -THEN - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent .. !'; - END IF; - CREATE TABLE ret_ob_consent as SELECT * FROM ob_consent WHERE 1 = 2; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent_auth_resource'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent_auth_resource .. !'; - END IF; - CREATE TABLE ret_ob_consent_auth_resource as SELECT * FROM ob_consent_auth_resource WHERE 1 = 2; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent_mapping'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent_mapping .. !'; - END IF; - CREATE TABLE ret_ob_consent_mapping as SELECT * FROM ob_consent_mapping WHERE 1 = 2; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent_file'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent_file .. !'; - END IF; - CREATE TABLE ret_ob_consent_file as SELECT * FROM ob_consent_file WHERE 1 = 2; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent_attribute'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent_attribute .. !'; - END IF; - CREATE TABLE ret_ob_consent_attribute as SELECT * FROM ob_consent_attribute WHERE 1 = 2; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('ret_ob_consent_status_audit'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING RETENTION TABLE ret_ob_consent_status_audit .. !'; - END IF; - CREATE TABLE ret_ob_consent_status_audit as SELECT * FROM ob_consent_status_audit WHERE 1 = 2; - END IF; -END IF; - - --- ------------------------------------------------------ --- CALCULATING CONSENTS IN OB_CONSENT TABLE --- ------------------------------------------------------ - -IF (enableLog) THEN - RAISE NOTICE ''; - RAISE NOTICE 'CALCULATING CONSENTS ON OB_CONSENT .... !'; - - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - SELECT COUNT(1) INTO rowcount FROM ob_consent; - RAISE NOTICE 'TOTAL CONSENTS ON OB_CONSENT TABLE BEFORE DELETE: %',rowcount; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT COUNT(1) INTO cleanupCount FROM ob_consent WHERE - ((consentStatuses = '') IS NOT FALSE OR STRPOS( LOWER(','||consentStatuses||','), ','||LOWER(CURRENT_STATUS)||',') > 0) AND - ((consentTypes = '') IS NOT FALSE OR STRPOS( LOWER(','||consentTypes||','), ','||LOWER(CONSENT_TYPE)||',') > 0) AND - ((clientIds = '') IS NOT FALSE OR STRPOS( LOWER(','||clientIds||','), ','||LOWER(CLIENT_ID)||',') > 0) AND - UPDATED_TIME < lastUpdatedTime; - RAISE NOTICE 'TOTAL CONSENTS SHOULD BE DELETED FROM OB_CONSENT: %',cleanupCount; - RAISE NOTICE 'NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - rowcount := (rowcount - cleanupCount); - RAISE NOTICE 'TOTAL CONSENTS SHOULD BE RETAIN IN OB_CONSENT: %',rowcount; - END IF; -END IF; - --- ------------------------------------------------------ --- BATCH DELETE CONSENT DATA --- ------------------------------------------------------ - -IF (enableLog) -THEN -RAISE NOTICE ''; -RAISE NOTICE 'CONSENTS PURGING STARTED .... !'; -END IF; - -LOOP - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('chunk_ob_consent'); - IF (rowcount = 1) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'DROPPING EXISTING TABLE chunk_ob_consent !'; - END IF; - DROP TABLE chunk_ob_consent; - END IF; - - CREATE TABLE chunk_ob_consent (CONSENT_ID VARCHAR); - - INSERT INTO chunk_ob_consent (CONSENT_ID) SELECT CONSENT_ID FROM ob_consent WHERE - ((consentStatuses = '') IS NOT FALSE OR STRPOS(LOWER(','||consentStatuses||','), ','||LOWER(CURRENT_STATUS)||',') > 0) AND - ((consentTypes = '') IS NOT FALSE OR STRPOS( LOWER(','||consentTypes||','), ','||LOWER(CONSENT_TYPE)||',') > 0) AND - ((clientIds = '') IS NOT FALSE OR STRPOS( LOWER(','||clientIds||','), ','||LOWER(CLIENT_ID)||',') > 0) AND - UPDATED_TIME < lastUpdatedTime LIMIT chunkSize; - GET diagnostics chunkCount := ROW_COUNT; - - IF (chunkCount < checkCount) - THEN - EXIT; - END IF; - - CREATE INDEX idx_chunk_ob_consent ON chunk_ob_consent (CONSENT_ID); - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - RAISE NOTICE ''; - RAISE NOTICE 'PROCEEDING WITH NEW CHUNK TABLE chunk_ob_consent %',chunkCount; - RAISE NOTICE ''; - END IF; - - IF (enableAudit) - THEN - INSERT INTO auditlog_ob_consent_cleanup SELECT OBC.*, NOW() FROM ob_consent OBC , chunk_ob_consent CHK WHERE OBC.CONSENT_ID=CHK.CONSENT_ID; - COMMIT; - END IF; - - LOOP - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('batch_ob_consent'); - IF (rowcount = 1) - THEN - DROP TABLE batch_ob_consent; - END IF; - - CREATE TABLE batch_ob_consent (CONSENT_ID VARCHAR); - - INSERT INTO batch_ob_consent (CONSENT_ID) SELECT CONSENT_ID FROM chunk_ob_consent LIMIT batchSize; - GET diagnostics batchCount := ROW_COUNT; - - IF ((batchCount = 0)) - THEN - EXIT WHEN batchCount=0; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'BATCH DELETE START ON CONSENT DATA WITH : %',batchCount; - END IF; - - -- STORING RETENTION DATA IN RETENTION DB - IF (enableDataRetention) THEN - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent TABLE !'; - END IF; - INSERT INTO ret_ob_consent SELECT * FROM ob_consent where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - - -- STORE OB_CONSENT_AUTH_RESOURCE AND OB_CONSENT_MAPPING RETENTION DATA IF ENABLED. - IF (enableDataRetentionForAuthResourceAndMapping) THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent_auth_resource TABLE !'; - END IF; - INSERT INTO ret_ob_consent_auth_resource SELECT * FROM ob_consent_auth_resource where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent_mapping TABLE !'; - END IF; - INSERT INTO ret_ob_consent_mapping SELECT * FROM ob_consent_mapping where MAPPING_ID in (SELECT MAPPING_ID FROM ob_consent_mapping OBCM - INNER JOIN ob_consent_auth_resource OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN batch_ob_consent B ON OBAR.CONSENT_ID = B.CONSENT_ID); - END IF; - - -- STORE OB_CONSENT_STATUS_AUDIT RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentStatusAudit) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent_status_audit TABLE !'; - END IF; - INSERT INTO ret_ob_consent_status_audit SELECT * FROM ob_consent_status_audit where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - END IF; - - -- STORE OB_CONSENT_FILE RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentFile) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent_file TABLE !'; - END IF; - INSERT INTO ret_ob_consent_file SELECT * FROM ob_consent_file where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - END IF; - - -- STORE OB_CONSENT_ATTRIBUTE RETENTION DATA IF ENABLED. - IF (enableDataRetentionForObConsentAttribute) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'INSERTING OB_CONSENT DATA TO ret_ob_consent_attribute TABLE !'; - END IF; - INSERT INTO ret_ob_consent_attribute SELECT * FROM ob_consent_attribute where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - END IF; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_ATTRIBUTE - -- ------------------------------------------------------ - DELETE FROM ob_consent_attribute where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent_attribute WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_FILE - -- ------------------------------------------------------ - DELETE FROM ob_consent_file where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent_file WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_STATUS_AUDIT - -- ------------------------------------------------------ - DELETE FROM ob_consent_status_audit where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent_status_audit WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_MAPPING - -- ------------------------------------------------------ - DELETE FROM ob_consent_mapping where MAPPING_ID in (SELECT MAPPING_ID FROM ob_consent_mapping OBCM - INNER JOIN ob_consent_auth_resource OBAR ON OBCM.AUTH_ID = OBAR.AUTH_ID - INNER JOIN batch_ob_consent B ON OBAR.CONSENT_ID = B.CONSENT_ID); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent_mapping WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT_AUTH_RESOURCE - -- ------------------------------------------------------ - DELETE FROM ob_consent_auth_resource where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent_auth_resource WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_CONSENT - -- ------------------------------------------------------ - DELETE FROM ob_consent where CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_consent WITH : %',deleteCount; - END IF; - - DELETE FROM chunk_ob_consent WHERE CONSENT_ID in (select CONSENT_ID from batch_ob_consent); - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'DELETED BATCH ON chunk_ob_consent !'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'SLEEPING ...'; - END IF; - perform pg_sleep(sleepTime); - - END LOOP; -END LOOP; - -IF (enableLog) -THEN -RAISE NOTICE ''; -RAISE NOTICE 'CONSENT DATA DELETE COMPLETED .... !'; -END IF; - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ -IF (enableReindexing) -THEN - OPEN tablesCursor; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'INDEX REBUILDING STARTED ...!'; - END IF; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - RAISE NOTICE 'INDEX REBUILDING FOR TABLE %',cusrRecord.tablename; - END IF; - EXECUTE 'REINDEX TABLE '||quote_ident(cusrRecord.tablename); - END LOOP; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'INDEX REBUILDING COMPLETED ...!'; - END IF; - CLOSE tablesCursor; - RAISE NOTICE ''; -END IF; - --- ------------------------------------------------------ --- ANALYSING TABLES --- ------------------------------------------------------ -IF (enableTblAnalyzing) -THEN - OPEN tablesCursor; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ANALYZING STARTED ...!'; - END IF; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - RAISE NOTICE 'TABLE ANALYZING FOR TABLE %',cusrRecord.tablename; - END IF; - EXECUTE 'ANALYZE '||quote_ident(cusrRecord.tablename); - END LOOP; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ANALYZING COMPLETED ...!'; - END IF; - CLOSE tablesCursor; - RAISE NOTICE ''; -END IF; - -IF (enableLog) THEN -RAISE NOTICE ''; -RAISE NOTICE 'WSO2_OB_CONSENT_CLEANUP_SP COMPLETED .... !'; -RAISE NOTICE ''; -END IF; - -END; -$$ -LANGUAGE 'plpgsql'; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-restore-script.sql deleted file mode 100644 index 0674051e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/postgresql-consent-restore-script.sql +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR REPLACE FUNCTION WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP() RETURNS void AS $$ -DECLARE - -rowcount bigint; -enableLog boolean; -logLevel VARCHAR(10); - -BEGIN - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -enableLog := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP STARTED .... !'; -RAISE NOTICE ''; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent TABLE !'; -END IF; -INSERT INTO ob_consent SELECT A.* FROM bak_ob_consent A LEFT JOIN ob_consent B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent_attribute'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent_attribute TABLE !'; -END IF; -INSERT INTO ob_consent_attribute SELECT A.* FROM bak_ob_consent_attribute A LEFT JOIN ob_consent_attribute B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent_attribute WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent_file'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent_file TABLE !'; -END IF; -INSERT INTO ob_consent_file SELECT A.* FROM bak_ob_consent_file A LEFT JOIN ob_consent_file B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent_file WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent_status_audit'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent_status_audit TABLE !'; -END IF; -INSERT INTO ob_consent_status_audit SELECT A.* FROM bak_ob_consent_status_audit A LEFT JOIN ob_consent_status_audit B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent_status_audit WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent_auth_resource'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent_auth_resource TABLE !'; -END IF; -INSERT INTO ob_consent_auth_resource SELECT A.* FROM bak_ob_consent_auth_resource A LEFT JOIN ob_consent_auth_resource B ON A.CONSENT_ID = B.CONSENT_ID WHERE B.CONSENT_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent_auth_resource WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_consent_mapping'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_consent_mapping TABLE !'; -END IF; -INSERT INTO ob_consent_mapping SELECT A.* FROM bak_ob_consent_mapping A LEFT JOIN ob_consent_mapping B ON A.MAPPING_ID = B.MAPPING_ID WHERE B.MAPPING_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_consent_mapping WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'; -RAISE NOTICE ''; -END IF; - -END; -$$ -LANGUAGE 'plpgsql'; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/readme.MD deleted file mode 100644 index 60bae28e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/postgresql/readme.MD +++ /dev/null @@ -1,44 +0,0 @@ -## **HOW TO RUN** - -**>> postgresql-consent-cleanup-script.sql** - - -**Compile the stored procedure** - -First - Compile the stored procedure using a PostgreSQL client. Following is a sample for CLI based PostgreSQL client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -**Execute the stored procedure.** - -Then execute the compiled stored procedure by using the call function in the PostgreSQL client. Following is a sample for CLI based PostgreSQL client. - -- consentTypes `VARCHAR` -- clientIds `VARCHAR` -- consentStatuses `VARCHAR` -- purgeConsentsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- enableReindexing `BOOLEAN` -- enableTblAnalyzing `BOOLEAN` -- enableDataRetention `BOOLEAN` - -``` -WSO2_OB_CONSENT_CLEANUP_SP( consentTypes, clientIds, consentStatuses, purgeConsentsOlderThanXNumberOfDays, - lastUpdatedTime, backupTables, enableAudit, enableReindexing, enableTblAnalyzing, enableDataRetention); -``` -``` -Ex: -pgsql> CALL WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, - TRUE, TRUE, TRUE, TRUE, FALSE); -``` - -**Execute the restore from backup procedure.** - -``` -select WSO2_OB_CONSENT_CLEANUP_DATA_RESTORE_SP(); -``` -- Note : If data retention feature is enabled, temporary retention tables will be created and stored the purged consents - until the server job (can run periodical or invoke via API) sync the temporary data to retention database. -- Note: When running backup procedure (consent-cleanup-restore.sql) to restore back the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/readme.MD deleted file mode 100644 index 266a5aa2..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/consent-purging-procedures/readme.MD +++ /dev/null @@ -1,268 +0,0 @@ -# Introduction - -You can perform data purging by clearing the consent data using the script given here. As the volume of the data stored grows over time, It is highly recommended to perform data purging on servers to mitigate performance issues. - -Based on the use cases sometimes the data in the database might grow fast and cleaning them up from the product itself becomes expensive. These stored procedures help us to offload the expensive data cleanups to the database server. - -`Tip : It is recommended to run these steps at the time where server traffic is low. Especially, if you are running this in the production environment for the first time, since the data volume to be purged may be higher. However, consider this as a housekeeping task that needs to be run at regular intervals.` - -1) Take a backup of the running database. -2) Set up the database dump in a test environment and test it for any issues. - -`Tip : We recommend that you test the database dump before the cleanup task as the cleanup can take some time.` - -3) Execute the store procedures given for specific DBs. -4) Once the cleanup is over, start WSO2 Servers pointing to the cleaned-up database dump and test throughly for any issues. - -## **Usage** - -**>> consent-cleanup.sql** - -This is a consent data cleanup script with batch wise delete, This procedure includes the cleanup of consents from the respective tables of *OB_CONSENT* , *OB_CONSENT_AUTH_RESOURCE* , *OB_CONSENT_MAPPING* , *OB_CONSENT_FILE* , *OB_CONSENT_ATTRIBUTE* , *OB_CONSENT_STATUS_AUDIT* - -1. Compile the stored procedure. -2. Execute the compiled store procedure. - -**Data retention feature:** - -- If enabled, all the purged consents will be stored in temporary retention tables in the consent database. -- Later these retention data will move to separate retention database with the configured periodical sync job. (This job can be invoked via API) -- This archived data can be extracted using the consent admin, audit log and file search API by sending the additional query parameter `fetchFromRetentionDatabase` : `true` -- For more details refer : **Data retention**. - -*- Logical condition and configs used for consent purging and data retention.* - -*CONSENT DATA PURGING PARAMETERS* -- `consentTypes` - - consent_types which should be eligible for purging. (ex : 'accounts,payments', leave as empty to skip) -- `clientIds` - - client_ids which should be eligible for purging. (leave as empty to skip) -- `consentStatuses` - - consent_statuses which should be eligible for purging. (ex : 'expired,revoked') -- `purgeConsentsOlderThanXNumberOfDays` - - time period to delete consents older than `n` days. (check below for more info.) -- `lastUpdatedTime` - - last_updated_time for purging, (if consent's updated time is older than this value then it's eligible for purging, check below for more info.) - -- Here if we wish to purge consents with last updated_time older than 31 days (1 month), we can configure `purgeConsentsOlderThanXNumberOfDays` = `31` -this value is in no. of days. -- If we wish to configure exact timestamp of the `lastUpdatedTime` rather than a time period, we can ignore configuring `purgeConsentsOlderThanXNumberOfDays` = `NULL`, -and only configure lastUpdatedTime with exact unix timestamp. - - `ex : lastupdatedtime = 1660737878;` - -*CONSENT DATA RETENTION PARAMETERS* -- `enableDataRetention` - - set true for enable data retention (archive purged data, default : false) - - Note: When running backup procedure (consent-cleanup-restore.sql) to restore back the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. - -Note: below data retention parameters need to set in the scripts before compiling, Ignore if data retention is not enabled. - -- `enableDataRetentionForAuthResourceAndMapping` - - enable storing auth resource and consent mapping tables for retention data. -- `enableDataRetentionForObConsentFile` - - enable storing ob_consent_file table for retention data. -- `enableDataRetentionForObConsentAttribute` - - enable storing ob_consent_attribute table for retention data. -- `enableDataRetentionForObConsentStatusAudit` - - enable storing ob_consent_status_audit table for retention data. - - -*OTHER PARAMETERS* - -- `backupTables` - - enable the backup table to restore later at a later stage. (Please note this backup tables will be overwritten every time you run the cleanup script.). - - Also, this would not capture the consents which were created in between the backup task and the cleanup iteration, hence if consents created after the backup task will not be able to restore if its get deleted from the cleanup iteration. - -- `enableAudit` - - By setting this parameter to true, will log each of deleted consents in the auditlog_ob_consent_cleanup table for track them in a later time. - -Once compiled the stored procedure, We can execute the procedure with input parameters as in below example. (for mysql) - -``` -WSO2_OB_CONSENT_CLEANUP_SP( consentTypes, clientIds, consentStatuses, purgeConsentsOlderThanXNumberOfDays, - lastUpdatedTime, backupTables, enableAudit, analyzeTables, enableDataRetention ); -``` - -``` -Ex: -mysql> call WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, - TRUE, TRUE, TRUE, FALSE); -``` - -Please refer the readme.MD file on each DB type for more information. - -*CONFIGURABLE ATTRIBUTES* - -Following are some important variables you need to consider, You can configure these parameters directly in the script. - -**batchSize* - This variable defines how many records will be deleted per batch for one iteration. - -**chunkSize* - If you have millions of data in the table, this variable allows to handle them chunk wise , which is a larger set to the batch where the batch processes each of the chunk (ex if you have 20 million data in the particular table, the chunk will initially take half million of such data and provided it into the batch delete as 10000 records per batch. Once that chunk is completed it will get another half million and proceed.) - -**checkCount* - If the consent were kept expiring / revoking or eligible for purging while the cleanup scripts run, it will be stuck in an endless loop. Hence, this defines a safe margin for the cleanup script to complete its job if the eligible Consents for delete are less than checkCount. - -**sleepTime* - Used to define the wait time for each iteration of the batch deletes to avoid table locks. - -**enableLog* - Parameter use for enable or disable the logs. - -**logLevel* - Parameter used to set the log levels. - -**Functions** - -**BACKUP CONSENT TABLE* - This section acts to back up all the required table in case of restoration to be performed. - -**CREATING AUDITLOG TABLES FOR DELETING CONSENTS* - This section creates the initial audit logs table for persisting the deleted consents. - -**CALCULATING CONSENTS IN OB_CONSENT TABLE* - This section used prints the breakdown of the consents which should delete and retain. - -**BATCH DELETE * TABLE* - This section does the chunk and batch-wise delete for the consent data. - -**REBUILDING INDEXES* - As an extra step to optimize the database, this can perform an index rebuilding task for improving the performance, However, it's not recommended to perform on a live system unless you have downtime. Hence this could lock down the whole table. - -**ANALYSING TABLES* - As an extra step you can perform a table analyze for gather the statistics for the tables which had the delete operation. This is also to improve the performance of the database. However, it's also not recommended to perform on a live system unless you have downtime. - -**>> consent-cleanup-restore.sql** - -This is the stored procedure used to restore the deleted consents from the consent tables. The restoration can be only done if the backupTables property is set to true in the WSO2_OB_CONSENT_CLEANUP_SP procedure. -- Note: When restoring the purged data with the retention feature enabled, make sure to clean retention tables with these un-purged data. - -This is only an immediate restoration script for the WSO2_OB_CONSENT_CLEANUP_SP procedure, hence each execution of the WSO2_OB_CONSENT_CLEANUP_SP procedure will replace the backup tables. - -**Please note that it is highly recommended to have a complete backup of the production environment before modifying any data, in case of any restoration would be required.** - -*You can also schedule a cleanup task that will be automatically run after a given period of time.* - -Ex: For Mysql - -``` -USE 'WSO2_OB_CONSENT_DB'; -DROP EVENT IF EXISTS consent_cleanup; -CREATE EVENT consent_cleanup - ON SCHEDULE - EVERY 1 WEEK STARTS '2015-01-01 00:00.00' - DO - CALL `WSO2_OB_CONSENT_DB`.WSO2_OB_CONSENT_CLEANUP_SP('accounts,payments', 'clientId1,clientId2', 'expired,revoked', 31, NULL, TRUE, TRUE, TRUE, FALSE); - --- 'Turn on the event_scheduler' -SET GLOBAL event_scheduler = ON; - -``` - -## **Data retention** - -This feature is used for archival purposes of the data that we purge using the consent purging scripts. - -This will, -- Keep the data records like consent and its audit log for 7+ (configurable) years even after purging, In a separate retention database. -- This archived data can be extracted using the consent admin, audit log and file search API by sending the additional query parameter `fetchFromRetentionDatabase` : `true` - -**Instructions for enabling data retention** - -- Create a separate database to store the retention data. Execute the default consent db creation scripts in `/carbon-home/dbscripts/open-banking/consent/` to create tables. -- Add below configs to introduce the new datasource to the deployment toml and to enable data retention support from the OB IAM server. - -Ex: - -``` -[[open_banking.jdbc_retention_data_persistence_manager]] -data_source.name = "WSO2OB_RET_DB" -connection_verification_timeout=1 - -[open_banking.consent.data_retention] -enabled=true - -[[datasource]] -id="WSO2OB_RET_DB" -url = ".. jdbc url for retention database.." -username = "user" -password = "password" -driver = "com.mysql.jdbc.Driver" -jmx_enable=false -pool_options.maxActive = "150" -pool_options.maxWait = "60000" -pool_options.minIdle = "5" -pool_options.testOnBorrow = true -pool_options.validationQuery="SELECT 1" -#Use below for oracle -#validationQuery="SELECT 1 FROM DUAL" -pool_options.validationInterval="30000" -pool_options.defaultAutoCommit=false -``` - -- By enabling the data retention in the OB IAM server, we can use the `fetchFromRetentionDatabase` query param to fetch the data from the retention database in admin API's. -- Configure in the consent data purging script with types of data to be archived as below, -``` - SET enableDataRetentionForAuthResourceAndMapping = TRUE; - SET enableDataRetentionForObConsentFile = FALSE; - SET enableDataRetentionForObConsentAttribute = FALSE; - SET enableDataRetentionForObConsentStatusAudit = TRUE; -``` -- Execute purging script with data retention enabled, - -``` -WSO2_OB_CONSENT_CLEANUP_SP( - consentTypes, - clientIds, - consentStatuses, - purgeConsentsOlderThanXNumberOfDays, - lastUpdatedTime, - backupTables, - enableAudit, - analyzeTables, - enableDataRetention -); -``` - -- This will create temporary retention consent tables in consent DB with `RET_` prefix and store the purged data temporary to these tables. -- Later these temporary retention data will move to the retention database which is created in step 1, by a server db sync task. All the moved consents will be deleted from the temporary retention tables. (This task can be invoked via API or configured as periodical job) - - - For retention data DB sync via API : - ``` - curl --location --request GET 'https://localhost:9446/api/openbanking/consent/admin/sync-temporary-retention-data' \ - --header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206d3NvMjEyMw==' - ``` - - - For retention data DB sync via periodical sync job : - - Add below configs to deployment.toml file - - ``` - [open_banking.consent.data_retention] - enabled=true - enable_db_sync_periodical_job=true - db_sync_cron_value="0 0/2 * ? * * *" - ``` - -- Finally, to purge the consents in the retention database, we can use these purging scripts in the retention database by only configuring the last update time to 7+ years. - - Ex: - - ``` - WSO2_OB_CONSENT_CLEANUP_SP('', '', '', 31*12*7,NULL,FALSE,FALSE,TRUE,FALSE); - ``` - -- This archived data can be extracted using the consent admin search API by sending the additional query parameter `fetchFromRetentionDatabase` : `true` - - Ex: - - Consent search API: - ``` - curl --location --request GET 'https://localhost:9446/api/openbanking/consent/admin/search/?fromTime=1638993429&toTime=1638993429&consentStatuses=valid&userIDs=admin@wso2.com@carbon.super&consentIDs=234ba17f-c3ac-4493-9049-d71f99c36dc2&clientIDs=V92mG4mQwiMqSE8oWS5_VvaVgb4a&limit=25&offset=0&fetchFromRetentionDatabase=true&consentTypes=accounts' \ - --header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206d3NvMjEyMw==' \ - --data-raw '' - ``` - - - Consent status audit search API: - ``` - curl --location --request GET 'https://localhost:9446/api/openbanking/consent/admin/search/consent-status-audit?limit=2&offset=10&consentIDs=d239d1be-4e81-46d6-8a2e-76345370dbf3,f18b6ce1-15f7-44f7-9633-4e66fa6ceb88&fetchFromRetentionDatabase=true' \ - --header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206d3NvMjEyMw==' \ - --data-raw '' - ``` - - - Consent file search API: - ``` - curl --location --request GET 'https://localhost:9446/api/openbanking/consent/admin/search/consent-file?consentId=05ac14f9-b980-45c1-913c-614cb1469a90' \ - --header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206d3NvMjEyMw==' \ - --data-raw '' - ``` - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-cleanup-script.sql deleted file mode 100644 index c57c4913..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-cleanup-script.sql +++ /dev/null @@ -1,456 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR ALTER PROCEDURE WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP ( - @eventStatuses VARCHAR(1024), - @clientIds VARCHAR(4096), - @purgeEventsOlderThanXNumberOfDays INT, - @lastUpdatedTime BIGINT, - @purgeNonExistingResourceIds BIT, - @backupTables BIT, - @enableAudit BIT, - @rebuildIndexes BIT, - @updateStats BIT -) -AS - -BEGIN - --- ------------------------------------------ --- DECLARE VARIABLES --- ------------------------------------------ -DECLARE @batchSize INT; -DECLARE @chunkSize INT; -DECLARE @checkCount INT; -DECLARE @sleepTime AS VARCHAR(12); -DECLARE @rowCount INT; -DECLARE @cleaupCount INT; -DECLARE @enableLog BIT; -DECLARE @logLevel VARCHAR(10); -DECLARE @cusrBackupTable VARCHAR(100); -DECLARE @SQL NVARCHAR(MAX); -DECLARE @backupTable VARCHAR(100); -DECLARE @chunkCount INT; -DECLARE @batchCount INT; -DECLARE @deleteCount INT; -DECLARE @olderThanTimePeriodForPurging bigint; -DECLARE @purgeNonExistingResourceIdsInternal INT; - -DECLARE backupTablesCursor CURSOR FOR -SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES -WHERE TABLE_NAME IN ('OB_NOTIFICATION','OB_NOTIFICATION_EVENT','OB_NOTIFICATION_ERROR') - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET @batchSize = 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] -SET @chunkSize = 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFULT : 500000] -SET @checkCount = 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE EVENT NOTIFICATION COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] -SET @sleepTime = '00:00:02.000'; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -SET @enableLog = 'TRUE'; -- ENABLE LOGGING [DEFAULT : FALSE] -SET @logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG -SET @purgeNonExistingResourceIdsInternal = 2; - - -IF (@purgeNonExistingResourceIds = 1) -BEGIN -SET @purgeNonExistingResourceIdsInternal = 1; -- SET TRUE (1) FOR PURGE UNTRACEABLE NOTIFICATION EVENTS. [DEFAULT : FALSE] -END -ELSE -BEGIN -SET @purgeNonExistingResourceIdsInternal = 2; -END - -IF (@backupTables IS NULL) -BEGIN -SET @backupTables = 'TRUE'; -- SET IF EVENT NOTIFICATION TABLES NEEDS TO BACKUP BEFORE DELETE, WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION -END; - -IF (@enableAudit IS NULL) -BEGIN -SET @enableAudit = 'FALSE'; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED EVENT NOTIFICATIONS USING A TABLE [DEFAULT : FALSE] [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] -END; - -IF (@rebuildIndexes IS NULL) -BEGIN -SET @rebuildIndexes = 'FALSE'; -- SET TRUE FOR REBUILD INDEXES TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] -END; - -IF (@updateStats IS NULL) -BEGIN -SET @updateStats = 'FALSE'; -- SET TRUE FOR GATHER TABLE STATS TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] -END; - --- ------------------------------------------ --- EVENT NOTIFICATION DATA PURGING CONFIGS --- ------------------------------------------ - -IF (@eventStatuses IS NULL) -BEGIN -SET @eventStatuses = ''; -- SET EVENT_NOTIFICATION_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'ACK,ERR') -END; - -IF (@clientIds IS NULL) -BEGIN -SET @clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) -END; - -IF (@purgeEventsOlderThanXNumberOfDays IS NULL) - BEGIN - SET @olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE EVENT NOTIFICATION OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - END -ELSE - BEGIN - SET @olderThanTimePeriodForPurging = 60 * 60 * 24 * @purgeEventsOlderThanXNumberOfDays; - END; - -IF (@lastUpdatedTime IS NULL) -BEGIN -SET @lastUpdatedTime = DATEDIFF(SECOND,'1970-01-01', GETUTCDATE()) - @olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF EVENT NOTIFICATION'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) -END; - --- HERE IF WE WISH TO PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeEventsOlderThanXNumberOfDays = 31 , FOR PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeEventsOlderThanXNumberOfDays --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP STARTED ... !' AS 'INFO LOG'; -END; - -IF (@enableAudit = 1) -BEGIN -SET @backupTables = 'TRUE'; -- BACKUP TABLES IS REQUIRED BE TRUE, HENCE THE AUDIT IS ENABLED. -END; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- BACKUP TABLES --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@backupTables = 1) -BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] TABLE BACKUP STARTED ... !' AS 'INFO LOG'; - END; - - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - SELECT @backupTable = 'BAK_'+@cusrBackupTable; - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @backupTable)) - BEGIN - SELECT @SQL = 'DROP TABLE dbo.' +@backupTable; - EXEC sp_executesql @SQL; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT @SQL = 'SELECT ''BACKING UP '+@cusrBackupTable+' INTO '+@backupTable+' STARTED WITH : '' as ''DEBUG LOG'', COUNT_BIG(*) as ''COUNT'' FROM dbo.'+@cusrBackupTable; - EXEC sp_executesql @SQL; - END - - SELECT @SQL = 'SELECT * INTO '+@backupTable+' FROM dbo.' +@cusrBackupTable; - EXEC sp_executesql @SQL; - - IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) - BEGIN - SELECT @SQL = 'SELECT ''BACKING UP '+@cusrBackupTable+' INTO '+@backupTable+' COMPLETED WITH : '' as ''DEBUG LOG'', COUNT_BIG(*) as ''COUNT'' FROM dbo.'+@backupTable; - EXEC sp_executesql @SQL; - END - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -END - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDIT TABLES FOR EVENT NOTIFICATION DELETION FOR THE FIRST TIME RUN --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@enableAudit = 1) -BEGIN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP')) - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CREATING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP .. !'; - END - Select * into dbo.AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP from dbo.OB_NOTIFICATION where 1 =2; - ALTER TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ADD AUDIT_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP; - END - ELSE - BEGIN - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] USING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ..!'; - END - END -END - - ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- CALCULATING EVENT NOTIFICATIONS IN OB_NOTIFICATION TABLE ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (@enableLog = 1) -BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CALCULATING EVENT NOTIFICATIONS IN OB_NOTIFICATION TABLE .... !'; - - IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) - BEGIN - SELECT @rowcount = COUNT(1) FROM OB_NOTIFICATION; - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE BEFORE DELETE :'+CAST(@rowCount as varchar); - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT @cleaupCount = COUNT(1) FROM OB_NOTIFICATION A WHERE (CHARINDEX( ',' + LOWER(A.STATUS) + ',', LOWER(',' + @eventStatuses + ',')) > 0) AND - (@clientIds = '' OR CHARINDEX(',' + LOWER(A.CLIENT_ID) + ',', LOWER(',' + @clientIds + ',')) > 0) AND DATEDIFF(second,{d '1970-01-01'},A.updated_timestamp) < @lastUpdatedTime OR - A.RESOURCE_ID in (SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL AND 1 = @purgeNonExistingResourceIdsInternal); - - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL EVENT NOTIFICATIONS SHOULD BE DELETED FROM OB_NOTIFICATION : ' + CAST(@cleaupCount as varchar); - SELECT '[' + convert(varchar, getdate(), 121) + '] NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - select @rowcount = (@rowcount - @cleaupCount); - SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL EVENT NOTIFICATIONS SHOULD BE RETAIN IN OB_NOTIFICATION : ' + CAST(@rowCount as varchar); - END -END - ----- ------------------------------------------------------ ----- BATCH DELETE EVENT NOTIFICATION DATA ----- ------------------------------------------------------ - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] EVENT NOTIFICATION PURGING STARTED .... !'; -END - - -WHILE (1=1) -BEGIN - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'CHUNK_OB_EVENT_NOTIFICATION')) - BEGIN - DROP TABLE CHUNK_OB_EVENT_NOTIFICATION; - END - - CREATE TABLE CHUNK_OB_EVENT_NOTIFICATION (NOTIFICATION_ID VARCHAR (255),CONSTRAINT CHUNK_OB_EVENT_NOTIFICATION_PRI PRIMARY KEY (NOTIFICATION_ID)); - - INSERT INTO CHUNK_OB_EVENT_NOTIFICATION (NOTIFICATION_ID) SELECT TOP (@chunkSize) NOTIFICATION_ID FROM OB_NOTIFICATION A WHERE - (CHARINDEX( ',' + LOWER(A.STATUS) + ',', LOWER(',' + @eventStatuses + ',')) > 0) AND - (@clientIds = '' OR CHARINDEX(',' + LOWER(A.CLIENT_ID) + ',', LOWER(',' + @clientIds + ',')) > 0) AND - DATEDIFF(second,{d '1970-01-01'},A.updated_timestamp) < @lastUpdatedTime OR - A.RESOURCE_ID in (SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL AND 1 = @purgeNonExistingResourceIdsInternal); - - SELECT @chunkCount = @@rowcount; - - IF (@chunkCount < @checkCount) - BEGIN - BREAK; - END - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] CHUNK TABLE CHUNK_OB_EVENT_NOTIFICATION CREATED WITH : '+CAST(@chunkCount as varchar); - END - - IF (@enableAudit=1) - BEGIN - INSERT INTO dbo.AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP SELECT OBN.*, CURRENT_TIMESTAMP FROM OB_NOTIFICATION OBN , CHUNK_OB_EVENT_NOTIFICATION CHK WHERE OBN.NOTIFICATION_ID = CHK.NOTIFICATION_ID; - END - - WHILE (1=1) - BEGIN - IF (EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'BATCH_OB_EVENT_NOTIFICATION')) - BEGIN - DROP TABLE BATCH_OB_EVENT_NOTIFICATION; - END - - CREATE TABLE BATCH_OB_EVENT_NOTIFICATION (NOTIFICATION_ID VARCHAR (255),CONSTRAINT BATCH_OB_EVENT_NOTIFICATION_PRI PRIMARY KEY (NOTIFICATION_ID)); - - INSERT INTO BATCH_OB_EVENT_NOTIFICATION (NOTIFICATION_ID) SELECT TOP (@batchSize) NOTIFICATION_ID FROM CHUNK_OB_EVENT_NOTIFICATION ; - SELECT @batchCount = @@rowcount; - - IF(@batchCount = 0) - BEGIN - BREAK; - END - - IF ((@batchCount > 0)) - BEGIN - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE START ON EVENT NOTIFICATION TABLES WITH BATCH COUNT : '+CAST(@batchCount as varchar); - END - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_EVENT - -- ------------------------------------------------------ - - DELETE OB_NOTIFICATION_EVENT where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_NOTIFICATION_EVENT WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_ERROR - -- ------------------------------------------------------ - - DELETE OB_NOTIFICATION_ERROR where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_NOTIFICATION_ERROR WITH : '+CAST(@deleteCount as varchar); - END - - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION - -- ------------------------------------------------------ - - DELETE OB_NOTIFICATION where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION); - SELECT @deleteCount= @@rowcount; - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] BATCH DELETE FINISHED ON OB_NOTIFICATION WITH : '+CAST(@deleteCount as varchar); - END - - DELETE CHUNK_OB_EVENT_NOTIFICATION WHERE NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION); - - IF (@enableLog = 1 AND @logLevel IN ('TRACE')) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] DELETED BATCH ON CHUNK_OB_EVENT_NOTIFICATION !'; - END - - IF ((@deleteCount > 0)) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] SLEEPING ...'; - WAITFOR DELAY @sleepTime; - END - END - END -END - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] EVENT NOTIFICATION DELETE ON TABLES COMPLETED .... !'; -END - -IF (@enableLog = 1 AND @logLevel IN ('DEBUG','TRACE')) -BEGIN -SELECT @rowcount = COUNT(1) FROM OB_NOTIFICATION; -SELECT '[' + convert(varchar, getdate(), 121) + '] TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE AFTER DELETE :'+CAST(@rowCount as varchar); -END - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ - -IF (@rebuildIndexes = 1) -BEGIN - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING STARTED ...!'; - -END - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING FOR TABLE :'+@cusrBackupTable; - END - - SELECT @SQL = 'ALTER INDEX ALL ON '+@cusrBackupTable+' REBUILD WITH (ONLINE = ON)'; - EXEC sp_executesql @SQL; - - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] INDEX REBUILDING FINISHED ...!'; -END - -END - --- ------------------------------------------------------ --- UPDATE TABLE STATS --- ------------------------------------------------------ - -IF (@updateStats = 1) -BEGIN - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE DATABASE STATISTICS JOB STARTED ...!'; - -END - OPEN backupTablesCursor; - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - - WHILE @@FETCH_STATUS = 0 - BEGIN - - IF (@enableLog = 1) - BEGIN - SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE TABLE STATICTICS :'+@cusrBackupTable; - END - - SELECT @SQL = 'UPDATE STATISTICS '+@cusrBackupTable; - EXEC sp_executesql @SQL; - - FETCH NEXT FROM backupTablesCursor INTO @cusrBackupTable - END - CLOSE backupTablesCursor; - -IF (@enableLog = 1) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] UPDATE DATABASE STATISTICS JOB FINISHED ...!'; -END - -END - -deallocate backupTablesCursor; - -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) -BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP COMPLETED .... !' AS 'INFO LOG'; -END - -END diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-restore-script.sql deleted file mode 100644 index fc1376ca..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/mssql-event-notification-restore-script.sql +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR ALTER PROCEDURE WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP -AS - -BEGIN - -DECLARE @rowCount INT; -DECLARE @enableLog BIT; -DECLARE @logLevel VARCHAR(10); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET @enableLog = 'TRUE'; -- ENABLE LOGGING [DEFAULT : TRUE] -SET @logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (@enableLog = 1) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP STARTED .... !'; -END - --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_NOTIFICATION'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION TABLE !'; -END -INSERT INTO dbo.OB_NOTIFICATION SELECT A.* FROM dbo.BAK_OB_NOTIFICATION AS A LEFT JOIN dbo.OB_NOTIFICATION AS B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION WITH '+CAST(@rowCount as varchar) -END -END - --- --------------------- -SET IDENTITY_INSERT OB_NOTIFICATION_EVENT ON; -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_NOTIFICATION_EVENT'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_EVENT TABLE !'; -END -INSERT INTO dbo.OB_NOTIFICATION_EVENT (EVENT_ID, NOTIFICATION_ID, EVENT_TYPE, EVENT_INFO) SELECT A.EVENT_ID , A.NOTIFICATION_ID, A.EVENT_TYPE , A.EVENT_INFO FROM dbo.BAK_OB_NOTIFICATION_EVENT AS A LEFT JOIN dbo.OB_NOTIFICATION_EVENT AS B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_EVENT WITH '+CAST(@rowCount as varchar) -END -END -SET IDENTITY_INSERT OB_NOTIFICATION_EVENT OFF; --- --------------------- - -SELECT @rowCount = COUNT(1) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('OB_NOTIFICATION_ERROR'); -IF (@rowCount = 1) -BEGIN -IF (@enableLog = 1 AND @logLevel IN ('TRACE')) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_ERROR TABLE !'; -END -INSERT INTO dbo.OB_NOTIFICATION_ERROR SELECT A.* FROM dbo.BAK_OB_NOTIFICATION_ERROR AS A LEFT JOIN dbo.OB_NOTIFICATION_ERROR AS B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -SELECT @rowCount = @@rowcount; -IF (@enableLog = 1 ) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_ERROR WITH '+CAST(@rowCount as varchar) -END -END - -IF (@enableLog = 1) BEGIN -SELECT '[' + convert(varchar, getdate(), 121) + '] WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'; -END - -END diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/readme.MD deleted file mode 100644 index c4a9d095..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mssql/readme.MD +++ /dev/null @@ -1,45 +0,0 @@ -## **HOW TO RUN** - -**>> mssql-event-notification-cleanup-script.sql** - -**Compile the stored procedure** - -First - Compile the stored procedure using a MSSQL client by selecting the whole script at once and execute from the MSSQL client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -**Execute the stored procedure.** - -Then execute the compiled store procedure by using the EXEC function in the MSSQL client. Following is a sample. - - -- eventStatuses `VARCHAR` -- clientIds `VARCHAR` -- purgeEventsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- purgeNonExistingResourceIds `BOOLEAN` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- rebuildIndexes `BOOLEAN` -- updateStats `BOOLEAN` - -``` -Ex: - ->> EXEC WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP @eventStatuses='ACK,ERR', @clientIds='clientId1,clientId2', - @purgeEventsOlderThanXNumberOfDays=31, @lastUpdatedTime=1631867692, @purgeNonExistingResourceIds=TRUE, - @backupTables=TRUE, @enableAudit=TRUE, @rebuildIndexes=TRUE, - @updateStats=TRUE; -``` - - -**Execute the restore from backup procedure.** - -``` -EXEC WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP; -``` - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-cleanup-script.sql deleted file mode 100644 index 4088e347..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-cleanup-script.sql +++ /dev/null @@ -1,372 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -DROP PROCEDURE IF EXISTS `WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP`; - -DELIMITER $$ - -CREATE PROCEDURE `WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP`( - IN eventStatuses VARCHAR(1024), - IN clientIds VARCHAR(4096), - IN purgeEventsOlderThanXNumberOfDays INT, - IN lastUpdatedTime BIGINT, - IN purgeNonExistingResourceIds BOOLEAN, - IN backupTables BOOLEAN, - IN enableAudit BOOLEAN, - IN analyzeTables BOOLEAN -) -BEGIN - --- ------------------------------------------ --- DECLARE VARIABLES --- ------------------------------------------ - DECLARE batchSize INT; - DECLARE chunkSize INT; - DECLARE checkCount INT; - DECLARE sleepTime FLOAT; - DECLARE rowCount INT; - DECLARE enableLog BOOLEAN; - DECLARE logLevel VARCHAR(10); - DECLARE cursorTable VARCHAR(255); - DECLARE BACKUP_TABLE VARCHAR(255); - DECLARE cursorLoopFinished INTEGER DEFAULT 0; - - -- Event Notification Data Purging Parameters - DECLARE olderThanTimePeriodForPurging BIGINT; - - DECLARE backupTablesCursor CURSOR FOR - SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA in (SELECT DATABASE()) AND - TABLE_NAME IN ('OB_NOTIFICATION','OB_NOTIFICATION_EVENT','OB_NOTIFICATION_ERROR'); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET cursorLoopFinished = 1; - --- ----------------------------------------- --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ - SET batchSize = 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] - SET chunkSize = 500000; -- SET TEMP TABLE CHUNK SIZE FOR AVOID TABLE LOCKS [DEFAULT : 1000000] - SET checkCount = 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE EVENT NOTIFICATION COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] - SET sleepTime = 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] - SET rowCount = 0; - SET enableLog = TRUE; -- ENABLE LOGGING [DEFAULT : FALSE] - SET logLevel = 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - - CASE WHEN (backupTables IS NULL) - THEN SET backupTables = TRUE; -- SET IF EVENT NOTIFICATION TABLES NEEDS TO BACKUP BEFORE DELETE [DEFAULT : TRUE] , WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION - ELSE BEGIN END; - END CASE; - - CASE WHEN (enableAudit IS NULL) - THEN SET enableAudit = FALSE; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED EVENT NOTIFICATIONS USING A TABLE [DEFAULT : FALSE] [IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] - ELSE BEGIN END; - END CASE; - - CASE WHEN (analyzeTables IS NULL) - THEN SET analyzeTables = FALSE; -- SET TRUE FOR Analyze the tables TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE BEGIN END; - END CASE; - - CASE WHEN (purgeNonExistingResourceIds IS NULL) - THEN SET purgeNonExistingResourceIds = FALSE; -- SET TRUE FOR PURGE UNTRACEABLE NOTIFICATION EVENTS. [DEFAULT : FALSE] - ELSE BEGIN END; - END CASE; - - -- Event Notification Data Purging Configs - - CASE WHEN (eventStatuses IS NULL) - THEN SET eventStatuses = ''; -- SET EVENT_NOTIFICATION_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'ACK,ERR') - ELSE BEGIN END; - END CASE; - - CASE WHEN (clientIds IS NULL) - THEN SET clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) - ELSE BEGIN END; - END CASE; - - CASE WHEN (purgeEventsOlderThanXNumberOfDays IS NULL) - THEN SET olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE EVENT NOTIFICATION OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - ELSE SET olderThanTimePeriodForPurging = 60 * 60 * 24 * purgeEventsOlderThanXNumberOfDays; - END CASE; - - CASE WHEN (lastUpdatedTime IS NULL) - THEN SET lastUpdatedTime = unix_timestamp() - olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF EVENT NOTIFICATION'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE BEGIN END; - END CASE; - --- HERE IF WE WISH TO PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeEventsOlderThanXNumberOfDays = 31 , FOR PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeEventsOlderThanXNumberOfDays --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - - IF (enableLog) - THEN - SELECT 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP STARTED ... !' AS 'INFO LOG'; - END IF; - - IF (enableAudit) - THEN - SET backupTables = TRUE; -- BACKUP TABLES IS REQUIRED HENCE THE AUDIT IS ENABLED. - END IF; - - - IF (backupTables) - THEN - IF (enableLog) - THEN - SELECT 'TABLE BACKUP STARTED ... !' AS 'INFO LOG'; - END IF; - - OPEN backupTablesCursor; - backupLoop: loop - fetch backupTablesCursor into cursorTable; - - IF cursorLoopFinished = 1 THEN - LEAVE backupLoop; - END IF; - - SELECT CONCAT('BAK_', cursorTable) into BACKUP_TABLE; - - SET @dropTab=CONCAT("DROP TABLE IF EXISTS ", BACKUP_TABLE); - PREPARE stmtDrop FROM @dropTab; - EXECUTE stmtDrop; - DEALLOCATE PREPARE stmtDrop; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SET @printstate=CONCAT("SELECT 'BACKING UP ",cursorTable," DATA INTO ", BACKUP_TABLE, " 'AS' TRACE LOG' , COUNT(1) FROM ", cursorTable); - PREPARE stmtPrint FROM @printstate; - EXECUTE stmtPrint; - DEALLOCATE PREPARE stmtPrint; - END IF; - - SET @cretTab=CONCAT("CREATE TABLE ", BACKUP_TABLE," SELECT * FROM ",cursorTable); - PREPARE stmtDrop FROM @cretTab; - EXECUTE stmtDrop; - DEALLOCATE PREPARE stmtDrop; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE') ) - THEN - SET @printstate= CONCAT("SELECT 'BACKING UP ",BACKUP_TABLE," COMPLETED ! ' AS 'DEBUG LOG', COUNT(1) FROM ", BACKUP_TABLE); - PREPARE stmtPrint FROM @printstate; - EXECUTE stmtPrint; - DEALLOCATE PREPARE stmtPrint; - END IF; - END loop backupLoop; - CLOSE backupTablesCursor; - END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDITLOG TABLES FOR DELETING EVENT NOTIFICATION --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IF (enableAudit) - THEN - IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP' and TABLE_SCHEMA in (SELECT DATABASE()))) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CREATING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP .. !'; - END IF; - CREATE TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP SELECT * FROM OB_NOTIFICATION WHERE 1 = 2; - ALTER TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ADD COLUMN `AUDIT_TIMESTAMP` TIMESTAMP DEFAULT CURRENT_TIMESTAMP; - ELSE - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'USING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ..!'; - END IF; - END IF; - END IF; - - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CALCULATING NOTIFICATION EVENTS IN OB_NOTIFICATION TABLE --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - IF (enableLog) - THEN - SELECT 'CALCULATING EVENT NOTIFICATIONS IN OB_NOTIFICATION TABLE .... !' AS 'INFO LOG'; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT COUNT(1) into rowcount FROM OB_NOTIFICATION; - SELECT 'TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE BEFORE DELETE' AS 'DEBUG LOG',rowcount; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SELECT COUNT(1) into @cleanupCount FROM OB_NOTIFICATION A WHERE FIND_IN_SET(A.STATUS, eventStatuses) > 0 AND - (clientIds = '' OR FIND_IN_SET(A.CLIENT_ID, clientIds) > 0) AND A.UPDATED_TIMESTAMP < FROM_UNIXTIME(lastUpdatedTime) - OR A.RESOURCE_ID IN ( - SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B - LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL AND purgeNonExistingResourceIds - ); - SELECT 'TOTAL EVENT NOTIFICATIONS SHOULD BE DELETED FROM OB_NOTIFICATION' AS 'TRACE LOG', @cleanupCount; - SELECT 'NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !' AS 'TRACE LOG'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - set rowcount = (rowcount - @cleanupCount); - SELECT 'TOTAL EVENT NOTIFICATIONS SHOULD BE RETAIN IN OB_NOTIFICATION' AS 'TRACE LOG', rowcount; - END IF; - END IF; - --- ------------------------------------------------------ --- BATCH DELETE EVENT NOTIFICATION DATA --- ------------------------------------------------------ - IF (enableLog) - THEN - SELECT 'EVENT NOTIFICATIONS PURGING STARTED .... !' AS 'INFO LOG'; - END IF; - - EVENT_NOTIFICATION_CHUNK_LOOP: REPEAT - - DROP TEMPORARY TABLE IF EXISTS CHUNK_OB_EVENT_NOTIFICATION; - - CREATE TEMPORARY TABLE CHUNK_OB_EVENT_NOTIFICATION SELECT NOTIFICATION_ID FROM OB_NOTIFICATION A WHERE FIND_IN_SET(A.STATUS, eventStatuses) > 0 AND - (clientIds = '' OR FIND_IN_SET(A.CLIENT_ID, clientIds) > 0) AND A.UPDATED_TIMESTAMP < FROM_UNIXTIME(lastUpdatedTime) - OR A.RESOURCE_ID IN ( - SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID - WHERE C.CONSENT_ID IS NULL AND purgeNonExistingResourceIds - ) LIMIT chunkSize; - - SELECT COUNT(1) INTO @chunkCount FROM CHUNK_OB_EVENT_NOTIFICATION; - - IF (@chunkCount 0)) - THEN - DO SLEEP(sleepTime); - END IF; - UNTIL rowCount=0 END REPEAT; - UNTIL @chunkCount=0 END REPEAT; - - IF (enableLog ) - THEN - SELECT 'EVENT NOTIFICATION DELETE ON OB_NOTIFICATION, OB_NOTIFICATION_ERROR, OB_NOTIFICATION_EVENT COMPLETED .... !' AS 'INFO LOG'; - END IF; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT 'TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE AFTER DELETE' AS 'DEBUG LOG', COUNT(1) FROM OB_NOTIFICATION; - END IF; - - -- ------------------------------------------------------ - -- OPTIMIZING TABLES FOR BETTER PERFORMANCE - -- ------------------------------------------------------ - - IF (analyzeTables) - THEN - - IF (enableLog) - THEN - SELECT 'TABLE ANALYZING STARTED .... !' AS 'INFO LOG'; - END IF; - - ANALYZE TABLE OB_NOTIFICATION; - ANALYZE TABLE OB_NOTIFICATION_ERROR; - ANALYZE TABLE OB_NOTIFICATION_EVENT; - - END IF; - --- ------------------------------------------------------ - IF (enableLog) - THEN - SELECT 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP() COMPLETED .... !' AS 'INFO LOG'; - END IF; - -END$$ - -DELIMITER ; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-restore-script.sql deleted file mode 100644 index 39865eb2..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/mysql-event-notification-restore-script.sql +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -DROP PROCEDURE IF EXISTS `WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP`; -DELIMITER $$ -CREATE PROCEDURE `WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP`() - -BEGIN - -DECLARE rowCount INT; -DECLARE enableLog BOOLEAN; -DECLARE logLevel VARCHAR(10); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -SET enableLog = TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -SET logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (enableLog) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED .... !'; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_NOTIFICATION'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION TABLE !'; -END IF; -INSERT INTO OB_NOTIFICATION SELECT A.* FROM BAK_OB_NOTIFICATION A LEFT JOIN OB_NOTIFICATION B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -SELECT row_count() INTO rowcount; -IF (enableLog ) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION WITH %',rowcount; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_NOTIFICATION_EVENT'); -IF (rowcount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_EVENT TABLE !'; - END IF; - INSERT INTO OB_NOTIFICATION_EVENT SELECT A.* FROM BAK_OB_NOTIFICATION_EVENT A LEFT JOIN OB_NOTIFICATION_EVENT B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; - SELECT row_count() INTO rowcount; - IF (enableLog ) THEN - SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_EVENT WITH %',rowcount; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IN (SELECT DATABASE()) AND TABLE_NAME IN ('OB_NOTIFICATION_ERROR'); -IF (rowcount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT 'CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_ERROR TABLE !'; - END IF; - INSERT INTO OB_NOTIFICATION_ERROR SELECT A.* FROM BAK_OB_NOTIFICATION_ERROR A LEFT JOIN OB_NOTIFICATION_ERROR B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; - SELECT row_count() INTO rowcount; - IF (enableLog ) THEN - SELECT 'CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_ERROR WITH %',rowcount; - END IF; -END IF; - --- --------------------- - -IF (enableLog) THEN -SELECT 'CLEANUP DATA RESTORATION COMPLETED .... !'; -END IF; - - -END$$ - -DELIMITER ; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/readme.MD deleted file mode 100644 index 849a0498..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/mysql/readme.MD +++ /dev/null @@ -1,66 +0,0 @@ -## **HOW TO RUN** - -**>> mysql-event-notification-cleanup-script.sql** - - -**Compile the Stored Procedure** - -First - Compile the stored procedure using a mysql client. Following is a sample for CLI based mysql client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -``` -mysql> source \\mysql-event-notification-cleanup-script.sql; -``` -or -``` -bash:~$ mysql -u yourusername -p yourpassword yourdatabase < \\mysql-event-notification-cleanup-script.sql -``` - -**Compile the stored procedure** - -Then execute the compiled store procedure by using the call function in the mysql client. Following is a sample for CLI based mysql client. - -- eventStatuses `VARCHAR` -- clientIds `VARCHAR` -- purgeEventsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- purgeNonExistingResourceIds `BOOLEAN` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- analyzeTables `BOOLEAN` - -``` -WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP( eventStatuses, clientIds, purgeEventsOlderThanXNumberOfDays, lastUpdatedTime, - purgeNonExistingResourceIds, backupTables, enableAudit, analyzeTables ); -``` - -``` -Ex: -mysql> call WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 10, NULL, TRUE, TRUE, TRUE, TRUE); - -``` - - -**Execute the restore from backup procedure.** - -``` -EXEC WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP(); -``` - -**You can also schedule a cleanup task that will be automatically run after a given period of time.** - -Ex: Mysql - -``` -USE 'WSO2_OB_CONSENT_DB'; -DROP EVENT IF EXISTS event_notification_cleanup; -CREATE EVENT event_notification_cleanup - ON SCHEDULE - EVERY 1 WEEK STARTS '2015-01-01 00:00.00' - DO - CALL `WSO2_OB_CONSENT_DB`.WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 10, NULL, TRUE, TRUE, TRUE, TRUE); - --- 'Turn on the event_scheduler' -SET GLOBAL event_scheduler = ON; - -``` \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-cleanup-script.sql deleted file mode 100644 index 00e3f8b6..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-cleanup-script.sql +++ /dev/null @@ -1,461 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - CREATE OR REPLACE PROCEDURE WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP ( - eventStatuses_in IN VARCHAR2, - clientIds_in IN VARCHAR2, - purgeEventsOlderThanXNumberOfDays_in IN NUMBER, - lastUpdatedTime_in IN NUMBER, - purgeNonExistingResourceIds_in IN BOOLEAN, - backupTables_in IN BOOLEAN, - enableAudit_in IN BOOLEAN, - enableStsGthrn_in IN BOOLEAN, - enableRebuildIndexes_in IN BOOLEAN -) IS - --- ------------------------------------------ --- VARIABLE DECLARATION --- ------------------------------------------ - -systime TIMESTAMP := systimestamp; -utcTime TIMESTAMP := sys_extract_utc(systimestamp); -deleteCount INT := 0; -chunkCount INT := 0; -batchCount INT := 0; -ROWCOUNT INT := 0; -cleaupCount INT := 0; -CURRENT_SCHEMA VARCHAR(100); -backupTable VARCHAR(100); -cursorTable VARCHAR(100); - -CURSOR backupTablesCursor is -SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER = CURRENT_SCHEMA AND -TABLE_NAME IN ('OB_NOTIFICATION','OB_NOTIFICATION_EVENT','OB_NOTIFICATION_ERROR'); - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ - -batchSize INT := 10000; -- BATCH WISE DELETE [DEFAULT : 10000] -chunkSize INT := 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFAULT : 500000] -checkCount INT := 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE EVENT NOTIFICATION COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] -sleepTime FLOAT := 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -enableLog BOOLEAN := TRUE ; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel VARCHAR(10) := 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - -purgeNonExistingResourceIds INT := 2; -backupTables BOOLEAN := TRUE; -enableAudit BOOLEAN := FALSE; -enableStsGthrn BOOLEAN := FALSE; -enableRebuildIndexes BOOLEAN := FALSE; - --- Event Notification Data Purging Configs -eventStatuses VARCHAR(1024) := ''; -clientIds VARCHAR(4096) := ''; -olderThanTimePeriodForPurging NUMBER := 60 * 60 * 24 * 365; -lastUpdatedTime NUMBER := EXTRACT(DAY FROM(utcTime - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(utcTime, 'SSSSS')) - olderThanTimePeriodForPurging; - -BEGIN - -backupTables:= backupTables_in; -- SET IF EVENT NOTIFICATION TABLES NEEDS TO BACKUP BEFORE DELETE, WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION -enableAudit := enableAudit_in; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED EVENT NOTIFICATIONS USING A TABLE [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] -enableStsGthrn := enableStsGthrn_in; -- SET TRUE FOR GATHER SCHEMA LEVEL STATS TO IMPROVE QUERY PERFORMANCE -enableRebuildIndexes := enableRebuildIndexes_in; -- SET TRUE FOR REBUILD INDEXES TO IMPROVE QUERY PERFORMANCE - --- Event Notification Data Purging Configs -eventStatuses := eventStatuses_in; -- SET EVENT_NOTIFICATION_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'ACK,ERR') -clientIds := clientIds_in; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) - -CASE WHEN purgeNonExistingResourceIds_in = TRUE - THEN purgeNonExistingResourceIds := 1; -- SET 1 (TRUE) FOR PURGE UNTRACEABLE NOTIFICATION EVENTS. [DEFAULT : FALSE] - ELSE purgeNonExistingResourceIds := 2; -END CASE; - -CASE WHEN purgeEventsOlderThanXNumberOfDays_in IS NOT NULL - THEN olderThanTimePeriodForPurging := 60 * 60 * 24 * purgeEventsOlderThanXNumberOfDays_in; -- SET TIME PERIOD (SECONDS) TO DELETE EVENT NOTIFICATION OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - ELSE olderThanTimePeriodForPurging := 60 * 60 * 24 * 365; -END CASE; - -CASE WHEN lastUpdatedTime_in IS NOT NULL - THEN lastUpdatedTime := lastUpdatedTime_in; -- SET LAST_UPDATED_TIME FOR PURGING, (IF EVENT NOTIFICATION'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE lastUpdatedTime := EXTRACT(DAY FROM(utcTime - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(utcTime, 'SSSSS')) - olderThanTimePeriodForPurging; -END CASE; - --- HERE IF WE WISH TO PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeEventsOlderThanXNumberOfDays = 31 , FOR PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeEventsOlderThanXNumberOfDays --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - --- ------------------------------------------------------ --- CREATING LOG TABLE FOR DELETING EVENT NOTIFICATIONS --- ------------------------------------------------------ - -SELECT SYS_CONTEXT( 'USERENV', 'CURRENT_SCHEMA' ) INTO CURRENT_SCHEMA FROM DUAL; - -IF (enableLog) -THEN -SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP'; - COMMIT; - END if; -EXECUTE IMMEDIATE 'CREATE TABLE LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP VARCHAR(250) , LOG VARCHAR(250)) NOLOGGING'; -COMMIT; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP STARTED .... !'')'; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING SCHEMA :'||CURRENT_SCHEMA||''')'; -COMMIT; -END IF; - - -IF (enableAudit) -THEN -backupTables := TRUE; -- BACKUP TABLES IS REQUIRED BE TRUE, HENCE THE AUDIT IS ENABLED. -END IF; - --- ------------------------------------------------------ --- BACKUP TABLES --- ------------------------------------------------------ - - -IF (backupTables) -THEN - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TABLE BACKUP STARTED ... !'')'; - COMMIT; - END IF; - - FOR cursorTable IN backupTablesCursor - LOOP - - SELECT REPLACE(''||cursorTable.TABLE_NAME||'','OB_','BAK_OB_') INTO backupTable FROM DUAL; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BACKING UP '||cursorTable.TABLE_NAME||' INTO '||backupTable||' STARTED '')'; - COMMIT; - END IF; - - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper(backupTable); - IF (ROWCOUNT = 1) - THEN - EXECUTE IMMEDIATE 'DROP TABLE '||backupTable; - COMMIT; - END if; - - EXECUTE IMMEDIATE 'CREATE TABLE '||backupTable||' AS (SELECT * FROM '||cursorTable.TABLE_NAME||')'; - ROWCOUNT:= sql%rowcount; - COMMIT; - - IF (enableLog AND logLevel IN ('TRACE','DEBUG') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BACKING UP '||cursorTable.TABLE_NAME||' COMPLETED WITH : '||ROWCOUNT||''')'; - COMMIT; - END IF; - - END LOOP; - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - - --- ------------------------------------------------------ --- CREATING AUDIT TABLES FOR EVENT NOTIFICATION DELETION FOR THE FIRST TIME RUN --- ------------------------------------------------------ -IF (enableAudit) -THEN - - SELECT count(1) into ROWCOUNT FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = 'AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP'; - IF (ROWCOUNT =0 ) - THEN - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CREATING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP .. ! '')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'CREATE TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP as (SELECT * FROM OB_NOTIFICATION WHERE 1 = 2)'; - EXECUTE IMMEDIATE 'ALTER TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ADD AUDIT_TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP'; - COMMIT; - ELSE - IF (enableLog AND logLevel IN ('TRACE') ) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP'')'; - COMMIT; - END IF; - END IF; - - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; - -END IF; - - ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ----- CALCULATING EVENT NOTIFICATION COUNTS IN OB_NOTIFICATION ----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CALCULATING EVENT NOTIFICATION COUNTS IN OB_NOTIFICATION TABLE .... !'')'; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - SELECT COUNT(1) INTO ROWCOUNT FROM OB_NOTIFICATION; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE BEFORE DELETE : '||ROWCOUNT||''')'; - COMMIT; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - SELECT COUNT(1) INTO cleaupCount FROM OB_NOTIFICATION A WHERE (INSTR(LOWER(','||eventStatuses||','), ','||LOWER(A.STATUS)||',') > 0) AND (clientIds IS NULL OR INSTR(LOWER(','||clientIds||','), ','||LOWER(A.CLIENT_ID)||',') > 0) AND EXTRACT(DAY FROM(sys_extract_utc(A.updated_timestamp) - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(sys_extract_utc(A.updated_timestamp), 'SSSSS')) < lastUpdatedTime OR A.RESOURCE_ID IN (SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL and 1 = purgeNonExistingResourceIds); - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL EVENT NOTIFICATIONS SHOULD BE DELETED FROM OB_NOTIFICATION : '||cleaupCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'')'; - COMMIT; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - ROWCOUNT := (ROWCOUNT - cleaupCount); - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL EVENT NOTIFICATIONS SHOULD BE RETAIN IN OB_NOTIFICATION : '||ROWCOUNT||''')'; - COMMIT; - END IF; -END IF; - --- ------------------------------------------------------ --- BATCH DELETE EVENT NOTIFICATION DATA --- ------------------------------------------------------ -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''EVENT NOTIFICATION PURGING STARTED ... ! '')'; - COMMIT; -END IF; - -LOOP - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('CHUNK_OB_EVENT_NOTIFICATION'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE CHUNK_OB_EVENT_NOTIFICATION'; - COMMIT; - END if; - - EXECUTE IMMEDIATE 'CREATE TABLE CHUNK_OB_EVENT_NOTIFICATION (NOTIFICATION_ID VARCHAR(255),CONSTRAINT CHUNK_EVENT_NOTIFICATION_PRI PRIMARY KEY (NOTIFICATION_ID)) NOLOGGING'; - COMMIT; - EXECUTE IMMEDIATE q'!INSERT /*+ APPEND */ INTO CHUNK_OB_EVENT_NOTIFICATION (NOTIFICATION_ID) SELECT A.NOTIFICATION_ID FROM OB_NOTIFICATION A WHERE rownum <= :chunkSize AND ( - (INSTR( LOWER( ','||:eventStatuses||','), LOWER( ','||A.STATUS||',') ) > 0) AND - (:clientIds IS NULL OR INSTR( LOWER( ','||:clientIds||','), LOWER(','||A.CLIENT_ID||',') ) > 0) AND - EXTRACT(DAY FROM(sys_extract_utc(A.UPDATED_TIMESTAMP) - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400 + to_number(TO_CHAR(sys_extract_utc(A.UPDATED_TIMESTAMP), 'SSSSS')) < :lastUpdatedTime) OR - A.RESOURCE_ID IN (SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL and 1 = :purgeNonExistingResourceIds)!' - using chunkSize, eventStatuses, clientIds, clientIds, lastUpdatedTime, purgeNonExistingResourceIds; - chunkCount:= sql%Rowcount; - COMMIT; - - EXIT WHEN chunkCount < checkCount ; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CHUNK TABLE CHUNK_OB_EVENT_NOTIFICATION CREATED WITH : '||chunkCount||''')'; - COMMIT; - END IF; - - IF (enableAudit) - THEN - EXECUTE IMMEDIATE 'INSERT INTO AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP SELECT OBN.*, CURRENT_TIMESTAMP FROM OB_NOTIFICATION OBN , CHUNK_OB_EVENT_NOTIFICATION CHK WHERE OBN.NOTIFICATION_ID = CHK.NOTIFICATION_ID'; - COMMIT; - END IF; - - LOOP - SELECT COUNT(*) INTO ROWCOUNT from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('BATCH_OB_EVENT_NOTIFICATION'); - IF (ROWCOUNT = 1) then - EXECUTE IMMEDIATE 'DROP TABLE BATCH_OB_EVENT_NOTIFICATION'; - COMMIT; - END IF; - - EXECUTE IMMEDIATE 'CREATE TABLE BATCH_OB_EVENT_NOTIFICATION (NOTIFICATION_ID VARCHAR(255),CONSTRAINT BATCH_OB_EVENT_NOTIFICATION_PRI PRIMARY KEY (NOTIFICATION_ID)) NOLOGGING'; - COMMIT; - - EXECUTE IMMEDIATE 'INSERT /*+ APPEND */ INTO BATCH_OB_EVENT_NOTIFICATION (NOTIFICATION_ID) SELECT NOTIFICATION_ID FROM CHUNK_OB_EVENT_NOTIFICATION WHERE rownum <= '||batchSize||''; - batchCount:= sql%rowcount; - COMMIT; - - EXIT WHEN batchCount = 0 ; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE START ON EVENT NOTIFICATION TABLES WITH BATCH_COUNT : '||batchCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_EVENT - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_NOTIFICATION_EVENT where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_NOTIFICATION_EVENT WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_ERROR - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_NOTIFICATION_ERROR where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_NOTIFICATION_ERROR WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION - -- ------------------------------------------------------ - IF ((batchCount > 0)) - THEN - EXECUTE IMMEDIATE 'DELETE OB_NOTIFICATION where NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION)'; - deleteCount:= sql%rowcount; - COMMIT; - END IF; - - IF (enableLog) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE FINISHED ON OB_NOTIFICATION WITH : '||deleteCount||''')'; - COMMIT; - END IF; - - - EXECUTE IMMEDIATE 'DELETE CHUNK_OB_EVENT_NOTIFICATION WHERE NOTIFICATION_ID in (select NOTIFICATION_ID from BATCH_OB_EVENT_NOTIFICATION)'; - COMMIT; - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''DELETED BATCH ON CHUNK_OB_EVENT_NOTIFICATION !'')'; - COMMIT; - END IF; - - EXIT WHEN deleteCount = 0 ; - - IF ((deleteCount > 0)) - THEN - IF (enableLog AND logLevel IN ('TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SLEEPING ...'')'; - COMMIT; - END IF; - DBMS_LOCK.SLEEP(sleepTime); - END IF; - END LOOP; -END LOOP; - -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''BATCH DELETE ON EVENT NOTIFICATION DATA COMPLETED .... !'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; -END IF; -COMMIT; - - -IF (enableLog AND logLevel IN ('DEBUG','TRACE')) -THEN - SELECT COUNT(1) INTO ROWCOUNT FROM OB_NOTIFICATION; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE AFTER DELETE :'||ROWCOUNT||''')'; - COMMIT; - - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; -END IF; - - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ - -IF(enableRebuildIndexes) -THEN - FOR cursorTable IN backupTablesCursor - LOOP - FOR INDEX_ENTRY IN (SELECT INDEX_NAME FROM ALL_INDEXES WHERE TABLE_NAME=''||cursorTable.TABLE_NAME||'' AND INDEX_TYPE='NORMAL' AND OWNER = CURRENT_SCHEMA) - LOOP - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''REBUILDING INDEXES ON '||cursorTable.TABLE_NAME||' TABLE : '||INDEX_ENTRY.INDEX_NAME||''')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'ALTER INDEX ' || INDEX_ENTRY.INDEX_NAME || ' REBUILD'; - COMMIT; - END LOOP; - END LOOP; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - END IF; - COMMIT; -END IF; - - --- ------------------------------------------------------ --- STATS GATHERING FOR OPTIMUM PERFORMANCE --- ------------------------------------------------------ - -IF(enableStsGthrn) -THEN - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SCHEMA LEVEL STATS GATHERING JOB STARTED.'')'; - COMMIT; - END IF; - - BEGIN - dbms_stats.gather_schema_stats(CURRENT_SCHEMA,DBMS_STATS.AUTO_SAMPLE_SIZE); - END; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) - THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''SCHEMA LEVEL STATS GATHERING JOB COMPLETED.'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - -IF (enableLog AND logLevel IN ('DEBUG','TRACE')) -THEN -EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP COMPLETED .... !'')'; -COMMIT; -END IF; - -END; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-restore-script.sql deleted file mode 100644 index 6aefb12e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/oracle-event-notification-restore-script.sql +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - CREATE OR REPLACE PROCEDURE WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP IS - - -rowCount INT; -CURRENT_SCHEMA VARCHAR(100); --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -enableLog BOOLEAN := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel VARCHAR(10):= 'TRACE'; -- SET LOG LEVELS : TRACE - - -BEGIN - -SELECT SYS_CONTEXT( 'USERENV', 'CURRENT_SCHEMA' ) INTO CURRENT_SCHEMA FROM DUAL; - -IF (enableLog) -THEN - SELECT COUNT(*) INTO rowCount from ALL_TABLES where OWNER = CURRENT_SCHEMA AND table_name = upper('LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP'); - IF (rowCount = 1) then - EXECUTE IMMEDIATE 'DROP TABLE LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP'; - COMMIT; - END if; - EXECUTE IMMEDIATE 'CREATE TABLE LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP VARCHAR(250) , LOG VARCHAR(250)) NOLOGGING'; - COMMIT; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP STARTED .... !'')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''USING SCHEMA :'||CURRENT_SCHEMA||''')'; - COMMIT; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_NOTIFICATION'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_NOTIFICATION SELECT A.* FROM BAK_OB_NOTIFICATION A LEFT JOIN OB_NOTIFICATION B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_NOTIFICATION_EVENT'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_EVENT TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_NOTIFICATION_EVENT SELECT A.* FROM BAK_OB_NOTIFICATION_EVENT A LEFT JOIN OB_NOTIFICATION_EVENT B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_EVENT WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowCount FROM ALL_TABLES where OWNER = CURRENT_SCHEMA AND TABLE_NAME IN ('OB_NOTIFICATION_ERROR'); -IF (rowCount = 1) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION STARTED ON OB_NOTIFICATION_ERROR TABLE !'')'; - COMMIT; - END IF; - EXECUTE IMMEDIATE 'INSERT INTO OB_NOTIFICATION_ERROR SELECT A.* FROM BAK_OB_NOTIFICATION_ERROR A LEFT JOIN OB_NOTIFICATION_ERROR B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL'; - rowCount:= sql%Rowcount; - IF (enableLog ) THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''CLEANUP DATA RESTORATION COMPLETED ON OB_NOTIFICATION_ERROR WITH '||rowCount||''')'; - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),'' '')'; - COMMIT; - END IF; -END IF; - --- --------------------- - -IF (enableLog) -THEN - EXECUTE IMMEDIATE 'INSERT INTO LOG_WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP (TIMESTAMP,LOG) VALUES (TO_CHAR( SYSTIMESTAMP, ''DD.MM.YYYY HH24:MI:SS:FF4''),''WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'')'; - COMMIT; -END IF; - -END; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/readme.MD deleted file mode 100644 index 28ce75be..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/oracle/readme.MD +++ /dev/null @@ -1,45 +0,0 @@ -## **HOW TO RUN** - -**>> oracle-event-notification-cleanup-script.sql** - - -**Compile the stored procedure** - -First - Compile the stored procedure using a Oracle client. Following is a sample for CLI based Oracle client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -``` -sqlplus> @\\oracle-event-notification-cleanup-script.sql; -``` - -**Execute the stored procedure.** - -Then execute the compiled store procedure by using the exec function in the Oracle client. Following is a sample for CLI based Oracle client. - -- eventStatuses `VARCHAR2` -- clientIds `VARCHAR2` -- purgeEventsOlderThanXNumberOfDays `NUMBER` -- lastUpdatedTime `NUMBER` -- purgeNonExistingResourceIds `BOOLEAN` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- enableStsGthrn `BOOLEAN` -- enableRebuilddexes `BOOLEAN` - -``` -WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP( eventStatuses, clientIds, purgeEventsOlderThanXNumberOfDays, lastUpdatedTime, - purgeNonExistingResourceIds, backupTables, enableAudit, enableStsGthrn, enableRebuildIndexes ); -``` - -``` -Ex: - -sqlplus> exec WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 31, NULL, - TRUE, TRUE, TRUE, TRUE, TRUE); -``` - -**Execute the restore from backup procedure.** - -``` -EXEC WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP(); -``` diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-cleanup-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-cleanup-script.sql deleted file mode 100644 index 4d6458b3..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-cleanup-script.sql +++ /dev/null @@ -1,417 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -CREATE OR REPLACE PROCEDURE WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP( - IN eventStatuses VARCHAR(1024), - IN clientIds VARCHAR(4096), - IN purgeEventsOlderThanXNumberOfDays INT, - IN lastUpdatedTime BIGINT, - IN purgeNonExistingResourceIds BOOLEAN, - IN backupTables BOOLEAN, - IN enableAudit BOOLEAN, - IN enableReindexing BOOLEAN, - IN enableTblAnalyzing BOOLEAN -) AS $$ -DECLARE - -batchSize int; -chunkSize int; -checkCount int; -sleepTime float; -enableLog boolean; -logLevel VARCHAR(10); -backupTable text; -indexTable text; -notice text; -cusrRecord record; -rowcount bigint :=0; -cleanupCount bigint :=0; -deleteCount INT := 0; -chunkCount INT := 0; -batchCount INT := 0; -olderThanTimePeriodForPurging bigint; - -tablesCursor CURSOR FOR SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = current_schema() AND -tablename IN ('ob_notification','ob_notification_event','ob_notification_error'); - - -BEGIN - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -batchSize := 10000; -- SET BATCH SIZE FOR AVOID TABLE LOCKS [DEFAULT : 10000] -chunkSize := 500000; -- CHUNK WISE DELETE FOR LARGE TABLES [DEFAULT : 500000] -checkCount := 100; -- SET CHECK COUNT FOR FINISH CLEANUP SCRIPT (CLEANUP ELIGIBLE EVENT NOTIFICATIONS COUNT SHOULD BE HIGHER THAN checkCount TO CONTINUE) [DEFAULT : 100] - -CASE WHEN (purgeNonExistingResourceIds IS NULL) - THEN purgeNonExistingResourceIds := FALSE; -- SET TRUE FOR PURGE UNTRACEABLE NOTIFICATION EVENTS. [DEFAULT : FALSE] -ELSE -END CASE; - -CASE WHEN (backupTables IS NULL) - THEN backupTables := TRUE; -- SET IF EVENT NOTIFICATION TABLES NEEDS TO BACKUP BEFORE DELETE [DEFAULT : TRUE] , WILL DROP THE PREVIOUS BACKUP TABLES IN NEXT ITERATION - ELSE -END CASE; - -sleepTime := 2; -- SET SLEEP TIME FOR AVOID TABLE LOCKS [DEFAULT : 2] -enableLog := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE , DEBUG - -CASE WHEN (enableAudit IS NULL) - THEN enableAudit := FALSE; -- SET TRUE FOR KEEP TRACK OF ALL THE DELETED EVENT NOTIFICATIONS USING A TABLE [DEFAULT : FALSE] [# IF YOU ENABLE THIS TABLE BACKUP WILL FORCEFULLY SET TO TRUE] - ELSE -END CASE; - -CASE WHEN (enableReindexing IS NULL) - THEN enableReindexing := FALSE; -- SET TRUE FOR GATHER SCHEMA LEVEL STATS TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE -END CASE; - -CASE WHEN (enableTblAnalyzing IS NULL) - THEN enableTblAnalyzing := FALSE; -- SET TRUE FOR Rebuild Indexes TO IMPROVE QUERY PERFORMANCE [DEFAULT : FALSE] - ELSE -END CASE; - --- ------------------------------------------ --- EVENT NOTIFICATION DATA PURGING CONFIGS --- ------------------------------------------ - -CASE WHEN (eventStatuses IS NULL) - THEN eventStatuses = ''; -- SET EVENT_NOTIFICATION_STATUSES WHICH SHOULD BE ELIGIBLE FOR PURGING. (Ex : 'ACK,ERR') - ELSE -END CASE; - -CASE WHEN (clientIds IS NULL) - THEN clientIds = ''; -- SET CLIENT_IDS WHICH SHOULD BE ELIGIBLE FOR PURGING. (LEAVE AS EMPTY TO SKIP) - ELSE -END CASE; - -CASE WHEN (purgeEventsOlderThanXNumberOfDays IS NULL) - THEN olderThanTimePeriodForPurging = 60 * 60 * 24 * 365; -- SET TIME PERIOD (SECONDS) TO DELETE EVENT NOTIFICATION OLDER THAN N DAYS. (DEFAULT 365 DAYS) (CHECK BELOW FOR FOR INFO.) - ELSE olderThanTimePeriodForPurging = 60 * 60 * 24 * purgeEventsOlderThanXNumberOfDays; -END CASE; - -CASE WHEN (lastUpdatedTime IS NULL) - THEN lastUpdatedTime = cast(extract(epoch from now())as bigint) - olderThanTimePeriodForPurging; -- SET LAST_UPDATED_TIME FOR PURGING, (IF EVENT NOTIFICATION'S UPDATED TIME IS OLDER THAN THIS VALUE THEN IT'S ELIGIBLE FOR PURGING, CHECK BELOW FOR FOR INFO.) - ELSE -END CASE; - - --- HERE IF WE WISH TO PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS (1 MONTH), WE CAN CONFIGURE olderThanTimePeriodForPurging = 60 * 60 * 24 * 31 --- THIS VALUE IS IN SECONDS (60 (1 MINUTE) * 60 (1 HOUR) * 24 (24 HOURS = 1 DAY) * 31 (31 DAYS = 1 MONTH)) --- OR ELSE WE CAN SET THE INPUT PARAMETER purgeEventsOlderThanXNumberOfDays = 31 , FOR PURGE EVENT NOTIFICATION WITH LAST UPDATED_TIME OLDER THAN 31 DAYS. --- IF WE WISH TO CONFIGURE EXACT TIMESTAMP OF THE LAST UPDATED_TIME RATHER THAN A TIME PERIOD, WE CAN IGNORE CONFIGURING olderThanTimePeriodForPurging, purgeEventsOlderThanXNumberOfDays --- AND ONLY CONFIGURE lastUpdatedTime WITH EXACT UNIX TIMESTAMP. --- EX : `SET lastUpdatedTime = 1660737878;` - --- ------------------------------------------------------ --- BACKUP EVENT_NOTIFICATION TABLES --- ------------------------------------------------------ - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP STARTED .... !'; -RAISE NOTICE ''; -END IF; - -IF (enableAudit) -THEN -backupTables:=TRUE; -END IF; - -IF (backupTables) -THEN - IF (enableLog) THEN - RAISE NOTICE 'TABLE BACKUP STARTED ... !'; - END IF; - - OPEN tablesCursor; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - backupTable := 'bak_'||cusrRecord.tablename; - - EXECUTE 'SELECT count(1) from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename = $1' into rowcount USING backupTable; - IF (rowcount = 1) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ALREADY EXISTS HENCE DROPPING TABLE %',backupTable; - END IF; - EXECUTE 'DROP TABLE '||quote_ident(backupTable); - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - EXECUTE 'SELECT COUNT(1) FROM '||quote_ident(cusrRecord.tablename) INTO rowcount; - notice := cusrRecord.tablename||' NUMBER OF ROWS: '||rowcount; - RAISE NOTICE 'BACKING UP %',notice; - END IF; - - EXECUTE 'CREATE TABLE '||quote_ident(backupTable)||' as SELECT * FROM '||quote_ident(cusrRecord.tablename); - - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - EXECUTE 'SELECT COUNT(1) FROM '||quote_ident(backupTable) INTO rowcount; - notice := cusrRecord.tablename||' TABLE INTO '||backupTable||' TABLE COMPLETED WITH : '||rowcount; - RAISE NOTICE 'BACKING UP %',notice; - RAISE NOTICE ''; - END IF; - END LOOP; - CLOSE tablesCursor; -END IF; - --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- CREATING AUDIT TABLES FOR DELETING --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -IF (enableAudit) -THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING AUDIT TABLES ... !'; - END IF; - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('auditlog_ob_event_notification_cleanup'); - IF (rowcount = 0) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'CREATING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP .. !'; - END IF; - CREATE TABLE auditlog_ob_event_notification_cleanup as SELECT * FROM ob_notification WHERE 1 = 2; - ALTER TABLE auditlog_ob_event_notification_cleanup ADD COLUMN AUDIT_TIMESTAMP TIMESTAMP DEFAULT NOW(); - ELSE - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'USING AUDIT TABLE AUDITLOG_OB_EVENT_NOTIFICATION_CLEANUP ..!'; - END IF; - END IF; -END IF; - --- ------------------------------------------------------ --- CALCULATING EVENT NOTIFICATIONS IN OB_NOTIFICATION TABLE --- ------------------------------------------------------ - -IF (enableLog) THEN - RAISE NOTICE ''; - RAISE NOTICE 'CALCULATING EVENT NOTIFICATIONS ON OB_NOTIFICATION .... !'; - - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - SELECT COUNT(1) INTO rowcount FROM ob_notification; - RAISE NOTICE 'TOTAL EVENT NOTIFICATIONS ON OB_NOTIFICATION TABLE BEFORE DELETE: %',rowcount; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - SELECT COUNT(1) INTO cleanupCount FROM ob_notification A WHERE (STRPOS( LOWER(','||eventStatuses||','), ','||LOWER(A.STATUS)||',') > 0) AND - ((clientIds = '') IS NOT FALSE OR STRPOS(LOWER(','||clientIds||','), ','||LOWER(A.CLIENT_ID)||',') > 0) AND - A.UPDATED_TIMESTAMP < to_timestamp(lastUpdatedTime) - OR A.RESOURCE_ID IN ( - SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL - AND purgeNonExistingResourceIds - ); - RAISE NOTICE 'TOTAL EVENT NOTIFICATIONS SHOULD BE DELETED FROM OB_NOTIFICATION: %',cleanupCount; - RAISE NOTICE 'NOTE: ACTUAL DELETION WILL HAPPEN ONLY WHEN DELETE COUNT IS LARGER THAN CHECKCOUNT .... !'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - rowcount := (rowcount - cleanupCount); - RAISE NOTICE 'TOTAL EVENT NOTIFICATIONS SHOULD BE RETAIN IN OB_NOTIFICATION: %',rowcount; - END IF; -END IF; - --- ------------------------------------------------------ --- BATCH DELETE EVENT NOTIFICATIONS DATA --- ------------------------------------------------------ - -IF (enableLog) -THEN -RAISE NOTICE ''; -RAISE NOTICE 'EVENT NOTIFICATIONS PURGING STARTED .... !'; -END IF; - -LOOP - - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('chunk_ob_event_notifications'); - IF (rowcount = 1) - THEN - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'DROPPING EXISTING TABLE chunk_ob_event_notifications !'; - END IF; - DROP TABLE chunk_ob_event_notifications; - END IF; - - CREATE TABLE chunk_ob_event_notifications (NOTIFICATION_ID VARCHAR); - - INSERT INTO chunk_ob_event_notifications (NOTIFICATION_ID) SELECT NOTIFICATION_ID FROM ob_notification A WHERE ( - STRPOS( LOWER(','||eventStatuses||','), ','||LOWER(A.STATUS)||',') > 0) AND - ((clientIds = '') IS NOT FALSE OR STRPOS(LOWER(','||clientIds||','), ','||LOWER(A.CLIENT_ID)||',') > 0) AND - A.UPDATED_TIMESTAMP < to_timestamp(lastUpdatedTime) OR - A.RESOURCE_ID IN ( - SELECT B.RESOURCE_ID FROM OB_NOTIFICATION B LEFT JOIN OB_CONSENT C ON B.RESOURCE_ID = C.CONSENT_ID WHERE C.CONSENT_ID IS NULL AND - purgeNonExistingResourceIds - ) LIMIT chunkSize; - GET diagnostics chunkCount := ROW_COUNT; - - IF (chunkCount < checkCount) - THEN - EXIT; - END IF; - - CREATE INDEX idx_chunk_ob_event_notifications ON chunk_ob_event_notifications (NOTIFICATION_ID); - - IF (enableLog AND logLevel IN ('TRACE')) - THEN - RAISE NOTICE ''; - RAISE NOTICE 'PROCEEDING WITH NEW CHUNK TABLE chunk_ob_event_notifications %',chunkCount; - RAISE NOTICE ''; - END IF; - - IF (enableAudit) - THEN - INSERT INTO auditlog_ob_event_notification_cleanup SELECT OBN.*, NOW() FROM ob_notification OBN , chunk_ob_event_notifications CHK WHERE OBN.NOTIFICATION_ID=CHK.NOTIFICATION_ID; - COMMIT; - END IF; - - LOOP - SELECT count(1) INTO rowcount from pg_catalog.pg_tables WHERE schemaname = current_schema() AND tablename IN ('batch_ob_event_notification'); - IF (rowcount = 1) - THEN - DROP TABLE batch_ob_event_notification; - END IF; - - CREATE TABLE batch_ob_event_notification (NOTIFICATION_ID VARCHAR); - - INSERT INTO batch_ob_event_notification (NOTIFICATION_ID) SELECT NOTIFICATION_ID FROM chunk_ob_event_notifications LIMIT batchSize; - GET diagnostics batchCount := ROW_COUNT; - - IF ((batchCount = 0)) - THEN - EXIT WHEN batchCount=0; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE ''; - RAISE NOTICE 'BATCH DELETE START ON EVENT NOTIFICATIONS DATA WITH : %',batchCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_EVENT - -- ------------------------------------------------------ - DELETE FROM ob_notification_event where NOTIFICATION_ID in (select NOTIFICATION_ID from batch_ob_event_notification); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_notification_event WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION_ERROR - -- ------------------------------------------------------ - DELETE FROM ob_notification_error where NOTIFICATION_ID in (select NOTIFICATION_ID from batch_ob_event_notification); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_notification_error WITH : %',deleteCount; - END IF; - - -- ------------------------------------------------------ - -- BATCH DELETE OB_NOTIFICATION - -- ------------------------------------------------------ - DELETE FROM ob_notification where NOTIFICATION_ID in (select NOTIFICATION_ID from batch_ob_event_notification); - GET diagnostics deleteCount := ROW_COUNT; - COMMIT; - - IF (enableLog AND logLevel IN ('DEBUG','TRACE')) THEN - RAISE NOTICE 'BATCH DELETE FINISHED ON ob_notification WITH : %',deleteCount; - END IF; - - DELETE FROM chunk_ob_event_notifications WHERE NOTIFICATION_ID in (select NOTIFICATION_ID from batch_ob_event_notification); - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'DELETED BATCH ON chunk_ob_event_notifications !'; - END IF; - - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'SLEEPING ...'; - END IF; - perform pg_sleep(sleepTime); - - END LOOP; -END LOOP; - -IF (enableLog) -THEN -RAISE NOTICE ''; -RAISE NOTICE 'EVENT NOTIFICATION DATA DELETE COMPLETED .... !'; -END IF; - --- ------------------------------------------------------ --- REBUILDING INDEXES --- ------------------------------------------------------ -IF (enableReindexing) -THEN - OPEN tablesCursor; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'INDEX REBUILDING STARTED ...!'; - END IF; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - RAISE NOTICE 'INDEX REBUILDING FOR TABLE %',cusrRecord.tablename; - END IF; - EXECUTE 'REINDEX TABLE '||quote_ident(cusrRecord.tablename); - END LOOP; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'INDEX REBUILDING COMPLETED ...!'; - END IF; - CLOSE tablesCursor; - RAISE NOTICE ''; -END IF; - --- ------------------------------------------------------ --- ANALYSING TABLES --- ------------------------------------------------------ -IF (enableTblAnalyzing) -THEN - OPEN tablesCursor; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ANALYZING STARTED ...!'; - END IF; - LOOP - FETCH tablesCursor INTO cusrRecord; - EXIT WHEN NOT FOUND; - IF (enableLog AND logLevel IN ('TRACE','DEBUG')) THEN - RAISE NOTICE 'TABLE ANALYZING FOR TABLE %',cusrRecord.tablename; - END IF; - EXECUTE 'ANALYZE '||quote_ident(cusrRecord.tablename); - END LOOP; - IF (enableLog AND logLevel IN ('TRACE')) THEN - RAISE NOTICE 'TABLE ANALYZING COMPLETED ...!'; - END IF; - CLOSE tablesCursor; - RAISE NOTICE ''; -END IF; - -IF (enableLog) THEN -RAISE NOTICE ''; -RAISE NOTICE 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP COMPLETED .... !'; -RAISE NOTICE ''; -END IF; - -END; -$$ -LANGUAGE 'plpgsql'; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-restore-script.sql b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-restore-script.sql deleted file mode 100644 index 26ebddd3..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/postgresql-event-notification-restore-script.sql +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - CREATE OR REPLACE FUNCTION WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP() RETURNS void AS $$ -DECLARE - -rowcount bigint; -enableLog boolean; -logLevel VARCHAR(10); - -BEGIN - --- ------------------------------------------ --- CONFIGURABLE ATTRIBUTES --- ------------------------------------------ -enableLog := TRUE; -- ENABLE LOGGING [DEFAULT : TRUE] -logLevel := 'TRACE'; -- SET LOG LEVELS : TRACE - - - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP STARTED .... !'; -RAISE NOTICE ''; -END IF; - - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_notification'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_notification TABLE !'; -END IF; -INSERT INTO ob_notification SELECT A.* FROM bak_ob_notification A LEFT JOIN ob_notification B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_notification WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_notification_event'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_notification_event TABLE !'; -END IF; -INSERT INTO ob_notification_event SELECT A.* FROM bak_ob_notification_event A LEFT JOIN ob_notification_event B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_notification_event WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -SELECT COUNT(1) INTO rowcount FROM PG_CATALOG.PG_TABLES WHERE SCHEMANAME = CURRENT_SCHEMA() AND TABLENAME IN ('ob_notification_error'); -IF (rowcount = 1) -THEN -IF (enableLog AND logLevel IN ('TRACE')) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION STARTED ON ob_notification_error TABLE !'; -END IF; -INSERT INTO ob_notification_error SELECT A.* FROM bak_ob_notification_error A LEFT JOIN ob_notification_error B ON A.NOTIFICATION_ID = B.NOTIFICATION_ID WHERE B.NOTIFICATION_ID IS NULL; -GET DIAGNOSTICS rowcount := ROW_COUNT; -IF (enableLog ) THEN -RAISE NOTICE 'CLEANUP DATA RESTORATION COMPLETED ON ob_notification_error WITH %',ROWCOUNT; -END IF; -END IF; - --- --------------------- - -IF (enableLog) THEN -RAISE NOTICE 'WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP COMPLETED .... !'; -RAISE NOTICE ''; -END IF; - -END; -$$ -LANGUAGE 'plpgsql'; diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/readme.MD deleted file mode 100644 index 753d7c9c..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/postgresql/readme.MD +++ /dev/null @@ -1,43 +0,0 @@ -## **HOW TO RUN** - -**>> postgresql-event-notification-cleanup-script.sql** - - -**Compile the stored procedure** - -First - Compile the stored procedure using a PostgreSQL client. Following is a sample for CLI based PostgreSQL client. -Make sure to create the procedure in the openbank_openbankingdb (consent DB) database schema only. - -**Execute the stored procedure.** - -Then execute the compiled stored procedure by using the call function in the PostgreSQL client. Following is a sample for CLI based PostgreSQL client. - -- eventStatuses `VARCHAR` -- clientIds `VARCHAR` -- purgeEventsOlderThanXNumberOfDays `INT` -- lastUpdatedTime `BIGINT` -- purgeNonExistingResourceIds `BOOLEAN` -- backupTables `BOOLEAN` -- enableAudit `BOOLEAN` -- enableReindexing `BOOLEAN` -- enableTblAnalyzing `BOOLEAN` - -``` -WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP( eventStatuses, clientIds, purgeEventsOlderThanXNumberOfDays, lastUpdatedTime, - purgeNonExistingResourceIds, backupTables, enableAudit, enableReindexing, enableTblAnalyzing); -``` - -``` -Ex: -pgsql> CALL WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 31, NULL, TRUE, TRUE, TRUE, TRUE, TRUE); - -``` - -**Execute the restore from backup procedure.** - -``` -select WSO2_OB_EVENT_NOTIFICATION_CLEANUP_DATA_RESTORE_SP(); -``` - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/readme.MD b/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/readme.MD deleted file mode 100644 index ccab6769..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/dbscripts/stored-procedures/event-notification-purging-procedures/readme.MD +++ /dev/null @@ -1,130 +0,0 @@ -# Introduction - -You can perform the data purging by clearing the event notification data using the script given here. As the volume of the data stored grows over time, It is highly recommended to perform data purging on servers to mitigate performance issues. - -Based on the use cases sometimes the data in the database might grow fast and cleaning them up from the product itself becomes expensive. These stored procedures help us to offload the expensive data cleanups to the database server. - -This script is similar to the consent data purging script, However has different parameters to purge the event notification data. - -`Tip : It is recommended to run these steps at the time where server traffic is low. Especially, if you are running this in the production environment for the first time, since the data volume to be purged may be higher. However, consider this as a housekeeping task that needs to be run at regular intervals.` - -1) Take a backup of the running database. -2) Set up the database dump in a test environment and test it for any issues. - -`Tip : We recommend that you test the database dump before the cleanup task as the cleanup can take some time.` - -3) Execute the store procedures given for specific DBs. -4) Once the cleanup is over, start WSO2 Servers pointing to the cleaned-up database dump and test throughly for any issues. - -## **Usage** - -**>> event-notification-cleanup.sql** - -This is the event-notification data cleanup script with batch wise delete, This procedure includes the cleanup of event notifications from the respective tables of *OB_NOTIFICATION* , *OB_NOTIFICATION_EVENT* , *OB_NOTIFICATION_ERROR* - -1. Compile the stored procedure. -2. Execute the compiled store procedure. - -*- Logical condition and configs used for event-notification purging.* - -*EVENT NOTIFICATION DATA PURGING PARAMETERS* - -- `eventStatuses` - - event statuses which should be eligible for purging. (ex : 'ACK,ERR') -- `clientIds` - - client_ids which should be eligible for purging. (leave as empty to skip) -- `purgeEventsOlderThanXNumberOfDays` - - time period to delete event-notifications older than `n` days. (check below for more info.) -- `lastUpdatedTime` - - last_updated_time for purging, (if event-notification's updated timestamp is older than this value then it's eligible for purging, check below for more info.) -- `purgeNonExistingResourceIds` - - flag to enable the purging of untraceable event notifications (if the `ob_notification's` `resource_id` is not exists in the `ob_consent` table's `consent_id` (untraceable), then it's eligible for purging) - - setting this to `true` will purge the untraceable notification event regard less filtering the other purging parameters. - - -- Here if we wish to purge event-notifications with last updated_time older than 31 days (1 month), we can configure `purgeEventsOlderThanXNumberOfDays` = `31` -this value is in number of days. -- If we wish to configure exact timestamp of the `lastUpdatedTime` rather than a time period, we can ignore configuring `purgeEventsOlderThanXNumberOfDays` = `NULL`, -and only configure lastUpdatedTime with exact unix timestamp. - - `ex : lastupdatedtime = 1660737878;` - -*OTHER PARAMETERS* - -- `backupTables` - - enable the backup table to restore later at a later stage. (Please note this backup tables will be overwritten every time you run the cleanup script.). - - Also, this would not capture the event notifications which were created in between the backup task and the cleanup iteration, hence if event notifications created after the backup task will not be able to restore if its get deleted from the cleanup iteration. - -- `enableAudit` - - By setting this parameter to true, will log each of deleted event notification in the auditlog_ob_event_notification_cleanup table for track them in a later time. - -Once compiled the stored procedure, We can execute the procedure with input parameters as in below example. (for mysql) - -``` -WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP( eventStatuses, clientIds, purgeEventsOlderThanXNumberOfDays, lastUpdatedTime, - purgeNonExistingResourceIds, backupTables, enableAudit, analyzeTables ); -``` - -``` -Ex: -mysql> call WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 10, NULL, TRUE, TRUE, TRUE, TRUE); - -``` - -Please refer the readme.MD file on each DB type for more information. - -*CONFIGURABLE ATTRIBUTES* - -Following are some important variables you need to consider, You can configure these parameters directly in the script. - -**batchSize* - This variable defines how many records will be deleted per batch for one iteration. - -**chunkSize* - If you have millions of data in the table, this variable allows to handle them chunk wise , which is a larger set to the batch where the batch processes each of the chunk (ex if you have 20 million data in the particular table, the chunk will initially take half million of such data and provided it into the batch delete as 10000 records per batch. Once that chunk is completed it will get another half million and proceed.) - -**checkCount* - If the event notifications were kept eligible for purging while the cleanup scripts run, it will be stuck in an endless loop. Hence, this defines a safe margin for the cleanup script to complete its job if the eligible event-notifications for delete are less than checkCount. - -**sleepTime* - Used to define the wait time for each iteration of the batch deletes to avoid table locks. - -**enableLog* - Parameter use for enable or disable the logs. - -**logLevel* - Parameter used to set the log levels. - -**Functions** - -**BACKUP EVENT NOTIFICATION TABLES* - This section acts to back up all the required table in case of restoration to be performed. - -**CREATING AUDITLOG TABLES FOR DELETING EVENT NOTIFICATIONS* - This section creates the initial audit logs table for persisting the deleted event-notifications. - -**CALCULATING EVENT NOTIFICATIONS IN OB_NOTIFICATION TABLE* - This section used prints the breakdown of the event-notification which should delete and retain. - -**BATCH DELETE * TABLE* - This section does the chunk and batch-wise delete for the event-notification data. - -**REBUILDING INDEXES* - As an extra step to optimize the database, this can perform an index rebuilding task for improving the performance, However, it's not recommended to perform on a live system unless you have downtime. Hence this could lock down the whole table. - -**ANALYSING TABLES* - As an extra step you can perform a table analyze for gather the statistics for the tables which had the delete operation. This is also to improve the performance of the database. However, it's also not recommended to perform on a live system unless you have downtime. - -**>> event-notification-cleanup-restore.sql** - -This is the stored procedure used to restore the deleted event-notification from the event-notification tables. The restoration can be only done if the backupTables property is set to true in the WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP procedure. - -This is only an immediate restoration script for the WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP procedure, hence each execution of the WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP procedure will replace the backup tables. - -**Please note that it is highly recommended to have a complete backup of the production environment before modifying any data, in case of any restoration would be required.** - - -*You can also schedule a cleanup task that will be automatically run after a given period of time.* - -Ex: For Mysql - -``` -USE 'WSO2_OB_CONSENT_DB'; -DROP EVENT IF EXISTS event_notification_cleanup; -CREATE EVENT event_notification_cleanup - ON SCHEDULE - EVERY 1 WEEK STARTS '2015-01-01 00:00.00' - DO - CALL `WSO2_OB_CONSENT_DB`.WSO2_OB_EVENT_NOTIFICATION_CLEANUP_SP('ACK,ERR', 'clientId1,clientId2', 10, NULL, TRUE, TRUE, TRUE, TRUE); - --- 'Turn on the event_scheduler' -SET GLOBAL event_scheduler = ON; - -``` \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/MANIFEST.MF b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/MANIFEST.MF deleted file mode 100644 index 5ace58fe..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Maven WAR Plugin 3.3.2 -Build-Jdk-Spec: 11 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.properties deleted file mode 100644 index 03b2e684..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -artifactId=openbanking-application-info-endpoint -groupId=com.wso2 -version=3.0.0 diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.xml deleted file mode 100644 index 3fbb955c..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/maven/com.wso2/openbanking-application-info-endpoint/pom.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - open-banking-accelerator - com.wso2.openbanking.accelerator - 3.2.0-SNAPSHOT - ../../../pom.xml - - 4.0.0 - - openbanking-application-info-endpoint - war - WSO2 Open Banking - Application Info Endpoint - - - - io.swagger - swagger-jaxrs - provided - - - org.springframework - spring-web - provided - - - org.apache.cxf - cxf-bundle-jaxrs - provided - - - com.fasterxml.jackson.core - jackson-databind - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.core - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.authentication.framework - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.common - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.identity - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - provided - - - org.apache.commons - commons-lang3 - provided - - - org.testng - testng - test - - - - - - - org.openapitools - openapi-generator-maven-plugin - ${openapi.generator.plugin.version} - - - - generate - - - - true - ${project.basedir}/src/main/resources/application-info-130.yaml - jaxrs-cxf - - src/gen/java/ - true - - false - com.wso2.open.banking.application.info.endpoint.model - com.wso2.open.banking.application.info.endpoint.api - impl - DTO - ${project.basedir} - - - - - - maven-war-plugin - ${maven-war-plugin.version} - - - - - src/main/webapp - - - api#openbanking#application - - - - com.github.spotbugs - spotbugs-maven-plugin - - Max - Low - true - false - ${project.build.directory}/spotbugs - ${project.basedir}/src/main/resources/findbugs-exclude.xml - ${project.basedir}/src/main/resources/findbugs-include.xml - - - com.h3xstream.findsecbugs - findsecbugs-plugin - ${com.h3xstream.findsecbugs.version} - - - - - - analyze-compile - compile - - check - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/webapp-classloading.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/webapp-classloading.xml deleted file mode 100644 index dfc87b0b..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - false - - - Carbon,CXF3 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/beans.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/beans.xml deleted file mode 100644 index 3aed2904..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/beans.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/application-info-300.yaml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/application-info-300.yaml deleted file mode 100644 index 1c72700a..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/application-info-300.yaml +++ /dev/null @@ -1,147 +0,0 @@ -openapi: 3.0.0 -info: - version: v3.0.0 - title: ApplicationInfoAPI - description: This specifies a RESTful API for retrieving OAuth Application Information - contact: - name: WSO2 - url: http://wso2.com/solutions/financial/open-banking/ - email: openbankingdemo@wso2.com - license: - name: WSO2 Commercial License - url: https://wso2.com -servers: - - url: https://{ob_km_host}:{ob_km_port}/api/openbanking/application/ - variables: - ob_km_host: - default: localhost - description: Host of the Open Banking Key Manager - ob_km_port: - default: "9446" - description: Port of the Open Banking Key Manager -paths: - /metadata/: - get: - summary: Retrieve Bulk Application Metadata - operationId: getBulkApplicationMetadata - tags: - - Application Information - parameters: - - in: query - name: clientIds - required: true - schema: - type: array - items: - type: string - style: form - explode: false - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationBulkMetadataSuccess" - "404": - description: Service Provider Data Not Found - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationInfoError" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationInfoError" - /metadata/{id}: - get: - summary: Retrieve Single Application Metadata - operationId: getSingleApplicationMetadata - tags: - - Application Information - parameters: - - name: id - in: path - description: The client id of the application - required: true - schema: - type: string - responses: - "200": - description: OK - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationSingleMetadataSuccess" - "404": - description: Service Provider Data Not Found - "400": - description: Bad Request - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationInfoError" - "500": - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/ApplicationInfoError" -components: - schemas: - ApplicationBulkMetadataSuccess: - title: Application Bulk Metadata Success Response - description: Defines metadata for the requested applications - type: object - properties: - data: - type: object - description: Key value pairs of client ids and attributes - additionalProperties: - $ref: "#/components/schemas/ApplicationMetadataResource" - - required: - - data - ApplicationSingleMetadataSuccess: - title: Application Single Metadata Success Response - description: Defines metadata for a requested application - type: object - properties: - data: - $ref: "#/components/schemas/ApplicationMetadataResource" - required: - - data - ApplicationMetadataResource: - title: Application Metadata Resource - description: Defines a resource object for an application - type: object - properties: - type: - type: string - description: Object type - Id: - type: string - description: The OAuth client id of the application - metadata: - type: object - description: Key-Value pairs of application metadata - additionalProperties: - type: string - ApplicationInfoError: - title: Error Response - description: Defines an error object for the Application Information API - type: object - properties: - status: - type: string - description: The HTTP error code as a string - title: - type: string - description: Error summary - description: - type: string - description: Human readable error description diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-exclude.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-exclude.xml deleted file mode 100644 index 6804ed0a..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-exclude.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-include.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-include.xml deleted file mode 100644 index 8932a22e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/classes/findbugs-include.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/web.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/web.xml deleted file mode 100644 index 16c696c8..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#application/WEB-INF/web.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - WSO2 Open Banking - Application Info - WSO2 Open Banking - Application Info API - - - contextConfigLocation - WEB-INF/beans.xml - - - - HttpHeaderSecurityFilter - org.apache.catalina.filters.HttpHeaderSecurityFilter - - hstsEnabled - false - - - - - HttpHeaderSecurityFilter - * - - - - - org.springframework.web.context.ContextLoaderListener - - - - - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - - CXFServlet - /* - - - - 60 - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/MANIFEST.MF b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/MANIFEST.MF deleted file mode 100644 index 5ace58fe..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Maven WAR Plugin 3.3.2 -Build-Jdk-Spec: 11 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.properties deleted file mode 100644 index 30b6131e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -artifactId=openbanking-consent-endpoint -groupId=com.wso2 -version=3.0.0 diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.xml deleted file mode 100644 index 80248e96..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/maven/com.wso2/openbanking-consent-endpoint/pom.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - 4.0.0 - - - open-banking-accelerator - com.wso2.openbanking.accelerator - 3.2.0-SNAPSHOT - ../../../pom.xml - - - openbanking-consent-endpoint - war - WSO2 Open Banking - Consent Endpoint - - - - io.swagger - swagger-jaxrs - - - javax.ws.rs - jsr311-api - - - com.google.guava - guava - - - org.yaml - snakeyaml - - - - - net.minidev - json-smart - provided - - - org.testng - testng - test - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.identity - - - org.slf4j - slf4j-api - - - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.consent.dao - - - org.slf4j - slf4j-api - - - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.consent.service - - - org.slf4j - slf4j-api - - - provided - - - org.wso2.carbon.identity.local.auth.api - org.wso2.carbon.identity.local.auth.api.core - - - org.slf4j - slf4j-api - - - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.consent.extensions - - - org.slf4j - slf4j-api - - - provided - - - com.fasterxml.jackson.core - jackson-databind - provided - - - - - - - maven-war-plugin - ${maven-war-plugin.version} - - - - - src/main/webapp - - - api#openbanking#consent - WEB-INF/lib/slf4j-api-*.jar - - - - com.github.spotbugs - spotbugs-maven-plugin - - Max - Low - true - false - ${project.build.directory}/spotbugs - ${project.basedir}/src/main/resources/findbugs-exclude.xml - ${project.basedir}/src/main/resources/findbugs-include.xml - - - com.h3xstream.findsecbugs - findsecbugs-plugin - ${com.h3xstream.findsecbugs.version} - - - - - - analyze-compile - compile - - check - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/webapp-classloading.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/webapp-classloading.xml deleted file mode 100644 index 7569f0a1..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF3,Carbon - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/beans.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/beans.xml deleted file mode 100644 index 048b8809..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/beans.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-exclude.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-exclude.xml deleted file mode 100644 index c4f8e532..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-exclude.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-include.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-include.xml deleted file mode 100644 index 8932a22e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/classes/findbugs-include.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/web.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/web.xml deleted file mode 100644 index 3879430c..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#consent/WEB-INF/web.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - WSO2 Open Banking - Consent API - WSO2 Open Banking - Consent API - - - contextConfigLocation - WEB-INF/beans.xml - - - - HttpHeaderSecurityFilter - org.apache.catalina.filters.HttpHeaderSecurityFilter - - hstsEnabled - false - - - - - HttpHeaderSecurityFilter - * - - - - - org.springframework.web.context.ContextLoaderListener - - - - - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - - CXFServlet - /* - - - - 60 - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/MANIFEST.MF b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/MANIFEST.MF deleted file mode 100644 index 5ace58fe..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Maven WAR Plugin 3.3.2 -Build-Jdk-Spec: 11 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.properties deleted file mode 100644 index ae52fdea..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -artifactId=com.wso2.openbanking.accelerator.dcr.endpoint -groupId=com.wso2 -version=3.0.0 diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.xml deleted file mode 100644 index 576a7cea..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/maven/com.wso2/com.wso2.openbanking.accelerator.dcr.endpoint/pom.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - open-banking-accelerator - com.wso2.openbanking.accelerator - 3.2.0-SNAPSHOT - ../../../pom.xml - - 4.0.0 - - com.wso2.openbanking.accelerator.dcr.endpoint - WSO2 Open Banking - Dynamic Client Registration Endpoint - WSO2 Open Banking - Dynamic Client Endpoint - war - - - - io.swagger - swagger-jaxrs - - - javax.ws.rs - jsr311-api - - - com.google.guava - guava - - - org.yaml - snakeyaml - - - - - javax.validation - validation-api - provided - - - org.springframework - spring-web - provided - - - org.apache.cxf - cxf-bundle-jaxrs - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.identity - - - javax.ws.rs - jsr311-api - - - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.common - provided - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth.dcr - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.application.mgt - provided - - - com.fasterxml.jackson.core - jackson-databind - provided - - - io.swagger - swagger-annotations - - - net.minidev - json-smart - provided - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source-api - generate-sources - - add-source - - - - src/gen/java - - - - - - - com.github.spotbugs - spotbugs-maven-plugin - - Max - Low - true - false - ${project.build.directory}/spotbugs - ${project.basedir}/src/main/resources/findbugs-include.xml - - - com.h3xstream.findsecbugs - findsecbugs-plugin - ${com.h3xstream.findsecbugs.version} - - - - - - analyze-compile - compile - - check - - - - - - maven-war-plugin - ${maven-war-plugin.version} - - - - - src/main/webapp - - - api#openbanking#dynamic-client-registration - WEB-INF/lib/axis2-kernel-1.6.1-wso2v12.jar, - WEB-INF/lib/slf4j-api-*.jar - - - - org.openapitools - openapi-generator-maven-plugin - ${openapi.generator.plugin.version} - - - - generate - - - - true - true - ${project.basedir}/src/main/resources/dynamic.client.registration.yaml - jaxrs-cxf - - src/gen/java - true - - false - com.wso2.openbanking.accelerator.dynamic.client.registration.src.main.model - com.wso2.openbanking.accelerator.dynamic.client.registration.src.main.api - impl - DTO - ${project.basedir} - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/webapp-classloading.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/webapp-classloading.xml deleted file mode 100644 index b212826c..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - Carbon,CXF3 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/beans.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/beans.xml deleted file mode 100644 index 32e98763..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/beans.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/classes/findbugs-include.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/classes/findbugs-include.xml deleted file mode 100644 index 8932a22e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/classes/findbugs-include.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/web.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/web.xml deleted file mode 100644 index 6eb2b9c3..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/api#openbanking#dynamic-client-registration/WEB-INF/web.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - WSO2 Open Banking - Dynamic Client Registration API - WSO2 Open Banking - Dynamic Client Registration API - - - contextConfigLocation - WEB-INF/beans.xml - - - - HttpHeaderSecurityFilter - org.apache.catalina.filters.HttpHeaderSecurityFilter - - hstsEnabled - false - - - - - HttpHeaderSecurityFilter - * - - - - - org.springframework.web.context.ContextLoaderListener - - - - - CXFServlet - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - - CXFServlet - /* - - - - 60 - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/MANIFEST.MF b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/MANIFEST.MF deleted file mode 100644 index 5ace58fe..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Created-By: Maven WAR Plugin 3.3.2 -Build-Jdk-Spec: 11 - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.properties deleted file mode 100644 index 138500bc..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -artifactId=com.wso2.openbanking.authentication.webapp -groupId=com.wso2 -version=3.0.0 diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.xml deleted file mode 100644 index 2218c8b3..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/META-INF/maven/com.wso2/com.wso2.openbanking.authentication.webapp/pom.xml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - open-banking-accelerator - com.wso2.openbanking.accelerator - 3.2.0-SNAPSHOT - ../../../pom.xml - - 4.0.0 - - com.wso2.openbanking.authentication.webapp - war - WSO2 Open Banking - Authentication Webapp - - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.identity - provided - - - com.wso2.openbanking.accelerator - com.wso2.openbanking.accelerator.consent.extensions - provided - - - javax.servlet - jstl - - - org.testng - testng - test - - - org.mockito - mockito-all - test - - - org.jacoco - org.jacoco.agent - runtime - test - - - org.springframework - spring-test - test - - - org.springframework - spring-core - provided - - - org.wso2.orbit.org.owasp.encoder - encoder - ${encoder.wso2.version} - - - - - - maven-war-plugin - ${maven-war-plugin.version} - - - - - src/main/resources/ - - - ob#authenticationendpoint - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.jacoco - jacoco-maven-plugin - - - **/*Constants.class - - - - - default-prepare-agent - - prepare-agent - - - - default-prepare-agent-integration - - prepare-agent-integration - - - - default-report - - report - - - - default-report-integration - - report-integration - - - - default-check - - check - - - - - **/*OBDefaultAuthServletImpl.class - - - - BUNDLE - - - INSTRUCTION - COVEREDRATIO - - - - - - - - - - - com.github.spotbugs - spotbugs-maven-plugin - - Max - Low - true - false - ${project.build.directory}/spotbugs - ${project.basedir}/src/main/resources/findbugs-exclude.xml - ${project.basedir}/src/main/resources/findbugs-include.xml - false - - - com.h3xstream.findsecbugs - findsecbugs-plugin - ${com.h3xstream.findsecbugs.version} - - - - - - analyze-compile - compile - - check - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/com/wso2/openbanking/authentication/webapp/i18n.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/com/wso2/openbanking/authentication/webapp/i18n.properties deleted file mode 100644 index ad04e6c8..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/com/wso2/openbanking/authentication/webapp/i18n.properties +++ /dev/null @@ -1,125 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -login=Sign In -username=User Name -password=Password -login.fail.message=Login failed! Please recheck the username and password and try again. -recaptcha.fail.message=reCaptcha validation is required for user. -account.confirmation.pending=Account is unverified. An account activation link has been sent to your registered email address, please check your inbox. -password.reset.pending=Password reset is required. A password reset link has been sent to your registered email address, please check your inbox. -account.resend.email.success=Email sent successfully. -account.resend.email.fail=Email sent fail. -user.tenant.domain.mismatch.message=Application you are trying to access does not allow users from your organization. -remember.me=Remember me on this computer -signin.to.authenticate1=Please sign in to authenticate to -signin.to.authenticate2=as -profile=Profile : -cancel=Cancel -approve=Approve -deny=Deny -approve.always=Approve Always -request.access.scope=requests access to -request.access.profile=requests access to your profile information -saml.sso=SAML 2.0 based Single Sign-On -tenantListLabel=Tenant -select.tenant.dropdown.display.name=Select Tenant -super.tenant.display.name=Super Tenant -super.tenant=carbon.super -domain.unknown=domain.unknown -confirm.password=Confirm Password -email=Email -continue=Continue -forgot.username.password=Forgot -forgot.username.password.or=or -forgot.password=Password -forgot.username=Username -no.account=Don't have an account? -have.account=Already have an account? -register.now=Register Now -register=Register -no.confirmation.mail=Not received confirmation email? -resend.mail=Re-Send -openid=Open ID -openid.user.claims=OpenID User Claims -username.or.password.invalid=Username or Password is Invalid -create.an.account=Create an account -unauthorized.to.login=You are not authorized to login -domain.cannot.be.identified=Domain cannot be identified! Please retry. -wso2.open.banking=WSO2 Open Banking -open.banking=Open Banking -domain=Domain -submit=Submit -inc=Inc -all.rights.reserved=All rights reserved -verification=Verification -touch.your.u2f.device=Touch your U2F device to Proceed -authentication.error=Authentication Error! -something.went.wrong.during.authentication=Something went wrong during the authentication process.Please try signing in again. -attention=Attention -provide.mandatory.details=Provide Mandatory Details -requested.claims.recommendation= application,that you are trying to login to needs following information filled in the user profile. You can fill those below and proceed with the authentication. But it is advised to fill these information in your Identity Provider profile in order to avoid this step every time you login -logged.out=You have successfully logged out. -authorize=Authorize -invalid.request=Invalid Request -oauth.processing.error.msg=OAuth Processing Error Message -openid.connect.logout=OpenID connect logout -do.you.want.to.logout=Do you want to logout? -yes=Yes -no=No -openid2.profile=OpenID2.0 Profile -claim.uri=Claim URI -claim.value=Claim Value -internal.error.occurred=Internal Error Occurred -information=Information -user.details.submitted=User details successfully submitted -close=Close -other.login.options=Other login options -sign.in.with=Sign In With -domain.name=Domain Name -go=Go -please.select.recaptcha=Please select recaptcha -error.when.processing.authentication.request=Error when processing authentication request! -please.try.login.again=Please try login again! -you.are.redirected.back.to=You are now redirected back to, -if.the.redirection.fails.please.click=If the redirection fails, please click the -post=POST -enter.required.fields.to.complete.registration=Enter required fields to complete registration -first.name=First Name -last.name=Last Name -password.mismatch=Passwords did not match. Please try again -user.exists=User already exist -unknown.error=Unknown error occurred -authentication.failed.please.retry=Authentication Failed! Please Retry -user.consents=User Consents -mandatory.claims.recommendation=Mandatory claims are marked with an asterisk -mandatory.claims.warning.msg.1=You need to provide consent for -mandatory.claims.warning.msg.2=all the mandatory claims -mandatory.claims.warning.msg.3=in order to proceed -privacy.policy.cookies=Cookie Policy -privacy.policy.cookies.short.description=After a successful sign in, we use a cookie in your browser to track your session. You can refer our -privacy.policy.general=Privacy Policy -privacy.policy.privacy.short.description=By signing in, you agree to our -privacy.policy.privacy.short.description.approving=By approving, you agree to our -privacy.policy.for.more.details=for more details. -under.construction=This page is under construction -by.selecting.following.attributes=By selecting following attributes I agree to share them with the above service provider. -select.all=Select All -requested.scopes=Requested scopes -requested.attributes=Requested attributes -please.select.approve.always=Please select either "Approve Always" or "Approve" to provide consent to requested scopes to continue -ok=Ok -mandatory.claims=Mandatory claims diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/configurations.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/configurations.properties deleted file mode 100644 index c118c4de..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/configurations.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). -# -# WSO2 LLC. 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. - -ConsentAPICredentials.IsConfiguredInWebapp = false -ConsentAPICredentials.Username = null -ConsentAPICredentials.Password = null diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-exclude.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-exclude.xml deleted file mode 100644 index d7392112..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-exclude.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-include.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-include.xml deleted file mode 100644 index 8932a22e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/classes/findbugs-include.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/web.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/web.xml deleted file mode 100644 index 59a41b2f..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/WEB-INF/web.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - OBConsentServlet - com.wso2.openbanking.accelerator.authentication.webapp.OBConsentServlet - - - - OBConsentServlet - /oauth2_authz.do - - - - OBConsentServlet - /oauth2_consent.do - - - - retrievalBaseURL - https://localhost:9446/api/openbanking/consent/authorize/retrieve - - - - displayScopes - true - - - - - - OBConsentConfirmServlet - com.wso2.openbanking.accelerator.authentication.webapp.OBConsentConfirmServlet - - - - OBConsentConfirmServlet - /oauth2_authz_confirm.do - - - - persistenceBaseURL - https://localhost:9446/api/openbanking/consent/authorize/persist - - - - - - cookie_policy.do - /cookie_policy.jsp - - - - cookie_policy.do - /cookie_policy.do - - - - - - privacy_policy.do - /privacy_policy.jsp - - - - privacy_policy.do - /privacy_policy.do - - - - - - java.lang.Throwable - /generic-exception-response.jsp - - - - - - oauth2_authz_consent.do - /oauth2_authz_consent.do - - - - retry.do - /generic-exception-response.jsp - - - - oauth2_authz_consent.do - /oauth2_authz_displayconsent.jsp - - - - retry.do - /retry.do - - - \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings-white.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings-white.png deleted file mode 100644 index 3bf6484a..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings-white.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings.png deleted file mode 100644 index 79bc568c..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/img/glyphicons-halflings.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/js/html5.js b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/js/html5.js deleted file mode 100644 index 560aa942..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/assets/js/html5.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! HTML5 Shiv vpre3.6 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed - Uncompressed source: https://github.com/aFarkas/html5shiv */ -(function(a,b){function h(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function i(){var a=l.elements;return typeof a=="string"?a.split(" "):a}function j(a){var b={},c=a.createElement,f=a.createDocumentFragment,g=f();a.createElement=function(a){if(!l.shivMethods)return c(a);var f;return b[a]?f=b[a].cloneNode():e.test(a)?f=(b[a]=c(a)).cloneNode():f=c(a),f.canHaveChildren&&!d.test(a)?g.appendChild(f):f},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+i().join().replace(/\w+/g,function(a){return c(a),g.createElement(a),'c("'+a+'")'})+");return n}")(l,g)}function k(a){var b;return a.documentShived?a:(l.shivCSS&&!f&&(b=!!h(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),g||(b=!j(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^<|^(?:a|b|button|code|div|fieldset|form|h1|h2|h3|h4|h5|h6|i|iframe|img|input|label|li|link|ol|option|p|param|q|script|select|span|strong|style|table|tbody|td|textarea|tfoot|th|thead|tr|ul)$/i,f,g;(function(){var c=b.createElement("a");c.innerHTML="",f="hidden"in c,f&&typeof injectElementWithStyles=="function"&&injectElementWithStyles("#modernizr{}",function(b){b.hidden=!0,f=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle).display=="none"}),g=c.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var l={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:k};a.html5=l,k(b)})(this,document) \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/com/wso2/openbanking/authentication/webapp/i18n.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/com/wso2/openbanking/authentication/webapp/i18n.properties deleted file mode 100644 index ad04e6c8..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/com/wso2/openbanking/authentication/webapp/i18n.properties +++ /dev/null @@ -1,125 +0,0 @@ - # Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - # - # WSO2 LLC. 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. - -login=Sign In -username=User Name -password=Password -login.fail.message=Login failed! Please recheck the username and password and try again. -recaptcha.fail.message=reCaptcha validation is required for user. -account.confirmation.pending=Account is unverified. An account activation link has been sent to your registered email address, please check your inbox. -password.reset.pending=Password reset is required. A password reset link has been sent to your registered email address, please check your inbox. -account.resend.email.success=Email sent successfully. -account.resend.email.fail=Email sent fail. -user.tenant.domain.mismatch.message=Application you are trying to access does not allow users from your organization. -remember.me=Remember me on this computer -signin.to.authenticate1=Please sign in to authenticate to -signin.to.authenticate2=as -profile=Profile : -cancel=Cancel -approve=Approve -deny=Deny -approve.always=Approve Always -request.access.scope=requests access to -request.access.profile=requests access to your profile information -saml.sso=SAML 2.0 based Single Sign-On -tenantListLabel=Tenant -select.tenant.dropdown.display.name=Select Tenant -super.tenant.display.name=Super Tenant -super.tenant=carbon.super -domain.unknown=domain.unknown -confirm.password=Confirm Password -email=Email -continue=Continue -forgot.username.password=Forgot -forgot.username.password.or=or -forgot.password=Password -forgot.username=Username -no.account=Don't have an account? -have.account=Already have an account? -register.now=Register Now -register=Register -no.confirmation.mail=Not received confirmation email? -resend.mail=Re-Send -openid=Open ID -openid.user.claims=OpenID User Claims -username.or.password.invalid=Username or Password is Invalid -create.an.account=Create an account -unauthorized.to.login=You are not authorized to login -domain.cannot.be.identified=Domain cannot be identified! Please retry. -wso2.open.banking=WSO2 Open Banking -open.banking=Open Banking -domain=Domain -submit=Submit -inc=Inc -all.rights.reserved=All rights reserved -verification=Verification -touch.your.u2f.device=Touch your U2F device to Proceed -authentication.error=Authentication Error! -something.went.wrong.during.authentication=Something went wrong during the authentication process.Please try signing in again. -attention=Attention -provide.mandatory.details=Provide Mandatory Details -requested.claims.recommendation= application,that you are trying to login to needs following information filled in the user profile. You can fill those below and proceed with the authentication. But it is advised to fill these information in your Identity Provider profile in order to avoid this step every time you login -logged.out=You have successfully logged out. -authorize=Authorize -invalid.request=Invalid Request -oauth.processing.error.msg=OAuth Processing Error Message -openid.connect.logout=OpenID connect logout -do.you.want.to.logout=Do you want to logout? -yes=Yes -no=No -openid2.profile=OpenID2.0 Profile -claim.uri=Claim URI -claim.value=Claim Value -internal.error.occurred=Internal Error Occurred -information=Information -user.details.submitted=User details successfully submitted -close=Close -other.login.options=Other login options -sign.in.with=Sign In With -domain.name=Domain Name -go=Go -please.select.recaptcha=Please select recaptcha -error.when.processing.authentication.request=Error when processing authentication request! -please.try.login.again=Please try login again! -you.are.redirected.back.to=You are now redirected back to, -if.the.redirection.fails.please.click=If the redirection fails, please click the -post=POST -enter.required.fields.to.complete.registration=Enter required fields to complete registration -first.name=First Name -last.name=Last Name -password.mismatch=Passwords did not match. Please try again -user.exists=User already exist -unknown.error=Unknown error occurred -authentication.failed.please.retry=Authentication Failed! Please Retry -user.consents=User Consents -mandatory.claims.recommendation=Mandatory claims are marked with an asterisk -mandatory.claims.warning.msg.1=You need to provide consent for -mandatory.claims.warning.msg.2=all the mandatory claims -mandatory.claims.warning.msg.3=in order to proceed -privacy.policy.cookies=Cookie Policy -privacy.policy.cookies.short.description=After a successful sign in, we use a cookie in your browser to track your session. You can refer our -privacy.policy.general=Privacy Policy -privacy.policy.privacy.short.description=By signing in, you agree to our -privacy.policy.privacy.short.description.approving=By approving, you agree to our -privacy.policy.for.more.details=for more details. -under.construction=This page is under construction -by.selecting.following.attributes=By selecting following attributes I agree to share them with the above service provider. -select.all=Select All -requested.scopes=Requested scopes -requested.attributes=Requested attributes -please.select.approve.always=Please select either "Approve Always" or "Approve" to provide consent to requested scopes to continue -ok=Ok -mandatory.claims=Mandatory claims diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/configurations.properties b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/configurations.properties deleted file mode 100644 index c118c4de..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/configurations.properties +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). -# -# WSO2 LLC. 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. - -ConsentAPICredentials.IsConfiguredInWebapp = false -ConsentAPICredentials.Username = null -ConsentAPICredentials.Password = null diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/cookie_policy.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/cookie_policy.jsp deleted file mode 100644 index e141abad..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/cookie_policy.jsp +++ /dev/null @@ -1,240 +0,0 @@ -<%@ page import="static com.wso2.openbanking.accelerator.consent.extensions.authservlet.impl.util.Utils.i18n" %><%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> - -<%@include file="includes/localize.jsp" %> - - - - - - - - - -
-
-
- - - -
-
-
- -
- - -
-
-
-
-
-
-

- <%=i18n(resourceBundle, "wso2.open.banking")%> - <%=i18n(resourceBundle, "privacy.policy.cookies")%> -

-
- -
-
-

About WSO2 Open Banking Solution

-

WSO2 Open Banking Solution (referred to as “WSO2 Open Banking” within this policy) is a comprehensive Open Banking Solution that is supporting PSD2 compliance along with more value added features.

-
- -
- -

WSO2 Open Banking uses cookies so that it can provide the best user experience for you and identify you for security purposes. If you disable cookies, some of the services will (most probably) be inaccessible to you.

-
- -
-

How does WSO2 Open Banking process cookies?

-

WSO2 Open Banking stores and retrieves information on your browser using cookies. This information is used to provide a better experience. Some cookies serve the primary purposes of allowing a user to log in to the system, maintaining sessions, and keeping track of activities you do within the login session.

-

The primary purpose of some cookies used in WSO2 Open Banking is to personally identify you as required by the functionality of WSO2 Open Banking. However the cookie lifetime ends once your session ends i.e., after you log-out, or after the session expiry time has elapsed.

-

Some cookies are simply used to give you a more personalised web experience and these cookies can not be used to personally identify you or your activities.

-

This cookie policy is part of the WSO2 Open Banking Privacy Policy.

-
- -
- -

A browser cookie is a small piece of data that is stored on your device to help websites and mobile apps remember things about you. Other technologies, including web storage and identifiers associated with your device, may be used for similar purposes. In this policy, we use the term “cookies” to discuss all of these technologies.

-
- -
-

What does WSO2 Open Banking use cookies for?

-

Cookies are used for two purposes in WSO2 Open Banking.

-
    -
  1. To identify you and provide security (as this is the main function of WSO2 IS).
  2. -
  3. To provide a satisfying user experience.
  4. -
-
- -
-

WSO2 Open Banking uses cookies for the following purposes listed below.

-

Preferences

-

WSO2 Open Banking uses these cookies to remember your settings and preferences, and to auto-fill the form fields to make your interactions with the site easier.

-

These cookies can not be used to personally identify you.

-

Security

-
    -
  • WSO2 Open Banking uses selected cookies to identify and prevent security risks. - For example, WSO2 Open Banking may use these cookies to store your session information in order to prevent others from changing your password without your username and password.
  • -
  • WSO2 Open Banking uses session cookies to maintain your active session.
  • -
  • WSO2 Open Banking may use temporary cookies when performing multi-factor authentication and federated authentication.
  • -
  • WSO2 Open Banking may use permanent cookies to detect that you have previously used the same device to log in. This is to to calculate the “risk level” associated with your current login attempt. This is primarily to protect you and your account from possible attack.
  • -
-

Performance

-

WSO2 Open Banking may use cookies to allow “Remember Me” functionalities.

-
- -
-

Analytics

-

WSO2 Open Banking as a product does not use cookies for analytical purposes.

-
- -
-

Third party cookies

-

Using WSO2 Open Banking may cause some third-party cookies to be set in your browser. WSO2 Open Banking has no control over how any of them operate. The third-party cookies that may be set include:

-
    -
  • Any social login sites. For example, third-party cookies may be set when WSO2 Open Banking is configured to use “social” or “federated” login, and you opt to login with your “Social Account”.
  • -
  • Any third party federated login.
  • -
-

WSO2 strongly advises you to refer the respective cookie policy of such sites carefully as WSO2 has no knowledge or use on these cookies.

-
- -
-

What type of cookies does WSO2 Open Banking use?

-

WSO2 Open Banking uses persistent cookies and session cookies. A persistent cookie helps WSO2 Open Banking to recognize you as an existing user so that it is easier to return to WSO2 or interact with WSO2 Open Banking without signing in again. After you sign in, a persistent cookie stays in your browser and will be read by WSO2 Open Banking when you return to WSO2 Open Banking.

-

A session cookie is a cookie that is erased when the user closes the web browser. The session cookie is stored in temporary memory and is not retained after the browser is closed. Session cookies do not collect information from the user's computer.

-
- -
-

How do I control my cookies?

-

Most browsers allow you to control cookies through their settings preferences. However, if you limit the given ability for websites to set cookies, you may worsen your overall user experience since it will no longer be personalized to you. It may also stop you from saving customized settings like login information.

-

Most likely, disabling cookies will make you unable to use authentication and authorization functionalities offered by WSO2 Open Banking.

-

If you have any questions or concerns regarding the use of cookies, please contact the entity or individuals (or their data protection officer, if applicable) of the organization running this WSO2 Open Banking instance.

-
- -
-

What are the cookies used?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Cookie Name

-
-

Purpose

-
-

Retention

-
-

JSESSIONID

-
-

To keep your session data in order to give you a good user experience.

-
-

Session

-
-

MSG##########

-
-

To keep some messages that are shown to you in order to give you a good user experience.

-

The “##########” reference in this coookie represents a random number e.g., MSG324935932.

-
-

Session

-
-

requestedURI

-
-

The URI you are accessing.

-
-

Session

-
-

current-breadcrumb

-
-

To keep your active page in session in order to give you a good user experience.

-
-

Session

-
-
- -
-

Disclaimer

-
    -
  1. This cookie policy is only for the illustrative purposes of the product WSO2 Open Banking. The content in the policy is technically correct at the time of the product shipment. The organization which runs this WSO2 Open Banking instance has full authority and responsibility with regard to the effective Cookie Policy.

  2. -
  3. WSO2, its employees, partners, and affiliates do not have access to and do not require, store, process or control any of the data, including personal data contained in WSO2 Open Banking. All data, including personal data is controlled and processed by the entity or individual running WSO2 Open Banking. WSO2, its employees partners and affiliates are not a data processor or a data controller within the meaning of any data privacy regulations. WSO2 does not provide any warranties or undertake any responsibility or liability in connection with the lawfulness or the manner and purposes for which WSO2 Open Banking is used by such entities or persons.
  4. -
-
-
- -
-
- - -
- - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/Roboto.css b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/Roboto.css deleted file mode 100644 index 558ee634..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/Roboto.css +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -@font-face { - font-family: 'Roboto'; - src: url('../fonts/Roboto/Roboto-Black-webfont.woff') format('woff'), - url('../fonts/Roboto/Roboto-Black-webfont.ttf') format('truetype'), - url('../fonts/Roboto/Roboto-Black-webfont.svg') format('svg'); - font-weight: 100; - font-style: normal; -} diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/custom-common.css b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/custom-common.css deleted file mode 100644 index c6eb9257..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/custom-common.css +++ /dev/null @@ -1,597 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -html { - position: relative; - height: 100%; - overflow-y: auto; - overflow-x: hidden; - width: 100%; -} - -body { - background: #efefef; - font-family: "Open Sans", "Helvetica", "Arial", sans-serif; -} - -body.sticky-footer { - padding-bottom: 40px; -} - -header { - background: transparent; - min-height: 150px; - position: relative; -} - -header .brand a { - min-height: 24px; -} - -header .brand img.logo { - height: 24px; -} - -header .brand h1 { - margin: 0 0 0 5px; - display: inline-block; - line-height: 1; -} - -header .brand h1 em { - font-weight: 500; - font-size: 17px; - margin: 0; - color: #ffffff; - padding: 3px 0 0 0; - font-style: normal; - text-transform: uppercase; -} - -header .brand img.logo { - height: 45px; -} - -header .brand { - margin-top: 35px; - margin-left: 25px; - width: 181px; -} - -footer { - position: absolute; - bottom: 0; - width: 100%; - min-height: 40px; - overflow: hidden; - color: rgba(0, 0, 0, 0.87); - background: #efefef; - text-align: center; -} - -footer .icon { - font-size: 37px; - vertical-align: middle; - color: rgba(0, 0, 0, 0.87); -} - -footer > .container, -footer > .container-fluid { - padding-right: 15px; - padding-left: 15px; -} - -footer > .container p, -footer > .container-fluid p { - line-height: 40px; - margin-bottom: 0; -} - -footer a, -footer a:hover { - text-decoration: none; - color: #cbcbcb; -} - -body.sticky-footer footer { - position: absolute; - bottom: 0; - z-index: 1000; -} - -.form-control { - border-radius: 0; - background-color: #1A1F28; - color: #efefef; - border: 1px solid #1A1F28; -} - -.form-control:focus { - border-color: #00B4FF; - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #00B4FF; - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px #00B4FF; -} - -.col-centered { - float: none; - margin: 0 auto; -} - -.boarder-bottom-blue { - border-bottom: 2px solid #006596; -} - -.white { - color: #FFF; -} - -.blue-bg { - background-color: #3a9ecf !important; -} - -.green-bg { - background-color: #87ad1c !important; -} - -.uppercase { - text-transform: uppercase; -} - -.brand-container { - padding-top: 26px; -} - -@media (min-width: 1200px) { - .pull-right-lg { - float: right !important; - } -} - -.well { - background-color: #2f3e54; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; - border: none; - padding-bottom: 10px; - padding-left: initial; -} - -.data-container { - margin: 3rem 0; - background-image: linear-gradient(to bottom, #1a1f28 0%, #2e3b41 100%); - background-image: url(../images/login-back.svg), linear-gradient(to bottom, #1a1f28 0%, #2e3b41 100%); - background-repeat: no-repeat; - background-position: left bottom; - background-size: contain; - border: 1px solid #000; - border-radius: 10px; - color: '#fff'; -} - -.data-container.error { - border-left: 3px solid #00B4FF; -} - -.data-container form h3 { - margin-top: 10px; -} - -.input-group-addon { - background: #2f3e54; - color: #fff; - border: none; - border-radius: 0 !important; -} - -.input-group-lg > .form-control, -.input-group-lg > .input-group-addon, -.input-group-lg > .input-group-btn > .btn { - border-radius: 0 !important; -} - -@media (min-width: 991px) { - .data-container h3 { - font-size: 1.8em; - } -} - -.font-large { - font-size: 16px; -} - -.wr-input-control { - margin-bottom: 20px; -} - -.wr-login { - padding-top: 50px; - -} - -.wr-login input[type=text], -.wr-login input[type=password] { - border: 1px #d2d2d2 solid; - width: 100%; - padding: 6px 10px; - z-index: 1; - -webkit-appearance: none; - line-height: 30px; - border-radius: 0px; -} - -.btn-primary, -.btn-primary:focus, -.btn-primary:active { - color: #fff; - background-color: #87ad1c; - border: 1px solid #18184c; - transition: all .2s ease-in-out; - border-radius: 0; -} - -.btn-primary:hover { - background-color: #87ad1c; - color: #fff; - border: 1px solid #18184c; -} - -.btn-secondary, -.btn-secondary:focus, -.btn-secondary:active { - color: #fff; - background-color: transparent; - transition: all .2s ease-in-out; - border-radius: 0; - font-size: 17px; - font-weight: 600; -} - -.btn-secondary:hover { - background-color: transparent; - color: #fff; -} - -.wr-btn { - font-weight: normal; - font-size: 13px; - color: #fff; - background: #5d81d2; - padding: 10px 10px; - display: inline-block; - border: none; -} - -button.grey-bg:hover { - background-color: #3A9ECF; -} - -.wr-btn:hover { - text-decoration: none; - color: #ffffff; - background-color: #6b94f1; -} - -button.grey-bg { - background-color: #222222; -} - -button.font-extra-large { - font-size: 20px; -} - -img.idp-image { - padding: 3px 2px; -} - - -.padding-left { - padding-left: 10px; -} - -.padding-right { - padding-right: 10px; -} - -.padding-top { - padding-top: 10px; -} - -.padding-bottom { - padding-bottom: 10px; -} - -.padding { - padding: 10px; - margin-bottom: 0px; -} - -.padding-none { - padding: 0px !important; -} - -.padding-left-double { - padding-left: 20px; -} - -.padding-right-double { - padding-right: 20px; -} - -.padding-top-double { - padding-top: 20px; -} - -.padding-bottom-double { - padding-bottom: 20px; -} - -.padding-double { - padding: 20px; -} - -.margin-left { - margin-left: 10px; -} - -.margin-right { - margin-right: 10px; -} - -.margin-top { - margin-top: 10px; -} - -.margin-bottom { - margin-bottom: 10px; -} - -.margin { - margin: 10px; -} - -.margin-none { - margin: 0px !important; -} - -.margin-left-double { - margin-left: 20px; -} - -.margin-right-double { - margin-right: 20px; -} - -.margin-top-double { - margin-top: 20px; -} - -.margin-bottom-double { - margin-bottom: 20px; -} - -.margin-double { - margin: 20px; -} - -.font-small { - font-size: 12px; -} - -.font-medium { - font-size: 16px; -} - -.font-large { - font-size: 1.3em; -} - -.font-extra-large { - font-size: 20px !important; -} - -.error-alert { - background-color: #FFE7E8; -} - -.form-group.required .control-label:after { - content: " *"; - color: red; -} - -@media (min-width: 991px) { - .login-form-wrapper { - padding-top: 5%; - } -} - -.login-form .scope { - font-size: 1.5em; -} - -a, -a:hover, -a:active, -a:focus, -.data-container a, -.login a { - color: #00b4ff; - text-decoration: none; -} - -.policy-info-message { - margin-bottom: 0; - margin-top: 10px; -} - -.static-page { - padding-right: 40px; - padding-left: 40px; -} - -.table-of-contents ul { - padding-left: 20px; - font-size: 14px; -} - -.table-of-contents h4 { - color: #fff; -} - -.table-of-contents ul a { - color: #b7c0cd; -} - -.table-of-contents ul a:hover { - color: #fff; -} - -.table-of-contents ul li.sub { - margin-left: 25px; -} - -.policies-wrapper section { - margin-bottom: 50px; -} - -.policies-wrapper section h2, -.policies-wrapper section h3 { - color: #fff; -} - -.login-logo { - margin: auto; - width: 20%; -} - -h3.ui.header { - font-weight: 300; - color: #efefef; - font-family: -apple-system, BlinkMacSystemFont, Segoe WPC, Segoe UI, HelveticaNeue-Light, Ubuntu, Droid Sans, sans-serif, font-wso2, 'Helvetica Neue', Arial, Helvetica, sans-serif; -} - -h4.ui.header { - font-weight: 280; - color: #efefef; - font-family: -apple-system, BlinkMacSystemFont, Segoe WPC, Segoe UI, HelveticaNeue-Light, Ubuntu, Droid Sans, sans-serif, font-wso2, 'Helvetica Neue', Arial, Helvetica, sans-serif; -} - -div.ui.body { - color: #efefef; - font-size: 12px; - margin-top: 1em; -} - -h5.ui.body { - color: #efefef; - font-size: 1.2em; -} - -div.ui.form { - margin: auto; - color: #efefef; -} - -.ui.primary.button, .ui.primary.button:hover { - background: #18184c; - color: #ffffff; - font-family: -apple-system, BlinkMacSystemFont, Segoe WPC, Segoe UI, HelveticaNeue-Light, Ubuntu, Droid Sans, sans-serif, font-wso2, 'Helvetica Neue', Arial, Helvetica, sans-serif; - font-size: 17px; - font-weight: 500; -} - -.ui.primary.button:hover { - background: #070749; -} - -div.well.policy-info-message { - margin-bottom: 1em; -} - -select.ui.select { - opacity: 0.8; - background-image: linear-gradient(to right, #2a363d 0%, #25405d 100%); -} - -.well { - background-color: transparent; - padding-left: initial; -} - -div.ui.box { - padding-left: 40px; - padding-right: 40px; - padding-top: 20px; -} - -div.ui.subheading { - font-size: 1.2em; -} - -.h4 { - font-size: 1.7em; -} - -div.ui.form.select { - padding-right: 25px; - padding-left: 25px; -} - -div.ui.body.text { - padding-left: unset; -} - -div.ui.form.row { - padding-left: 25px; - padding-right: 25px; -} - -div.section.heading { - color: #159cfa; - padding-top: inherit; -} - -.privacy-policy-product-title { - background: #fff; - padding-left: 15em; - padding-bottom: 1em; - padding-top: 1em; -} - -.ui.segment.toc { - background: #fff; - box-shadow: 0 1px 2px 0 rgba(34,36,38,.15); - padding-right: 1.5rem; - padding-left: 1.5rem; - border-radius: 3px; - border: 1px solid rgba(34,36,38,.15); -} - -ui.segment.toc.h4 { - color: #000; -} - -li.sub { - list-style: none; -} - -li.sub::before { - content: "\2192"; - margin-left: -1em; -} diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles-ie7.css b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles-ie7.css deleted file mode 100644 index 04f8b280..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles-ie7.css +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -.form-horizontal .controls{ - margin-left:0; -} \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles.css b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles.css deleted file mode 100644 index 1e225726..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/localstyles.css +++ /dev/null @@ -1,282 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -body, p, div, a, span, h1, h2, h3, h4 { - font-family: 'helvetica neue', helvetica, arial, 'lucida grande', sans-serif; -} - -body { - background: #999 url(../images/body-back.png) no-repeat center 10px; -} - -.header-strip { - background: #5e5e5e; - height: 10px; -} - -.header-back { - background: transparent url(../images/repeat.jpg) repeat-x left top; - height: 85px; -} - -.header-text { - background: #000; - color: #cccccc; - font-size: 13px; - text-align: center; -} - -.header-text strong { - color: #fff; - font-size: 14px; -} - -.logo { - background: transparent url(../images/logo.png) no-repeat left top; - width: 424px; - height: 85px; - display: block; - cursor: pointer; -} - -.content-section { - text-align: left; - padding: 10px 0 0 0; -} - -.content-section form.well { - text-align: left; -} - -.btn-primary { - background-color: #316a90; - *background-color: #316a90; - background-image: -ms-linear-gradient(top, #316a90, #4583ac); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#316a90), to(#4583ac)); - background-image: -webkit-linear-gradient(top, #316a90, #4583ac); - background-image: -o-linear-gradient(top, #316a90, #4583ac); - background-image: -moz-linear-gradient(top, #316a90, #4583ac); - background-image: linear-gradient(top, #316a90, #4583ac); - background-repeat: repeat-x; - border-color: #0055cc #0055cc #003580; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:dximagetransform.microsoft.gradient(startColorstr='#316a90', endColorstr='#4583ac', GradientType=0); - filter: progid:dximagetransform.microsoft.gradient(enabled=false); -} - -.login-header { - background: #e86d1f; - color: #fff; - padding: 5px; - - -webkit-border-top-left-radius: 4px; - border-top-left-radius: 4px; - -moz-border-radius-topleft: 4px; - - -webkit-border-top-right-radius: 4px; - border-top-right-radius: 4px; - -moz-border-radius-topright: 4px; - - margin-top: 10px; -} - -.form-horizontal .control-label { - width: 80px; -} - -.form-horizontal .controls { - margin-left: 100px; -} - -.form-horizontal .form-actions { - padding-left: 100px; - padding-bottom: 0; - margin-bottom: 0; -} - -h1 { - margin-top: 20px; - color: #fff; - font-weight: normal; - font-size: 30px; -} - -.different-login-container { - background: #F5F5F5; - padding: 10px; - -webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - -moz-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); -} - -.main-login-container { - background: transparent url(../images/container-back.png) repeat left top; - padding: 20px 10px; - margin-bottom: 20px; - -webkit-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - -moz-box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); - box-shadow: 7px 7px 5px 0px rgba(50, 50, 50, 0.75); -} - -.vertical-slitter { - border-right: solid 1px #fff; -} - -.form-actions { - border-top: none; - background: transparent; -} - -.btn-primary.active { - color: rgba(255, 255, 255, 0.75); -} - -.btn-primary { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background: #45484d; /* Old browsers */ - background: -moz-linear-gradient(top, #45484d 0%, #000000 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #45484d), color-stop(100%, #000000)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #45484d 0%, #000000 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #45484d 0%, #000000 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #45484d 0%, #000000 100%); /* IE10+ */ - background: linear-gradient(to bottom, #45484d 0%, #000000 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#45484d', endColorstr='#000000', GradientType=0); /* IE6-9 */ - padding: 5px 10px; - -} - -.btn-primary:hover, -.btn-primary:focus, -.btn-primary:active, -.btn-primary.active, -.btn-primary.disabled, -.btn-primary[disabled] { - color: #ffffff; - - background: #45484d; /* Old browsers */ - background: -moz-linear-gradient(top, #45484d 0%, #000000 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #45484d), color-stop(100%, #000000)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #45484d 0%, #000000 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #45484d 0%, #000000 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #45484d 0%, #000000 100%); /* IE10+ */ - background: linear-gradient(to bottom, #45484d 0%, #000000 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#45484d', endColorstr='#000000', GradientType=0); /* IE6-9 */ - -} - -.btn-primary:active, -.btn-primary.active { - background-color: #003399 \9; -} - -.btn-primary-deny { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background: #C94135; /* Old browsers */ - background: -moz-linear-gradient(top, #C94135 0%, #4E0505 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #C94135), color-stop(100%, #4E0505)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #C94135 0%, #4E0505 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #C94135 0%, #4E0505 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #C94135 0%, #4E0505 100%); /* IE10+ */ - background: linear-gradient(to bottom, #C94135 0%, #4E0505 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#C94135', endColorstr='#4E0505', GradientType=0); /* IE6-9 */ - padding: 5px 10px; - -} - -.btn-primary-deny:hover, -.btn-primary-deny:focus, -.btn-primary-deny:active, -.btn-primary-deny.active, -.btn-primary-deny.disabled, -.btn-primary-deny[disabled] { - color: #ffffff; - - background: #C94135; /* Old browsers */ - background: -moz-linear-gradient(top, #C94135 0%, #4E0505 100%); /* FF3.6+ */ - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #C94135), color-stop(100%, #4E0505)); /* Chrome,Safari4+ */ - background: -webkit-linear-gradient(top, #C94135 0%, #4E0505 100%); /* Chrome10+,Safari5.1+ */ - background: -o-linear-gradient(top, #C94135 0%, #4E0505 100%); /* Opera 11.10+ */ - background: -ms-linear-gradient(top, #C94135 0%, #4E0505 100%); /* IE10+ */ - background: linear-gradient(to bottom, #C94135 0%, #4E0505 100%); /* W3C */ - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#C94135', endColorstr='#4E0505', GradientType=0); /* IE6-9 */ - -} - -.btn-primary-deny:active, -.btn-primary-deny.active { - background-color: #CA1909 \9; -} - -.marL30 { - margin-left: 30% !important; -} - -.marL32 { - margin-left: 32% !important; -} - -h2 { - color: #ddd; - font-weight: normal; -} - -.different-login-container a.main-link { - display: block; - background: transparent url(../images/icon-default.png) no-repeat left top; - width: 75px; - height: 76px; - float: left; - margin-right: 10px; - padding-left: 74px; -} - -#claimed_id { - background: #fff url(../images/openid-input.gif) no-repeat left 4px; - padding-left: 20px; -} - -.slidePopper { - position: absolute; - margin-top: 70px; - padding: 10px; - background: #fff; - border: solid 1px #ccc; - border-radius: 5px; - z-index: 6; -} - -.slidePopper-cancel { - cursor: pointer; -} - -.overlay { - background: #ccc; - opacity: 0.5; - width: 500px; - height: 500px; - position: absolute; - top: 0; - left: 0; - z-index: 5; -} - -.go-btn { - margin-top: -8px; -} diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/openid-provider.css b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/openid-provider.css deleted file mode 100644 index e5678434..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/css/openid-provider.css +++ /dev/null @@ -1,195 +0,0 @@ -/** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - * - * WSO2 LLC. 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. - */ - -.card-box-top{ - background-image:url(../images/card-box02.jpg); - background-repeat:repeat-x; - background-position:0 0; -} -.card-box-left{ - background-image:url(../images/card-box08.jpg); - background-repeat:repeat-y; - background-position:0 0; - width:15px; -} -.card-box-right{ - background-image:url(../images/card-box04.jpg); - background-repeat:repeat-y; - background-position:0 0; - width:18px; -} -.card-box-bottom{ - background-image:url(../images/card-box06.jpg); - background-repeat:repeat-x; - background-position:0 0; -} -.card-box-mid{ - background-color:#ffffff; -} -.user-pic{ - margin-bottom:10px; -} -.card-box{ - width:400px; -} -.openid-box-top{ - background-image:url(../images/openid-box-back.gif); - background-position:0 0; - background-repeat:no-repeat; - width:812px; - height:123px; -} -.openid-box-05{ - background-image:url(../images/openid-box-05.gif); -} -.openid-box-07{ - background-image:url(../images/openid-box-07.gif); -} - -.openid-box-06{ - background-image:url(../images/openid-box-06.gif); - background-position:0 0; - background-repeat:repeat-x; -} -.openid-box-04{ - background-image:url(../images/openid-box-04.gif); - background-position:0 0; - background-repeat:repeat-y; - width:2px; -} -.openid-box-08{ - background-image:url(../images/openid-box-08.gif); - background-position:0 0; - background-repeat:repeat-y; - width:2px; -} -.openid-box-back{ - background-color:#e3e7ea; - padding-bottom:50px; - padding-left:50px; - font-size:20px; -} -.openid-box-05,.openid-box-07{ - background-position:0 0; - background-repeat:no-repeat; - width:19px; - height:31px; -} -.openid-box{ - width:812px; -} -.openid-box-username{ - color:#569643; -} - -.userClaimsTbl { - margin:0px;padding:0px; - width:100%; - border:1px solid #000000; - - -moz-border-radius-bottomleft:0px; - -webkit-border-bottom-left-radius:0px; - border-bottom-left-radius:0px; - - -moz-border-radius-bottomright:0px; - -webkit-border-bottom-right-radius:0px; - border-bottom-right-radius:0px; - - -moz-border-radius-topright:0px; - -webkit-border-top-right-radius:0px; - border-top-right-radius:0px; - - -moz-border-radius-topleft:0px; - -webkit-border-top-left-radius:0px; - border-top-left-radius:0px; -}.userClaimsTbl table{ - border-collapse: collapse; - border-spacing: 0; - width:100%; - height:100%; - margin:0px;padding:0px; -}.userClaimsTbl tr:last-child td:last-child { - -moz-border-radius-bottomright:0px; - -webkit-border-bottom-right-radius:0px; - border-bottom-right-radius:0px; -} -.userClaimsTbl table tr:first-child td:first-child { - -moz-border-radius-topleft:0px; - -webkit-border-top-left-radius:0px; - border-top-left-radius:0px; -} -.userClaimsTbl table tr:first-child td:last-child { - -moz-border-radius-topright:0px; - -webkit-border-top-right-radius:0px; - border-top-right-radius:0px; -}.userClaimsTbl tr:last-child td:first-child{ - -moz-border-radius-bottomleft:0px; - -webkit-border-bottom-left-radius:0px; - border-bottom-left-radius:0px; -}.userClaimsTbl tr:hover td{ - background-color:#ffffff; - - -} -.userClaimsTbl td{ - vertical-align:middle; - - background-color:#e5e5e5; - - border:1px solid #000000; - border-width:0px 1px 1px 0px; - text-align:left; - padding:7px; - font-size:12px; - font-family:Arial; - font-weight:normal; - color:#000000; -}.userClaimsTbl tr:last-child td{ - border-width:0px 1px 0px 0px; -}.userClaimsTbl tr td:last-child{ - border-width:0px 0px 1px 0px; -}.userClaimsTbl tr:last-child td:last-child{ - border-width:0px 0px 0px 0px; -} -.userClaimsTbl tr:first-child td{ - background:-o-linear-gradient(bottom, #cccccc 5%, #cccccc 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #cccccc) ); - background:-moz-linear-gradient( center top, #cccccc 5%, #cccccc 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#cccccc"); background: -o-linear-gradient(top,#cccccc,cccccc); - - background-color:#cccccc; - border:0px solid #000000; - text-align:center; - border-width:0px 0px 1px 1px; - font-size:14px; - font-family:Arial; - font-weight:bold; - color:#000000; -} -.userClaimsTbl tr:first-child:hover td{ - background:-o-linear-gradient(bottom, #cccccc 5%, #cccccc 100%); background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #cccccc), color-stop(1, #cccccc) ); - background:-moz-linear-gradient( center top, #cccccc 5%, #cccccc 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#cccccc", endColorstr="#cccccc"); background: -o-linear-gradient(top,#cccccc,cccccc); - - background-color:#cccccc; -} -.userClaimsTbl tr:first-child td:first-child{ - border-width:0px 0px 1px 0px; -} -.userClaimsTbl tr:first-child td:last-child{ - border-width:0px 0px 1px 1px; -} \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_consent.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_consent.jsp deleted file mode 100644 index ff38a299..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_consent.jsp +++ /dev/null @@ -1,181 +0,0 @@ -<%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %> - - - -
- - - -
- - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_displayconsent.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_displayconsent.jsp deleted file mode 100644 index 2048c280..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/default_displayconsent.jsp +++ /dev/null @@ -1,143 +0,0 @@ -<%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> -<%@ page import="java.util.List" %> -<%@ page import="java.util.Map" %> -<%@ page import="org.json.JSONArray" %> -<%@ page import="org.json.JSONObject" %> - -<%@ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %> - - -<% - session.setAttribute("configParamsMap", request.getAttribute("data_requested")); - Map> consentData = (Map>) request.getAttribute("data_requested"); -%> -
-
-
-
- diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-exclude.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-exclude.xml deleted file mode 100644 index d7392112..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-exclude.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-include.xml b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-include.xml deleted file mode 100644 index 8932a22e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/findbugs-include.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.svg b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.svg deleted file mode 100644 index 43b5ed22..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.svg +++ /dev/null @@ -1,593 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.ttf b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.ttf deleted file mode 100644 index 1da72769..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.ttf and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.woff b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.woff deleted file mode 100644 index 0c699487..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/fonts/Roboto/Roboto-Bold-webfont.woff and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/generic-exception-response.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/generic-exception-response.jsp deleted file mode 100644 index 5d384318..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/generic-exception-response.jsp +++ /dev/null @@ -1,81 +0,0 @@ -<%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> - - - -<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> -<%@ page import="org.owasp.encoder.Encode" %> -<% - String stat = request.getParameter("status"); - String statusMessage = request.getParameter("statusMsg"); - if (stat == null || statusMessage == null) { - stat = "Authentication Error !"; - statusMessage = "Something went wrong during the authentication process. Please try signing in again."; - } - session.invalidate(); -%> - - - - - - - -
-
-
- -
-
-
- - - - - \ No newline at end of file diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/U2F.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/U2F.png deleted file mode 100644 index c9d8f3a2..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/U2F.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/body-back.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/body-back.png deleted file mode 100644 index f2e7914b..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/body-back.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/container-back.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/container-back.png deleted file mode 100644 index 3c805492..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/container-back.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/favicon.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/favicon.png deleted file mode 100644 index 2ad073a9..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/favicon.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/icon-default.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/icon-default.png deleted file mode 100644 index 70a4834e..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/icon-default.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-back.svg b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-back.svg deleted file mode 100644 index 8c719e2b..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-back.svg +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-icon.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-icon.png deleted file mode 100644 index 6b43c768..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/login-icon.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-dark.svg b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-dark.svg deleted file mode 100644 index 9ea4358f..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-dark.svg +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - image/svg+xml - - OB-Publisher-logo-Dark-background - - - - - - - - OB-Publisher-logo-Dark-background - - - - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-inverse.svg b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-inverse.svg deleted file mode 100644 index 6e7f1d89..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo-inverse.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo.png deleted file mode 100644 index 2de1612c..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/logo.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/openid-input.gif b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/openid-input.gif deleted file mode 100644 index cde836c8..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/openid-input.gif and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/repeat.jpg b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/repeat.jpg deleted file mode 100644 index 891eea01..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/repeat.jpg and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-logo.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-logo.png deleted file mode 100644 index ae180a42..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-logo.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-new.png b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-new.png deleted file mode 100644 index 18d55b28..00000000 Binary files a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/images/wso2-open-banking-new.png and /dev/null differ diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_bottom.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_bottom.jsp deleted file mode 100644 index 8cbea3e7..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_bottom.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> - -<%@ page contentType="text/html;charset=UTF-8" %> - -
- - - - - - - - - diff --git a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_top.jsp b/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_top.jsp deleted file mode 100644 index 15427d5e..00000000 --- a/open-banking-accelerator/accelerators/ob-is/carbon-home/repository/deployment/server/webapps/ob#authenticationendpoint/includes/consent_top.jsp +++ /dev/null @@ -1,52 +0,0 @@ -<%-- - ~ Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). - ~ - ~ WSO2 LLC. 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. - --%> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ page import="org.json.JSONArray" %> -<%@ page import="org.json.JSONObject" %> -<%@ page import="org.owasp.encoder.Encode" %> - -<%@ page import="java.util.List" %> -<%@ page import="java.util.ArrayList" %> -<%@ page import="org.apache.commons.lang.StringUtils" %> -<%@ page import="org.apache.commons.lang.ArrayUtils" %> -<%@ page import="java.util.stream.Stream" %> - -<%@ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %> -<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %> - - - - - - - - - - -
-
-
-