mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Merge branch 'feature/migration-spring5' of bitbucket.org:wisemapping/wisemapping-open-source into feature/migration-spring5
This commit is contained in:
commit
49c459f386
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<scm>
|
<scm>
|
||||||
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>
|
<developerConnection>scm:git:git@bitbucket.org:wisemapping/wisemapping-open-source.git</developerConnection>
|
||||||
|
@ -2,25 +2,44 @@
|
|||||||
# Database Configuration
|
# Database Configuration
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
|
||||||
# MySQL 5.X configuration properties
|
# MariaDB configuration properties
|
||||||
database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
|
database.url=jdbc:mariadb://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
|
||||||
database.driver=com.mysql.jdbc.Driver
|
database.driver=org.mariadb.jdbc.Driver
|
||||||
database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
|
database.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
|
||||||
database.username=wisemapping
|
database.username=wisemapping
|
||||||
database.password=password
|
database.password=mappingwise
|
||||||
database.validation.enabled=true
|
database.validation.enabled=true
|
||||||
database.validation.query=SELECT 1
|
database.validation.query=SELECT 1
|
||||||
|
|
||||||
## PostgreSQL configuration properties
|
# MySQL 5.X configuration properties
|
||||||
#database.url=jdbc:postgresql://<hostname:port>/wisemapping
|
#database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
|
||||||
#database.driver=org.postgresql.Driver
|
#database.driver=com.mysql.jdbc.Driver
|
||||||
#database.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
#database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
|
||||||
#database.username=<username>
|
#database.username=wisemapping
|
||||||
#database.password=<password>
|
#database.password=password
|
||||||
#database.validation.enabled=true
|
#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.query=
|
||||||
#database.validation.enabled=false
|
#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.
|
# Mail configuration. Must be configured to enable user registration confirmation.
|
||||||
##################################################################################
|
##################################################################################
|
||||||
@ -135,13 +154,7 @@ security.openid.enabled=false
|
|||||||
#
|
#
|
||||||
# This properties are used for REST API Documentation( http://localhost:8080/wisemapping/doc/rest/index.html)
|
# This properties are used for REST API Documentation( http://localhost:8080/wisemapping/doc/rest/index.html)
|
||||||
# Change the URL for proper documentation console setup.
|
# Change the URL for proper documentation console setup.
|
||||||
documentation.services.basePath=http://localhost:8080/wisemapping/service
|
documentation.services.basePath=http://localhost:8080/service
|
||||||
documentation.services.version=3.0.1
|
documentation.services.version=3.0.1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
12
pom.xml
12
pom.xml
@ -4,7 +4,7 @@
|
|||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<com.wisemapping.version>4.0.5-SNAPSHOT</com.wisemapping.version>
|
<com.wisemapping.version>5.0.0-SNAPSHOT</com.wisemapping.version>
|
||||||
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
|
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<name>WiseMapping Project</name>
|
<name>WiseMapping Project</name>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||||
<artifactId>maven-jaxb2-plugin</artifactId>
|
<artifactId>maven-jaxb2-plugin</artifactId>
|
||||||
<version>0.8.1</version>
|
<version>0.14.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>net.alchim31.maven</groupId>
|
<groupId>net.alchim31.maven</groupId>
|
||||||
@ -117,10 +117,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.8.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>11</source>
|
||||||
<target>1.8</target>
|
<target>11</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<groupId>org.wisemapping</groupId>
|
<groupId>org.wisemapping</groupId>
|
||||||
<artifactId>wisemapping</artifactId>
|
<artifactId>wisemapping</artifactId>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
<version>4.0.5-SNAPSHOT</version>
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -28,8 +28,9 @@
|
|||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<org.springframework.version>3.2.18.RELEASE</org.springframework.version>
|
<org.springframework.version>5.2.10.RELEASE</org.springframework.version>
|
||||||
<org.springframework.addons>3.2.10.RELEASE</org.springframework.addons>
|
<org.springframework.addons>5.2.5.RELEASE</org.springframework.addons>
|
||||||
|
<hibernate.version>5.4.23.Final</hibernate.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -56,7 +57,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.velocity</groupId>
|
<groupId>org.apache.velocity</groupId>
|
||||||
<artifactId>velocity</artifactId>
|
<artifactId>velocity</artifactId>
|
||||||
<version>1.5</version>
|
<version>1.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -101,6 +102,25 @@
|
|||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
@ -122,7 +142,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
<artifactId>fop</artifactId>
|
<artifactId>fop</artifactId>
|
||||||
<version>2.3</version>
|
<version>2.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
@ -145,7 +165,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tiles</groupId>
|
<groupId>org.apache.tiles</groupId>
|
||||||
<artifactId>tiles-jsp</artifactId>
|
<artifactId>tiles-jsp</artifactId>
|
||||||
<version>2.2.2</version>
|
<version>3.0.8</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
@ -190,18 +210,6 @@
|
|||||||
<version>${org.springframework.version}</version>
|
<version>${org.springframework.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>aopalliance</groupId>
|
<groupId>aopalliance</groupId>
|
||||||
<artifactId>aopalliance</artifactId>
|
<artifactId>aopalliance</artifactId>
|
||||||
@ -228,7 +236,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax</groupId>
|
<groupId>javax</groupId>
|
||||||
<artifactId>javaee-api</artifactId>
|
<artifactId>javaee-api</artifactId>
|
||||||
<version>6.0</version>
|
<version>8.0.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -239,13 +247,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
<version>5.1.5</version>
|
<version>8.0.22</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-dbcp</groupId>
|
<groupId>commons-dbcp</groupId>
|
||||||
<artifactId>commons-dbcp</artifactId>
|
<artifactId>commons-dbcp</artifactId>
|
||||||
<version>1.2.2</version>
|
<version>1.4</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -264,19 +272,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
<version>2.2.8</version>
|
<version>2.5.1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core-asl</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>2.11.3</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.jackson</groupId>
|
|
||||||
<artifactId>jackson-mapper-asl</artifactId>
|
|
||||||
<version>1.9.4</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@ -290,6 +292,26 @@
|
|||||||
<version>2.10.0</version>
|
<version>2.10.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<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>
|
<dependency>
|
||||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
@ -311,6 +333,11 @@
|
|||||||
<artifactId>jstl</artifactId>
|
<artifactId>jstl</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>fluent-hc</artifactId>
|
<artifactId>fluent-hc</artifactId>
|
||||||
@ -567,11 +594,9 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
<artifactId>jetty-maven-plugin</artifactId>
|
||||||
<version>9.4.12.v20180830</version>
|
<version>9.4.34.v20201102</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<baseAppFirst>false</baseAppFirst>
|
|
||||||
<stopKey>foo</stopKey>
|
<stopKey>foo</stopKey>
|
||||||
<nonBlocking>true</nonBlocking>
|
|
||||||
<stopPort>9999</stopPort>
|
<stopPort>9999</stopPort>
|
||||||
<war>${project.build.directory}/wisemapping.war</war>
|
<war>${project.build.directory}/wisemapping.war</war>
|
||||||
<reload>automatic</reload>
|
<reload>automatic</reload>
|
||||||
@ -595,14 +620,15 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>start-jetty</id>
|
<id>run-forked</id>
|
||||||
<phase>pre-integration-test</phase>
|
<phase>pre-integration-test</phase>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>run</goal>
|
<goal>run-forked</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<scanIntervalSeconds>0</scanIntervalSeconds>
|
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||||
<daemon>true</daemon>
|
<waitForChild>false</waitForChild>
|
||||||
|
<jvmArgs>-Ddatabase.base.url=${project.build.directory}</jvmArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -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;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
import com.wisemapping.model.Label;
|
import com.wisemapping.model.Label;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -18,27 +35,34 @@ public class LabelManagerImpl extends HibernateDaoSupport
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveLabel(@NotNull final Label label) {
|
public void saveLabel(@NotNull final Label label) {
|
||||||
getSession().save(label);
|
currentSession().save(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<Label> getAllLabels(@NotNull final User user) {
|
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
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Label getLabelById(int id, @NotNull final User user) {
|
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});
|
var query = currentSession().createQuery("from com.wisemapping.model.Label wisemapping where id=:id and creator=:creator");
|
||||||
return getFirst(labels);
|
query.setParameter("id", id);
|
||||||
|
query.setParameter("creator", user);
|
||||||
|
return getFirst(query.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Label getLabelByTitle(@NotNull String title, @NotNull final User user) {
|
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});
|
var query = currentSession().createQuery("from com.wisemapping.model.Label wisemapping where title=:title and creator=:creator");
|
||||||
return getFirst(labels);
|
query.setParameter("title", title);
|
||||||
|
query.setParameter("creator", user);
|
||||||
|
return getFirst(query.list());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,28 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.dao;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
import com.wisemapping.model.*;
|
import com.wisemapping.model.*;
|
||||||
import com.wisemapping.util.ZipUtils;
|
import com.wisemapping.util.ZipUtils;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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.Restrictions;
|
||||||
import org.hibernate.criterion.SimpleExpression;
|
import org.hibernate.criterion.SimpleExpression;
|
||||||
import org.hibernate.criterion.Junction;
|
import org.hibernate.criterion.Junction;
|
||||||
@ -40,7 +42,10 @@ public class MindmapManagerImpl
|
|||||||
@Override
|
@Override
|
||||||
public Collaborator findCollaborator(@NotNull final String email) {
|
public Collaborator findCollaborator(@NotNull final String email) {
|
||||||
final Collaborator collaborator;
|
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()) {
|
if (collaborators != null && !collaborators.isEmpty()) {
|
||||||
assert collaborators.size() == 1 : "More than one user with the same email!";
|
assert collaborators.size() == 1 : "More than one user with the same email!";
|
||||||
collaborator = collaborators.get(0);
|
collaborator = collaborators.get(0);
|
||||||
@ -57,7 +62,7 @@ public class MindmapManagerImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MindMapHistory> getHistoryFrom(int mindmapId) {
|
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.add(Restrictions.eq("mindmapId", mindmapId));
|
||||||
hibernateCriteria.addOrder(Order.desc("creationTime"));
|
hibernateCriteria.addOrder(Order.desc("creationTime"));
|
||||||
|
|
||||||
@ -78,7 +83,7 @@ public class MindmapManagerImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void purgeHistory(int mapId) throws IOException {
|
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.add(Restrictions.eq("mindmapId", mapId));
|
||||||
hibernateCriteria.addOrder(Order.desc("creationTime"));
|
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 ...
|
// 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;
|
int max = mindmap.getLastModificationTime().before(yearAgo) ? 10 : 25;
|
||||||
|
|
||||||
|
final HibernateTemplate hibernateTemplate = getHibernateTemplate();
|
||||||
for (MindMapHistory history : historyList) {
|
for (MindMapHistory history : historyList) {
|
||||||
byte[] zippedXml = history.getZippedXml();
|
byte[] zippedXml = history.getZippedXml();
|
||||||
if (new String(zippedXml).startsWith("<map")) {
|
if (new String(zippedXml).startsWith("<map")) {
|
||||||
history.setZippedXml(ZipUtils.bytesToZip(zippedXml));
|
history.setZippedXml(ZipUtils.bytesToZip(zippedXml));
|
||||||
getHibernateTemplate().update(history);
|
hibernateTemplate.update(history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (historyList.size() > max) {
|
if (historyList.size() > max) {
|
||||||
for (int i = max; i < historyList.size(); i++) {
|
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
|
@Override
|
||||||
public List<Mindmap> search(MindMapCriteria criteria, int maxResult) {
|
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
|
//always search public maps
|
||||||
hibernateCriteria.add(Restrictions.like("public", Boolean.TRUE));
|
hibernateCriteria.add(Restrictions.like("public", Boolean.TRUE));
|
||||||
|
|
||||||
@ -154,19 +160,28 @@ public class MindmapManagerImpl
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Collaboration> findCollaboration(final long collaboratorId) {
|
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 colaboratorId=:colaboratorId");
|
||||||
|
query.setParameter("colaboratorId", collaboratorId);
|
||||||
|
return query.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Collaboration> findCollaboration(final CollaborationRole collaborationRole) {
|
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
|
@Override
|
||||||
public Collaboration findCollaboration(final int mindmapId, final User user) {
|
public Collaboration findCollaboration(final int mindmapId, final User user) {
|
||||||
final Collaboration result;
|
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()) {
|
if (mindMaps != null && !mindMaps.isEmpty()) {
|
||||||
result = mindMaps.get(0);
|
result = mindMaps.get(0);
|
||||||
} else {
|
} else {
|
||||||
@ -193,8 +208,9 @@ public class MindmapManagerImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<Mindmap> getAllMindmaps() {
|
public List<Mindmap> getAllMindmaps() {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.Mindmap wisemapping");
|
return currentSession().createQuery("from com.wisemapping.model.Mindmap wisemapping").list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -206,7 +222,12 @@ public class MindmapManagerImpl
|
|||||||
@Override
|
@Override
|
||||||
public Mindmap getMindmapByTitle(final String title, final User user) {
|
public Mindmap getMindmapByTitle(final String title, final User user) {
|
||||||
final Mindmap result;
|
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()) {
|
if (mindMaps != null && !mindMaps.isEmpty()) {
|
||||||
result = mindMaps.get(0);
|
result = mindMaps.get(0);
|
||||||
} else {
|
} else {
|
||||||
@ -223,7 +244,7 @@ public class MindmapManagerImpl
|
|||||||
@Override
|
@Override
|
||||||
public void saveMindmap(Mindmap mindMap) {
|
public void saveMindmap(Mindmap mindMap) {
|
||||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||||
getSession().save(mindMap);
|
currentSession().save(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -238,7 +259,7 @@ public class MindmapManagerImpl
|
|||||||
@Override
|
@Override
|
||||||
public void removeMindmap(@NotNull final Mindmap mindMap) {
|
public void removeMindmap(@NotNull final Mindmap mindMap) {
|
||||||
// Delete history first ...
|
// Delete history first ...
|
||||||
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
|
final Criteria hibernateCriteria = currentSession().createCriteria(MindMapHistory.class);
|
||||||
hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId()));
|
hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId()));
|
||||||
List list = hibernateCriteria.list();
|
List list = hibernateCriteria.list();
|
||||||
getHibernateTemplate().deleteAll(list);
|
getHibernateTemplate().deleteAll(list);
|
||||||
@ -257,4 +278,3 @@ public class MindmapManagerImpl
|
|||||||
getHibernateTemplate().saveOrUpdate(history);
|
getHibernateTemplate().saveOrUpdate(history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.dao;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
@ -25,9 +25,8 @@ import com.wisemapping.model.AccessAuditory;
|
|||||||
import org.hibernate.ObjectNotFoundException;
|
import org.hibernate.ObjectNotFoundException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate5.support.HibernateDaoSupport;
|
||||||
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
//import org.acegisecurity.providers.encoding.PasswordEncoder;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -42,29 +41,39 @@ public class UserManagerImpl
|
|||||||
this.passwordEncoder = passwordEncoder;
|
this.passwordEncoder = passwordEncoder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<User> getAllUsers() {
|
public List<User> getAllUsers() {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.User user");
|
return currentSession().createQuery("from com.wisemapping.model.User user").list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUserBy(@NotNull final String email) {
|
public User getUserBy(@NotNull final String email) {
|
||||||
User user = null;
|
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()) {
|
if (users != null && !users.isEmpty()) {
|
||||||
assert users.size() == 1 : "More than one user with the same email!";
|
assert users.size() == 1 : "More than one user with the same email!";
|
||||||
user = users.get(0);
|
user = users.get(0);
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collaborator getCollaboratorBy(final String email) {
|
public Collaborator getCollaboratorBy(final String email) {
|
||||||
final Collaborator cola;
|
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()) {
|
if (cols != null && !cols.isEmpty()) {
|
||||||
assert cols.size() == 1 : "More than one colaborator with the same email!";
|
assert cols.size() == 1 : "More than one colaborator with the same email!";
|
||||||
cola = (Collaborator) cols.get(0);
|
cola = cols.get(0);
|
||||||
} else {
|
} else {
|
||||||
cola = null;
|
cola = null;
|
||||||
}
|
}
|
||||||
@ -74,9 +83,9 @@ public class UserManagerImpl
|
|||||||
@Nullable
|
@Nullable
|
||||||
public User getUserBy(long id) {
|
public User getUserBy(long id) {
|
||||||
User user = null;
|
User user = null;
|
||||||
try{
|
try {
|
||||||
user = getHibernateTemplate().get(User.class, id);
|
user = getHibernateTemplate().get(User.class, id);
|
||||||
} catch (ObjectNotFoundException e){
|
} catch (ObjectNotFoundException e) {
|
||||||
// Ignore ...
|
// Ignore ...
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
@ -85,13 +94,13 @@ public class UserManagerImpl
|
|||||||
@Override
|
@Override
|
||||||
public void createUser(User user) {
|
public void createUser(User user) {
|
||||||
assert user != null : "Trying to store a null 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);
|
getHibernateTemplate().saveOrUpdate(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User createUser(@NotNull User user, @NotNull Collaborator col) {
|
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";
|
assert user != null : "Trying to store a null user";
|
||||||
|
|
||||||
final Set<Collaboration> set = col.getCollaborations();
|
final Set<Collaboration> set = col.getCollaborations();
|
||||||
@ -121,14 +130,20 @@ public class UserManagerImpl
|
|||||||
|
|
||||||
public void updateUser(@NotNull User user) {
|
public void updateUser(@NotNull User user) {
|
||||||
assert user != null : "user is null";
|
assert user != null : "user is null";
|
||||||
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
|
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||||
getHibernateTemplate().update(user);
|
getHibernateTemplate().update(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUserByActivationCode(long code) {
|
public User getUserByActivationCode(long code) {
|
||||||
final User user;
|
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!";
|
assert users.size() == 1 : "More than one user with the same username!";
|
||||||
user = (User) users.get(0);
|
user = (User) users.get(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,13 +30,13 @@ import org.apache.batik.transcoder.TranscoderOutput;
|
|||||||
import org.apache.batik.transcoder.image.ImageTranscoder;
|
import org.apache.batik.transcoder.image.ImageTranscoder;
|
||||||
import org.apache.batik.transcoder.image.JPEGTranscoder;
|
import org.apache.batik.transcoder.image.JPEGTranscoder;
|
||||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.fop.svg.PDFTranscoder;
|
import org.apache.fop.svg.PDFTranscoder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.w3c.dom.*;
|
import org.w3c.dom.*;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import sun.misc.BASE64Encoder;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
@ -51,6 +51,7 @@ import javax.xml.xpath.*;
|
|||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ExporterFactory {
|
public class ExporterFactory {
|
||||||
@ -266,8 +267,8 @@ public class ExporterFactory {
|
|||||||
final File iconFile = iconFile(imgUrl);
|
final File iconFile = iconFile(imgUrl);
|
||||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
fis = new FileInputStream(iconFile);
|
fis = new FileInputStream(iconFile);
|
||||||
BASE64Encoder encoder = new BASE64Encoder();
|
Base64.Encoder enc = Base64.getEncoder();
|
||||||
encoder.encode(fis, bos);
|
bos.write(enc.encode(IOUtils.toByteArray(fis)));
|
||||||
|
|
||||||
elem.setAttribute("xlink:href", "data:image/png;base64," + bos.toString("8859_1"));
|
elem.setAttribute("xlink:href", "data:image/png;base64," + bos.toString("8859_1"));
|
||||||
elem.appendChild(document.createTextNode(" "));
|
elem.appendChild(document.createTextNode(" "));
|
||||||
|
@ -26,13 +26,11 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import com.wisemapping.exceptions.UnsupportedBrowserException;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class BrowserSupportInterceptor extends HandlerInterceptorAdapter {
|
public class BrowserSupportInterceptor extends HandlerInterceptorAdapter {
|
||||||
private Set<String> exclude;
|
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 {
|
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 ?.
|
return true;
|
||||||
if (!userAgent.isBrowserSupported()) {
|
// // It's a supported browser ?.
|
||||||
throw new UnsupportedBrowserException();
|
// if (!userAgent.isBrowserSupported()) {
|
||||||
}
|
// throw new UnsupportedBrowserException();
|
||||||
|
// }
|
||||||
// Is a Explorer 9 or less without Google Chrome Frame ?.
|
//
|
||||||
if (userAgent.needsGCF()) {
|
// // Is a Explorer 9 or less without Google Chrome Frame ?.
|
||||||
throw new GoogleChromeFrameRequiredException();
|
// if (userAgent.needsGCF()) {
|
||||||
}
|
// throw new GoogleChromeFrameRequiredException();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ public class FreemindImporter
|
|||||||
result.setTitle(mapName);
|
result.setTitle(mapName);
|
||||||
result.setDescription(description);
|
result.setDescription(description);
|
||||||
|
|
||||||
} catch (JAXBException | IOException | TransformerException e) {
|
} catch (JAXBException | TransformerException e) {
|
||||||
throw new ImporterException(e);
|
throw new ImporterException(e);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package com.wisemapping.mail;
|
package com.wisemapping.mail;
|
||||||
|
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
import com.wisemapping.util.VelocityEngineUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import com.wisemapping.util.VelocityEngineWrapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.mail.javamail.JavaMailSender;
|
import org.springframework.mail.javamail.JavaMailSender;
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
import org.springframework.mail.javamail.MimeMessagePreparator;
|
import org.springframework.mail.javamail.MimeMessagePreparator;
|
||||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
|
||||||
|
|
||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -34,7 +34,7 @@ public final class Mailer {
|
|||||||
//~ Instance fields ......................................................................................
|
//~ Instance fields ......................................................................................
|
||||||
|
|
||||||
private JavaMailSender mailSender;
|
private JavaMailSender mailSender;
|
||||||
private VelocityEngine velocityEngine;
|
private VelocityEngineWrapper velocityEngineWrapper;
|
||||||
private String serverFromEmail;
|
private String serverFromEmail;
|
||||||
private String supportEmail;
|
private String supportEmail;
|
||||||
private String errorReporterEmail;
|
private String errorReporterEmail;
|
||||||
@ -62,7 +62,7 @@ public final class Mailer {
|
|||||||
message.setFrom(from);
|
message.setFrom(from);
|
||||||
message.setSubject(subject);
|
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);
|
message.setText(messageBody, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -74,8 +74,8 @@ public final class Mailer {
|
|||||||
this.mailSender = mailer;
|
this.mailSender = mailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVelocityEngine(VelocityEngine engine) {
|
public void setVelocityEngineWrapper(VelocityEngineWrapper engine) {
|
||||||
this.velocityEngine = engine;
|
this.velocityEngineWrapper = engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSupportEmail() {
|
public String getSupportEmail() {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2011] [wisemapping]
|
* Copyright [2011] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest;
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
|
@ -1,36 +1,39 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest;
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpInputMessage;
|
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.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
||||||
public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpMessageConverter {
|
public class DebugMappingJacksonHttpMessageConverter extends MappingJackson2HttpMessageConverter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws IOException, JsonHttpMessageNotReadableException {
|
protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage) throws JsonHttpMessageNotReadableException {
|
||||||
try {
|
try {
|
||||||
final byte[] bytes = IOUtils.toByteArray(inputMessage.getBody());
|
final byte[] bytes = IOUtils.toByteArray(inputMessage.getBody());
|
||||||
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||||
@ -38,9 +41,7 @@ public class DebugMappingJacksonHttpMessageConverter extends MappingJacksonHttpM
|
|||||||
|
|
||||||
return super.readInternal(clazz, wrap);
|
return super.readInternal(clazz, wrap);
|
||||||
|
|
||||||
} catch (org.springframework.http.converter.HttpMessageNotReadableException e) {
|
} catch (HttpMessageNotReadableException | IOException e) {
|
||||||
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
|
throw new JsonHttpMessageNotReadableException("Request Body could not be read", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +58,7 @@ class WrapHttpInputMessage implements HttpInputMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getBody() throws IOException {
|
public InputStream getBody() {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest;
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
@ -73,6 +73,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -87,7 +88,8 @@ import java.util.Set;
|
|||||||
public class MindmapController extends BaseController {
|
public class MindmapController extends BaseController {
|
||||||
final Logger logger = Logger.getLogger("com.wisemapping");
|
final Logger logger = Logger.getLogger("com.wisemapping");
|
||||||
|
|
||||||
public static final String LATEST_HISTORY_REVISION = "latest";
|
private static final String LATEST_HISTORY_REVISION = "latest";
|
||||||
|
|
||||||
@Qualifier("mindmapService")
|
@Qualifier("mindmapService")
|
||||||
@Autowired
|
@Autowired
|
||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
@ -256,15 +258,13 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@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
|
@ResponseBody
|
||||||
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
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);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
|
|
||||||
String xmlStr = mindmap.getXmlStr();
|
String xmlStr = mindmap.getXmlStr();
|
||||||
return xmlStr.getBytes("UTF-8");
|
return xmlStr.getBytes(StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@ -283,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
|
@ResponseBody
|
||||||
public byte[] retrieveDocument(@PathVariable int id, @PathVariable int hid, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
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);
|
final MindMapHistory mindmapHistory = mindmapService.findMindmapHistory(id, hid);
|
||||||
return mindmapHistory.getUnzipXml();
|
return mindmapHistory.getUnzipXml();
|
||||||
}
|
}
|
||||||
@ -394,7 +392,7 @@ public class MindmapController extends BaseController {
|
|||||||
// Update map ...
|
// Update map ...
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
mindmap.setTitle(title);
|
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"})
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
|
||||||
@ -463,7 +461,7 @@ public class MindmapController extends BaseController {
|
|||||||
// Update map ...
|
// Update map ...
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
mindmap.setDescription(description);
|
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"})
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/publish", consumes = {"text/plain"}, produces = {"application/json", "application/xml"})
|
||||||
@ -479,7 +477,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
// Update map status ...
|
// Update map status ...
|
||||||
mindMap.setPublic(Boolean.parseBoolean(value));
|
mindMap.setPublic(Boolean.parseBoolean(value));
|
||||||
mindmapService.updateMindmap(mindMap, !true);
|
mindmapService.updateMindmap(mindMap, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +527,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void batchDelete(@RequestParam(required = true) String ids) throws IOException, WiseMappingException {
|
public void batchDelete(@RequestParam(required = true) String ids) throws IOException, WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final String[] mapsIds = ids.split(",");
|
final String[] mapsIds = ",".split(ids);
|
||||||
for (final String mapId : mapsIds) {
|
for (final String mapId : mapsIds) {
|
||||||
final Mindmap mindmap = findMindmapById(Integer.parseInt(mapId));
|
final Mindmap mindmap = findMindmapById(Integer.parseInt(mapId));
|
||||||
mindmapService.removeMindmap(mindmap, user);
|
mindmapService.removeMindmap(mindmap, user);
|
||||||
@ -650,11 +648,12 @@ public class MindmapController extends BaseController {
|
|||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final Label delegated = restLabel.getDelegated();
|
final Label delegated = restLabel.getDelegated();
|
||||||
delegated.setCreator(user);
|
delegated.setCreator(user);
|
||||||
|
|
||||||
final Label found = labelService.getLabelById(labelId, user);
|
final Label found = labelService.getLabelById(labelId, user);
|
||||||
if (found == null) {
|
if (found == null) {
|
||||||
throw new LabelCouldNotFoundException("Label could not be found. Id: " + labelId);
|
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 int mindmapId = Integer.parseInt(id);
|
||||||
final Mindmap mindmap = findMindmapById(mindmapId);
|
final Mindmap mindmap = findMindmapById(mindmapId);
|
||||||
final Label label = mindmap.findLabel(labelId);
|
final Label label = mindmap.findLabel(labelId);
|
||||||
|
@ -19,10 +19,9 @@
|
|||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.wisemapping.model.Collaboration;
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.CollaborationRole;
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -18,19 +18,16 @@
|
|||||||
|
|
||||||
package com.wisemapping.rest.model;
|
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.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import com.wisemapping.util.TimeUtils;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@XmlRootElement(name = "collaborator")
|
@XmlRootElement(name = "collaborator")
|
||||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
package com.wisemapping.rest.model;
|
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 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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package com.wisemapping.rest.model;
|
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 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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
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")
|
@XmlRootElement(name = "label")
|
||||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.wisemapping.model.Label;
|
import com.wisemapping.model.Label;
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
package com.wisemapping.rest.model;
|
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.model.Collaborator;
|
||||||
import com.wisemapping.service.LockInfo;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
package com.wisemapping.rest.model;
|
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.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.CollaborationProperties;
|
import com.wisemapping.model.CollaborationProperties;
|
||||||
import com.wisemapping.model.CollaborationRole;
|
import com.wisemapping.model.CollaborationRole;
|
||||||
@ -26,9 +29,6 @@ import com.wisemapping.model.Collaborator;
|
|||||||
import com.wisemapping.model.Mindmap;
|
import com.wisemapping.model.Mindmap;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.util.TimeUtils;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
package com.wisemapping.rest.model;
|
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.MindMapHistory;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/**
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
@ -19,7 +19,7 @@
|
|||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
package com.wisemapping.rest.model;
|
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.Collaboration;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.Label;
|
import com.wisemapping.model.Label;
|
||||||
@ -26,9 +29,6 @@ import com.wisemapping.model.Mindmap;
|
|||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.util.TimeUtils;
|
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.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
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.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest.model;
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.Mindmap;
|
import com.wisemapping.model.Mindmap;
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest.model;
|
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 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 org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
@ -32,7 +32,6 @@ import java.util.Calendar;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@XmlRootElement(name = "user")
|
@XmlRootElement(name = "user")
|
||||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
@JsonAutoDetect(
|
@JsonAutoDetect(
|
||||||
@ -54,6 +53,7 @@ public class RestUser {
|
|||||||
this.password = user.getPassword();
|
this.password = user.getPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
public Calendar getCreationDate() {
|
public Calendar getCreationDate() {
|
||||||
return user.getCreationDate();
|
return user.getCreationDate();
|
||||||
}
|
}
|
||||||
@ -82,10 +82,6 @@ public class RestUser {
|
|||||||
user.setLastname(lastname);
|
user.setLastname(lastname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean isActive() {
|
|
||||||
// return user.isActive();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return user.getId();
|
return user.getId();
|
||||||
}
|
}
|
||||||
@ -102,10 +98,6 @@ public class RestUser {
|
|||||||
user.setEmail(email);
|
user.setEmail(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCreationDate(Calendar creationDate) {
|
|
||||||
// user.setCreationDate(creationDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(final String password) {
|
public void setPassword(final String password) {
|
||||||
this.user.setPassword(password);
|
this.user.setPassword(password);
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.rest.view;
|
package com.wisemapping.rest.view;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class TransformView extends AbstractView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 content = (String) viewMap.get("content");
|
||||||
final String filename = (String) viewMap.get("filename");
|
final String filename = (String) viewMap.get("filename");
|
||||||
@ -80,21 +80,22 @@ public class TransformView extends AbstractView {
|
|||||||
this.setContentDisposition(request, response, fileName);
|
this.setContentDisposition(request, response, fileName);
|
||||||
|
|
||||||
// Change image link URL.
|
// Change image link URL.
|
||||||
final ServletContext servletContext = request.getSession().getServletContext();
|
final ServletContext servletContext = getServletContext();
|
||||||
final ExporterFactory factory = new ExporterFactory(servletContext);
|
final ExporterFactory factory = new ExporterFactory(servletContext);
|
||||||
try {
|
try {
|
||||||
// Write the conversion content ...
|
// Write the conversion content ...
|
||||||
final ServletOutputStream outputStream = response.getOutputStream();
|
final ServletOutputStream outputStream = response.getOutputStream();
|
||||||
if (exportFormat == ExportFormat.FREEMIND) {
|
if (exportFormat == ExportFormat.FREEMIND) {
|
||||||
response.setCharacterEncoding("ASCII");
|
response.setContentType(String.format("%s; charset=%s", contentType, "ASCII"));
|
||||||
factory.export(properties, content, outputStream, null);
|
factory.export(properties, content, outputStream, null);
|
||||||
} else if (exportFormat == ExportFormat.WISEMAPPING) {
|
} 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 Object mindmap = viewMap.get("mindmap");
|
||||||
final StreamResult result = new StreamResult(outputStream);
|
final StreamResult result = new StreamResult(outputStream);
|
||||||
jaxbMarshaller.marshal(mindmap, result);
|
jaxbMarshaller.marshal(mindmap, result);
|
||||||
} else if (exportFormat == ExportFormat.MICROSOFT_EXCEL || exportFormat == ExportFormat.TEXT || exportFormat == ExportFormat.OPEN_OFFICE_WRITER || exportFormat == ExportFormat.MINDJET) {
|
} 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);
|
factory.export(properties, content, outputStream, null);
|
||||||
} else {
|
} else {
|
||||||
// Image export ...
|
// Image export ...
|
||||||
@ -112,9 +113,9 @@ public class TransformView extends AbstractView {
|
|||||||
String disposition = fileName;
|
String disposition = fileName;
|
||||||
try {
|
try {
|
||||||
byte[] fileNameBytes = fileName.getBytes((isInternetExplorer) ? ("windows-1250") : ("utf-8"));
|
byte[] fileNameBytes = fileName.getBytes((isInternetExplorer) ? ("windows-1250") : ("utf-8"));
|
||||||
String dispositionFileName = "";
|
final StringBuilder dispositionFileName = new StringBuilder();
|
||||||
for (byte b : fileNameBytes) {
|
for (byte b : fileNameBytes) {
|
||||||
dispositionFileName += (char) (b & 0xff);
|
dispositionFileName.append((char) (b & 0xff));
|
||||||
}
|
}
|
||||||
disposition = "attachment; filename=\"" + dispositionFileName + "\"";
|
disposition = "attachment; filename=\"" + dispositionFileName + "\"";
|
||||||
} catch (UnsupportedEncodingException ence) {
|
} catch (UnsupportedEncodingException ence) {
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.security;
|
package com.wisemapping.security;
|
||||||
|
|
||||||
@ -23,9 +23,9 @@ import com.wisemapping.model.User;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.security.authentication.BadCredentialsException;
|
import org.springframework.security.authentication.BadCredentialsException;
|
||||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||||
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.core.AuthenticationException;
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
|
||||||
|
|
||||||
public class AuthenticationProvider implements org.springframework.security.authentication.AuthenticationProvider {
|
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 UserDetails userDetails = getUserDetailsService().loadUserByUsername(email);
|
||||||
final User user = userDetails.getUser();
|
final User user = userDetails.getUser();
|
||||||
final String credentials = (String) auth.getCredentials();
|
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());
|
throw new BadCredentialsException("Username/Password does not match for " + auth.getPrincipal());
|
||||||
}
|
}
|
||||||
userDetailsService.getUserService().auditLogin(user);
|
userDetailsService.getUserService().auditLogin(user);
|
||||||
@ -49,7 +50,7 @@ public class AuthenticationProvider implements org.springframework.security.auth
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supports(final Class<? extends Object> authentication) {
|
public boolean supports(final Class<?> authentication) {
|
||||||
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
|
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ public class AuthenticationSuccessHandler extends SavedRequestAwareAuthenticatio
|
|||||||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
|
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
|
||||||
|
|
||||||
SavedRequest savedRequest = cache.getRequest(request, response);
|
SavedRequest savedRequest = cache.getRequest(request, response);
|
||||||
if (savedRequest!=null && savedRequest.getRedirectUrl().contains("c/restful")) {
|
if (savedRequest != null && savedRequest.getRedirectUrl().contains("c/restful")) {
|
||||||
cache.removeRequest(request,response);
|
cache.removeRequest(request, response);
|
||||||
}
|
}
|
||||||
super.onAuthenticationSuccess(request, response, authentication);
|
super.onAuthenticationSuccess(request, response, authentication);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,26 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* 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.password.PasswordEncoder;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class LegacyPasswordEncoder implements PasswordEncoder {
|
||||||
|
final private static Logger logger = Logger.getLogger("com.wisemapping.security.LegacyPasswordEncoder");
|
||||||
|
|
||||||
|
private static final String ENC_PREFIX = "ENC:";
|
||||||
|
private static final PasswordEncoder sha1Encoder = new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("SHA-1");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String encode(CharSequence rawPassword) {
|
||||||
|
|
||||||
|
logger.info("LegacyPasswordEncoder encode executed.");
|
||||||
|
|
||||||
|
String result = rawPassword.toString();
|
||||||
|
if (!rawPassword.toString().startsWith(ENC_PREFIX)) {
|
||||||
|
result = ENC_PREFIX + sha1Encoder.encode(rawPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(CharSequence rawPassword, String encodedPassword) {
|
||||||
|
|
||||||
|
String newEncodedPassword = encodedPassword;
|
||||||
|
if (encodedPassword.startsWith(ENC_PREFIX)) {
|
||||||
|
|
||||||
|
newEncodedPassword = encode(rawPassword);
|
||||||
|
}
|
||||||
|
return newEncodedPassword.equals(encodedPassword);
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,6 @@ import org.apache.http.NameValuePair;
|
|||||||
import org.apache.http.client.fluent.Form;
|
import org.apache.http.client.fluent.Form;
|
||||||
import org.apache.http.client.fluent.Request;
|
import org.apache.http.client.fluent.Request;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -1,43 +1,35 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright [2015] [wisemapping]
|
* Copyright [2015] [wisemapping]
|
||||||
*
|
*
|
||||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||||
* "powered by wisemapping" text requirement on every single page;
|
* "powered by wisemapping" text requirement on every single page;
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the license at
|
* You may obtain a copy of the license at
|
||||||
*
|
*
|
||||||
* http://www.wisemapping.org/license
|
* http://www.wisemapping.org/license
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.wisemapping.service;
|
package com.wisemapping.service;
|
||||||
|
|
||||||
import com.wisemapping.dao.UserManager;
|
import com.wisemapping.dao.UserManager;
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.mail.NotificationService;
|
import com.wisemapping.mail.NotificationService;
|
||||||
import com.wisemapping.model.AccessAuditory;
|
import com.wisemapping.model.*;
|
||||||
import com.wisemapping.model.AuthenticationType;
|
import com.wisemapping.util.VelocityEngineUtils;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.util.VelocityEngineWrapper;
|
||||||
import com.wisemapping.model.Mindmap;
|
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import org.apache.velocity.app.VelocityEngine;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class UserServiceImpl
|
public class UserServiceImpl
|
||||||
implements UserService {
|
implements UserService {
|
||||||
@ -45,7 +37,7 @@ public class UserServiceImpl
|
|||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
private NotificationService notificationService;
|
private NotificationService notificationService;
|
||||||
private MessageSource messageSource;
|
private MessageSource messageSource;
|
||||||
private VelocityEngine velocityEngine;
|
private VelocityEngineWrapper velocityEngineWrapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -165,7 +157,9 @@ public class UserServiceImpl
|
|||||||
model.put("noArgs", new Object[]{});
|
model.put("noArgs", new Object[]{});
|
||||||
model.put("locale", locale);
|
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.setXmlStr(mapXml);
|
||||||
result.setTitle(messageSource.getMessage("WELCOME", null, locale) + " " + firstName);
|
result.setTitle(messageSource.getMessage("WELCOME", null, locale) + " " + firstName);
|
||||||
@ -212,8 +206,8 @@ public class UserServiceImpl
|
|||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVelocityEngine(VelocityEngine velocityEngine) {
|
public void setVelocityEngineWrapper(VelocityEngineWrapper velocityEngineWrapper) {
|
||||||
this.velocityEngine = velocityEngine;
|
this.velocityEngineWrapper = velocityEngineWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,6 +27,7 @@ import javax.xml.bind.JAXBException;
|
|||||||
import javax.xml.bind.Marshaller;
|
import javax.xml.bind.Marshaller;
|
||||||
import javax.xml.bind.Unmarshaller;
|
import javax.xml.bind.Unmarshaller;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -34,11 +35,11 @@ public class JAXBUtils {
|
|||||||
|
|
||||||
private final static Map<String, JAXBContext> context = new HashMap<String, JAXBContext>();
|
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 JAXBContext context = getInstance(pakage);
|
||||||
final Unmarshaller unmarshaller = context.createUnmarshaller();
|
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);
|
return unmarshaller.unmarshal(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
1
wise-webapp/src/main/resources/Bundle.properties
Normal file
1
wise-webapp/src/main/resources/Bundle.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Solves error Can't find bundle for base name javax.xml.bind.Messages, locale en_US
|
@ -1,7 +1,6 @@
|
|||||||
log4j.rootLogger=WARN, stdout, R
|
log4j.rootLogger=WARN, stdout, R
|
||||||
log4j.logger.com.wisemapping=WARN,stdout,R
|
log4j.logger.com.wisemapping=INFO,stdout,R
|
||||||
log4j.logger.org.springframework=WARN,stdout,R
|
log4j.logger.org.springframework=INFO,stdout,R
|
||||||
log4j.logger.org.codehaus.jackson=WARN,stdout,R
|
|
||||||
log4j.logger.org.hibernate=WARN,stdout,R
|
log4j.logger.org.hibernate=WARN,stdout,R
|
||||||
log4j.logger.org.hibernate.engine.StatefulPersistenceContext=ERROR,stdout,R
|
log4j.logger.org.hibernate.engine.StatefulPersistenceContext=ERROR,stdout,R
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<filter-name>hibernate</filter-name>
|
<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>
|
<init-param>
|
||||||
<param-name>singleSession</param-name>
|
<param-name>singleSession</param-name>
|
||||||
<param-value>true</param-value>
|
<param-value>true</param-value>
|
||||||
|
@ -2,13 +2,11 @@
|
|||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
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"
|
<bean id="viewSecurityAdvisor"
|
||||||
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
||||||
<property name="advice">
|
<property name="advice" ref="viewSecurityAdvice"/>
|
||||||
<ref local="viewSecurityAdvice"/>
|
|
||||||
</property>
|
|
||||||
<property name="mappedNames">
|
<property name="mappedNames">
|
||||||
<list>
|
<list>
|
||||||
<value>getMindmapUserBy</value>
|
<value>getMindmapUserBy</value>
|
||||||
@ -22,9 +20,7 @@
|
|||||||
|
|
||||||
<bean id="updateSecurityAdvisor"
|
<bean id="updateSecurityAdvisor"
|
||||||
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
|
||||||
<property name="advice">
|
<property name="advice" ref="updateSecurityAdvice"/>
|
||||||
<ref local="updateSecurityAdvice"/>
|
|
||||||
</property>
|
|
||||||
<property name="mappedNames">
|
<property name="mappedNames">
|
||||||
<list>
|
<list>
|
||||||
<value>save*</value>
|
<value>save*</value>
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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
|
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">
|
|
||||||
|
|
||||||
<bean id="wiseDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
<bean id="wiseDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
||||||
<property name="driverClassName" value="${database.driver}"/>
|
<property name="driverClassName" value="${database.driver}"/>
|
||||||
@ -23,7 +20,7 @@
|
|||||||
<!--</property>-->
|
<!--</property>-->
|
||||||
<!--</bean>-->
|
<!--</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="dataSource" ref="wiseDataSource"/>
|
||||||
<property name="mappingResources">
|
<property name="mappingResources">
|
||||||
<list>
|
<list>
|
||||||
@ -43,21 +40,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
|
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
|
||||||
<property name="sessionFactory">
|
<property name="sessionFactory" ref="mindmapSessionFactory"/>
|
||||||
<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>
|
</bean>
|
||||||
|
|
||||||
<!-- Hibernate Template Definition -->
|
<!-- 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="sessionFactory" ref="mindmapSessionFactory"/>
|
||||||
<property name="jdbcExceptionTranslator" ref="jdbcExceptionTranslator"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="txAttributes"
|
<bean id="txAttributes"
|
||||||
@ -69,8 +58,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="txInterceptor"
|
<bean id="txInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||||
class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
|
||||||
<property name="transactionManager" ref="transactionManager"/>
|
<property name="transactionManager" ref="transactionManager"/>
|
||||||
<property name="transactionAttributeSource" ref="txAttributes"/>
|
<property name="transactionAttributeSource" ref="txAttributes"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/beans
|
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>
|
<beans>
|
||||||
<bean id="userManager" class="com.wisemapping.dao.UserManagerImpl">
|
<bean id="userManager" class="com.wisemapping.dao.UserManagerImpl">
|
||||||
<property name="hibernateTemplate" ref="hibernateTemplate"/>
|
<property name="hibernateTemplate" ref="hibernateTemplate"/>
|
||||||
<property name="encoder" ref="encoder"/>
|
<property name="encoder" ref="passwordEncoder"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="mindmapManager" class="com.wisemapping.dao.MindmapManagerImpl">
|
<bean id="mindmapManager" class="com.wisemapping.dao.MindmapManagerImpl">
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||||
xsi:schemaLocation="
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/beans
|
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
|
||||||
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
|
||||||
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:component-scan base-package="com.wisemapping.rest"/>
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
@ -50,8 +50,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
|
<bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
|
||||||
<property name="defaultContentType" value="application/json"/>
|
<property name="favorParameter" value="true"/>
|
||||||
|
<property name="parameterName" value="mediaType"/>
|
||||||
|
<property name="defaultContentType" value="application/json" />
|
||||||
|
<property name="useJaf" value="false" />
|
||||||
|
|
||||||
<property name="mediaTypes">
|
<property name="mediaTypes">
|
||||||
<map>
|
<map>
|
||||||
<entry key="xml" value="application/xml"/>
|
<entry key="xml" value="application/xml"/>
|
||||||
@ -68,6 +72,10 @@
|
|||||||
<entry key="mmap" value="application/vnd.mindjet.mindmanager"/>
|
<entry key="mmap" value="application/vnd.mindjet.mindmanager"/>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
|
||||||
|
<property name="contentNegotiationManager" ref="contentNegotiationManager"/>
|
||||||
<property name="viewResolvers">
|
<property name="viewResolvers">
|
||||||
<list>
|
<list>
|
||||||
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
|
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
|
||||||
@ -75,7 +83,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="defaultViews">
|
<property name="defaultViews">
|
||||||
<list>
|
<list>
|
||||||
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView">
|
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView">
|
||||||
<property name="extractValueFromSingleKeyModel" value="true"/>
|
<property name="extractValueFromSingleKeyModel" value="true"/>
|
||||||
</bean>
|
</bean>
|
||||||
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
|
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
xmlns:sec="http://www.springframework.org/schema/security"
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
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
|
||||||
http://www.springframework.org/schema/security/spring-security-3.2.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-manager alias="authenticationManager">
|
||||||
<sec:authentication-provider ref="dbAuthenticationProvider"/>
|
<sec:authentication-provider ref="dbAuthenticationProvider"/>
|
||||||
@ -15,7 +17,6 @@
|
|||||||
|
|
||||||
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
|
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
|
||||||
<property name="userDetailsService" ref="userDetailsService"/>
|
<property name="userDetailsService" ref="userDetailsService"/>
|
||||||
<property name="encoder" ref="encoder"/>
|
<property name="encoder" ref="passwordEncoder"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@ -3,9 +3,9 @@
|
|||||||
xmlns:sec="http://www.springframework.org/schema/security"
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
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
|
||||||
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
|
http://www.springframework.org/schema/security/spring-security.xsd">
|
||||||
|
|
||||||
|
|
||||||
<sec:authentication-manager>
|
<sec:authentication-manager>
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
xmlns:sec="http://www.springframework.org/schema/security"
|
xmlns:sec="http://www.springframework.org/schema/security"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
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
|
||||||
http://www.springframework.org/schema/security/spring-security-3.2.xsd">
|
http://www.springframework.org/schema/security/spring-security.xsd">
|
||||||
|
|
||||||
<sec:http pattern="/css/**" security="none"/>
|
<sec:http pattern="/css/**" security="none"/>
|
||||||
<sec:http pattern="/js/**" security="none"/>
|
<sec:http pattern="/js/**" security="none"/>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<sec:http pattern="/c/login" security="none"/>
|
<sec:http pattern="/c/login" security="none"/>
|
||||||
<sec:http pattern="/c/loginopenid" security="none"/>
|
<sec:http pattern="/c/loginopenid" security="none"/>
|
||||||
<sec:http pattern="/c/user/registration" 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/home" security="none"/>
|
||||||
|
|
||||||
<sec:http pattern="/c/maps/*/embed" 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: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/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/admin/database/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
|
||||||
<sec:intercept-url pattern="/service/**" access="isAuthenticated() and hasRole('ROLE_USER')"/>
|
<sec:intercept-url pattern="/service/**" access="isAuthenticated() and hasRole('ROLE_USER')"/>
|
||||||
<sec:http-basic/>
|
<sec:http-basic/>
|
||||||
</sec:http>
|
</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/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/restful/admin/database/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
|
||||||
<sec:intercept-url pattern="/c/**/*" access="isAuthenticated() and hasRole('ROLE_USER')"/>
|
<sec:intercept-url pattern="/c/**/*" access="isAuthenticated() and hasRole('ROLE_USER')"/>
|
||||||
@ -51,7 +56,7 @@
|
|||||||
authentication-success-handler-ref="authenticationSuccessHandler"
|
authentication-success-handler-ref="authenticationSuccessHandler"
|
||||||
always-use-default-target="false"
|
always-use-default-target="false"
|
||||||
authentication-failure-url="/c/login?login_error=2"
|
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"
|
<sec:openid-login user-service-ref="userDetailsService"
|
||||||
authentication-failure-url="/c/login.jsp?login_error=true"
|
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:logout logout-url="/c/logout" invalidate-session="true" logout-success-url="/c/login"/>
|
||||||
</sec:http>
|
</sec:http>
|
||||||
|
|
||||||
<bean id="encoder" class="com.wisemapping.security.CustomPasswordEncoder"/>
|
|
||||||
|
|
||||||
<import resource="wisemapping-security-${security.type}.xml"/>
|
<import resource="wisemapping-security-${security.type}.xml"/>
|
||||||
|
|
||||||
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">
|
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">
|
||||||
|
@ -3,17 +3,19 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
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"/>
|
<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="0" value="${mail.serverSendEmail}"/>
|
||||||
<constructor-arg index="1" value="${mail.supportEmail}"/>
|
<constructor-arg index="1" value="${mail.supportEmail}"/>
|
||||||
<constructor-arg index="2" value="${mail.errorReporterEmail}"/>
|
<constructor-arg index="2" value="${mail.errorReporterEmail}"/>
|
||||||
|
|
||||||
<property name="mailSender" ref="mailSender"/>
|
<property name="mailSender" ref="mailSender"/>
|
||||||
<property name="velocityEngine" ref="velocityEngine"/>
|
<property name="velocityEngineWrapper" ref="velocityEngineWrapper"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
|
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
|
||||||
@ -21,14 +23,12 @@
|
|||||||
<property name="mindmapService" ref="mindMapServiceTarget"/>
|
<property name="mindmapService" ref="mindMapServiceTarget"/>
|
||||||
<property name="notificationService" ref="notificationService"/>
|
<property name="notificationService" ref="notificationService"/>
|
||||||
<property name="messageSource" ref="messageSource"/>
|
<property name="messageSource" ref="messageSource"/>
|
||||||
<property name="velocityEngine" ref="velocityEngine"/>
|
<property name="velocityEngineWrapper" ref="velocityEngineWrapper"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
||||||
<property name="transactionManager" ref="transactionManager"/>
|
<property name="transactionManager" ref="transactionManager"/>
|
||||||
<property name="target">
|
<property name="target" ref="userServiceTarget" />
|
||||||
<ref local="userServiceTarget"/>
|
|
||||||
</property>
|
|
||||||
<property name="transactionAttributes">
|
<property name="transactionAttributes">
|
||||||
<props>
|
<props>
|
||||||
<prop key="*">PROPAGATION_REQUIRED</prop>
|
<prop key="*">PROPAGATION_REQUIRED</prop>
|
||||||
@ -66,9 +66,7 @@
|
|||||||
|
|
||||||
<bean id="labelService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
<bean id="labelService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
||||||
<property name="transactionManager" ref="transactionManager"/>
|
<property name="transactionManager" ref="transactionManager"/>
|
||||||
<property name="target">
|
<property name="target" ref="labelServiceTarget" />
|
||||||
<ref local="labelServiceTarget"/>
|
|
||||||
</property>
|
|
||||||
<property name="transactionAttributes">
|
<property name="transactionAttributes">
|
||||||
<props>
|
<props>
|
||||||
<prop key="*">PROPAGATION_REQUIRED</prop>
|
<prop key="*">PROPAGATION_REQUIRED</prop>
|
||||||
@ -91,16 +89,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
|
<bean id="velocityEngineWrapper" class="com.wisemapping.util.VelocityEngineWrapper">
|
||||||
<property name="velocityProperties">
|
|
||||||
<value>
|
|
||||||
resource.loader=class
|
|
||||||
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
|
|
||||||
</value>
|
|
||||||
</property>
|
|
||||||
</bean>
|
</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="baseUrl" value="${site.baseurl}"/>
|
||||||
<property name="mailer" ref="mailer"/>
|
<property name="mailer" ref="mailer"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
||||||
xsi:schemaLocation="
|
xsi:schemaLocation="
|
||||||
http://www.springframework.org/schema/beans
|
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
|
||||||
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
|
||||||
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:component-scan base-package="com.wisemapping.webmvc"/>
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
@ -71,10 +71,10 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
|
<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>
|
||||||
|
|
||||||
<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">
|
<property name="definitions">
|
||||||
<list>
|
<list>
|
||||||
<value>/WEB-INF/defs/definitions.xml</value>
|
<value>/WEB-INF/defs/definitions.xml</value>
|
||||||
|
@ -21,13 +21,13 @@
|
|||||||
<div class="row jumbotron" id="loginPanel">
|
<div class="row jumbotron" id="loginPanel">
|
||||||
<h1><spring:message code="SIGN_IN"/></h1>
|
<h1><spring:message code="SIGN_IN"/></h1>
|
||||||
|
|
||||||
<form action="/c/j_spring_security_check" method="POST" class="form-horizontal"
|
<form action="/c/perform-login" method="POST" class="form-horizontal"
|
||||||
id="loginForm">
|
id="loginForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label>
|
<label class="col-md-3 control-label" for="email"><spring:message code="EMAIL"/>: </label>
|
||||||
|
|
||||||
<div class="col-md-9">
|
<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"/>
|
class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<label class="col-md-3 control-label" for="password"><spring:message code="PASSWORD"/>: </label>
|
<label class="col-md-3 control-label" for="password"><spring:message code="PASSWORD"/>: </label>
|
||||||
|
|
||||||
<div class="col-md-9">
|
<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"/>
|
class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<p><spring:message code="FORGOT_PASSWORD_MESSAGE"/></p>
|
<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>
|
<label for="email" class="col-md-2 control-label"><spring:message code="EMAIL"/>: </label>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<input id="email" type="email" required="required" name="email" class="form-control"/>
|
<input id="email" type="email" required="required" name="email" class="form-control"/>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<h1><spring:message code="USER_REGISTRATION"/></h1>
|
<h1><spring:message code="USER_REGISTRATION"/></h1>
|
||||||
|
|
||||||
<p><spring:message code="REGISTRATION_TITLE_MSG"/></p>
|
<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">
|
<div class="form-group">
|
||||||
<label for="email" class="col-md-2 control-label"><spring:message code="EMAIL"/>: </label>
|
<label for="email" class="col-md-2 control-label"><spring:message code="EMAIL"/>: </label>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
|
@ -22,18 +22,22 @@ public class ExportXsltBasedTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test(dataProvider = "Data-Provider-Function")
|
@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);
|
final Exporter exporter = XSLTExporter.create(type);
|
||||||
byte[] wiseMapContent = FileUtils.readFileToByteArray(wisemap);
|
byte[] wiseMapContent = FileUtils.readFileToByteArray(wisemap);
|
||||||
if (recFile.exists()) {
|
if (recFile.exists()) {
|
||||||
// Compare rec and file ...
|
// 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 ...
|
// Export mile content ...
|
||||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
exporter.export(wiseMapContent, bos);
|
exporter.export(wiseMapContent, bos);
|
||||||
final String exportContent = new String(bos.toByteArray(), StandardCharsets.UTF_8);
|
final String exportContent = new String(bos.toByteArray(), StandardCharsets.UTF_8)
|
||||||
|
.replaceAll("\n\\p{Blank}+", "\n")
|
||||||
|
.replaceAll("\n+", "\n");
|
||||||
Assert.assertEquals(exportContent, recContent);
|
Assert.assertEquals(exportContent, recContent);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.wisemapping.test.model;
|
package com.wisemapping.test.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.wisemapping.rest.model.*;
|
import com.wisemapping.rest.model.*;
|
||||||
import org.codehaus.jackson.map.ObjectMapper;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -97,12 +97,12 @@ public class RestAccountITCase {
|
|||||||
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
|
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
|
||||||
|
|
||||||
// Add extension only to avoid the fact that the last part is extracted ...
|
// 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);
|
return templateRest.exchange(url, HttpMethod.GET, findUserEntity, RestUser.class, email);
|
||||||
}
|
}
|
||||||
|
|
||||||
private URI createUser(HttpHeaders requestHeaders, RestTemplate templateRest, RestUser restUser) {
|
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);
|
return templateRest.postForLocation(BASE_REST_URL + "/admin/users", createUserEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,10 +125,10 @@ public class RestAdminITCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ResponseEntity<RestUser> findUserByEmail(HttpHeaders requestHeaders, RestTemplate templateRest, final String email) {
|
private ResponseEntity<RestUser> findUserByEmail(HttpHeaders requestHeaders, RestTemplate templateRest, final String email) {
|
||||||
HttpEntity<RestUser> findUserEntity = new HttpEntity<RestUser>(requestHeaders);
|
HttpEntity<RestUser> findUserEntity = new HttpEntity<>(requestHeaders);
|
||||||
|
|
||||||
// Add extension only to avoid the fact that the last part is extracted ...
|
// 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}?mediaType=json";
|
||||||
return templateRest.exchange(url, HttpMethod.GET, findUserEntity, RestUser.class, email);
|
return templateRest.exchange(url, HttpMethod.GET, findUserEntity, RestUser.class, email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,21 +2,10 @@ package com.wisemapping.test.rest;
|
|||||||
|
|
||||||
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.Label;
|
import com.wisemapping.rest.model.*;
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import com.wisemapping.rest.model.RestLabel;
|
|
||||||
import com.wisemapping.rest.model.RestLabelList;
|
|
||||||
import com.wisemapping.rest.model.RestMindmap;
|
|
||||||
import com.wisemapping.rest.model.RestMindmapInfo;
|
|
||||||
import com.wisemapping.rest.model.RestMindmapList;
|
|
||||||
import com.wisemapping.rest.model.RestUser;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.http.HttpEntity;
|
import org.springframework.http.*;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpMethod;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.testng.SkipException;
|
import org.testng.SkipException;
|
||||||
@ -27,14 +16,8 @@ import java.io.IOException;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.wisemapping.test.rest.RestHelper.BASE_REST_URL;
|
import static com.wisemapping.test.rest.RestHelper.*;
|
||||||
import static com.wisemapping.test.rest.RestHelper.COLOR;
|
import static org.testng.Assert.*;
|
||||||
import static com.wisemapping.test.rest.RestHelper.HOST_PORT;
|
|
||||||
import static com.wisemapping.test.rest.RestHelper.createHeaders;
|
|
||||||
import static com.wisemapping.test.rest.RestHelper.createTemplate;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
import static org.testng.Assert.fail;
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public class RestMindmapITCase {
|
public class RestMindmapITCase {
|
||||||
|
Loading…
Reference in New Issue
Block a user