generated from CDCgov/template
-
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.
* query for notification * ignore list * swapping to parent build * update * update * added support for ODSE DB * moved compress and decode and encode to share class * added compressing and encoding for nnd * added ignore * clean up * clean up * clean up * update sonar scan * support for compressed data in poll servie * update POll service * update * update * update * clean up * update adding null query and support for srte
- Loading branch information
Showing
38 changed files
with
694 additions
and
168 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
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
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
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
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
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
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
86 changes: 86 additions & 0 deletions
86
...vice/src/main/java/gov/cdc/nnddataexchangeservice/configuration/SrteDataSourceConfig.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,86 @@ | ||
package gov.cdc.nnddataexchangeservice.configuration; | ||
|
||
import jakarta.persistence.EntityManagerFactory; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.beans.factory.annotation.Value; | ||
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.jdbc.core.JdbcTemplate; | ||
import org.springframework.orm.jpa.JpaTransactionManager; | ||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; | ||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; | ||
import org.springframework.transaction.PlatformTransactionManager; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
import javax.sql.DataSource; | ||
import java.util.HashMap; | ||
|
||
|
||
@Configuration | ||
@EnableTransactionManagement | ||
@EnableJpaRepositories( | ||
entityManagerFactoryRef = "srteEntityManagerFactory", | ||
transactionManagerRef = "srteTransactionManager", | ||
basePackages = { | ||
"gov.cdc.nnddataexchangeservice.repository.srte" | ||
} | ||
) | ||
public class SrteDataSourceConfig { | ||
@Value("${spring.datasource.driverClassName}") | ||
private String driverClassName; | ||
|
||
@Value("${spring.datasource.srte.url}") | ||
private String dbUrl; | ||
|
||
@Value("${spring.datasource.username}") | ||
private String dbUserName; | ||
|
||
@Value("${spring.datasource.password}") | ||
private String dbUserPassword; | ||
|
||
@Bean(name = "srteDataSource") | ||
public DataSource srteDataSource() { | ||
DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); | ||
|
||
dataSourceBuilder.driverClassName(driverClassName); | ||
dataSourceBuilder.url(dbUrl); | ||
dataSourceBuilder.username(dbUserName); | ||
dataSourceBuilder.password(dbUserPassword); | ||
|
||
return dataSourceBuilder.build(); | ||
} | ||
|
||
@Bean(name = "srteEntityManagerFactoryBuilder") | ||
public EntityManagerFactoryBuilder srteEntityManagerFactoryBuilder() { | ||
return new EntityManagerFactoryBuilder(new HibernateJpaVendorAdapter(), new HashMap<>(), null); | ||
} | ||
|
||
@Primary | ||
@Bean(name = "srteEntityManagerFactory") | ||
public LocalContainerEntityManagerFactoryBean srteEntityManagerFactory( | ||
@Qualifier("srteEntityManagerFactoryBuilder") EntityManagerFactoryBuilder builder, | ||
@Qualifier("srteDataSource") DataSource dataSource) { | ||
return builder | ||
.dataSource(dataSource) | ||
.packages("gov.cdc.nnddataexchangeservice.repository.srte.model") | ||
.persistenceUnit("srte") | ||
.build(); | ||
} | ||
|
||
@Primary | ||
@Bean(name = "srteTransactionManager") | ||
public PlatformTransactionManager srteTransactionManager( | ||
@Qualifier("srteEntityManagerFactory") EntityManagerFactory entityManagerFactory) { | ||
return new JpaTransactionManager(entityManagerFactory); | ||
} | ||
|
||
|
||
@Bean(name = "srteJdbcTemplate") | ||
public JdbcTemplate srteJdbcTemplate(@Qualifier("srteDataSource") DataSource dataSource) { | ||
return new JdbcTemplate(dataSource); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...hange-service/src/main/java/gov/cdc/nnddataexchangeservice/constant/DataSyncConstant.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,10 @@ | ||
package gov.cdc.nnddataexchangeservice.constant; | ||
|
||
public class DataSyncConstant { | ||
public static final String DEFAULT_TIME_STAMP = "1753-01-01"; | ||
public static final String TIME_STAMP_PARAM = ":timestamp"; | ||
public static final String LIMIT_PARAM = ":limit"; | ||
public static final Integer BYTE_SIZE = 1024; | ||
public static final String DB_RDB = "RDB"; | ||
public static final String DB_SRTE = "SRTE"; | ||
} |
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
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
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
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
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
4 changes: 4 additions & 0 deletions
4
.../src/main/java/gov/cdc/nnddataexchangeservice/repository/srte/SrteDataSyncRepository.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,4 @@ | ||
package gov.cdc.nnddataexchangeservice.repository.srte; | ||
|
||
public interface SrteDataSyncRepository { | ||
} |
Oops, something went wrong.