generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/favouriteOpening
- Loading branch information
Showing
32 changed files
with
485 additions
and
873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
...src/main/java/ca/bc/gov/restapi/results/common/configuration/DataSourceConfiguration.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
.../src/main/java/ca/bc/gov/restapi/results/common/configuration/OracleJpaConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package ca.bc.gov.restapi.results.common.configuration; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import jakarta.persistence.EntityManagerFactory; | ||
import java.util.Map; | ||
import javax.sql.DataSource; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
import org.springframework.orm.jpa.JpaTransactionManager; | ||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | ||
import org.springframework.transaction.PlatformTransactionManager; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
/** | ||
* This class holds JPA configurations for the Oracle database. | ||
*/ | ||
@Configuration | ||
@EnableJpaRepositories( | ||
basePackages = {"ca.bc.gov.restapi.results.oracle"}, | ||
entityManagerFactoryRef = "oracleEntityManagerFactory", | ||
transactionManagerRef = "oracleTransactionManager" | ||
) | ||
@EnableTransactionManagement | ||
public class OracleJpaConfiguration { | ||
|
||
@Bean(name = "oracleEntityManagerFactory") | ||
public LocalContainerEntityManagerFactoryBean oracleEntityManagerFactory( | ||
@Qualifier("oracleDataSource") HikariDataSource dataSource, | ||
EntityManagerFactoryBuilder builder | ||
) { | ||
return builder | ||
.dataSource(dataSource) | ||
.properties(Map.of( | ||
"hibernate.dialect", "org.hibernate.dialect.OracleDialect", | ||
"hibernate.boot.allow_jdbc_metadata_access","false", | ||
"hibernate.hikari.connection.provider_class", | ||
"org.hibernate.hikaricp.internal.HikariCPConnectionProvider", | ||
"hibernate.connection.datasource", dataSource | ||
)) | ||
.packages("ca.bc.gov.restapi.results.oracle") | ||
.persistenceUnit("oracle") | ||
.build(); | ||
} | ||
|
||
@Bean(name = "oracleDataSource") | ||
@ConfigurationProperties(prefix = "spring.oracle.hikari") | ||
public HikariDataSource oracleDataSource() { | ||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); | ||
} | ||
|
||
@Bean(name = "oracleTransactionManager") | ||
public PlatformTransactionManager oracleTransactionManager( | ||
@Qualifier("oracleEntityManagerFactory") final EntityManagerFactory entityManagerFactory | ||
) { | ||
return new JpaTransactionManager(entityManagerFactory); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...rc/main/java/ca/bc/gov/restapi/results/common/configuration/PostgresJpaConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package ca.bc.gov.restapi.results.common.configuration; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import jakarta.persistence.EntityManagerFactory; | ||
import java.util.Map; | ||
import javax.sql.DataSource; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Primary; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
import org.springframework.orm.jpa.JpaTransactionManager; | ||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | ||
import org.springframework.transaction.PlatformTransactionManager; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
/** | ||
* This class holds JPA configurations for the Postgres database. | ||
*/ | ||
@Configuration | ||
@EnableTransactionManagement | ||
@EnableJpaRepositories( | ||
basePackages = {"ca.bc.gov.restapi.results.postgres"}, | ||
entityManagerFactoryRef = "postgresEntityManagerFactory", | ||
transactionManagerRef = "postgresTransactionManager") | ||
public class PostgresJpaConfiguration { | ||
|
||
@Primary | ||
@Bean(name = "postgresEntityManagerFactory") | ||
public LocalContainerEntityManagerFactoryBean postgresEntityManagerFactory( | ||
@Qualifier("postgresHikariDataSource") HikariDataSource dataSource, | ||
EntityManagerFactoryBuilder builder | ||
) { | ||
return builder | ||
.dataSource(dataSource) | ||
.properties(Map.of( | ||
"hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect", | ||
"hibernate.boot.allow_jdbc_metadata_access", "false", | ||
"hibernate.hikari.connection.provider_class", | ||
"org.hibernate.hikaricp.internal.HikariCPConnectionProvider", | ||
"hibernate.connection.datasource", dataSource | ||
)) | ||
.packages("ca.bc.gov.restapi.results.postgres") | ||
.persistenceUnit("postgres") | ||
.build(); | ||
} | ||
|
||
@Bean(name = "postgresHikariDataSource") | ||
@ConfigurationProperties(prefix = "spring.datasource.hikari") | ||
@Primary | ||
public HikariDataSource postgresHikariDataSource() { | ||
return DataSourceBuilder.create().type(HikariDataSource.class).build(); | ||
} | ||
|
||
@Bean(name = "postgresTransactionManager") | ||
@Primary | ||
public PlatformTransactionManager postgresTransactionManager( | ||
@Qualifier("postgresEntityManagerFactory") final EntityManagerFactory entityManagerFactory | ||
) { | ||
return new JpaTransactionManager(entityManagerFactory); | ||
} | ||
|
||
} |
17 changes: 0 additions & 17 deletions
17
.../src/main/java/ca/bc/gov/restapi/results/common/configuration/ProvidersConfiguration.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
backend/src/main/java/ca/bc/gov/restapi/results/common/configuration/SilvaConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package ca.bc.gov.restapi.results.common.configuration; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.With; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.NestedConfigurationProperty; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* This class contains configurations for all external APIs like address and keys. | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@With | ||
@Builder | ||
@Configuration | ||
@Component | ||
@ConfigurationProperties("ca.bc.gov.nrs") | ||
public class SilvaConfiguration { | ||
|
||
private List<String> dashboardJobUsers; | ||
private List<String> wmsWhitelist; | ||
private List<String> orgUnits; | ||
|
||
@NestedConfigurationProperty | ||
private ExternalApiAddress forestClientApi; | ||
@NestedConfigurationProperty | ||
private ExternalApiAddress openMaps; | ||
|
||
@Data | ||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ExternalApiAddress { | ||
|
||
private String address; | ||
private String key; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 0 additions & 25 deletions
25
...c/main/java/ca/bc/gov/restapi/results/oracle/configuration/OracleHikariConfiguration.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.