PAN-7 Initial setup of the persistence with Spring Data JPA, Hibernate, Tomcat Server, and Spring Boot
This commit is contained in:
@@ -41,7 +41,7 @@ allprojects {
|
|||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
apply plugin: 'org.unbroken-dome.test-sets'
|
apply plugin: 'org.unbroken-dome.test-sets'
|
||||||
apply plugin: 'idea'
|
apply plugin: 'idea'
|
||||||
// apply plugin: 'io.spring.dependency-management'
|
apply plugin: 'io.spring.dependency-management'
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@@ -95,9 +95,9 @@ dependencies {
|
|||||||
compile 'org.codehaus.groovy:groovy-all:2.3.11'
|
compile 'org.codehaus.groovy:groovy-all:2.3.11'
|
||||||
compile 'org.apache.commons:commons-lang3:3.5'
|
compile 'org.apache.commons:commons-lang3:3.5'
|
||||||
// The production code uses the SLF4J logging API at compile time
|
// The production code uses the SLF4J logging API at compile time
|
||||||
compile 'org.slf4j:slf4j-api:1.7.21'
|
compile 'org.slf4j:slf4j-api:1.7.22'
|
||||||
compile "joda-time:joda-time:2.2"
|
compile "joda-time:joda-time:2.2"
|
||||||
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.2.RELEASE'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.5.RELEASE'
|
||||||
|
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
testCompile "org.springframework:spring-test:5.0.9.RELEASE"
|
testCompile "org.springframework:spring-test:5.0.9.RELEASE"
|
||||||
@@ -129,6 +129,6 @@ compileTestKotlin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wrapper {
|
wrapper {
|
||||||
gradleVersion = '4.10.2'
|
gradleVersion = '5.2.1'
|
||||||
distributionType = Wrapper.DistributionType.ALL
|
distributionType = Wrapper.DistributionType.ALL
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,4 @@
|
|||||||
import org.gradle.internal.os.OperatingSystem;
|
import org.gradle.internal.os.OperatingSystem
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
@@ -15,25 +14,26 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '2.1.2.RELEASE'
|
compile group: 'org.springframework.data', name: 'spring-data-jpa', version: '2.0.5.RELEASE'
|
||||||
|
compile group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '9.0.16'
|
||||||
|
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '2.0.5.RELEASE'
|
||||||
// compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.1.2.RELEASE'
|
// compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-elasticsearch', version: '2.1.2.RELEASE'
|
||||||
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.2.RELEASE'
|
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.5.RELEASE'
|
||||||
compile 'javax:javaee-api:7.0'
|
compile group: 'org.springframework', name: 'spring-aspects', version: '5.1.5.RELEASE'
|
||||||
|
compile group: 'org.hibernate', name: 'hibernate-core', version: '5.4.1.Final'
|
||||||
|
|
||||||
compile fileTree(dir: 'lib', include: '**/*.jar')
|
compile fileTree(dir: 'lib', include: '**/*.jar')
|
||||||
|
|
||||||
compile 'com.mchange:c3p0:0.9.5.2'
|
compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'
|
||||||
compile 'mysql:mysql-connector-java:5.1.35'
|
// compile 'javax.validation:validation-api:1.1.0.Final'
|
||||||
compile 'javax.validation:validation-api:1.1.0.Final'
|
|
||||||
compile('com.googlecode.log4jdbc:log4jdbc:1.2') {
|
compile('com.googlecode.log4jdbc:log4jdbc:1.2') {
|
||||||
exclude(group: 'org.slf4j')
|
exclude(group: 'org.slf4j')
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimeOnly 'mysql:mysql-connector-java'
|
|
||||||
|
|
||||||
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.1.2.RELEASE'
|
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.1.2.RELEASE'
|
||||||
testCompile group: 'junit', name: 'junit', version: '4.12'
|
testCompile group: 'junit', name: 'junit', version: '4.12'
|
||||||
testCompile 'javax.el:javax.el-api:3.0.0'
|
testCompile 'javax.el:javax.el-api:3.0.0'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task loadDb(type: Exec, group: 'Verification', description: 'Reloads the local database.') {
|
task loadDb(type: Exec, group: 'Verification', description: 'Reloads the local database.') {
|
||||||
|
|||||||
+70
-33
@@ -1,70 +1,107 @@
|
|||||||
package edu.msudenver.tsp.persistence;
|
package edu.msudenver.tsp.persistence;
|
||||||
|
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.jpa.HibernatePersistenceProvider;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||||
|
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
import org.springframework.jdbc.datasource.init.DataSourceInitializer;
|
||||||
|
import org.springframework.orm.hibernate5.HibernateTransactionManager;
|
||||||
|
import org.springframework.orm.hibernate5.LocalSessionFactoryBuilder;
|
||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.JpaVendorAdapter;
|
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.sql.DataSource;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableJpaRepositories
|
@EnableJpaRepositories
|
||||||
|
@EnableJpaAuditing
|
||||||
|
@EntityScan
|
||||||
public class PersistenceApi {
|
public class PersistenceApi {
|
||||||
|
|
||||||
|
@Value("${spring.datasource.username}") private String username;
|
||||||
|
@Value("${spring.datasource.password}") private String password;
|
||||||
|
@Value("${spring.jpa.hibernate.ddl-auto}") private String hibernateTablePolicy;
|
||||||
|
@Value("${spring.datasource.url}") private String databaseUrl;
|
||||||
|
@Value("${spring.jpa.properties.hibernate.dialect}") private String hibernateDialect;
|
||||||
|
@Value("${spring.jpa.show-sql}") private String showSql;
|
||||||
|
@Value("${spring.datasource.driver-class-name}") private String driverClassName;
|
||||||
|
@Value("${spring.datasource.tomcat.max-active}") private String tomcatPoolMaxActive;
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
SpringApplication.run(PersistenceApi.class, args);
|
SpringApplication.run(PersistenceApi.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@Primary
|
||||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||||
final LocalContainerEntityManagerFactoryBean em
|
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
||||||
= new LocalContainerEntityManagerFactoryBean();
|
em.setJpaVendorAdapter(vendorAdapter());
|
||||||
em.setDataSource(dataSource());
|
em.setDataSource(getDataSource());
|
||||||
em.setPackagesToScan(new String[] { "edu.msudenver.tsp.persistence" });
|
em.setPersistenceProviderClass(HibernatePersistenceProvider.class);
|
||||||
|
em.setPackagesToScan("edu.msudenver.tsp.persistence");
|
||||||
final JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
|
||||||
em.setJpaVendorAdapter(vendorAdapter);
|
|
||||||
em.setJpaProperties(additionalProperties());
|
em.setJpaProperties(additionalProperties());
|
||||||
|
|
||||||
return em;
|
return em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public DriverManagerDataSource dataSource(){
|
public JpaTransactionManager jpaTransactionManager() {
|
||||||
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
final JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
|
||||||
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
jpaTransactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
|
||||||
dataSource.setUrl("jdbc:mysql://localhost:3306/pandamonium");
|
return jpaTransactionManager;
|
||||||
dataSource.setUsername( "panda" );
|
}
|
||||||
dataSource.setPassword( "secret" );
|
|
||||||
return dataSource;
|
private HibernateJpaVendorAdapter vendorAdapter() {
|
||||||
|
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
||||||
|
vendorAdapter.setShowSql(true);
|
||||||
|
return vendorAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "dataSource")
|
||||||
|
public DataSource getDataSource(){
|
||||||
|
return DataSourceBuilder
|
||||||
|
.create()
|
||||||
|
.username(username)
|
||||||
|
.password(password)
|
||||||
|
.url(databaseUrl)
|
||||||
|
.driverClassName(driverClassName)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "sessionFactory")
|
||||||
|
public SessionFactory getSessionFactory(final DataSource dataSource) {
|
||||||
|
final LocalSessionFactoryBuilder sessionFactoryBuilder = new LocalSessionFactoryBuilder(dataSource);
|
||||||
|
sessionFactoryBuilder.scanPackages("edu.msudenver.tsp.persistence.entity");
|
||||||
|
return sessionFactoryBuilder.buildSessionFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean(name = "transactionManager")
|
||||||
|
public HibernateTransactionManager getTransactionManager(final SessionFactory sessionFactory) {
|
||||||
|
return new HibernateTransactionManager(sessionFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PlatformTransactionManager transactionManager(
|
public DataSourceInitializer dataSourceInitializer(final DataSource dataSource) {
|
||||||
final EntityManagerFactory emf){
|
final DataSourceInitializer initializer = new DataSourceInitializer();
|
||||||
final JpaTransactionManager transactionManager = new JpaTransactionManager();
|
initializer.setDataSource(dataSource);
|
||||||
transactionManager.setEntityManagerFactory(emf);
|
return initializer;
|
||||||
|
|
||||||
return transactionManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public PersistenceExceptionTranslationPostProcessor exceptionTranslation(){
|
|
||||||
return new PersistenceExceptionTranslationPostProcessor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties additionalProperties() {
|
Properties additionalProperties() {
|
||||||
final Properties properties = new Properties();
|
final Properties properties = new Properties();
|
||||||
properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
|
properties.setProperty("hibernate.ddl-auto", hibernateTablePolicy);
|
||||||
properties.setProperty(
|
properties.setProperty("hibernate.dialect", hibernateDialect);
|
||||||
"hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
|
properties.setProperty("spring.jpa.show-sql", showSql);
|
||||||
|
properties.setProperty("spring.datasource.tomcat.max-active", tomcatPoolMaxActive);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1,21 +1,21 @@
|
|||||||
package edu.msudenver.tsp.persistence.manager;
|
package edu.msudenver.tsp.persistence.controller;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.entity.DefinitionEntity;
|
import edu.msudenver.tsp.persistence.dto.DefinitionDto;
|
||||||
import edu.msudenver.tsp.persistence.repository.DefinitionRepository;
|
import edu.msudenver.tsp.persistence.repository.DefinitionRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping(path = "/definitions/")
|
@RequestMapping(path = "/definitions/")
|
||||||
public class DefinitionManager {
|
public class DefinitionController {
|
||||||
private final DefinitionRepository definitionRepository;
|
private final DefinitionRepository definitionRepository;
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public @ResponseBody Iterable<DefinitionEntity> getAllDefinitions() {
|
public @ResponseBody Iterable<DefinitionDto> getAllDefinitions() {
|
||||||
return definitionRepository.findAll();
|
return definitionRepository.findAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package edu.msudenver.tsp.persistence.manager;
|
package edu.msudenver.tsp.persistence.controller;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.repository.NotationRepository;
|
import edu.msudenver.tsp.persistence.repository.NotationRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -6,6 +6,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class NotationManager {
|
public class NotationController {
|
||||||
final private NotationRepository notationRepository;
|
final private NotationRepository notationRepository;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package edu.msudenver.tsp.persistence.manager;
|
package edu.msudenver.tsp.persistence.controller;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.repository.ProofRepository;
|
import edu.msudenver.tsp.persistence.repository.ProofRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -6,6 +6,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ProofManager {
|
public class ProofController {
|
||||||
final private ProofRepository proofRepository;
|
final private ProofRepository proofRepository;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package edu.msudenver.tsp.persistence.manager;
|
package edu.msudenver.tsp.persistence.controller;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.repository.TheoremRepository;
|
import edu.msudenver.tsp.persistence.repository.TheoremRepository;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -6,6 +6,6 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class TheoremManager {
|
public class TheoremController {
|
||||||
final private TheoremRepository theoremRepository;
|
final private TheoremRepository theoremRepository;
|
||||||
}
|
}
|
||||||
+4
-6
@@ -1,20 +1,18 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.*;
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Version;
|
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
public class BaseEntity {
|
@MappedSuperclass
|
||||||
|
public class BaseDto {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
Integer id;
|
Integer id;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity(name = "definitions")
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class DefinitionDto extends BaseDto implements Serializable {
|
||||||
|
@Size(min = 1, max = 200, message = "Must be between 1 and 200 characters") String name;
|
||||||
|
Definition definition;
|
||||||
|
Notation notation;
|
||||||
|
|
||||||
|
public static final long serialVersionUID = -5314619286352932857L;
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
|
public class NotationDto extends BaseDto {
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
|
public class ProofDto extends BaseDto {
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package edu.msudenver.tsp.persistence.dto;
|
||||||
|
|
||||||
|
public class TheoremDto extends BaseDto {
|
||||||
|
}
|
||||||
-14
@@ -1,14 +0,0 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
|
|
||||||
@Entity(name = "definitions")
|
|
||||||
@Data
|
|
||||||
public class DefinitionEntity extends BaseEntity {
|
|
||||||
@Size(min = 1, max = 200, message = "Must be between 1 and 200 characters") String name;
|
|
||||||
Definition definition;
|
|
||||||
Notation notation;
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
|
||||||
|
|
||||||
public class NotationEntity extends BaseEntity {
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
|
||||||
|
|
||||||
public class ProofEntity extends BaseEntity {
|
|
||||||
}
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
package edu.msudenver.tsp.persistence.entity;
|
|
||||||
|
|
||||||
public class TheoremEntity extends BaseEntity {
|
|
||||||
}
|
|
||||||
+8
-8
@@ -1,18 +1,18 @@
|
|||||||
package edu.msudenver.tsp.persistence.repository;
|
package edu.msudenver.tsp.persistence.repository;
|
||||||
|
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.entity.Definition;
|
import edu.msudenver.tsp.persistence.dto.Definition;
|
||||||
import edu.msudenver.tsp.persistence.entity.DefinitionEntity;
|
import edu.msudenver.tsp.persistence.dto.DefinitionDto;
|
||||||
import edu.msudenver.tsp.persistence.entity.Notation;
|
import edu.msudenver.tsp.persistence.dto.Notation;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface DefinitionRepository extends CrudRepository<DefinitionEntity, Integer> {
|
public interface DefinitionRepository extends JpaRepository<DefinitionDto, Integer> {
|
||||||
|
|
||||||
DefinitionEntity findByName(final String name);
|
DefinitionDto findByName(final String name);
|
||||||
|
|
||||||
DefinitionEntity findByDefinition(final Definition definition);
|
DefinitionDto findByDefinition(final Definition definition);
|
||||||
|
|
||||||
DefinitionEntity findByNotation(final Notation notation);
|
DefinitionDto findByNotation(final Notation notation);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package edu.msudenver.tsp.persistence.repository;
|
package edu.msudenver.tsp.persistence.repository;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.entity.BaseEntity;
|
import edu.msudenver.tsp.persistence.dto.BaseDto;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
public interface NotationRepository extends CrudRepository<BaseEntity, Long> {
|
public interface NotationRepository extends CrudRepository<BaseDto, Long> {
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package edu.msudenver.tsp.persistence.repository;
|
package edu.msudenver.tsp.persistence.repository;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.entity.BaseEntity;
|
import edu.msudenver.tsp.persistence.dto.BaseDto;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
public interface ProofRepository extends CrudRepository<BaseEntity, Long> {
|
public interface ProofRepository extends CrudRepository<BaseDto, Long> {
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package edu.msudenver.tsp.persistence.repository;
|
package edu.msudenver.tsp.persistence.repository;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.entity.BaseEntity;
|
import edu.msudenver.tsp.persistence.dto.BaseDto;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
public interface TheoremRepository extends CrudRepository<BaseEntity, Long> {
|
public interface TheoremRepository extends CrudRepository<BaseDto, Long> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
spring.jpa.hibernate.ddl-auto=create
|
spring.jpa.hibernate.ddl-auto = none
|
||||||
spring.datasource.url=jdbc:mysql://localhost:3306/pandamonium
|
spring.jpa.database=mysql
|
||||||
|
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/pandamonium?autoReconnect=true&useSSL=false
|
||||||
spring.datasource.username=panda
|
spring.datasource.username=panda
|
||||||
spring.datasource.password=secret
|
spring.datasource.password=secret
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect
|
||||||
|
spring.jpa.show-sql = true
|
||||||
|
spring.datasource.tomcat.test-while-idle=true
|
||||||
|
spring.datasource.tomcat.validation-query=SELECT 1
|
||||||
|
logging.level.org.springframework.web=DEBUG
|
||||||
|
spring.datasource.tomcat.max-active=1
|
||||||
+14
-14
@@ -1,26 +1,26 @@
|
|||||||
package edu.msudenver.tsp.services.parser;
|
package edu.msudenver.tsp.services.parser;
|
||||||
|
|
||||||
import edu.msudenver.tsp.persistence.manager.DefinitionManager;
|
import edu.msudenver.tsp.persistence.controller.DefinitionController;
|
||||||
import edu.msudenver.tsp.persistence.manager.NotationManager;
|
import edu.msudenver.tsp.persistence.controller.NotationController;
|
||||||
import edu.msudenver.tsp.persistence.manager.ProofManager;
|
import edu.msudenver.tsp.persistence.controller.ProofController;
|
||||||
import edu.msudenver.tsp.persistence.manager.TheoremManager;
|
import edu.msudenver.tsp.persistence.controller.TheoremController;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class ParserService {
|
class ParserService {
|
||||||
private final DefinitionManager definitionManager;
|
private final DefinitionController definitionController;
|
||||||
private final TheoremManager theoremManager;
|
private final TheoremController theoremController;
|
||||||
private final NotationManager notationManager;
|
private final NotationController notationController;
|
||||||
private final ProofManager proofManager;
|
private final ProofController proofController;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ParserService(final DefinitionManager definitionManager, final TheoremManager theoremManager,
|
public ParserService(final DefinitionController definitionController, final TheoremController theoremController,
|
||||||
final NotationManager notationManager, final ProofManager proofManager) {
|
final NotationController notationController, final ProofController proofController) {
|
||||||
this.definitionManager = definitionManager;
|
this.definitionController = definitionController;
|
||||||
this.theoremManager = theoremManager;
|
this.theoremController = theoremController;
|
||||||
this.notationManager = notationManager;
|
this.notationController = notationController;
|
||||||
this.proofManager = proofManager;
|
this.proofController = proofController;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user