51 Commits

Author SHA1 Message Date
Paulo Gustavo Veiga
aff87ed808 Update version 2020-11-22 13:14:05 -08:00
Paulo Gustavo Veiga
e80fa2e49e Fix log level on hibernate.
Fix footer.
2020-11-22 13:12:03 -08:00
Paulo Gustavo Veiga
6ae148b69a Update favicon 2020-11-22 13:01:26 -08:00
Paulo Gustavo Veiga
91d24dc668 Fix error on mindmap publish & details 2020-11-22 12:53:35 -08:00
Paulo Gustavo Veiga
6b175d9885 Fix wrong query. 2020-11-08 15:42:51 -08:00
Paulo Gustavo Veiga
2576ad325c Copy Sha1 implementationo 2020-11-08 15:29:42 -08:00
Paulo Gustavo Veiga
11c6ce1004 Fix password encription 2020-11-08 13:43:38 -08:00
Paulo Gustavo Veiga
145986fb61 Merge branch 'feature/migration-spring5' of bitbucket.org:wisemapping/wisemapping-open-source into feature/migration-spring5 2020-11-08 13:36:09 -08:00
Paulo Gustavo Veiga
6789fa60b5 Fix password encoder for compatibility 2020-11-08 12:08:13 -08:00
Paulo Gustavo Veiga
9111b6988f Update JDBC drivers for mysql & others... 2020-11-07 18:44:53 -08:00
Paulo Gustavo Veiga
391ed63b39 Update to tiles 3 version 2020-11-07 14:46:20 -08:00
Paulo Gustavo Veiga
55711b4f7b Fix ClassNotFound starting Hibernate 2020-11-07 14:42:00 -08:00
Paulo Gustavo Veiga
08c2548aec Initial commit 2020-11-07 11:56:38 -08:00
Paulo Gustavo Veiga
9b738eaaf7 Support for Java 11 2020-11-06 21:35:54 -08:00
Paulo Gustavo Veiga
6872cda952 Disable timestamp control. Issue seems to be related to changes in the JDBC driver. 2020-07-29 12:32:20 -07:00
Paulo Gustavo Veiga
a0f5794618 Disable timestamp control. Issue seems to be related to changes in the JDBC driver. 2020-07-29 12:30:44 -07:00
Paulo Gustavo Veiga
6507d6566e Disable brower support check. This was required because the validation is failing with some new version of Chrome. 2020-04-30 21:15:52 -07:00
Paulo Veiga
7f81ea7830 Bump up version 2018-09-16 18:37:13 -07:00
Paulo Veiga
9a364dd702 Merge branch 'develop' 2018-09-16 18:29:02 -07:00
Paulo Veiga
a52f83d179 Fix test 2018-09-16 18:27:42 -07:00
Paulo Veiga
4c66002339 Hack for workaround batik OOM 2018-09-16 18:06:47 -07:00
Paulo Veiga
4aaa00fc45 Update batik 2018-09-16 13:05:11 -07:00
Paulo Veiga
2c9faca7e7 Fix several minor issues. 2018-09-16 12:29:19 -07:00
Paulo Veiga
1da36f2595 Fix bug on based URL generation 2018-09-15 01:25:14 -07:00
Paulo Veiga
abfb6b1157 Bump up version 2018-09-14 23:16:35 -07:00
Paulo Veiga
edf31e86b6 Bump up version 2018-09-14 23:15:47 -07:00
Paulo Veiga
45ccacad39 Merge branch 'develop' 2018-09-14 23:08:50 -07:00
Paulo Veiga
71e99673e4 Upgrade Spring version.
Fix failing export tests
2018-09-14 23:08:34 -07:00
Paulo Veiga
e610ef60d5 Update batik library.
Fix sample SVG tests.
2018-09-14 17:33:36 -07:00
Paulo Veiga
d5cc311f9d Revert "Try push"
This reverts commit f9acc51888.
2018-09-14 13:45:03 -07:00
Paulo Veiga
f9acc51888 Try push 2018-09-14 13:44:24 -07:00
Paulo Gustavo Veiga
8ce979299a Return to java 1.7. Why ?. Spring does not like it. 2015-11-02 08:57:21 -03:00
Paulo Gustavo Veiga
f7318161b6 Return to java 1.7 2015-11-02 08:57:12 -03:00
Paulo Gustavo Veiga
f85585b3b0 Fix typo... 2015-11-01 21:53:38 -03:00
Paulo Gustavo Veiga
33c3da51c8 Merge branch 'develop' of bitbucket.org:wisemapping/wisemapping-open-source into develop 2015-11-01 21:48:58 -03:00
Ezequiel Bergamaschi
8db908912c Merge remote-tracking branch 'origin/develop'
Conflicts:
	core-js/pom.xml
	mindplot/pom.xml
	pom.xml
	web2d/pom.xml
	wise-editor/pom.xml
	wise-webapp/pom.xml
2015-10-29 23:06:57 -03:00
Ezequiel Bergamaschi
a51846e536 zoom factor decreased, fixing some js errors due to legacy code 2015-10-29 22:31:40 -03:00
Ezequiel Bergamaschi
f20b4d63d1 rest user has not password set for rest api 2015-08-29 02:14:49 -03:00
Ezequiel Bergamaschi
070815c95c fix api rest for get user by email, email was trimmed 2015-08-26 23:38:41 -03:00
Ezequiel Bergamaschi
7e440fb9de firefox 40+ support 2015-08-26 23:37:49 -03:00
Paulo Gustavo Veiga
12f2048fa2 Minor java 8 refactors. 2015-07-25 13:17:53 -03:00
Paulo Gustavo Veiga
0cc08b34cf Move to Java 1.8. 2015-07-04 11:02:48 -03:00
Mariela Michalek
0633bb589e fix focus link editor 2015-05-31 11:12:27 -03:00
Ezequiel Bergamaschi
c6c825fedc fix error stack not reporting to autolog 2015-05-09 17:30:00 -03:00
Paulo Gustavo Veiga
1320bb737c Update lattest version. 2015-05-09 12:10:39 -03:00
Paulo Gustavo Veiga
2a9fa3f978 Finish Docker implementation. 2015-05-09 12:08:53 -03:00
Paulo Gustavo Veiga
6e76288093 Initial version of Dockerfile generation. 2015-05-09 11:02:09 -03:00
Ezequiel Bergamaschi
c0b61a2a5d adding error stack information to error reporter 2015-05-09 04:55:40 -03:00
Ezequiel Bergamaschi
cec637afbe fix underscorejs.min.map not found 2015-05-09 02:44:28 -03:00
Ezequiel Bergamaschi
d2a6312b7c fix bug WA-794: submitDialogForm not defined issue WA #resolve 2015-05-09 02:43:46 -03:00
Paulo Gustavo Veiga
64f371e2da Update to new version. 2015-04-29 12:10:53 -07:00
162 changed files with 1373 additions and 936 deletions

View File

@@ -8,7 +8,7 @@ The goal of this project is to provide a high quality product that can be deploy
The following products must be installed:
* Java Development Kit 7 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html])
* Java Development Kit 8 or higher ([http://www.oracle.com/technetwork/java/javase/downloads/index.html])
* Maven 3.x or higher ([http://maven.apache.org/])
### Compiling
@@ -32,7 +32,7 @@ The previously generated war can be deployed locally executing within the direct
`cd wise-webapp;mvn jetty:run-war`
This will start the application on the URL: [http://localhost:8080/wise-webapp/]. Additionally, a file based database is automatically populated with a test user.
This will start the application on the URL: [http://localhost:8080/] using file based database..
User: test@wisemapping.org
Password: test
@@ -49,6 +49,10 @@ To test the javascript frontend you then do:
Now open a browser using the URL http://localhost:8000/wise-editor/src/main/webapp/
## Maintenance
## Members
### Founders
@@ -70,3 +74,4 @@ Now open a browser using the URL http://localhost:8000/wise-editor/src/main/weba
The source code is Licensed under the WiseMapping Open License, Version 1.0 (the “License”);
You may obtain a copy of the License at: [https://wisemapping.atlassian.net/wiki/display/WS/License]

View File

@@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.2</version>
<version>5.0.0</version>
</parent>
<scm>
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>

47
distribution/Dockerfile Normal file
View File

@@ -0,0 +1,47 @@
# Dockerizing WiseMapping: Dockerfile for building WiseMapping images
# Based on ubuntu:latest, installs WiseMapping (http://ww.wisemapping.org)
FROM ubuntu:latest
MAINTAINER Paulo Gustavo Veiga <pveiga@wisemapping.com>
ENV DEBIAN_FRONTEND noninteractive
ENV MYSQL_ROOT_PASSWORD password
ENV WISE_VERSION 4.0.2
# Install utilities
RUN apt-get install -y zip
# Prepare distribution
COPY target/wisemapping-v${WISE_VERSION}.zip .
RUN unzip wisemapping-v${WISE_VERSION}.zip
# Install MySQL
RUN echo mysql-server mysql-server/root_password password ${MYSQL_ROOT_PASSWORD} | debconf-set-selections;\
echo mysql-server mysql-server/root_password_again password ${MYSQL_ROOT_PASSWORD} | debconf-set-selections;\
apt-get install -y mysql-server
RUN service mysql start && \
mysql -uroot -p${MYSQL_ROOT_PASSWORD} < /wisemapping-v${WISE_VERSION}/config/database/mysql/create-database.sql && \
mysql -uwisemapping -Dwisemapping -ppassword < /wisemapping-v${WISE_VERSION}/config/database/mysql/create-schemas.sql && \
mysql -uwisemapping -Dwisemapping -ppassword < /wisemapping-v${WISE_VERSION}/config/database/mysql/apopulate-schemas.sql
# Install Java 8
RUN apt-get install -y software-properties-common && \
add-apt-repository ppa:webupd8team/java && \
apt-get update
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections;\
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections;\
sudo apt-get install -y oracle-java8-installer
# Configure instance
COPY docker-conf/app.properties wisemapping-v4.0.1/webapps/wisemapping/WEB-INF/app.properties
# Clean up
RUN apt-get clean
RUN rm wisemapping-v${WISE_VERSION}.zip
EXPOSE 8080
CMD "sh" "-c" "service mysql start;cd wisemapping-v${WISE_VERSION};./start.sh"

View File

@@ -0,0 +1,160 @@
##################################################################################
# Database Configuration
##################################################################################
# MariaDB configuration properties
database.url=jdbc:mariadb://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
database.driver=org.mariadb.jdbc.Driver
database.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
database.username=wisemapping
database.password=mappingwise
database.validation.enabled=true
database.validation.query=SELECT 1
# MySQL 5.X configuration properties
#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
#database.driver=com.mysql.jdbc.Driver
#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
#database.username=wisemapping
#database.password=password
#database.validation.enabled=true
#database.validation.query=SELECT 1
## PostgreSQL configuration properties
#database.url=jdbc:mariadb://localhost:3306/wisemapping
#database.driver=org.mariadb.jdbc.Driver
#database.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
#database.username=wisemapping
#database.password=password
#database.validation.query=
#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=
##################################################################################
# Mail configuration. Must be configured to enable user registration confirmation.
##################################################################################
#------------------------
# Plain SMTP Server Configuration
#------------------------
mail.smtp.port=25
mail.smtp.host=localhost
mail.username=root
mail.password=
mail.smtp.auth=false
mail.smtp.starttls.enable=false
mail.smtp.quitwait=false
#------------------------
# GMAIL SMTP Configuration
#------------------------
#mail.smtp.port=587
#mail.smtp.host=smtp.gmail.com
#mail.username=<gmail-user-account>
#mail.password=<gmail-password>
#mail.smtp.auth=true
#mail.smtp.starttls.enable=true
#mail.smtp.quitwait=false
#------------------------
# Emails configuration
#------------------------
# Required: "from" email account that will appear in the emails sent from the sender.
mail.serverSendEmail=root@localhost
# Optional: Support account that the users could use to contact you. This address will appear in emails and in some places in the site.
mail.supportEmail=root@localhost
# Optional: Unexpected errors will be reported to this address.
mail.errorReporterEmail=
##################################################################################
# Users Registration Configuration
##################################################################################
# Enable captcha confirmation
google.recaptcha2.enabled = true
# ReCaptcha is the default captcha. Public and private keys are required.
# More Info: http://www.google.com/recaptcha .
google.recaptcha2.siteKey = 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
##################################################################################
# Site configuration
##################################################################################
# Site administration user. This user will have special permissions for operations such as removing users, set password
# etc.
admin.user = admin@wisemapping.org
# Base URL where WiseMapping is deployed. By default, It will be automatically inferred.
# If you are planning to put wisemapping behind an Apache using an Apache Proxy setup, you must enable this property.
#site.baseurl = http://example.com:8080/wisemapping
# Site Homepage URL. This will be used as URL for homepage location.
site.homepage = c/home
##################################################################################
# Google Analytics Settings
##################################################################################
google.analytics.enabled=false
google.analytics.account=UA-XXXX
##################################################################################
# Google Ads enable
##################################################################################
google.ads.enabled=false
#######################################################################################
# Authentication Configuration Section
#######################################################################################
# Two type of security are supported:
# - db: User are stored in the database. Registration is required in advance.
# - ldap: Authentication takes place using a LDAP. In this case, security.ldap.* must be configured.
security.type=db
# LDAP Configuration properties.
security.ldap.server=ldap://localhost:389
# If anonymous password is required, change the wisemapping-security-ldap.xml removing the
security.ldap.server.user=cn=pveiga,dc=wisemapping,dc=com
security.ldap.server.password=password
security.ldap.basedn=dc=wisemapping,dc=com
# This will be concatenated as part of the DN. In this case, I will be "ou=people".
# In case this need to be changed, modify the wisemapping-security-ldap.xml.
security.ldap.subDn=ou=people
# Attribute used as authentication login (Eg: in this case, the user email will be used)
security.ldap.auth.attribute=mail
security.ldap.lastName.attribute=sn
security.ldap.firstName.attribute=givenName
# Enable OpenId Authentication.
security.openid.enabled=false
# REST Documentation
#
# This properties are used for REST API Documentation( http://localhost:8080/wisemapping/doc/rest/index.html)
# Change the URL for proper documentation console setup.
documentation.services.basePath=http://localhost:8080/service
documentation.services.version=3.0.1

View File

@@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.2</version>
<version>5.0.0</version>
</parent>
<dependencies>
@@ -50,28 +50,27 @@
<configuration>
<source>
def outdir = new File(project.basedir, 'src/main/javascript');
if (project.packaging != 'pom')
{
def dir = new File(project.basedir, 'src/main/resources/');
if (project.packaging != 'pom') {
def dir = new File(project.basedir, 'src/main/resources/');
dir.eachFile { file ->
def matcher = file.name =~ /messages_(.+)\.properties/;
def lang = matcher[0][1];
def outfile = new File(outdir, "MessageBundle_${lang}.js");
println "Converting ${file.name} to ${outfile.name}";
dir.eachFile { file ->
def matcher = file.name =~ /messages_(.+)\.properties/;
def lang = matcher[0][1];
def outfile = new File(outdir, "MessageBundle_${lang}.js");
println "Converting ${file.name} to ${outfile.name}";
outfile.withWriter('UTF-8') { out ->
out.writeLine "mindplot.Messages.BUNDLES['${lang.toLowerCase()}'] = { ";
file.eachLine('UTF-8') { line ->
if( line.trim()!="" &amp;&amp; line[0]!='#' ) {
matcher = line =~ /(.+)=(.+)/;
out.writeLine("'${matcher[0][1]}' : \"${matcher[0][2]}\",");
}
}
out.writeLine("'DUMMY' : '' ");
out.writeLine "};"
}
}
outfile.withWriter('UTF-8') { out ->
out.writeLine "mindplot.Messages.BUNDLES['${lang.toLowerCase()}'] = { ";
file.eachLine('UTF-8') { line ->
if (line.trim() != "" &amp;&amp; line[0] != '#') {
matcher = line =~ /(.+)=(.+)/;
out.writeLine("'${matcher[0][1]}' : \"${matcher[0][2]}\",");
}
}
out.writeLine("'DUMMY' : '' ");
out.writeLine "};"
}
}
}
</source>
</configuration>
@@ -258,13 +257,13 @@
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.3.1.5</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<!--<executions>-->
<!--<execution>-->
<!--<goals>-->
<!--<goal>test</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<dependencies>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>

View File

@@ -82,32 +82,14 @@ mindplot.Designer = new Class(/** @lends Designer */{
* @private
*/
_registerWheelEvents: function () {
var workspace = this._workspace;
var zoomFactor = 1.006;
var me = this;
// Zoom In and Zoom Out must active event
$(document).on('mousewheel', function (event) {
// Change mousewheel handling so we let the default
// event happen if we are outside the container. -> FIXME: it still happening?
/*var coords = screenManager.getContainer().getCoordinates();
var isOutsideContainer = event.client.y < coords.top ||
event.client.y > coords.bottom ||
event.client.x < coords.left ||
event.client.x > coords.right;
if (!isOutsideContainer) {
if (event.wheel > 0) {
this.zoomIn(1.05);
}
else {
this.zoomOut(1.05);
}
event.preventDefault();
}*/
if (event.deltaY > 0) {
me.zoomIn(1.05);
}
else {
me.zoomOut(1.05);
me.zoomIn(zoomFactor);
} else {
me.zoomOut(zoomFactor);
}
event.preventDefault();
});

File diff suppressed because one or more lines are too long

View File

@@ -63,6 +63,9 @@ mindplot.widget.LinkEditor = new Class(/** @lends LinkEditor */{
'autofocus': 'autofocus',
'class': 'form-control'
});
input.on("keypress", function(event) {
event.stopPropagation();
});
if (model.getValue() != null){
input.val(model.getValue());

14
phantomjsdriver.log Normal file
View File

@@ -0,0 +1,14 @@
[INFO - 2015-11-02T11:53:26.059Z] GhostDriver - Main - running on port 23859
[INFO - 2015-11-02T11:53:26.556Z] Session [53aba090-8158-11e5-b4b7-df7d699a4283] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
[INFO - 2015-11-02T11:53:26.556Z] Session [53aba090-8158-11e5-b4b7-df7d699a4283] - page.customHeaders: - {}
[INFO - 2015-11-02T11:53:26.556Z] Session [53aba090-8158-11e5-b4b7-df7d699a4283] - CONSTRUCTOR - Desired Capabilities: {"phantomjs.binary.path":"/Users/pveiga/repo/wisemapping/mindplot/target/phantomjs-maven-plugin/phantomjs-1.9.2-macosx/bin/phantomjs","javascriptEnabled":true}
[INFO - 2015-11-02T11:53:26.556Z] Session [53aba090-8158-11e5-b4b7-df7d699a4283] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"mac-unknown-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2015-11-02T11:53:26.556Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 53aba090-8158-11e5-b4b7-df7d699a4283
[INFO - 2015-11-02T11:53:30.454Z] ShutdownReqHand - _handle - About to shutdown
[INFO - 2015-11-02T11:56:02.272Z] GhostDriver - Main - running on port 47468
[INFO - 2015-11-02T11:56:02.546Z] Session [b0a5cff0-8158-11e5-b537-631f7ef82703] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34","webSecurityEnabled":true}
[INFO - 2015-11-02T11:56:02.546Z] Session [b0a5cff0-8158-11e5-b537-631f7ef82703] - page.customHeaders: - {}
[INFO - 2015-11-02T11:56:02.546Z] Session [b0a5cff0-8158-11e5-b537-631f7ef82703] - CONSTRUCTOR - Desired Capabilities: {"phantomjs.binary.path":"/Users/pveiga/repo/wisemapping/mindplot/target/phantomjs-maven-plugin/phantomjs-1.9.2-macosx/bin/phantomjs","javascriptEnabled":true}
[INFO - 2015-11-02T11:56:02.546Z] Session [b0a5cff0-8158-11e5-b537-631f7ef82703] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"mac-unknown-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2015-11-02T11:56:02.546Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: b0a5cff0-8158-11e5-b537-631f7ef82703
[INFO - 2015-11-02T11:56:04.055Z] ShutdownReqHand - _handle - About to shutdown

18
pom.xml
View File

@@ -1,10 +1,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties>
<com.wisemapping.version>4.0.2</com.wisemapping.version>
<com.wisemapping.version>5.0.0</com.wisemapping.version>
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
</properties>
@@ -16,7 +16,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<name>WiseMapping Project</name>
<version>4.0.2</version>
<version>5.0.0</version>
<packaging>pom</packaging>
<licenses>
@@ -72,12 +72,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5</version>
<version>2.10</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.1</version>
<version>0.14.0</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
@@ -117,10 +117,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>11</source>
<target>11</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

View File

@@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.2</version>
<version>5.0.0</version>
</parent>
<build>

View File

@@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.2</version>
<version>5.0.0</version>
</parent>
<dependencies>

View File

@@ -78,7 +78,7 @@ function buildDesigner(options) {
headers: {"Content-Type": "application/json", "Accept": "application/json"},
data: JSON.stringify({
jsErrorMsg: "Message: '" + errorMsg + "', line:'" + lineNo + "', url: :" + url,
jsStack: window.errorStack,
jsStack: window.event.error.stack || window.errorStack,
userAgent: navigator.userAgent,
mapId: options.mapId
})

View File

@@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>4.0.2</version>
<version>5.0.0</version>
</parent>
<repositories>
@@ -28,7 +28,9 @@
</repositories>
<properties>
<org.springframework.version>3.1.3.RELEASE</org.springframework.version>
<org.springframework.version>5.2.10.RELEASE</org.springframework.version>
<org.springframework.addons>5.2.5.RELEASE</org.springframework.addons>
<hibernate.version>5.4.23.Final</hibernate.version>
</properties>
<dependencies>
@@ -55,15 +57,14 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
<version>1.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<version>6.9.8</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.intellij</groupId>
@@ -80,13 +81,13 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>${org.springframework.version}</version>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-openid</artifactId>
<version>${org.springframework.version}</version>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -101,6 +102,25 @@
<version>${org.springframework.version}</version>
<scope>compile</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- Hibernate Validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.21.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>
@@ -110,7 +130,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.2</version>
<version>1.7.25</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -122,7 +142,7 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>0.94</version>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -145,8 +165,14 @@
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>2.1.4</version>
<version>3.0.8</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -163,19 +189,19 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.version}</version>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springframework.version}</version>
<version>${org.springframework.addons}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.version}</version>
<version>${org.springframework.addons}</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -184,18 +210,6 @@
<version>${org.springframework.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.0.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
@@ -205,7 +219,7 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.7</version>
<version>1.10</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -217,12 +231,12 @@
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-codec</artifactId>
<version>1.7</version>
<version>1.10</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<version>8.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -233,13 +247,13 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.5</version>
<version>8.0.22</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
<version>1.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -258,24 +272,18 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.8</version>
<version>2.5.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
<scope>compile</scope>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
<version>1.7.25</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -285,10 +293,24 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.tanesha.recaptcha4j</groupId>
<artifactId>recaptcha4j</artifactId>
<version>0.0.7</version>
<scope>compile</scope>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</dependency>
<dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
@@ -311,7 +333,21 @@
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>fluent-hc</artifactId>
<version>4.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.5</version>
</dependency>
</dependencies>
<profiles>
<profile>
@@ -556,11 +592,10 @@
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.14.v20131031</version>
<version>9.4.34.v20201102</version>
<configuration>
<baseAppFirst>false</baseAppFirst>
<stopKey>foo</stopKey>
<stopPort>9999</stopPort>
<war>${project.build.directory}/wisemapping.war</war>
@@ -585,14 +620,15 @@
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<id>run-forked</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
<goal>run-forked</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
<waitForChild>false</waitForChild>
<jvmArgs>-Ddatabase.base.url=${project.build.directory}</jvmArgs>
</configuration>
</execution>
<execution>

View File

@@ -1,10 +1,27 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.dao;
import com.wisemapping.model.Label;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import java.util.List;
@@ -18,27 +35,34 @@ public class LabelManagerImpl extends HibernateDaoSupport
@Override
public void saveLabel(@NotNull final Label label) {
getSession().save(label);
currentSession().save(label);
}
@NotNull
@Override
@SuppressWarnings("unchecked")
public List<Label> getAllLabels(@NotNull final User user) {
return getHibernateTemplate().find("from com.wisemapping.model.Label wisemapping where creator_id=?", user.getId());
var query = currentSession().createQuery("from com.wisemapping.model.Label wisemapping where creator_id=:creatorId");
query.setParameter("creatorId", user.getId());
return query.list();
}
@Nullable
@Override
public Label getLabelById(int id, @NotNull final User user) {
List<Label> labels = getHibernateTemplate().find("from com.wisemapping.model.Label wisemapping where id=? and creator=?", new Object[]{id, user});
return getFirst(labels);
var query = currentSession().createQuery("from com.wisemapping.model.Label wisemapping where id=:id and creator=:creator");
query.setParameter("id", id);
query.setParameter("creator", user);
return getFirst(query.list());
}
@Nullable
@Override
public Label getLabelByTitle(@NotNull String title, @NotNull final User user) {
final List<Label> labels = getHibernateTemplate().find("from com.wisemapping.model.Label wisemapping where title=? and creator=?", new Object[]{title, user});
return getFirst(labels);
var query = currentSession().createQuery("from com.wisemapping.model.Label wisemapping where title=:title and creator=:creator");
query.setParameter("title", title);
query.setParameter("creator", user);
return getFirst(query.list());
}
@Override

View File

@@ -1,28 +1,30 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.dao;
import com.wisemapping.model.*;
import com.wisemapping.util.ZipUtils;
import org.hibernate.Query;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.SimpleExpression;
import org.hibernate.criterion.Junction;
@@ -40,7 +42,10 @@ public class MindmapManagerImpl
@Override
public Collaborator findCollaborator(@NotNull final String email) {
final Collaborator collaborator;
final List<Collaborator> collaborators = getHibernateTemplate().find("from com.wisemapping.model.Collaborator collaborator where email=?", email);
Query query = currentSession().createQuery("from com.wisemapping.model.Collaborator collaborator where email=:email");
query.setParameter("email", email);
final List<Collaborator> collaborators = query.list();
if (collaborators != null && !collaborators.isEmpty()) {
assert collaborators.size() == 1 : "More than one user with the same email!";
collaborator = collaborators.get(0);
@@ -57,7 +62,7 @@ public class MindmapManagerImpl
@Override
public List<MindMapHistory> getHistoryFrom(int mindmapId) {
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
hibernateCriteria.add(Restrictions.eq("mindmapId", mindmapId));
hibernateCriteria.addOrder(Order.desc("creationTime"));
@@ -78,7 +83,7 @@ public class MindmapManagerImpl
@Override
public void purgeHistory(int mapId) throws IOException {
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
hibernateCriteria.add(Restrictions.eq("mindmapId", mapId));
hibernateCriteria.addOrder(Order.desc("creationTime"));
@@ -92,17 +97,18 @@ public class MindmapManagerImpl
// If the map has not been modified in the last months, it means that I don't need to keep all the history ...
int max = mindmap.getLastModificationTime().before(yearAgo) ? 10 : 25;
final HibernateTemplate hibernateTemplate = getHibernateTemplate();
for (MindMapHistory history : historyList) {
byte[] zippedXml = history.getZippedXml();
if (new String(zippedXml).startsWith("<map")) {
history.setZippedXml(ZipUtils.bytesToZip(zippedXml));
getHibernateTemplate().update(history);
hibernateTemplate.update(history);
}
}
if (historyList.size() > max) {
for (int i = max; i < historyList.size(); i++) {
getHibernateTemplate().delete(historyList.get(i));
hibernateTemplate.delete(historyList.get(i));
}
}
}
@@ -110,7 +116,7 @@ public class MindmapManagerImpl
@Override
public List<Mindmap> search(MindMapCriteria criteria, int maxResult) {
final Criteria hibernateCriteria = getSession().createCriteria(Mindmap.class);
final Criteria hibernateCriteria = currentSession().createCriteria(Mindmap.class);
//always search public maps
hibernateCriteria.add(Restrictions.like("public", Boolean.TRUE));
@@ -140,10 +146,6 @@ public class MindmapManagerImpl
hibernateCriteria.add(junction);
}
// if (maxResult>0)
// {
// hibernateCriteria.setMaxResults(maxResult);
// }
return hibernateCriteria.list();
}
@@ -154,19 +156,28 @@ public class MindmapManagerImpl
@Override
public List<Collaboration> findCollaboration(final long collaboratorId) {
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where colaborator_id=?", collaboratorId);
Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration collaboration where colaborator_id=:colaboratorId");
query.setParameter("colaboratorId", collaboratorId);
return query.list();
}
@Override
public List<Collaboration> findCollaboration(final CollaborationRole collaborationRole) {
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where roleId=?", collaborationRole.ordinal());
Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration collaboration where roleId=:roleId");
query.setParameter("roleId", collaborationRole.ordinal());
return query.list();
}
@Override
public Collaboration findCollaboration(final int mindmapId, final User user) {
final Collaboration result;
final List<Collaboration> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Collaboration collaboration where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()});
Query query = currentSession().createQuery("from com.wisemapping.model.Collaboration collaboration where mindMap.id=:mindMapId and colaborator_id=:collaboratorId");
query.setParameter("mindMap", mindmapId);
query.setParameter("collaboratorId", user.getId());
final List<Collaboration> mindMaps = query.list();
if (mindMaps != null && !mindMaps.isEmpty()) {
result = mindMaps.get(0);
} else {
@@ -193,8 +204,9 @@ public class MindmapManagerImpl
}
@Override
@SuppressWarnings("unchecked")
public List<Mindmap> getAllMindmaps() {
return getHibernateTemplate().find("from com.wisemapping.model.Mindmap wisemapping");
return currentSession().createQuery("from com.wisemapping.model.Mindmap wisemapping").list();
}
@Override
@@ -206,7 +218,12 @@ public class MindmapManagerImpl
@Override
public Mindmap getMindmapByTitle(final String title, final User user) {
final Mindmap result;
List<Mindmap> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Mindmap wisemapping where title=? and creator=?", new Object[]{title, user});
Query query = currentSession().createQuery("from com.wisemapping.model.Mindmap wisemapping where title=:title and creator=:creator");
query.setParameter("title", title);
query.setParameter("creator", user);
List<Mindmap> mindMaps = query.list();
if (mindMaps != null && !mindMaps.isEmpty()) {
result = mindMaps.get(0);
} else {
@@ -223,7 +240,7 @@ public class MindmapManagerImpl
@Override
public void saveMindmap(Mindmap mindMap) {
assert mindMap != null : "Save Mindmap: Mindmap is required!";
getSession().save(mindMap);
currentSession().save(mindMap);
}
@Override
@@ -238,7 +255,7 @@ public class MindmapManagerImpl
@Override
public void removeMindmap(@NotNull final Mindmap mindMap) {
// Delete history first ...
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId()));
List list = hibernateCriteria.list();
getHibernateTemplate().deleteAll(list);
@@ -257,4 +274,3 @@ public class MindmapManagerImpl
getHibernateTemplate().saveOrUpdate(history);
}
}

View File

@@ -1,20 +1,20 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.dao;
@@ -25,9 +25,8 @@ import com.wisemapping.model.AccessAuditory;
import org.hibernate.ObjectNotFoundException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.security.authentication.encoding.PasswordEncoder;
//import org.acegisecurity.providers.encoding.PasswordEncoder;
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
import org.springframework.security.crypto.password.PasswordEncoder;
import java.util.List;
import java.util.Set;
@@ -42,29 +41,39 @@ public class UserManagerImpl
this.passwordEncoder = passwordEncoder;
}
@SuppressWarnings("unchecked")
public List<User> getAllUsers() {
return getHibernateTemplate().find("from com.wisemapping.model.User user");
return currentSession().createQuery("from com.wisemapping.model.User user").list();
}
@Override
public User getUserBy(@NotNull final String email) {
User user = null;
final List<User> users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where email=?", email);
var query = currentSession().createQuery("from com.wisemapping.model.User colaborator where email=:email");
query.setParameter("email", email);
final List<User> users = query.list();
if (users != null && !users.isEmpty()) {
assert users.size() == 1 : "More than one user with the same email!";
user = users.get(0);
}
return user;
}
@Override
public Collaborator getCollaboratorBy(final String email) {
final Collaborator cola;
final List cols = getHibernateTemplate().find("from com.wisemapping.model.Collaborator colaborator where email=?", email);
var query = currentSession().createQuery("from com.wisemapping.model.Collaborator colaborator where " +
"email=:email");
query.setParameter("email", email);
final List<User> cols = query.list();
if (cols != null && !cols.isEmpty()) {
assert cols.size() == 1 : "More than one colaborator with the same email!";
cola = (Collaborator) cols.get(0);
cola = cols.get(0);
} else {
cola = null;
}
@@ -74,9 +83,9 @@ public class UserManagerImpl
@Nullable
public User getUserBy(long id) {
User user = null;
try{
try {
user = getHibernateTemplate().get(User.class, id);
} catch (ObjectNotFoundException e){
} catch (ObjectNotFoundException e) {
// Ignore ...
}
return user;
@@ -85,13 +94,13 @@ public class UserManagerImpl
@Override
public void createUser(User user) {
assert user != null : "Trying to store a null user";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
user.setPassword(passwordEncoder.encode(user.getPassword()));
getHibernateTemplate().saveOrUpdate(user);
}
@Override
public User createUser(@NotNull User user, @NotNull Collaborator col) {
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
user.setPassword(passwordEncoder.encode(user.getPassword()));
assert user != null : "Trying to store a null user";
final Set<Collaboration> set = col.getCollaborations();
@@ -121,14 +130,20 @@ public class UserManagerImpl
public void updateUser(@NotNull User user) {
assert user != null : "user is null";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
user.setPassword(passwordEncoder.encode(user.getPassword()));
getHibernateTemplate().update(user);
}
public User getUserByActivationCode(long code) {
final User user;
final List users = getHibernateTemplate().find("from com.wisemapping.model.User user where activationCode=?", code);
if (users != null && !users.isEmpty()) {
var query = currentSession().createQuery("from com.wisemapping.model.User user where " +
"activationCode=:activationCode");
query.setParameter("activationCode", code);
final List users = query.list();
if(users != null && !users.isEmpty()) {
assert users.size() == 1 : "More than one user with the same username!";
user = (User) users.get(0);
} else {

View File

@@ -48,7 +48,7 @@ public class ExportProperties {
this.version = version;
}
static public class GenericProperties extends ExportProperties {
private static class GenericProperties extends ExportProperties {
private GenericProperties(ExportFormat format) {
super(format);
}
@@ -65,7 +65,7 @@ public class ExportProperties {
this.size = size;
}
public ImageProperties(ExportFormat format) {
ImageProperties(ExportFormat format) {
super(format);
}

View File

@@ -19,6 +19,7 @@
package com.wisemapping.exporter;
import com.wisemapping.importer.VersionNumber;
import org.apache.batik.ext.awt.image.rendered.TileCache;
import org.apache.batik.parser.AWTTransformProducer;
import org.apache.batik.parser.ParseException;
import org.apache.batik.parser.TransformListParser;
@@ -29,13 +30,13 @@ import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.apache.commons.io.IOUtils;
import org.apache.fop.svg.PDFTranscoder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import sun.misc.BASE64Encoder;
import javax.servlet.ServletContext;
import javax.xml.parsers.DocumentBuilder;
@@ -49,26 +50,34 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.*;
import java.awt.geom.AffineTransform;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.regex.Pattern;
public class ExporterFactory {
static {
// Try to prevent OOM.
TileCache.setSize(0);
}
private static final String GROUP_NODE_NAME = "g";
private static final String IMAGE_NODE_NAME = "image";
public static final int MANGING = 50;
public static final String UTF_8_CHARSET_NAME = "UTF-8";
private static final int MANGING = 50;
private static final String UTF_8_CHARSET_NAME = "UTF-8";
private File baseImgDir;
public ExporterFactory(@NotNull final ServletContext servletContext) throws ParserConfigurationException {
public ExporterFactory(@NotNull final ServletContext servletContext) {
this.baseImgDir = new File(servletContext.getRealPath("/"));
}
public ExporterFactory(@NotNull final File baseImgDir) throws ParserConfigurationException {
public ExporterFactory(@NotNull final File baseImgDir) {
this.baseImgDir = baseImgDir;
}
public void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws ExportException, IOException, TranscoderException {
final ExportFormat format = properties.getFormat();
switch (format) {
case PNG: {
// Create a JPEG transcoder
@@ -80,18 +89,20 @@ public class ExporterFactory {
// Create the transcoder input.
final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray()));
final CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output);
TranscoderOutput transcoderOutput = new TranscoderOutput(output);
// Save the image.
transcoder.transcode(input, trascoderOutput);
transcoder.transcode(input, transcoderOutput);
reader.close();
break;
}
case JPG: {
// Create a JPEG transcoder
final Transcoder transcoder = new JPEGTranscoder();
transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99));
transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, .99f);
final ExportProperties.ImageProperties imageProperties =
(ExportProperties.ImageProperties) properties;
@@ -100,12 +111,13 @@ public class ExporterFactory {
// Create the transcoder input.
final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray()));
CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output);
// Save the image.
transcoder.transcode(input, trascoderOutput);
reader.close();
break;
}
case PDF: {
@@ -114,31 +126,32 @@ public class ExporterFactory {
// Create the transcoder input.
final String svgString = normalizeSvg(mapSvg);
final TranscoderInput input = new TranscoderInput(new CharArrayReader(svgString.toCharArray()));
CharArrayReader reader = new CharArrayReader(svgString.toCharArray());
final TranscoderInput input = new TranscoderInput(reader);
TranscoderOutput trascoderOutput = new TranscoderOutput(output);
// Save the image.
transcoder.transcode(input, trascoderOutput);
reader.close();
break;
}
case SVG: {
final String svgString = normalizeSvg(mapSvg);
output.write(svgString.getBytes(UTF_8_CHARSET_NAME));
output.write(svgString.getBytes(StandardCharsets.UTF_8));
break;
}
case TEXT: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.TEXT);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break;
}
case OPEN_OFFICE_WRITER: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.OPEN_OFFICE);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break;
}
case MICROSOFT_EXCEL: {
final Exporter exporter = XSLTExporter.create(XSLTExporter.Type.MICROSOFT_EXCEL);
exporter.export(xml.getBytes(UTF_8_CHARSET_NAME), output);
exporter.export(xml.getBytes(StandardCharsets.UTF_8), output);
break;
}
case FREEMIND: {
@@ -155,6 +168,9 @@ public class ExporterFactory {
default:
throw new UnsupportedOperationException("Export method not supported.");
}
output.flush();
output.close();
}
private String normalizeSvg(@NotNull String svgXml) throws ExportException {
@@ -167,6 +183,10 @@ public class ExporterFactory {
svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
}
if (!svgXml.contains("xmlns=\"http://www.w3.org/2000/svg\"")) {
svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" ");
}
// Hacks for some legacy cases ....
svgXml = svgXml.replaceAll("NaN,", "0");
svgXml = svgXml.replaceAll(",NaN", "0");
@@ -247,8 +267,8 @@ public class ExporterFactory {
final File iconFile = iconFile(imgUrl);
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
fis = new FileInputStream(iconFile);
BASE64Encoder encoder = new BASE64Encoder();
encoder.encode(fis, bos);
Base64.Encoder enc = Base64.getEncoder();
bos.write(enc.encode(IOUtils.toByteArray(fis)));
elem.setAttribute("xlink:href", "data:image/png;base64," + bos.toString("8859_1"));
elem.appendChild(document.createTextNode(" "));

View File

@@ -63,10 +63,10 @@ public class FreemindExporter
export(map.getUnzipXml(), outputStream);
}
public void export(byte[] xml, @NotNull OutputStream outputStream) throws ExportException {
public void export(@NotNull byte[] xml, @NotNull OutputStream outputStream) throws ExportException {
objectFactory = new com.wisemapping.jaxb.freemind.ObjectFactory();
nodesMap = new HashMap<String, Node>();
nodesMap = new HashMap<>();
final com.wisemapping.jaxb.wisemap.Map mindmapMap;
try {
@@ -124,15 +124,7 @@ public class FreemindExporter
}
JAXBUtils.saveMap(freemindMap, outputStream);
} catch (JAXBException e) {
throw new ExportException(e);
} catch (UnsupportedEncodingException e) {
throw new ExportException(e);
} catch (SAXException e) {
throw new ExportException(e);
} catch (ParserConfigurationException e) {
throw new ExportException(e);
} catch (IOException e) {
} catch (JAXBException | SAXException | IOException | ParserConfigurationException e) {
throw new ExportException(e);
}
}

View File

@@ -41,9 +41,7 @@ public class XSLTExporter implements Exporter {
final CharArrayReader reader = new CharArrayReader(mmos.toString("iso-8859-1").toCharArray());
final Source mmSource = new StreamSource(reader);
transformer.transform(mmSource, new StreamResult(outputStream));
} catch (TransformerException e) {
throw new ExportException(e);
} catch (UnsupportedEncodingException e) {
} catch (TransformerException | UnsupportedEncodingException e) {
throw new ExportException(e);
}

View File

@@ -26,13 +26,11 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.wisemapping.exceptions.UnsupportedBrowserException;
import java.util.Set;
public class BrowserSupportInterceptor extends HandlerInterceptorAdapter {
private Set<String> exclude;
public static final String USER_AGENT = "wisemapping.user_agent";
private static final String USER_AGENT = "wisemapping.user_agent";
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, Object object) throws Exception {
@@ -54,15 +52,16 @@ public class BrowserSupportInterceptor extends HandlerInterceptorAdapter {
}
}
// It's a supported browser ?.
if (!userAgent.isBrowserSupported()) {
throw new UnsupportedBrowserException();
}
// Is a Explorer 9 or less without Google Chrome Frame ?.
if (userAgent.needsGCF()) {
throw new GoogleChromeFrameRequiredException();
}
return true;
// // It's a supported browser ?.
// if (!userAgent.isBrowserSupported()) {
// throw new UnsupportedBrowserException();
// }
//
// // Is a Explorer 9 or less without Google Chrome Frame ?.
// if (userAgent.needsGCF()) {
// throw new GoogleChromeFrameRequiredException();
// }
}

View File

@@ -39,26 +39,27 @@ public class SupportedUserAgent implements Serializable {
public boolean isBrowserSupported() {
final UserAgent userAgent = this.getUserAgent();
final Browser browser = userAgent.getBrowser();
final OperatingSystem os = userAgent.getOperatingSystem();
final Version version = userAgent.getBrowserVersion();
final int majorVersion = version != null ? Integer.parseInt(version.getMajorVersion()) : -1;
// final UserAgent userAgent = this.getUserAgent();
// final Browser browser = userAgent.getBrowser();
// final OperatingSystem os = userAgent.getOperatingSystem();
// final Version version = userAgent.getBrowserVersion();
// final int majorVersion = version != null ? Integer.parseInt(version.getMajorVersion()) : -1;
//
// boolean result = browser == Browser.FIREFOX && majorVersion >= 10;
// result = result || browser == Browser.FIREFOX2 && majorVersion >= 17;
// result = result || browser == Browser.FIREFOX3 && majorVersion >= 29;
// result = result || browser == Browser.FIREFOX4 && majorVersion >= 40;
// result = result || browser == Browser.IE8 || browser == Browser.IE9 || browser == Browser.IE11 ;
// result = result || browser == Browser.IE && majorVersion >= 8;
// result = result || browser == Browser.OPERA10 && majorVersion >= 11;
// result = result || browser == Browser.CHROME && majorVersion >= 18;
// result = result || browser == Browser.SAFARI5;
// result = result || browser == Browser.SAFARI && majorVersion >= 5;
// result = result || browser == Browser.MOBILE_SAFARI;
// result = result || os.isMobileDevice() && (os == OperatingSystem.ANDROID || os == OperatingSystem.iOS4_IPHONE);
// result = result || browser.getBrowserType() == BrowserType.ROBOT;
boolean result = browser == Browser.FIREFOX && majorVersion >= 10;
result = result || browser == Browser.FIREFOX2 && majorVersion >= 17;
result = result || browser == Browser.FIREFOX3 && majorVersion >= 29;
result = result || browser == Browser.IE8 || browser == Browser.IE9 || browser == Browser.IE11 ;
result = result || browser == Browser.IE && majorVersion >= 8;
result = result || browser == Browser.OPERA10 && majorVersion >= 11;
result = result || browser == Browser.CHROME && majorVersion >= 18;
result = result || browser == Browser.SAFARI5;
result = result || browser == Browser.SAFARI && majorVersion >= 5;
result = result || browser == Browser.MOBILE_SAFARI;
result = result || os.isMobileDevice() && (os == OperatingSystem.ANDROID || os == OperatingSystem.iOS4_IPHONE);
result = result || browser.getBrowserType() == BrowserType.ROBOT;
return result;
return true;
}
@NotNull

View File

@@ -135,7 +135,7 @@ public class FreemindImporter
result.setTitle(mapName);
result.setDescription(description);
} catch (JAXBException | IOException | TransformerException e) {
} catch (JAXBException | TransformerException e) {
throw new ImporterException(e);
}
return result;

View File

@@ -1,30 +1,30 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.mail;
import org.apache.velocity.app.VelocityEngine;
import org.jetbrains.annotations.NotNull;
import com.wisemapping.util.VelocityEngineUtils;
import com.wisemapping.util.VelocityEngineWrapper;
import org.jetbrains.annotations.NotNull;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.mail.javamail.MimeMessagePreparator;
import org.springframework.ui.velocity.VelocityEngineUtils;
import javax.mail.internet.MimeMessage;
import java.util.Map;
@@ -34,7 +34,7 @@ public final class Mailer {
//~ Instance fields ......................................................................................
private JavaMailSender mailSender;
private VelocityEngine velocityEngine;
private VelocityEngineWrapper velocityEngineWrapper;
private String serverFromEmail;
private String supportEmail;
private String errorReporterEmail;
@@ -62,7 +62,7 @@ public final class Mailer {
message.setFrom(from);
message.setSubject(subject);
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, model);
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
message.setText(messageBody, true);
}
};
@@ -74,8 +74,8 @@ public final class Mailer {
this.mailSender = mailer;
}
public void setVelocityEngine(VelocityEngine engine) {
this.velocityEngine = engine;
public void setVelocityEngineWrapper(VelocityEngineWrapper engine) {
this.velocityEngineWrapper = engine;
}
public String getSupportEmail() {

View File

@@ -160,6 +160,12 @@ public class Mindmap {
return isPublic;
}
//@Todo: This is a hack to overcome some problem with JS EL. For some reason, ${mindmap.public} fails as not supported.
// More research is needed...
public boolean isAccessible() {
return isPublic();
}
public void setPublic(boolean isPublic) {
this.isPublic = isPublic;
}

View File

@@ -215,7 +215,7 @@ public class MindmapIcons {
private static void load() {
try {
if (iconsByFamily == null) {
iconsByFamily = new TreeMap<IconFamily, List<MindmapIcon>>();
iconsByFamily = new TreeMap<>();
Field[] fields = MindmapIcons.class.getDeclaredFields();
for (Field field : fields) {

View File

@@ -72,7 +72,7 @@ public class AdminController extends BaseController {
}
@ApiOperation("Note: Administration permissions required.")
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email}", produces = {"application/json", "application/xml"})
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email:.+}", produces = {"application/json", "application/xml"})
@ResponseBody
public RestUser getUserByEmail(@PathVariable String email) throws IOException {
final User user = userService.getUserBy(email);

View File

@@ -1,20 +1,20 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest;

View File

@@ -1,36 +1,39 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpMessageConverter {
public class DebugMappingJacksonHttpMessageConverter extends MappingJackson2HttpMessageConverter {
@Override
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException, JsonHttpMessageNotReadableException {
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws JsonHttpMessageNotReadableException {
try {
final byte[] bytes = IOUtils.toByteArray(inputMessage.getBody());
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
@@ -38,9 +41,7 @@ public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpM
return super.readInternal(clazz, wrap);
} catch (org.springframework.http.converter.HttpMessageNotReadableException e) {
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
} catch (IOException e) {
} catch (HttpMessageNotReadableException | IOException e) {
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
}
}
@@ -57,7 +58,7 @@ class WrapHttpInputMessage implements HttpInputMessage {
}
@Override
public InputStream getBody() throws IOException {
public InputStream getBody() {
return body;
}

View File

@@ -1,20 +1,20 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest;
@@ -53,6 +53,7 @@ import com.wisemapping.service.MindmapService;
import com.wisemapping.validator.MapInfoValidator;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiParam;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -72,6 +73,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
@@ -84,8 +86,10 @@ import java.util.Set;
@Api(value = "mindmap", description = "User Mindmap Objects.")
@Controller
public class MindmapController extends BaseController {
final Logger logger = Logger.getLogger("com.wisemapping");
private static final String LATEST_HISTORY_REVISION = "latest";
public static final String LATEST_HISTORY_REVISION = "latest";
@Qualifier("mindmapService")
@Autowired
private MindmapService mindmapService;
@@ -254,15 +258,13 @@ public class MindmapController extends BaseController {
}
@ApiIgnore
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/document/xml", "/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml"})
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/document/xml", "/maps/{id}/document/xml-pub"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
@ResponseBody
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
// I should not return byte, but there is some encoding issue here. Further research needed.
response.setCharacterEncoding("UTF-8");
final Mindmap mindmap = findMindmapById(id);
String xmlStr = mindmap.getXmlStr();
return xmlStr.getBytes("UTF-8");
return xmlStr.getBytes(StandardCharsets.UTF_8);
}
@ApiIgnore
@@ -281,11 +283,9 @@ public class MindmapController extends BaseController {
}
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml"})
@RequestMapping(method = RequestMethod.GET, value = {"/maps/{id}/{hid}/document/xml"}, consumes = {"text/plain"}, produces = {"application/xml; charset=UTF-8"})
@ResponseBody
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
// I should not return byte, but there is some encoding issue here. Further research needed.
response.setCharacterEncoding("UTF-8");
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
return mindmapHistory.getUnzipXml();
}
@@ -301,16 +301,20 @@ public class MindmapController extends BaseController {
final LockInfo lockInfo = lockManager.getLockInfo(mindmap);
if (lockInfo.getUser().identityEquality(user)) {
final boolean outdated = mindmap.getLastModificationTime().getTimeInMillis() > timestamp;
long savedTimestamp = mindmap.getLastModificationTime().getTimeInMillis();
final boolean outdated = savedTimestamp > timestamp;
if (lockInfo.getSession() == session) {
// Timestamp might not be returned to the client. This try to cover this case, ignoring the client timestamp check.
final User lastEditor = mindmap.getLastEditor();
boolean editedBySameUser = lastEditor == null || user.identityEquality(lastEditor);
if (outdated && !editedBySameUser) {
throw new SessionExpiredException("Map has been updated by " + (lastEditor.getEmail()) + ",Timestamp:" + timestamp + "," + mindmap.getLastModificationTime().getTimeInMillis() + ", User:" + lastEditor.getId() + ":" + user.getId() + ",Mail:'" + lastEditor.getEmail() + "':'" + user.getEmail(), lastEditor);
throw new SessionExpiredException("Map has been updated by " + (lastEditor.getEmail()) + ",Timestamp:" + timestamp + "," + savedTimestamp + ", User:" + lastEditor.getId() + ":" + user.getId() + ",Mail:'" + lastEditor.getEmail() + "':'" + user.getEmail(), lastEditor);
}
} else if (outdated) {
throw new MultipleSessionsOpenException("Sessions:" + session + ":" + lockInfo.getSession() + ",Timestamp: " + timestamp + ": " + lockInfo.getTimestamp() + ",User:");
logger.warn("Sessions:" + session + ":" + lockInfo.getSession() + ",Timestamp: " + timestamp + ": " + savedTimestamp);
// @Todo: Temporally disabled to unblock save action. More research needed.
// throw new MultipleSessionsOpenException("Sessions:" + session + ":" + lockInfo.getSession() + ",Timestamp: " + timestamp + ": " + savedTimestamp);
}
} else {
throw new SessionExpiredException("Different Users.", lockInfo.getUser());
@@ -388,7 +392,7 @@ public class MindmapController extends BaseController {
// Update map ...
final Mindmap mindmap = findMindmapById(id);
mindmap.setTitle(title);
mindmapService.updateMindmap(mindMap, !true);
mindmapService.updateMindmap(mindMap, false);
}
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
@@ -457,7 +461,7 @@ public class MindmapController extends BaseController {
// Update map ...
final Mindmap mindmap = findMindmapById(id);
mindmap.setDescription(description);
mindmapService.updateMindmap(mindMap, !true);
mindmapService.updateMindmap(mindMap, false);
}
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "application/xml"})
@@ -473,7 +477,7 @@ public class MindmapController extends BaseController {
// Update map status ...
mindMap.setPublic(Boolean.parseBoolean(value));
mindmapService.updateMindmap(mindMap, !true);
mindmapService.updateMindmap(mindMap, false);
}
@@ -523,7 +527,7 @@ public class MindmapController extends BaseController {
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void batchDelete(@RequestParam(required = true) String ids) throws IOException, WiseMappingException {
final User user = Utils.getUser();
final String[] mapsIds = ids.split(",");
final String[] mapsIds = ",".split(ids);
for (final String mapId : mapsIds) {
final Mindmap mindmap = findMindmapById(Integer.parseInt(mapId));
mindmapService.removeMindmap(mindmap, user);
@@ -644,11 +648,12 @@ public class MindmapController extends BaseController {
final User user = Utils.getUser();
final Label delegated = restLabel.getDelegated();
delegated.setCreator(user);
final Label found = labelService.getLabelById(labelId, user);
if (found == null) {
throw new LabelCouldNotFoundException("Label could not be found. Id: " + labelId);
}
for (String id : ids.split(",")) {
for (String id : ",".split(ids)) {
final int mindmapId = Integer.parseInt(id);
final Mindmap mindmap = findMindmapById(mindmapId);
final Label label = mindmap.findLabel(labelId);

View File

@@ -41,7 +41,7 @@ public class TransformerController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/pdf"}, consumes = {"image/svg+xml"})
@ResponseBody
public ModelAndView transformPdf(@RequestBody @Nullable final String content) throws IOException {
public ModelAndView transformPdf(@RequestBody @Nullable final String content) {
final Map<String, Object> values = new HashMap<String, Object>();
if (content == null || content.length() == 0) {
throw new IllegalArgumentException("Body can not be null.");
@@ -53,7 +53,7 @@ public class TransformerController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/svg+xml"}, consumes = {"image/svg+xml"})
@ResponseBody
public ModelAndView transformSvg(@RequestBody @Nullable final String content) throws IOException {
public ModelAndView transformSvg(@RequestBody @Nullable final String content) {
final Map<String, Object> values = new HashMap<String, Object>();
if (content == null || content.length() == 0) {
throw new IllegalArgumentException("Body can not be null.");
@@ -65,7 +65,7 @@ public class TransformerController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"image/png"}, consumes = {"image/svg+xml"})
@ResponseBody
public ModelAndView transformPng(@RequestBody @Nullable final String content) throws IOException {
public ModelAndView transformPng(@RequestBody @Nullable final String content) {
final Map<String, Object> values = new HashMap<String, Object>();
if (content == null || content.length() == 0) {
throw new IllegalArgumentException("Body can not be null.");

View File

@@ -19,10 +19,9 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.wisemapping.model.Collaboration;
import com.wisemapping.model.CollaborationRole;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -19,7 +19,7 @@
package com.wisemapping.rest.model;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -18,19 +18,16 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.User;
import com.wisemapping.util.TimeUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar;
import java.util.Date;
@XmlRootElement(name = "collaborator")
@XmlAccessorType(XmlAccessType.PROPERTY)

View File

@@ -18,10 +18,10 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.exceptions.Severity;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.context.MessageSource;

View File

@@ -1,17 +1,18 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.Label;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
@XmlRootElement(name = "label")
@XmlAccessorType(XmlAccessType.PROPERTY)

View File

@@ -1,7 +1,7 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.wisemapping.model.Label;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -19,10 +19,10 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.Collaborator;
import com.wisemapping.service.LockInfo;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -19,7 +19,7 @@
package com.wisemapping.rest.model;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -19,6 +19,9 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.CollaborationProperties;
import com.wisemapping.model.CollaborationRole;
@@ -26,9 +29,6 @@ import com.wisemapping.model.Collaborator;
import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User;
import com.wisemapping.util.TimeUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

View File

@@ -19,10 +19,10 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.MindMapHistory;
import com.wisemapping.model.User;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -1,4 +1,4 @@
/*
/**
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
@@ -19,7 +19,7 @@
package com.wisemapping.rest.model;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -19,6 +19,9 @@
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.Collaboration;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.Label;
@@ -26,9 +29,6 @@ import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.util.TimeUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -36,7 +36,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Calendar;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

View File

@@ -1,27 +1,27 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest.model;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.Mindmap;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;

View File

@@ -1,28 +1,28 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest.model;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wisemapping.model.User;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
@@ -32,7 +32,6 @@ import java.util.Calendar;
import java.util.Set;
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.PROPERTY)
@JsonAutoDetect(
@@ -51,8 +50,10 @@ public class RestUser {
public RestUser(@NotNull User user) {
this.user = user;
this.password = user.getPassword();
}
@JsonIgnore
public Calendar getCreationDate() {
return user.getCreationDate();
}
@@ -81,10 +82,6 @@ public class RestUser {
user.setLastname(lastname);
}
// public boolean isActive() {
// return user.isActive();
// }
public long getId() {
return user.getId();
}
@@ -101,10 +98,6 @@ public class RestUser {
user.setEmail(email);
}
public void setCreationDate(Calendar creationDate) {
// user.setCreationDate(creationDate);
}
public void setPassword(final String password) {
this.user.setPassword(password);
this.password = password;

View File

@@ -1,20 +1,20 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.rest.view;
@@ -55,7 +55,7 @@ public class TransformView extends AbstractView {
}
@Override
protected void renderMergedOutputModel(@NotNull Map<String, Object> viewMap, @NotNull HttpServletRequest request, @NotNull final HttpServletResponse response) throws Exception {
protected void renderMergedOutputModel(@NotNull Map<String, Object> viewMap, @NotNull HttpServletRequest request, @NotNull final HttpServletResponse response) {
final String content = (String) viewMap.get("content");
final String filename = (String) viewMap.get("filename");
@@ -80,21 +80,22 @@ public class TransformView extends AbstractView {
this.setContentDisposition(request, response, fileName);
// Change image link URL.
final ServletContext servletContext = request.getSession().getServletContext();
final ServletContext servletContext = getServletContext();
final ExporterFactory factory = new ExporterFactory(servletContext);
try {
// Write the conversion content ...
final ServletOutputStream outputStream = response.getOutputStream();
if (exportFormat == ExportFormat.FREEMIND) {
response.setCharacterEncoding("ASCII");
response.setContentType(String.format("%s; charset=%s", contentType, "ASCII"));
factory.export(properties, content, outputStream, null);
} else if (exportFormat == ExportFormat.WISEMAPPING) {
response.setCharacterEncoding(DEFAULT_ENCODING);
response.setContentType(String.format("%s; charset=%s", contentType, DEFAULT_ENCODING));
final Object mindmap = viewMap.get("mindmap");
final StreamResult result = new StreamResult(outputStream);
jaxbMarshaller.marshal(mindmap, result);
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER || exportFormat == ExportFormat.MINDJET) {
response.setCharacterEncoding(DEFAULT_ENCODING);
response.setContentType(String.format("%s; charset=%s", contentType, DEFAULT_ENCODING));
factory.export(properties, content, outputStream, null);
} else {
// Image export ...
@@ -112,9 +113,9 @@ public class TransformView extends AbstractView {
String disposition = fileName;
try {
byte[] fileNameBytes = fileName.getBytes((isInternetExplorer) ? ("windows-1250") : ("utf-8"));
String dispositionFileName = "";
final StringBuilder dispositionFileName = new StringBuilder();
for (byte b : fileNameBytes) {
dispositionFileName += (char) (b & 0xff);
dispositionFileName.append((char) (b & 0xff));
}
disposition = "attachment; filename=\"" + dispositionFileName + "\"";
} catch (UnsupportedEncodingException ence) {

View File

@@ -1,20 +1,20 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
@@ -23,9 +23,9 @@ import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.crypto.password.PasswordEncoder;
public class AuthenticationProvider implements org.springframework.security.authentication.AuthenticationProvider {
@@ -41,7 +41,8 @@ public class AuthenticationProvider implements org.springframework.security.auth
final UserDetails userDetails = getUserDetailsService().loadUserByUsername(email);
final User user = userDetails.getUser();
final String credentials = (String) auth.getCredentials();
if (user == null || credentials == null || !encoder.isPasswordValid(user.getPassword(), credentials, null)) {
if (user == null || credentials == null || !encoder.matches(user.getPassword(), credentials)) {
throw new BadCredentialsException("Username/Password does not match for " + auth.getPrincipal());
}
userDetailsService.getUserService().auditLogin(user);
@@ -49,7 +50,7 @@ public class AuthenticationProvider implements org.springframework.security.auth
}
@Override
public boolean supports(final Class<? extends Object> authentication) {
public boolean supports(final Class<?> authentication) {
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
}

View File

@@ -24,8 +24,8 @@ public class AuthenticationSuccessHandler extends SavedRequestAwareAuthenticatio
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
SavedRequest savedRequest = cache.getRequest(request, response);
if (savedRequest!=null && savedRequest.getRedirectUrl().contains("c/restful")) {
cache.removeRequest(request,response);
if (savedRequest != null && savedRequest.getRedirectUrl().contains("c/restful")) {
cache.removeRequest(request, response);
}
super.onAuthenticationSuccess(request, response, authentication);
}

View File

@@ -1,54 +0,0 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.dao.DataAccessException;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
public class CustomPasswordEncoder
implements PasswordEncoder {
private PasswordEncoder delegateEncoder = new ShaPasswordEncoder();
private static final String ENC_PREFIX = "ENC:";
public String encodePassword(@NotNull String rawPass, @Nullable Object salt) throws DataAccessException {
String password = rawPass;
if (!rawPass.startsWith(ENC_PREFIX)) {
password = ENC_PREFIX + delegateEncoder.encodePassword(rawPass, salt);
}
return password;
}
public boolean isPasswordValid(@NotNull String encPass, @NotNull String rawPass, Object salt) throws DataAccessException {
String pass1 = "" + encPass;
String pass2 = rawPass;
if (pass1.startsWith(ENC_PREFIX)) {
pass2 = encodePassword(rawPass, salt);
}
return pass1.equals(pass2);
}
}

View File

@@ -0,0 +1,25 @@
package com.wisemapping.security;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.DelegatingPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import java.util.HashMap;
import java.util.Map;
public class DefaultPasswordEncoderFactories {
private static final String ENCODING_ID = "bcrypt";
static PasswordEncoder createDelegatingPasswordEncoder() {
final Map<String, PasswordEncoder> encoders = new HashMap<>();
encoders.put(ENCODING_ID, new BCryptPasswordEncoder(16));
DelegatingPasswordEncoder result = new DelegatingPasswordEncoder(ENCODING_ID, encoders);
result.setDefaultPasswordEncoderForMatches(new LegacyPasswordEncoder());
return result;
}
}

View File

@@ -0,0 +1,157 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.security;
import org.apache.log4j.Logger;
import org.springframework.security.crypto.codec.Base64;
import org.springframework.security.crypto.codec.Hex;
import org.springframework.security.crypto.codec.Utf8;
import org.springframework.security.crypto.password.MessageDigestPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.util.Assert;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.springframework.security.crypto.codec.Base64;
import org.springframework.security.crypto.codec.Hex;
import org.springframework.security.crypto.codec.Utf8;
import org.springframework.util.Assert;
public class LegacyPasswordEncoder implements PasswordEncoder {
final private static Logger logger = Logger.getLogger("com.wisemapping.security.LegacyPasswordEncoder");
private static final String ENC_PREFIX = "ENC:";
private final ShaPasswordEncoder sha1Encoder = new ShaPasswordEncoder();
@Override
public String encode(CharSequence rawPassword) {
logger.debug("LegacyPasswordEncoder encode executed.");
return ENC_PREFIX + sha1Encoder.encode(rawPassword.toString(), "");
}
@Override
public boolean matches(CharSequence rawPassword, String encodedPassword) {
final String encode = encode(rawPassword);
return encode.equals(encodedPassword);
}
}
/**
* Just copied to keep compatibility with Spring 3.
*/
class ShaPasswordEncoder {
private final String algorithm;
private boolean encodeHashAsBase64;
/**
* The digest algorithm to use
* Supports the named <a href="http://java.sun.com/j2se/1.4.2/docs/guide/security/CryptoSpec.html#AppA">
* Message Digest Algorithms</a> in the Java environment.
**/
ShaPasswordEncoder() {
this("SHA-1", false);
}
/**
* Convenience constructor for specifying the algorithm and whether or not to enable base64 encoding
*
* @param algorithm
* @param encodeHashAsBase64
* @throws IllegalArgumentException if an unknown
*/
private ShaPasswordEncoder(String algorithm, boolean encodeHashAsBase64) throws IllegalArgumentException {
this.algorithm = algorithm;
this.encodeHashAsBase64 = encodeHashAsBase64;
getMessageDigest();
}
/**
* Encodes the rawPass using a MessageDigest.
* If a salt is specified it will be merged with the password before encoding.
*
* @param rawPass The plain text password
* @param salt The salt to sprinkle
* @return Hex string of password digest (or base64 encoded string if encodeHashAsBase64 is enabled.
*/
public String encode(String rawPass, Object salt) {
String saltedPass = mergePasswordAndSalt(rawPass, salt, false);
MessageDigest messageDigest = getMessageDigest();
byte[] digest = messageDigest.digest(Utf8.encode(saltedPass));
if (getEncodeHashAsBase64()) {
return Utf8.decode(Base64.encode(digest));
} else {
return new String(Hex.encode(digest));
}
}
/**
* Get a MessageDigest instance for the given algorithm.
* Throws an IllegalArgumentException if <i>algorithm</i> is unknown
*
* @return MessageDigest instance
* @throws IllegalArgumentException if NoSuchAlgorithmException is thrown
*/
private final MessageDigest getMessageDigest() throws IllegalArgumentException {
try {
return MessageDigest.getInstance(algorithm);
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("No such algorithm [" + algorithm + "]");
}
}
//~ Methods ========================================================================================================
private boolean getEncodeHashAsBase64() {
return encodeHashAsBase64;
}
private String mergePasswordAndSalt(String password, Object salt, boolean strict) {
if (password == null) {
password = "";
}
if (strict && (salt != null)) {
if ((salt.toString().lastIndexOf("{") != -1)
|| (salt.toString().lastIndexOf("}") != -1)) {
throw new IllegalArgumentException("Cannot use { or } in salt.toString()");
}
}
if ((salt == null) || "".equals(salt)) {
return password;
} else {
return password + "{" + salt.toString() + "}";
}
}
}

View File

@@ -0,0 +1,91 @@
package com.wisemapping.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.client.fluent.Form;
import org.apache.http.client.fluent.Request;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RecaptchaService {
final private static Logger logger = Logger.getLogger(RecaptchaService.class);
final private static String GOOGLE_RECAPTCHA_VERIFY_URL =
"https://www.google.com/recaptcha/api/siteverify";
private final static ObjectMapper objectMapper = new ObjectMapper();
private String recaptchaSecret;
public String verifyRecaptcha(String ip, String recaptchaResponse) {
final List<NameValuePair> build = Form.form()
.add("secret", recaptchaSecret)
.add("response", recaptchaResponse)
.add("remoteip", ip)
.build();
// Add logs ...
logger.debug("Response from remoteip: " + ip);
logger.debug("Response from recaptchaSecret: " + recaptchaSecret);
logger.debug("Response from recaptchaResponse: " + recaptchaResponse);
String result = StringUtils.EMPTY;
HashMap bodyJson;
try {
final byte[] body = Request
.Post(GOOGLE_RECAPTCHA_VERIFY_URL)
.bodyForm(build)
.execute()
.returnContent()
.asBytes();
bodyJson = objectMapper
.readValue(body, HashMap.class);
logger.debug("Response from recaptcha after parse: " + bodyJson);
final Boolean success = (Boolean) bodyJson.get("success");
if (!success) {
final List<String> errorCodes = (List<String>) bodyJson
.get("error-codes");
result = RecaptchaUtil.RECAPTCHA_ERROR_CODE.get(errorCodes.get(0));
}
} catch (IOException e) {
logger.error(e.getMessage(), e);
result = e.getMessage();
}
logger.debug("Captcha Result:" + result);
return result;
}
public void setRecaptchaSecret(String recaptchaSecret) {
this.recaptchaSecret = recaptchaSecret;
}
}
class RecaptchaUtil {
static final Map<String, String>
RECAPTCHA_ERROR_CODE = new HashMap<>();
static {
RECAPTCHA_ERROR_CODE.put("missing-input-secret",
"The secret parameter is missing");
RECAPTCHA_ERROR_CODE.put("invalid-input-secret",
"The secret parameter is invalid or malformed");
RECAPTCHA_ERROR_CODE.put("missing-input-response",
"The response parameter is missing");
RECAPTCHA_ERROR_CODE.put("invalid-input-response",
"The response parameter is invalid or malformed");
RECAPTCHA_ERROR_CODE.put("bad-request",
"The request is invalid or malformed");
}
}

View File

@@ -1,43 +1,35 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.service;
import com.wisemapping.dao.UserManager;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.mail.NotificationService;
import com.wisemapping.model.AccessAuditory;
import com.wisemapping.model.AuthenticationType;
import com.wisemapping.model.Collaborator;
import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User;
import org.apache.velocity.app.VelocityEngine;
import com.wisemapping.model.*;
import com.wisemapping.util.VelocityEngineUtils;
import com.wisemapping.util.VelocityEngineWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.velocity.VelocityEngineUtils;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.*;
public class UserServiceImpl
implements UserService {
@@ -45,7 +37,7 @@ public class UserServiceImpl
private MindmapService mindmapService;
private NotificationService notificationService;
private MessageSource messageSource;
private VelocityEngine velocityEngine;
private VelocityEngineWrapper velocityEngineWrapper;
@Override
@@ -102,7 +94,7 @@ public class UserServiceImpl
}
@Override
public void removeUser(@NotNull User user) {
public void removeUser(@NotNull User user) {
// Force object reload before removing....
final User userBy = userManager.getUserBy(user.getEmail());
userManager.removeUser(userBy);
@@ -165,7 +157,9 @@ public class UserServiceImpl
model.put("noArgs", new Object[]{});
model.put("locale", locale);
final String mapXml = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/samples/tutorial.vm", model);
final String mapXml = VelocityEngineUtils
.mergeTemplateIntoString(velocityEngineWrapper
.getVelocityEngine(), "/samples/tutorial.vm", model);
result.setXmlStr(mapXml);
result.setTitle(messageSource.getMessage("WELCOME", null, locale) + " " + firstName);
@@ -212,8 +206,8 @@ public class UserServiceImpl
this.messageSource = messageSource;
}
public void setVelocityEngine(VelocityEngine velocityEngine) {
this.velocityEngine = velocityEngine;
public void setVelocityEngineWrapper(VelocityEngineWrapper velocityEngineWrapper) {
this.velocityEngineWrapper = velocityEngineWrapper;
}
@Override

View File

@@ -27,6 +27,7 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@@ -34,11 +35,11 @@ public class JAXBUtils {
private final static Map<String, JAXBContext> context = new HashMap<String, JAXBContext>();
public static Object getMapObject(@NotNull InputStream is, @NotNull final String pakage) throws JAXBException, UnsupportedEncodingException {
public static Object getMapObject(@NotNull InputStream is, @NotNull final String pakage) throws JAXBException {
final JAXBContext context = getInstance(pakage);
final Unmarshaller unmarshaller = context.createUnmarshaller();
final Reader reader = new InputStreamReader(is, "UTF-8");
final Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8);
return unmarshaller.unmarshal(reader);
}

View File

@@ -0,0 +1,38 @@
package com.wisemapping.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.exception.VelocityException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
public class VelocityEngineUtils {
private static final Log logger = LogFactory.getLog(VelocityEngineUtils.class);
public static void mergeTemplate(
VelocityEngine velocityEngine, String templateLocation,
Map<String, Object> model, Writer writer
) throws VelocityException {
try {
VelocityContext velocityContext = new VelocityContext(model);
velocityEngine.mergeTemplate(templateLocation, "UTF-8", velocityContext, writer);
} catch (RuntimeException ex) {
throw ex;
} catch (Exception ex) {
logger.error("Why does VelocityEngine throw a generic checked exception, after all?", ex);
throw new VelocityException(ex.toString());
}
}
public static String mergeTemplateIntoString(
VelocityEngine velocityEngine, String templateLocation, Map<String, Object> model
) throws VelocityException {
StringWriter result = new StringWriter();
mergeTemplate(velocityEngine, templateLocation, model, result);
return result.toString();
}
}

View File

@@ -0,0 +1,24 @@
package com.wisemapping.util;
import org.apache.commons.collections.ExtendedProperties;
import org.apache.velocity.app.VelocityEngine;
import org.jetbrains.annotations.NotNull;
public class VelocityEngineWrapper {
private VelocityEngine velocityEngine;
public VelocityEngineWrapper() {
ExtendedProperties extendedProperties = new ExtendedProperties();
extendedProperties.setProperty("resource.loader", "class");
extendedProperties.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
this.velocityEngine = new VelocityEngine();
velocityEngine.setExtendedProperties(extendedProperties);
}
@NotNull
public VelocityEngine getVelocityEngine() {
return velocityEngine;
}
}

View File

@@ -26,6 +26,5 @@ public interface Messages {
String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS";
String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS";
String PASSWORD_MISSMATCH = "PASSWORD_MISSMATCH";
String CAPTCHA_ERROR = "CAPTCHA_ERROR";
String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR";
}

View File

@@ -18,10 +18,10 @@
package com.wisemapping.validator;
import com.wisemapping.service.RecaptchaService;
import com.wisemapping.service.UserService;
import com.wisemapping.view.UserBean;
import com.wisemapping.model.Constants;
import net.tanesha.recaptcha.ReCaptcha;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.validation.Errors;
@@ -32,7 +32,7 @@ public class UserValidator
implements Validator {
private UserService userService;
private ReCaptcha captchaService;
private RecaptchaService captchaService;
public boolean supports(final Class clazz) {
@@ -92,11 +92,11 @@ public class UserValidator
this.userService = userService;
}
public void setCaptchaService(@NotNull final ReCaptcha captchaService) {
public void setCaptchaService(@NotNull final RecaptchaService captchaService) {
this.captchaService = captchaService;
}
public ReCaptcha getCaptchaService() {
public RecaptchaService getCaptchaService() {
return captchaService;
}
}

View File

@@ -47,6 +47,12 @@ public class MindMapBean {
return mindmap.isPublic();
}
//@Todo: This is a hack to overcome some problem with JS EL. For some reason, ${mindmap.public} fails as not supported.
// More research is needed...
public boolean isAccessible() {
return getPublic();
}
public String getTitle() {
return mindmap.getTitle();
}

View File

@@ -1,36 +1,35 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.webmvc;
import com.wisemapping.model.AuthenticationType;
import com.wisemapping.service.InvalidAuthSchemaException;
import com.wisemapping.validator.Messages;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.AuthenticationType;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.InvalidAuthSchemaException;
import com.wisemapping.service.InvalidUserEmailException;
import com.wisemapping.service.RecaptchaService;
import com.wisemapping.service.UserService;
import com.wisemapping.validator.Messages;
import com.wisemapping.validator.UserValidator;
import com.wisemapping.view.UserBean;
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaResponse;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -55,11 +54,13 @@ public class UsersController {
private UserService userService;
@Autowired
private ReCaptcha captchaService;
private RecaptchaService captchaService;
@Value("${google.recaptcha.enabled}")
@Value("${google.recaptcha2.enabled}")
private boolean captchaEnabled;
@Value("${google.recaptcha2.siteKey}")
private String recaptchaSiteKey;
@RequestMapping(value = "user/resetPassword", method = RequestMethod.GET)
public ModelAndView showResetPasswordPage() {
@@ -74,10 +75,7 @@ public class UsersController {
userService.resetPassword(email);
result = new ModelAndView("forgotPasswordSuccess");
} catch (InvalidUserEmailException e) {
result = new ModelAndView("forgotPasswordError");
}
catch (InvalidAuthSchemaException e) {
} catch (InvalidUserEmailException | InvalidAuthSchemaException e) {
result = new ModelAndView("forgotPasswordError");
}
return result;
@@ -89,10 +87,8 @@ public class UsersController {
// If captcha is enabled, generate it ...
final Properties prop = new Properties();
prop.put("theme", "white");
final String captchaHtml = captchaService.createRecaptchaHtml(null, prop);
request.setAttribute("captchaHtml", captchaHtml);
request.setAttribute("captchaEnabled", true);
request.setAttribute("recaptchaSiteKey", recaptchaSiteKey);
request.setAttribute("recaptchaEnabled", true);
}
return new ModelAndView("userRegistration", "user", new UserBean());
}
@@ -115,7 +111,7 @@ public class UsersController {
boolean confirmRegistrationByEmail = false;
user.setAuthenticationType(AuthenticationType.DATABASE);
userService.createUser(user, confirmRegistrationByEmail,true);
userService.createUser(user, confirmRegistrationByEmail, true);
// Forward to the success view ...
result = new ModelAndView("userRegistrationSuccess");
@@ -130,7 +126,7 @@ public class UsersController {
return "accountSettings";
}
private BindingResult validateRegistrationForm(@NotNull UserBean userBean, @NotNull HttpServletRequest request, @NotNull BindingResult bindingResult) {
private void validateRegistrationForm(@NotNull UserBean userBean, @NotNull HttpServletRequest request, @NotNull BindingResult bindingResult) {
final UserValidator userValidator = new UserValidator();
userValidator.setUserService(userService);
userValidator.setCaptchaService(captchaService);
@@ -138,21 +134,18 @@ public class UsersController {
// If captcha is enabled, generate it ...
if (captchaEnabled) {
final String challenge = request.getParameter("recaptcha_challenge_field");
final String uresponse = request.getParameter("recaptcha_response_field");
final String gReponse = request.getParameter("g-recaptcha-response");
if (challenge != null && uresponse != null) {
if (gReponse != null) {
final String remoteAddr = request.getRemoteAddr();
final ReCaptchaResponse reCaptchaResponse = captchaService.checkAnswer(remoteAddr, challenge, uresponse);
if (!reCaptchaResponse.isValid()) {
bindingResult.rejectValue("captcha", Messages.CAPTCHA_ERROR);
final String reCaptchaResponse = captchaService.verifyRecaptcha(remoteAddr, gReponse);
if (!reCaptchaResponse.isEmpty()) {
bindingResult.rejectValue("captcha", reCaptchaResponse);
}
} else {
bindingResult.rejectValue("captcha", Messages.CAPTCHA_LOADING_ERROR);
}
}
return bindingResult;
}
}

View File

@@ -0,0 +1 @@
# Solves error Can't find bundle for base name javax.xml.bind.Messages, locale en_US

View File

@@ -52,7 +52,6 @@ PASSWORD_MISSMATCH=La contrasenya no concorda
WISEMAPPING_ACCOUNT_MESSAGE=Si us plau verifiqui la informació i llegeixi les condicions del servei.
REGISTRATION_CLICK_ADVICE= Seleccionant "Registre" està acceptant les condicions del servei.
REGISTRATION_TITLE_MSG=Completi el següent formulari per a convertir-se en memore de la comunitat WiseMapping. </br>El registre és <strong>de franc</strong> i només és un moment.
CAPTCHA_ERROR=Entri els caràcters com a la imatge superior.
CREATOR=Creador
CREATION_TIME=Data de creació
EDITORS=Editors

View File

@@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=Ihr Passwort wurde erfolgreich geändert
WISEMAPPING_ACCOUNT_MESSAGE=Bitte überprüfen Sie die eingegebenen WiseMapping Benutzerkonto Informationen und Geschäftsbedingungen
REGISTRATION_CLICK_ADVICE= Mit der Registrierung erklären Sie ihr Einverständnis mit den Geschäftsbedingungen und Datenschutzregeln von WiseMapping.
REGISTRATION_TITLE_MSG=Bitte fülle die Felder aus, um ein Mitglied der WiseMapping Gemeinschaft zu werden. Die Registrierung is <b>kostenlos</b> und in wenigen Augenblicken erledigt.
CAPTCHA_ERROR=Bitte geben Sie die Buchstaben wie auf dem Bild dargestellt ein.
CREATOR=Urheber
CREATION_TIME=Erstellungs Datum
EDITORS=Verfasser

View File

@@ -66,7 +66,6 @@ CHANGE_PASSWORD_SUCCESS=Your password has been changed successfully.
WISEMAPPING_ACCOUNT_MESSAGE=Please check the WiseMapping Account information you've entered above, and review the Terms of Service
REGISTRATION_CLICK_ADVICE= By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy.
REGISTRATION_TITLE_MSG=Please, fill the fields and become a member of WiseMapping community. Registration is <b> Free</b> and takes just a moment.
CAPTCHA_ERROR=Enter the letters as they are shown in the image above.
CREATOR=Creator
CREATION_TIME=Creation Time
EDITORS=Editors
@@ -218,7 +217,7 @@ DESELECT_ALL_TOPIC=Deselect All Topic
SHORTCUTS=Shortcuts
COLLAPSE_CHILDREN=Collapse Children
KEYBOARD_SHORTCUTS_MSG=Keyboard shortcuts can help you save time by allowing you to never take your hands off the keyboard to use the mouse.
COPY_AND_PASTE_TOPICS=Copy and Page Topics
COPY_AND_PASTE_TOPICS=Copy and Paste Topics
MULTIPLE_LINES=Add multiple text lines
TERM_OF_USE=Terms and Conditions

View File

@@ -52,7 +52,6 @@ PASSWORD_MISSMATCH=La contraseña no concuerda
WISEMAPPING_ACCOUNT_MESSAGE=Por favor, verifique la información que ha ingresado y lea las condiciones del servicio.
REGISTRATION_CLICK_ADVICE= Seleccionando 'Registración' esta aceptando las condiciones de uso de arriba y la politica de privacidad.
REGISTRATION_TITLE_MSG=Complete el siguiente formulario para convertirse en un miembro de la comunidad de WiseMapping. </br>La registración es <strong>Gratis</strong> y sólo toma un momento.
CAPTCHA_ERROR=Ingrese los caracteres tal como son mostrados en la imagen arriba.
CREATOR=Creador
CREATION_TIME=Fecha de creación
EDITORS=Editores

View File

@@ -69,7 +69,6 @@ CHANGE_PASSWORD_SUCCESS=Votre mot de passe a été changé avec succès.
WISEMAPPING_ACCOUNT_MESSAGE=Merci de vérifier l'information de Compte WiseMapping que vous avez saisie, et de relire les conditions de service
REGISTRATION_CLICK_ADVICE=En cliquant "M'enregistrer" ci-dessous, vous acceptez les conditions de service ci-dessus ainsi que les règles de confidentialité.
REGISTRATION_TITLE_MSG=Devenez membre de la communauté WiseMapping en remplissant les champs ci-dessous. L'inscription est <b> gratuite </b> et ne prend qu'un instant.
CAPTCHA_ERROR=Saisissez les caractères affichés dans l'image ci-dessus.
CREATOR=Créateur
CREATION_TIME=Heure de création
EDITORS=Editeurs

View File

@@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=La password è stata cambiata correttamente
WISEMAPPING_ACCOUNT_MESSAGE=Prego, controllare le informazioni del tuo account WiseMapping appena inserite, e prendi note dei Termini di Servizio
REGISTRATION_CLICK_ADVICE= Cliccando su 'Registra' di seguito, si accettano i Termini di Servizio riportati e le Privacy Policy di cui sopra.
REGISTRATION_TITLE_MSG=Prego, compilare tutti i campi per diventare membri della Community WiseMapping. La registrazione è <strong> Free</strong> richiede pochi istanti.
CAPTCHA_ERROR=Inserire le lettere così come appaiono sull'immagine riportata qui sopra.
CREATOR=Creatore
CREATION_TIME=Orario di creazione
EDITORS=Editori

View File

@@ -62,7 +62,6 @@ CHANGE_PASSWORD_SUCCESS=Sua senha foi alterada com sucesso.
WISEMAPPING_ACCOUNT_MESSAGE=Confira a informação da conta WiseMapping que você inseriu acima e reveja os Termos de Serviço.
REGISTRATION_CLICK_ADVICE= Clicando em Registrar abaixo você está concordando com os Termos de Seviço acima e a Política de Privacidade.
REGISTRATION_TITLE_MSG=Preencha os campos e toene-se membro da comunidade WiseMapping. O Registro é <b> Gratuito</b> e leva só alguns instantes.
CAPTCHA_ERROR=Digite as letras como são exibidas na imagem acima.
CREATOR=Criador
CREATION_TIME=Tempo de Criação
EDITORS=Editores

View File

@@ -63,7 +63,6 @@ CHANGE_PASSWORD_SUCCESS=密码修改成功!
WISEMAPPING_ACCOUNT_MESSAGE=请检查已输入的账户信息,并查阅服务条款
REGISTRATION_CLICK_ADVICE= 点击下面的“注册”,表示你同意上面提到的服务条款和隐私政策。
REGISTRATION_TITLE_MSG=请填写表单你将成为WiseMapping社区的一员。注册<b> 免费</b> 快速。
CAPTCHA_ERROR=输入你在上面的图像中看到的字符。
CREATOR=创建者
CREATION_TIME=创建时间
EDITORS=编辑者

View File

@@ -64,7 +64,6 @@ CHANGE_PASSWORD_SUCCESS=密碼修改成功!
WISEMAPPING_ACCOUNT_MESSAGE=請檢查已輸入的帳戶資訊,並查閱服務條款
REGISTRATION_CLICK_ADVICE= 點擊下麵的“註冊”,表示你同意上面提到的服務條款和隱私政策。
REGISTRATION_TITLE_MSG=請填寫表單你將成為WiseMapping社區的一員。註冊<b> 免費</b> 快速。
CAPTCHA_ERROR=輸入你在上面的圖像中看到的字元。
CREATOR=創建者
CREATION_TIME=創建時間
EDITORS=編輯者

View File

@@ -75,12 +75,12 @@ mail.errorReporterEmail=
##################################################################################
# Enable captcha confirmation
google.recaptcha.enabled = true
google.recaptcha2.enabled = true
# ReCaptcha is the default captcha. Public and private keys are required.
# More Info: http://www.google.com/recaptcha .
google.recaptcha.privateKey = 6LeQ4tISAAAAAMfHMPRKyHupTfA-KE4QeTCnLXhK
google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr
google.recaptcha2.siteKey = 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
google.recaptcha2.secretKey = 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
##################################################################################
# Site configuration

View File

@@ -1,11 +1,7 @@
log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=WARN,stdout,R
log4j.logger.org.codehaus.jackson=WARN,stdout,R
log4j.logger.org.hibernate=WARN,stdout,R
log4j.logger.org.hibernate.engine.StatefulPersistenceContext=ERROR,stdout,R
#log4j.logger.org.hibernate.SQL=WARN,stdout,R
log4j.logger.com.wisemapping=INFO,stdout,R
log4j.logger.org.springframework=INFO,stdout,R
log4j.logger.org.hibernate.engine.internal.StatefulPersistenceContext=ERROR,stdout,R
# Stdout logger <20>
log4j.appender.stdout=org.apache.log4j.ConsoleAppender

View File

@@ -1,62 +0,0 @@
##################################################################################
# Database Configuration
##################################################################################
# MySQL 5.X configuration properties
database.url=${DATABASE_URL}
database.driver=${DATABASE_DRIVER}
database.hibernate.dialect=${DATABASE_HIBERNATE_DIALECT}
database.username=${DATABASE_USERNAME}
database.password=${DATABASE_PASSWORD}
#------------------------
# Sendgrid Configuration
#------------------------
mail.smtp.port=587
mail.smtp.host=smtp.sendgrid.net
mail.username=${SENDGRID_USERNAME}
mail.password=${SENDGRID_PASSWORD}
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.quitwait=false
# Required: "from" email account that will appear in the emails sent from the sender.
mail.serverSendEmail=daemon@wisemapping.herokuapp.com
# Optional: Support account that the users could use to contact you. This address will appear in emails and in some places in the site.
mail.supportEmail=support@wisemapping.com
# Optional: Unexpected errors will be reported to this address.
mail.errorReporterEmail=bug-report@wisemapping.com
##################################################################################
# Users Registration Configuration
##################################################################################
# Enable/Disable user registration confirmation by e-mail. If it's enabled, mail must be configured.
registration.email.enabled = false
# Enable captcha confirmation
google.recaptcha.enabled = true
# ReCaptcha is the default captcha. Public and private keys are required.
# More Info: http://www.google.com/recaptcha .
google.recaptcha.privateKey = 6LeQ4tISAAAAAMfHMPRKyHupTfA-KE4QeTCnLXhK
google.recaptcha.publicKey = 6LeQ4tISAAAAALzCGKNgRv8UqsDx7Cb0vq4wbJBr
##################################################################################
# Site configuration
##################################################################################
# Site administration user. This user will have special permissions for operations such as removing users, set password
# etc.
admin.user = admin@wisemapping.org
# Site URL. This url will be used during sharing emails and public views.
site.baseurl = http://http://wisemapping.herokuapp.com:8080
##################################################################################
# Google Analytics Settings
##################################################################################
google.analytics.enabled=false
google.analytics.account=UA-XXXX

View File

@@ -53,7 +53,7 @@
<filter>
<filter-name>hibernate</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>

View File

@@ -2,13 +2,11 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="viewSecurityAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="viewSecurityAdvice"/>
</property>
<property name="advice" ref="viewSecurityAdvice"/>
<property name="mappedNames">
<list>
<value>getMindmapUserBy</value>
@@ -22,9 +20,7 @@
<bean id="updateSecurityAdvisor"
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="updateSecurityAdvice"/>
</property>
<property name="advice" ref="updateSecurityAdvice"/>
<property name="mappedNames">
<list>
<value>save*</value>

View File

@@ -1,11 +1,8 @@
<?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-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="wiseDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${database.driver}"/>
@@ -16,14 +13,14 @@
<property name="validationQuery" value="${database.validation.query}"/>
</bean>
<!--Descoment this lines for production environments -->
<!--Descoment this lines for production environments -->
<!--<bean id="wiseDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">-->
<!--<property name="jndiName">-->
<!--<value>java:comp/env/jdbc/wisemapping</value>-->
<!--</property>-->
<!--<property name="jndiName">-->
<!--<value>java:comp/env/jdbc/wisemapping</value>-->
<!--</property>-->
<!--</bean>-->
<bean id="mindmapSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<bean id="mindmapSessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="wiseDataSource"/>
<property name="mappingResources">
<list>
@@ -43,21 +40,13 @@
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mindmapSessionFactory"/>
</property>
</bean>
<!-- Spring Data Access Exception Translator Defintion -->
<bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
<property name="dataSource" ref="wiseDataSource"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="mindmapSessionFactory"/>
</bean>
<!-- Hibernate Template Definition -->
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate5.HibernateTemplate">
<property name="sessionFactory" ref="mindmapSessionFactory"/>
<property name="jdbcExceptionTranslator" ref="jdbcExceptionTranslator"/>
</bean>
<bean id="txAttributes"
@@ -69,8 +58,7 @@
</property>
</bean>
<bean id="txInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionAttributeSource" ref="txAttributes"/>
</bean>

View File

@@ -3,11 +3,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd">
<beans>
<bean id="userManager" class="com.wisemapping.dao.UserManagerImpl">
<property name="hibernateTemplate" ref="hibernateTemplate"/>
<property name="encoder" ref="encoder"/>
<property name="encoder" ref="passwordEncoder"/>
</bean>
<bean id="mindmapManager" class="com.wisemapping.dao.MindmapManagerImpl">

View File

@@ -6,11 +6,11 @@
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.wisemapping.rest"/>
<context:annotation-config/>
@@ -50,8 +50,12 @@
</property>
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="defaultContentType" value="application/json"/>
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
<property name="favorParameter" value="true"/>
<property name="parameterName" value="mediaType"/>
<property name="defaultContentType" value="application/json" />
<property name="useJaf" value="false" />
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml"/>
@@ -68,6 +72,10 @@
<entry key="mmap" value="application/vnd.mindjet.mindmanager"/>
</map>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="contentNegotiationManager" ref="contentNegotiationManager"/>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
@@ -75,7 +83,7 @@
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
<property name="extractValueFromSingleKeyModel" value="true"/>
</bean>
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">

View File

@@ -4,9 +4,11 @@
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
http://www.springframework.org/schema/security/spring-security.xsd">
<bean id="passwordEncoder" class="com.wisemapping.security.DefaultPasswordEncoderFactories" factory-method="createDelegatingPasswordEncoder"/>
<sec:authentication-manager alias="authenticationManager">
<sec:authentication-provider ref="dbAuthenticationProvider"/>
@@ -15,7 +17,6 @@
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService"/>
<property name="encoder" ref="encoder"/>
<property name="encoder" ref="passwordEncoder"/>
</bean>
</beans>

View File

@@ -3,9 +3,9 @@
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
http://www.springframework.org/schema/security/spring-security.xsd">
<sec:authentication-manager>

View File

@@ -4,9 +4,9 @@
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
http://www.springframework.org/schema/security/spring-security.xsd">
<sec:http pattern="/css/**" security="none"/>
<sec:http pattern="/js/**" security="none"/>
@@ -17,7 +17,7 @@
<sec:http pattern="/c/login" security="none"/>
<sec:http pattern="/c/loginopenid" security="none"/>
<sec:http pattern="/c/user/registration" security="none"/>
<sec:http pattern="/c/user/resetpassword" security="none"/>
<sec:http pattern="/c/user/resetPassword" security="none"/>
<sec:http pattern="/c/home" security="none"/>
<sec:http pattern="/c/maps/*/embed" security="none"/>
@@ -36,13 +36,18 @@
<sec:http use-expressions="true" create-session="stateless" pattern="/service/**">
<sec:csrf disabled="true"/>
<sec:intercept-url pattern="/service/admin/users/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/service/admin/database/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/service/**" access="isAuthenticated() and hasRole('ROLE_USER')"/>
<sec:http-basic/>
</sec:http>
<sec:http use-expressions="true" access-denied-page="/c/login">
<sec:http use-expressions="true">
<sec:csrf disabled="true"/>
<sec:access-denied-handler error-page="/c/login"/>
<sec:intercept-url pattern="/c/restful/admin/users/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/c/restful/admin/database/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
<sec:intercept-url pattern="/c/**/*" access="isAuthenticated() and hasRole('ROLE_USER')"/>
@@ -51,7 +56,7 @@
authentication-success-handler-ref="authenticationSuccessHandler"
always-use-default-target="false"
authentication-failure-url="/c/login?login_error=2"
login-processing-url="/c/j_spring_security_check"/>
login-processing-url="/c/perform-login"/>
<sec:openid-login user-service-ref="userDetailsService"
authentication-failure-url="/c/login.jsp?login_error=true"
@@ -82,8 +87,6 @@
<sec:logout logout-url="/c/logout" invalidate-session="true" logout-success-url="/c/login"/>
</sec:http>
<bean id="encoder" class="com.wisemapping.security.CustomPasswordEncoder"/>
<import resource="wisemapping-security-${security.type}.xml"/>
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">

View File

@@ -3,17 +3,19 @@
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-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="/WEB-INF/app.properties" ignore-unresolvable="true"/>
<bean id="mailer" class="com.wisemapping.mail.Mailer" scope ="singleton">
<bean id="mailer" class="com.wisemapping.mail.Mailer">
<constructor-arg index="0" value="${mail.serverSendEmail}"/>
<constructor-arg index="1" value="${mail.supportEmail}"/>
<constructor-arg index="2" value="${mail.errorReporterEmail}"/>
<property name="mailSender" ref="mailSender"/>
<property name="velocityEngine" ref="velocityEngine"/>
<property name="velocityEngineWrapper" ref="velocityEngineWrapper"/>
</bean>
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
@@ -21,14 +23,12 @@
<property name="mindmapService" ref="mindMapServiceTarget"/>
<property name="notificationService" ref="notificationService"/>
<property name="messageSource" ref="messageSource"/>
<property name="velocityEngine" ref="velocityEngine"/>
<property name="velocityEngineWrapper" ref="velocityEngineWrapper"/>
</bean>
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target">
<ref local="userServiceTarget"/>
</property>
<property name="target" ref="userServiceTarget" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
@@ -43,6 +43,10 @@
<property name="adminUser" value="${admin.user}"/>
</bean>
<bean id="recaptchaService" class="com.wisemapping.service.RecaptchaService">
<property name="recaptchaSecret" value="${google.recaptcha2.secretKey}"/>
</bean>
<bean id="mindmapService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="com.wisemapping.service.MindmapService"/>
<property name="interceptorNames">
@@ -62,9 +66,7 @@
<bean id="labelService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target">
<ref local="labelServiceTarget"/>
</property>
<property name="target" ref="labelServiceTarget" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
@@ -87,16 +89,10 @@
</property>
</bean>
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
<bean id="velocityEngineWrapper" class="com.wisemapping.util.VelocityEngineWrapper">
</bean>
<bean id="notificationService" class="com.wisemapping.mail.NotificationService" scope ="singleton">
<bean id="notificationService" class="com.wisemapping.mail.NotificationService">
<property name="baseUrl" value="${site.baseurl}"/>
<property name="mailer" ref="mailer"/>
</bean>

View File

@@ -5,11 +5,11 @@
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.wisemapping.webmvc"/>
<context:annotation-config/>
@@ -71,10 +71,10 @@
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView"/>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/definitions.xml</value>
@@ -86,12 +86,6 @@
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
</bean>
<bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl">
<property name="privateKey" value="${google.recaptcha.privateKey}"/>
<property name="publicKey" value="${google.recaptcha.publicKey}"/>
<property name="includeNoscript" value="false"/>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

@@ -1,46 +1,7 @@
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div id="footerContainer" class="row">
<script type="text/javascript"
src="https://wisemapping.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e/en_US-f1g0rh-1988229788/6211/26/1.4.5/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=a47981d6"></script>
<script type="text/javascript"
src="https://wisemapping.atlassian.net/s/d41d8cd98f00b204e9800998ecf8427e/en_US-f1g0rh-1988229788/6211/26/1.4.5/_/download/batch/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector/com.atlassian.jira.collector.plugin.jira-issue-collector-plugin:issuecollector.js?collectorId=703b9822"></script>
<script type="text/javascript">
window.ATL_JQ_PAGE_PROPS = $.extend(window.ATL_JQ_PAGE_PROPS, {
"a47981d6": {
triggerFunction: function (showCollectorDialog) {
//Requries that jQuery is available!
jQuery("#feedbackBtn").click(function (e) {
e.preventDefault();
showCollectorDialog();
});
}
},
"703b9822": {
triggerFunction: function (showCollectorDialog) {
//Requries that jQuery is available!
jQuery("#reportIssueBtn").click(function (e) {
e.preventDefault();
showCollectorDialog();
});
}
}
});
</script>
<div class="col-md-1 col-md-offset-2">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.wisemapping.com"
data-text="Check out this site" data-via="wisemapping" data-related="wisemapping">Tweet</a>
<script>!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');</script>
</div>
<div class="col-md-1">
<!-- Place this tag where you want the +1 button to render. -->
@@ -59,8 +20,8 @@
</script>
</div>
<div class="col-md-4" style="text-align: center">
<a href="" id="feedbackBtn"><spring:message code="FEEDBACK"/></a> |
<a href="" id="reportIssueBtn"><spring:message code="REPORT_BUG"/></a> |
<a href="mailto:feedback@wisemapping.com" id="feedbackBtn"><spring:message code="FEEDBACK"/></a> |
<a href="mailto:feedback@wisemapping.com" id="reportIssueBtn"><spring:message code="REPORT_BUG"/></a> |
<a href="mailto:team@wisemapping.com"><spring:message code="CONTACT_US"/></a> |
<a href="https://wisemapping.atlassian.net/wiki/display/WS/License "><spring:message
code="LICENSE"/></a><br/>

View File

@@ -21,13 +21,13 @@
<div class="row jumbotron" id="loginPanel">
<h1><spring:message code="SIGN_IN"/></h1>
<form action="<c:url value='/c/j_spring_security_check'/>" method="POST" class="form-horizontal"
<form action="/c/perform-login" method="POST" class="form-horizontal"
id="loginForm">
<div class="form-group">
<label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label>
<div class="col-md-9">
<input type='email' tabindex="1" id="email" name='j_username' required="required"
<input type='email' tabindex="1" id="username" name='username' required="required"
class="form-control"/>
</div>
</div>
@@ -35,7 +35,7 @@
<label class="col-md-3 control-label" for="password"><spring:message code="PASSWORD"/>: </label>
<div class="col-md-9">
<input type='password' tabindex="2" id="password" name='j_password' required="required"
<input type='password' tabindex="2" id="password" name='password' required="required"
class="form-control"/>
</div>
</div>
@@ -49,7 +49,7 @@
</div>
</div>
<div class="form-group" style="text-align: center">
<a href="<c:url value="/c/user/resetPassword"/>"><spring:message code="FORGOT_PASSWORD"/></a>
<a href="/c/user/resetPassword"><spring:message code="FORGOT_PASSWORD"/></a>
</div>
<div class="form-group">
<c:if test="${not empty param.login_error}">

View File

@@ -45,7 +45,7 @@
<div class="tab-pane fade" id="publish">
<c:choose>
<c:when test="${mindmap.public}">
<c:when test="${mindmap.accessible}">
<ul class="unstyled">
<p><spring:message code="ALL_VIEW_PUBLIC"/></p>
<li><strong><spring:message code="DIRECT_LINK_EXPLANATION"/></strong>

View File

@@ -25,6 +25,9 @@
color: #ffffff;
}
</style>
<script>
function submitDialogForm() {}
</script>
<div id="keyboardTable">
<table>

View File

@@ -58,14 +58,6 @@
var persistence = mindplot.PersistenceManager.getInstance();
var mindmap = mindmap = persistence.load(mapId);
designer.loadMap(mindmap);
$('zoomIn').addEvent('click', function () {
designer.zoomIn();
});
$('zoomOut').addEvent('click', function () {
designer.zoomOut();
});
});
</script>
</head>

View File

@@ -90,14 +90,6 @@
var persistence = mindplot.PersistenceManager.getInstance();
var mindmap = mindmap = persistence.load(mapId);
designer.loadMap(mindmap);
$('zoomIn').addEvent('click', function () {
designer.zoomIn();
});
$('zoomOut').addEvent('click', function () {
designer.zoomOut();
});
});
</script>
</head>

View File

@@ -11,7 +11,7 @@
<form method="post" id="dialogMainForm" action="#" class="well form-inline">
<label for="enablePublicView" class="control-label"><spring:message code="ENABLE_PUBLISHING"/>:
<input type="checkbox" id="enablePublicView" name="publicView"
<c:if test="${mindmap.public}">
<c:if test="${mindmap.accessible}">
checked="checked"
</c:if> />
</label>
@@ -28,6 +28,7 @@
</ul>
<br/>
<div class="tab-content">
<div class="tab-pane fade active in" id="embedTab">
<div class="tab-pane fade active in" id="embedTab">
<spring:message code="BLOG_INCLUSION"/>
<div id="wizardContainer">

View File

@@ -24,6 +24,7 @@
<meta property="og:url" content="http://www.wisemapping.com"/>
<meta property="og:image" content="http://www.wisemapping.com/images/logo.png"/>
<meta property="og:site_name" content="WiseMapping.com"/>
<link rel="icon" href="favicon.ico?v=2" />
<title>
<spring:message code="SITE.TITLE"/>-
@@ -44,6 +45,8 @@
<script type="text/javascript" language="javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script src="js/less.js" type="text/javascript"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>

View File

@@ -15,7 +15,7 @@
<p><spring:message code="FORGOT_PASSWORD_MESSAGE"/></p>
<form:form method="post" commandName="resetPassword" class="form-horizontal">
<form:form method="post" modelAttribute="resetPassword" class="form-horizontal">
<label for="email" class="col-md-2 control-label"><spring:message code="EMAIL"/>: </label>
<div class="col-md-5">
<input id="email" type="email" required="required" name="email" class="form-control"/>
@@ -23,7 +23,7 @@
<input type="submit" value="<spring:message code="SEND_ME_A_NEW_PASSWORD"/>" class="btn btn-primary"
data-loading-text="<spring:message code="SENDING"/>"/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn"
onclick="window.location='<c:url value="c/maps/"/>'"/>
onclick="window.location='/c/maps/'"/>
</form:form>
<div id="register">

View File

@@ -4,7 +4,7 @@
<h1><spring:message code="USER_REGISTRATION"/></h1>
<p><spring:message code="REGISTRATION_TITLE_MSG"/></p>
<form:form method="post" commandName="user" class="form-horizontal">
<form:form method="post" modelAttribute="user" class="form-horizontal">
<div class="form-group">
<label for="email" class="col-md-2 control-label"><spring:message code="EMAIL"/>: </label>
<div class="col-md-5">
@@ -47,11 +47,9 @@
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2">
<c:if test="${requestScope.captchaEnabled}">
${requestScope.captchaHtml}
<p>
<form:errors path="captcha" cssClass="errorMsg"/>
</p>
<c:if test="${requestScope.recaptchaEnabled}">
<div class="g-recaptcha" data-sitekey="${requestScope.recaptchaSiteKey}"></div>
<p cssClass="errorMsg">${requestScope.captcha}</p>
</c:if>
</div>
</div>

View File

@@ -92,11 +92,11 @@ public class ExportSVGBasedTest {
final File[] svgFile = dataDir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".svg") && !name.contains( "-exp.svg");
return name.endsWith(".svg") && !name.contains("-exp.svg");
}
});
if(svgFile==null){
if (svgFile == null) {
throw new IllegalArgumentException("Wrong based path specified. Change based path...");
}

View File

@@ -13,6 +13,7 @@ import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.*;
import java.nio.charset.StandardCharsets;
@Test
public class ExportXsltBasedTest {
@@ -21,18 +22,22 @@ public class ExportXsltBasedTest {
@Test(dataProvider = "Data-Provider-Function")
public void exportImportExportTest(@NotNull XSLTExporter.Type type, @NotNull final File wisemap, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
public void exportImportExportTest(@NotNull XSLTExporter.Type type, @NotNull final File wisemap, @NotNull final File recFile) throws IOException, ExportException {
final Exporter exporter = XSLTExporter.create(type);
byte[] wiseMapContent = FileUtils.readFileToByteArray(wisemap);
if (recFile.exists()) {
// Compare rec and file ...
final String recContent = FileUtils.readFileToString(recFile, ENC_UTF_8);
final String recContent = FileUtils.readFileToString(recFile, ENC_UTF_8)
.replaceAll("\n\\p{Blank}+", "\n")
.replaceAll("\n+", "\n");
// Export mile content ...
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
exporter.export(wiseMapContent, bos);
final String exportContent = new String(bos.toByteArray(), ENC_UTF_8);
final String exportContent = new String(bos.toByteArray(), StandardCharsets.UTF_8)
.replaceAll("\n\\p{Blank}+", "\n")
.replaceAll("\n+", "\n");
Assert.assertEquals(exportContent, recContent);
} else {

View File

@@ -1,8 +1,8 @@
package com.wisemapping.test.model;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wisemapping.rest.model.*;
import org.codehaus.jackson.map.ObjectMapper;
import org.testng.annotations.Test;
import java.io.IOException;

View File

@@ -4,7 +4,7 @@ import com.wisemapping.filter.SupportedUserAgent;
import org.testng.Assert;
import org.testng.annotations.Test;
@Test
@Test(enabled=false)
public class UserAgentTest {

View File

@@ -97,12 +97,12 @@ public class RestAccountITCase {
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
// Add extension only to avoid the fact that the last part is extracted ...
final String url = BASE_REST_URL + "/admin/users/email/{email}.json";
final String url = BASE_REST_URL + "/admin/users/email/{email}";
return templateRest.exchange(url, HttpMethod.GET, findUserEntity, RestUser.class, email);
}
private URI createUser(HttpHeaders requestHeaders, RestTemplate templateRest, RestUser restUser) {
HttpEntity<RestUser> createUserEntity = new HttpEntity<RestUser>(restUser, requestHeaders);
HttpEntity<RestUser> createUserEntity = new HttpEntity< >(restUser, requestHeaders);
return templateRest.postForLocation(BASE_REST_URL + "/admin/users", createUserEntity);
}

Some files were not shown because too many files have changed in this diff Show More