This commit is contained in:
Paulo Gustavo Veiga 2023-11-24 19:26:36 -08:00
parent 15325672a0
commit c29098d717
14 changed files with 249 additions and 234 deletions

View File

@ -0,0 +1,5 @@
#HSQL Database Engine 2.7.1
#Fri Nov 24 19:26:20 PST 2023
modified=yes
tx_timestamp=458
version=2.7.1

View File

@ -0,0 +1,46 @@
SET DATABASE UNIQUE NAME HSQLDB8C04588647
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 458
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)

View File

@ -2,19 +2,22 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>wise-webapp</artifactId>
<packaging>war</packaging>
<name>WiseMapping Webapp</name>
<url>http://www.wisemapping.org</url>
<parent>
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.2</version>
</parent>
<properties>
<org.springframework.version>6.0.14</org.springframework.version>
<org.springframework.addons>6.1.5</org.springframework.addons>
<com.wisemapping.version>5.1.0-SNAPSHOT</com.wisemapping.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<org.springframework.version>6.0.11</org.springframework.version>
<org.springframework.addons>6.1.2</org.springframework.addons>
<spring-security-taglibs.version>6.0.2</spring-security-taglibs.version>
</properties>
@ -31,6 +34,27 @@
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@ -43,55 +67,42 @@
<version>12.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework</groupId>-->
<!-- <artifactId>spring-messaging</artifactId>-->
<!-- <version>${org.springframework.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework</groupId>-->
<!-- <artifactId>spring-websocket</artifactId>-->
<!-- <version>${org.springframework.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework</groupId>-->
<!-- <artifactId>spring-beans</artifactId>-->
<!-- <version>${org.springframework.version}</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.springframework</groupId>-->
<!-- <artifactId>spring-tx</artifactId>-->
<!-- <version>${org.springframework.version}</version>-->
<!-- <scope>compile</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring-security-taglibs.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.1.7.Final</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.1</version>
<version>4.0.0</version>
</dependency>
<!-- Hibernate Validator -->
@ -100,78 +111,6 @@
<artifactId>hibernate-validator</artifactId>
<version>8.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>6.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
@ -280,10 +219,9 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.7.1</version>
<version>2.7.2</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>drop-schemas</id>
@ -395,6 +333,8 @@
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>

View File

@ -1,11 +1,12 @@
package com.wisemapping.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.TransactionManager;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ViewResolver;
@ -18,8 +19,15 @@ import org.springframework.web.servlet.view.JstlView;
@Configuration
@EnableTransactionManagement
@ComponentScan
@SpringBootApplication
@EnableJpaRepositories("com.wisemapping.model")
@ImportResource("classpath:spring/wisemapping-common.xml")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
HandlerExceptionResolver errorHandler() {
final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver();

View File

@ -1,8 +1,6 @@
package com.wisemapping.config;
import org.apache.commons.dbcp2.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -17,72 +15,72 @@ import java.util.Properties;
@EnableTransactionManagement
public class HibernateConfig {
@Value("${database.hibernate.dialect}")
private String dbDialect;
// @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;
@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
public HibernateTransactionManager hibernateTransactionManager() {
final HibernateTransactionManager result = new HibernateTransactionManager();
result.setNestedTransactionAllowed(true);
// @Todo: Am I creatting two instances ???
result.setSessionFactory(sessionFactory().getObject());
return result;
}
private Properties hibernateProperties() {
final Properties result = new Properties();
result.setProperty("hibernate.dialect", dbDialect);
result.setProperty("hibernate.default_batch_fetch_size", "200");
result.setProperty("hibernate.nestedTransactionAllowed", "true");
result.setProperty("hibernate.auto_quote_keyword", "true");
return result;
}
@Bean
public DataSource dataSource() {
final BasicDataSource result = new BasicDataSource();
result.setDriverClassName(dbDriver);
result.setUrl(dbUrl);
result.setUsername(dbUsername);
result.setPassword(dbPassword);
result.setTestOnBorrow(dbSetOnBorrow);
result.setDefaultQueryTimeout(15);
result.setMaxTotal(100);
result.setMaxIdle(30);
result.setInitialSize(5);
result.setMaxWaitMillis(10000);
result.setValidationQuery(dbValQuery);
return result;
}
// @Bean
// public LocalSessionFactoryBean sessionFactory() {
// final LocalSessionFactoryBean result = new LocalSessionFactoryBean();
// result.setPackagesToScan("com.wisemapping.model");
// result.setDataSource(dataSource());
// result.setHibernateProperties(hibernateProperties());
//
// return result;
// }
//
//
// @Bean
// public HibernateTransactionManager hibernateTransactionManager() {
// final HibernateTransactionManager result = new HibernateTransactionManager();
// result.setNestedTransactionAllowed(true);
// // @Todo: Am I creatting two instances ???
// result.setSessionFactory(sessionFactory().getObject());
// return result;
// }
//
// private Properties hibernateProperties() {
// final Properties result = new Properties();
// result.setProperty("hibernate.dialect", dbDialect);
// result.setProperty("hibernate.default_batch_fetch_size", "200");
// result.setProperty("hibernate.nestedTransactionAllowed", "true");
// result.setProperty("hibernate.auto_quote_keyword", "true");
//
// return result;
// }
//
// @Bean
// public DataSource dataSource() {
// final BasicDataSource result = new BasicDataSource();
// result.setDriverClassName(dbDriver);
// result.setUrl(dbUrl);
// result.setUsername(dbUsername);
// result.setPassword(dbPassword);
// result.setTestOnBorrow(dbSetOnBorrow);
//
// result.setDefaultQueryTimeout(15);
// result.setMaxTotal(100);
// result.setMaxIdle(30);
// result.setInitialSize(5);
// result.setMaxWaitMillis(10000);
// result.setValidationQuery(dbValQuery);
//
// return result;
// }
}

View File

@ -39,7 +39,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
@Repository
public class UserManagerImpl
implements UserManager {
@Autowired
// @Autowired
private SessionFactory sessionFactory;
@Autowired

View File

@ -48,7 +48,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
@Value("${site.homepage}")
private String siteHomepage;
@Value("${site.baseurl}")
@Value("${site.baseurl:}")
private String siteUrl;
@Value("${security.type}")
@ -75,7 +75,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor {
request.setAttribute("security.type", securityType);
// If the property could not be resolved, try to infer one from the request...
if ("${site.baseurl}".equals(siteUrl)) {
if (siteUrl.isBlank()) {
siteUrl = request.getRequestURL().toString().replace(request.getRequestURI(), request.getContextPath());
}
request.setAttribute("site.baseurl", siteUrl);

View File

@ -50,7 +50,7 @@ public final class MailerService {
@Value("${mail.supportEmail}")
private String supportEmail;
@Value("${mail.errorReporterEmail}")
@Value("${mail.errorReporterEmail:}")
private String errorReporterEmail;
//~ Methods ..............................................................................................

View File

@ -34,15 +34,15 @@ import com.wisemapping.service.google.http.HttpInvokerException;
public class GoogleService {
@Autowired
private HttpInvoker httpInvoker;
@Value("${security.oauth2.google.confirmUrl}")
@Value("${security.oauth2.google.confirmUrl:}")
private String optinConfirmUrl;
@Value("${security.oauth2.google.userinfoUrl}")
@Value("${security.oauth2.google.userinfoUrl:}")
private String accountBasicDataUrl;
@Value("${security.oauth2.google.clientId}")
@Value("${security.oauth2.google.clientId:}")
private String clientId;
@Value("${security.oauth2.google.clientSecret}")
@Value("${security.oauth2.google.clientSecret:}")
private String clientSecret;
@Value("${security.oauth2.google.callbackUrl}")
@Value("${security.oauth2.google.callbackUrl:}")
private String callbackUrl;
public void setHttpInvoker(HttpInvoker httpInvoker) {

View File

@ -31,7 +31,7 @@ import org.springframework.web.servlet.ModelAndView;
@PreAuthorize("permitAll()")
public class MvcLoginController {
@Value("${database.driver}")
// @Value("${database.driver}")
private String driver;
@RequestMapping(value = "login", method = RequestMethod.GET)

View File

@ -22,15 +22,16 @@
#database.validation.enabled=false
# 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=
##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.
@ -149,7 +150,9 @@ security.oauth2.google.confirmUrl=https://oauth2.googleapis.com/token
# Google service for get user data (name, email, etc)
security.oauth2.google.userinfoUrl=https://www.googleapis.com/oauth2/v3/userinfo
# Url for starting auth process with google
security.oauth2.google.url=https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${security.oauth2.google.callbackUrl}&prompt=consent&response_type=code&client_id=${security.oauth2.google.clientId}&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline&state=wisemapping&include_granted_scopes=true
@Todo
security.oauth2.google.url=https//review
@ -161,3 +164,21 @@ security.oauth2.google.url=https://accounts.google.com/o/oauth2/v2/auth?redirect
# Coma separated list of domains and emails ban
#accounts.exclusion.domain=
#######################################################################################
# Spring related configurations
#######################################################################################
spring.main.allow-circular-references=true
database.base.url=/Users/veigap/repos/wisemapping-open-source/wise-webapp
spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name = org.hsqldb.jdbc.JDBCDriver
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

View File

@ -1,13 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd">
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
<!-- <context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>-->
<import resource="wisemapping-service.xml"/>
<import resource="wisemapping-servlet.xml"/>

View File

@ -50,12 +50,12 @@
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="defaultEncoding" value="UTF-8"/>
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
<!-- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">-->
<!-- <property name="defaultEncoding" value="UTF-8"/>-->
<!-- <property name="basenames">-->
<!-- <list>-->
<!-- <value>messages</value>-->
<!-- </list>-->
<!-- </property>-->
<!-- </bean>-->
</beans>

View File

@ -19,16 +19,16 @@
<bean id="requestInterceptor" class="com.wisemapping.filter.RequestPropertiesInterceptor"/>
</mvc:interceptors>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
</bean>
<!-- <bean id="localeResolver"-->
<!-- class="org.springframework.web.servlet.i18n.SessionLocaleResolver">-->
<!-- </bean>-->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="defaultEncoding" value="UTF-8"/>
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
<!-- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">-->
<!-- <property name="defaultEncoding" value="UTF-8"/>-->
<!-- <property name="basenames">-->
<!-- <list>-->
<!-- <value>messages</value>-->
<!-- </list>-->
<!-- </property>-->
<!-- </bean>-->
</beans>