mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
Add db creation.
This commit is contained in:
parent
fa06852806
commit
e1b517f657
@ -1 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS ACCESS_AUDITORY;
DROP TABLE IF EXISTS COLLABORATION;
DROP TABLE IF EXISTS COLLABORATION_PROPERTIES;
DROP TABLE IF EXISTS MINDMAP_HISTORY;
DROP TABLE IF EXISTS R_LABEL_MINDMAP;
DROP TABLE IF EXISTS LABEL;
DROP TABLE IF EXISTS MINDMAP;
DROP TABLE IF EXISTS USER;
DROP TABLE IF EXISTS COLLABORATOR;
COMMIT;
|
|
5
wise-webapp/db/wisemapping.properties
Normal file
5
wise-webapp/db/wisemapping.properties
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#HSQL Database Engine 2.7.1
|
||||||
|
#Mon Nov 27 22:17:59 PST 2023
|
||||||
|
modified=yes
|
||||||
|
tx_timestamp=270
|
||||||
|
version=2.7.1
|
46
wise-webapp/db/wisemapping.script
Normal file
46
wise-webapp/db/wisemapping.script
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
SET DATABASE UNIQUE NAME HSQLDB8C147822D0
|
||||||
|
SET DATABASE DEFAULT RESULT MEMORY ROWS 0
|
||||||
|
SET DATABASE EVENT LOG LEVEL 0
|
||||||
|
SET DATABASE TRANSACTION CONTROL LOCKS
|
||||||
|
SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED
|
||||||
|
SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE
|
||||||
|
SET DATABASE TEXT TABLE DEFAULTS ''
|
||||||
|
SET DATABASE SQL NAMES FALSE
|
||||||
|
SET DATABASE SQL RESTRICT EXEC FALSE
|
||||||
|
SET DATABASE SQL REFERENCES FALSE
|
||||||
|
SET DATABASE SQL SIZE TRUE
|
||||||
|
SET DATABASE SQL TYPES FALSE
|
||||||
|
SET DATABASE SQL TDC DELETE TRUE
|
||||||
|
SET DATABASE SQL TDC UPDATE TRUE
|
||||||
|
SET DATABASE SQL SYS INDEX NAMES TRUE
|
||||||
|
SET DATABASE SQL CONCAT NULLS TRUE
|
||||||
|
SET DATABASE SQL UNIQUE NULLS TRUE
|
||||||
|
SET DATABASE SQL CONVERT TRUNCATE TRUE
|
||||||
|
SET DATABASE SQL AVG SCALE 0
|
||||||
|
SET DATABASE SQL DOUBLE NAN TRUE
|
||||||
|
SET FILES WRITE DELAY 500 MILLIS
|
||||||
|
SET FILES BACKUP INCREMENT TRUE
|
||||||
|
SET FILES CACHE SIZE 10000
|
||||||
|
SET FILES CACHE ROWS 50000
|
||||||
|
SET FILES SCALE 32
|
||||||
|
SET FILES LOB SCALE 32
|
||||||
|
SET FILES DEFRAG 0
|
||||||
|
SET FILES NIO TRUE
|
||||||
|
SET FILES NIO SIZE 256
|
||||||
|
SET FILES LOG TRUE
|
||||||
|
SET FILES LOG SIZE 50
|
||||||
|
SET FILES CHECK 270
|
||||||
|
SET DATABASE COLLATION "SQL_TEXT" PAD SPACE
|
||||||
|
CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e'
|
||||||
|
ALTER USER SA SET LOCAL TRUE
|
||||||
|
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
|
||||||
|
ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1
|
||||||
|
SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC
|
||||||
|
GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC
|
||||||
|
GRANT DBA TO SA
|
||||||
|
SET SCHEMA SYSTEM_LOBS
|
||||||
|
INSERT INTO BLOCKS VALUES(0,2147483647,0)
|
@ -146,7 +146,6 @@
|
|||||||
<version>2.7.1</version>
|
<version>2.7.1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
@ -198,101 +197,6 @@
|
|||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>hsqldb</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>true</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>sql-maven-plugin</artifactId>
|
|
||||||
<version>1.5</version>
|
|
||||||
|
|
||||||
<configuration>
|
|
||||||
<driver>org.hsqldb.jdbc.JDBCDriver</driver>
|
|
||||||
<url>jdbc:hsqldb:file:${project.build.directory}/db/wisemapping</url>
|
|
||||||
<username>sa</username>
|
|
||||||
</configuration>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hsqldb</groupId>
|
|
||||||
<artifactId>hsqldb</artifactId>
|
|
||||||
<version>2.7.2</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>drop-schemas</id>
|
|
||||||
<phase>prepare-package</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>execute</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<onError>continue</onError>
|
|
||||||
<orderFile>descending</orderFile>
|
|
||||||
<fileset>
|
|
||||||
<basedir>${project.basedir}</basedir>
|
|
||||||
<includes>
|
|
||||||
<include>config/database/hsql/drop-schemas.sql</include>
|
|
||||||
<include>config/database/hsql/create-schemas.sql</include>
|
|
||||||
<include>config/database/hsql/apopulate-schemas.sql</include>
|
|
||||||
</includes>
|
|
||||||
</fileset>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
<profile>
|
|
||||||
<id>mysqldb</id>
|
|
||||||
<activation>
|
|
||||||
<activeByDefault>false</activeByDefault>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
|
||||||
<artifactId>sql-maven-plugin</artifactId>
|
|
||||||
<version>1.5</version>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>8.0.31</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>init-schema</id>
|
|
||||||
<goals>
|
|
||||||
<goal>execute</goal>
|
|
||||||
</goals>
|
|
||||||
<phase>prepare-package</phase>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<driver>com.mysql.jdbc.Driver</driver>
|
|
||||||
<username>root</username>
|
|
||||||
<password/>
|
|
||||||
<url>jdbc:mysql://127.0.0.1:3306/?useUnicode=true&characterEncoding=UTF-8</url>
|
|
||||||
<autocommit>false</autocommit>
|
|
||||||
<srcFiles>
|
|
||||||
<srcFile>config/database/mysql/create-database.sql</srcFile>
|
|
||||||
<srcFile>config/database/mysql/create-schemas.sql</srcFile>
|
|
||||||
<srcFile>config/database/mysql/apopulate-schemas.sql</srcFile>
|
|
||||||
</srcFiles>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -14,15 +14,15 @@ import org.springframework.security.web.firewall.StrictHttpFirewall;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ImportResource(value = {"classpath:spring/wisemapping-service.xml"})
|
@ImportResource(value = {"classpath:spring/wisemapping-service.xml"})
|
||||||
@ComponentScan({"com.wisemapping.security", "com.wisemapping.service", "com.wisemapping.dao", "com.wisemapping.util"})
|
@ComponentScan({"com.wisemapping.security", "com.wisemapping.service", "com.wisemapping.dao", "com.wisemapping.util", "com.wisemapping.model"})
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
new SpringApplicationBuilder()
|
new SpringApplicationBuilder()
|
||||||
.parent(Application.class, HibernateConfig.class, MethodSecurityConfig.class).web(WebApplicationType.NONE)
|
.parent(Application.class, MethodSecurityConfig.class).web(WebApplicationType.NONE)
|
||||||
.child(MvcAppConfig.class, MvcSecurityConfig.class, ServletConfig.class).web(WebApplicationType.SERVLET)
|
.child(MvcAppConfig.class, MvcSecurityConfig.class, HibernateConfig.class, ServletConfig.class).web(WebApplicationType.SERVLET)
|
||||||
.sibling(RestAppConfig.class).web(WebApplicationType.SERVLET)
|
// .sibling(RestAppConfig.class).web(WebApplicationType.SERVLET)
|
||||||
.run(args);
|
.run(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,37 +8,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableJpaRepositories("com.wisemapping.model")
|
@EnableJpaRepositories("com.wisemapping.model")
|
||||||
public class HibernateConfig {
|
public class HibernateConfig {
|
||||||
// @Value("${database.hibernate.dialect}")
|
|
||||||
// private String dbDialect;
|
|
||||||
//
|
|
||||||
// @Value("${database.driver}")
|
|
||||||
// private String dbDriver;
|
|
||||||
//
|
|
||||||
// @Value("${database.url}")
|
|
||||||
// private String dbUrl;
|
|
||||||
//
|
|
||||||
// @Value("${database.username}")
|
|
||||||
// private String dbUsername;
|
|
||||||
// @Value("${database.password}")
|
|
||||||
// private String dbPassword;
|
|
||||||
//
|
|
||||||
// @Value("${database.validation.enabled:true}")
|
|
||||||
// private boolean dbSetOnBorrow;
|
|
||||||
//
|
|
||||||
// @Value("${database.validation.query:SELECT 1}")
|
|
||||||
// private String dbValQuery;
|
|
||||||
|
|
||||||
// @Bean
|
|
||||||
// public LocalSessionFactoryBean sessionFactory() {
|
|
||||||
// final LocalSessionFactoryBean result = new LocalSessionFactoryBean();
|
|
||||||
// result.setPackagesToScan("com.wisemapping.model");
|
|
||||||
// result.setDataSource(dataSource());
|
|
||||||
// result.setHibernateProperties(hibernateProperties());
|
|
||||||
//
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @Bean
|
// @Bean
|
||||||
// public HibernateTransactionManager hibernateTransactionManager() {
|
// public HibernateTransactionManager hibernateTransactionManager() {
|
||||||
// final HibernateTransactionManager result = new HibernateTransactionManager();
|
// final HibernateTransactionManager result = new HibernateTransactionManager();
|
||||||
|
@ -25,6 +25,7 @@ import org.hibernate.SessionFactory;
|
|||||||
import org.hibernate.query.SelectionQuery;
|
import org.hibernate.query.SelectionQuery;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -32,7 +33,7 @@ import java.util.List;
|
|||||||
@Repository("labelManager")
|
@Repository("labelManager")
|
||||||
public class LabelManagerImpl
|
public class LabelManagerImpl
|
||||||
implements LabelManager {
|
implements LabelManager {
|
||||||
@Resource
|
@Autowired
|
||||||
private SessionFactory sessionFactory;
|
private SessionFactory sessionFactory;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,6 +22,7 @@ import com.wisemapping.model.*;
|
|||||||
import com.wisemapping.security.DefaultPasswordEncoderFactories;
|
import com.wisemapping.security.DefaultPasswordEncoderFactories;
|
||||||
import com.wisemapping.security.LegacyPasswordEncoder;
|
import com.wisemapping.security.LegacyPasswordEncoder;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.persistence.EntityManagerFactory;
|
||||||
import org.hibernate.ObjectNotFoundException;
|
import org.hibernate.ObjectNotFoundException;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
@ -39,8 +40,8 @@ import java.util.concurrent.CopyOnWriteArraySet;
|
|||||||
@Repository
|
@Repository
|
||||||
public class UserManagerImpl
|
public class UserManagerImpl
|
||||||
implements UserManager {
|
implements UserManager {
|
||||||
// @Autowired
|
@Autowired
|
||||||
private SessionFactory sessionFactory;
|
private EntityManagerFactory entityManagerFactory;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PasswordEncoder passwordEncoder;
|
private PasswordEncoder passwordEncoder;
|
||||||
@ -54,7 +55,7 @@ public class UserManagerImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Session getSession() {
|
private Session getSession() {
|
||||||
return sessionFactory.getCurrentSession();
|
return entityManagerFactory.unwrap(SessionFactory.class).getCurrentSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,37 +1,17 @@
|
|||||||
##################################################################################
|
##################################################################################
|
||||||
# Database Configuration
|
Springboot Common
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
|
||||||
# MySQL 5.X configuration properties
|
spring.datasource.initialize=true
|
||||||
#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
|
spring.jpa.open-in-view=true
|
||||||
#database.driver=com.mysql.cj.jdbc.Driver
|
#spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
||||||
#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
|
spring.sql.init.mode=always
|
||||||
#database.username=wisemapping
|
spring.main.allow-circular-references=true
|
||||||
#database.password=password
|
|
||||||
#database.validation.enabled=true
|
|
||||||
#database.validation.query=SELECT 1
|
|
||||||
|
|
||||||
## PostgreSQL configuration properties
|
spring.jpa.properties.hibernate.current_session_context_class=thread
|
||||||
#database.url=jdbc:postgresql://<hostname:port>/wisemapping
|
spring.jpa.properties.hibernate.format_sql=true
|
||||||
#database.driver=org.postgresql.Driver
|
|
||||||
#database.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
|
||||||
#database.username=wisemapping
|
|
||||||
#database.password=password
|
|
||||||
#database.validation.enabled=true
|
|
||||||
#database.validation.query=
|
|
||||||
#database.validation.enabled=false
|
|
||||||
|
|
||||||
|
logging.level.root=TRACE
|
||||||
##database.base.url=/Users/veigap/repos/wisemapping-open-source/wise-webapp
|
|
||||||
### HSQL Configuration properties
|
|
||||||
##database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
|
|
||||||
##database.driver=org.hsqldb.jdbc.JDBCDriver
|
|
||||||
##database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
|
||||||
#
|
|
||||||
#database.username=sa
|
|
||||||
#database.password=
|
|
||||||
#database.validation.enabled=false
|
|
||||||
#database.validation.query=
|
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# Mail configuration. Must be configured to enable user registration confirmation.
|
# Mail configuration. Must be configured to enable user registration confirmation.
|
||||||
@ -155,8 +135,6 @@ security.oauth2.google.userinfoUrl=https://www.googleapis.com/oauth2/v3/userinfo
|
|||||||
security.oauth2.google.url=https//review
|
security.oauth2.google.url=https//review
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
# User Account filtering policies
|
# User Account filtering policies
|
||||||
#######################################################################################
|
#######################################################################################
|
||||||
@ -165,20 +143,13 @@ security.oauth2.google.url=https//review
|
|||||||
#accounts.exclusion.domain=
|
#accounts.exclusion.domain=
|
||||||
|
|
||||||
|
|
||||||
#######################################################################################
|
##################################################################################
|
||||||
# Spring related configurations
|
# Database Configuration
|
||||||
#######################################################################################
|
##################################################################################
|
||||||
spring.main.allow-circular-references=true
|
|
||||||
|
|
||||||
database.base.url=/Users/veigap/repos/wisemapping-open-source/wise-webapp
|
database.base.url=/Users/veigap/
|
||||||
spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
|
spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
|
||||||
spring.datasource.username=sa
|
spring.datasource.username=sa
|
||||||
spring.datasource.password=
|
spring.datasource.password=
|
||||||
spring.datasource.driver-class-name = org.hsqldb.jdbc.JDBCDriver
|
spring.datasource.driver-class-name = org.hsqldb.jdbc.JDBCDriver
|
||||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
||||||
spring.jpa.open-in-view=true
|
|
||||||
spring.h2.console.enabled=true
|
|
||||||
spring.h2.console.path=/h2-ui
|
|
||||||
|
|
||||||
|
|
||||||
logging.level.root=DEBUG
|
|
||||||
|
Loading…
Reference in New Issue
Block a user