Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
51b5de2eed | ||
|
c84a583c3f | ||
|
5c18c44a2f | ||
|
f16762636b | ||
|
1f99ce3889 | ||
|
63cfe44d50 | ||
|
07ad57e3b4 | ||
|
7fd227d56f | ||
|
5d7e7f8d30 | ||
|
d69373f563 | ||
|
7d7373768f | ||
|
5c0c18eba0 | ||
|
188b280bf2 | ||
|
6f205e04ce | ||
|
ff4c7d2949 | ||
|
fb1755768c | ||
|
c269cd9edb | ||
|
89dd7e0193 | ||
|
ccc0b10ea0 | ||
|
83cff3f66d | ||
|
f35d145fb8 | ||
|
609fdd7144 | ||
|
b67cd407a4 | ||
|
6c808dfc2a | ||
|
9af7247072 | ||
|
ea1349c518 | ||
|
607418dcf7 | ||
|
0da8c73d74 | ||
|
cd0ff1dc89 | ||
|
19ae88e93f | ||
|
18c67233da | ||
|
ebea27b3df | ||
|
13f8eb0898 | ||
|
aed943ce5a | ||
|
d9c7db9c1f | ||
|
d567caa61c | ||
|
4f662acefe | ||
|
6abc5a9e5e | ||
|
571895a2b3 | ||
|
62e009b7e4 | ||
|
4e45aea3f9 |
@@ -10,7 +10,7 @@ ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT"
|
||||
ARG DB_BASE_DIR="/var/lib/wisemapping"
|
||||
|
||||
# Defautl ENV configurations ...
|
||||
ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80"
|
||||
ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80 -javaagent:/opt/newrelic/newrelic.jar"
|
||||
ENV database.base.url=${DB_BASE_DIR}
|
||||
|
||||
# Copy wisemapping distribution ...
|
||||
|
4
pom.xml
4
pom.xml
@@ -4,7 +4,7 @@
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<properties>
|
||||
<com.wisemapping.version>5.0.2</com.wisemapping.version>
|
||||
<com.wisemapping.version>5.0.5</com.wisemapping.version>
|
||||
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
|
||||
</properties>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<groupId>org.wisemapping</groupId>
|
||||
<artifactId>wisemapping</artifactId>
|
||||
<name>WiseMapping Project</name>
|
||||
<version>5.0.2</version>
|
||||
<version>5.0.5</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<licenses>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<groupId>org.wisemapping</groupId>
|
||||
<artifactId>wisemapping</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>5.0.2</version>
|
||||
<version>5.0.5</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
@@ -29,11 +29,11 @@
|
||||
<mkdir dir="target/wisemapping-mindplot"/>
|
||||
<exec executable="npm" dir="target">
|
||||
<arg value="pack"/>
|
||||
<arg value="@wisemapping/mindplot@5.0.3"/>
|
||||
<arg value="@wisemapping/mindplot@5.0.5"/>
|
||||
</exec>
|
||||
<exec executable="tar" dir="target">
|
||||
<arg value="-xvzf"/>
|
||||
<arg value="wisemapping-mindplot-5.0.3.tgz"/>
|
||||
<arg value="wisemapping-mindplot-5.0.5.tgz"/>
|
||||
<arg value="-C"/>
|
||||
<arg value="wisemapping-mindplot"/>
|
||||
</exec>
|
||||
@@ -42,11 +42,11 @@
|
||||
<mkdir dir="target/wisemapping-webapp"/>
|
||||
<exec executable="npm" dir="target">
|
||||
<arg value="pack"/>
|
||||
<arg value="@wisemapping/webapp@5.0.3"/>
|
||||
<arg value="@wisemapping/webapp@5.0.6"/>
|
||||
</exec>
|
||||
<exec executable="tar" dir="target">
|
||||
<arg value="-xvzf"/>
|
||||
<arg value="wisemapping-webapp-5.0.3.tgz"/>
|
||||
<arg value="wisemapping-webapp-5.0.6.tgz"/>
|
||||
<arg value="-C"/>
|
||||
<arg value="wisemapping-webapp"/>
|
||||
</exec>
|
||||
|
@@ -9,28 +9,13 @@
|
||||
<groupId>org.wisemapping</groupId>
|
||||
<artifactId>wisemapping</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>5.0.2</version>
|
||||
<version>5.0.5</version>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven2-repository.dev.java.net</id>
|
||||
<name>Java.net Repository for Maven</name>
|
||||
<url>http://download.java.net/maven/2/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>maven2-repository.jahia.org</id>
|
||||
<name>Jahia Repository for Maven</name>
|
||||
<url>http://maven.jahia.org/maven2/</url>
|
||||
<layout>default</layout>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<org.springframework.version>5.3.14</org.springframework.version>
|
||||
<org.springframework.addons>5.3.5.RELEASE</org.springframework.addons>
|
||||
<hibernate.version>5.6.3.Final</hibernate.version>
|
||||
<hibernate.version>5.6.5.Final</hibernate.version>
|
||||
<hibernate-validator.version>6.0.21.Final</hibernate-validator.version>
|
||||
</properties>
|
||||
|
||||
@@ -205,7 +190,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.27</version>
|
||||
<version>8.0.28</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -213,12 +198,6 @@
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<version>2.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-ehcache</artifactId>
|
||||
@@ -240,6 +219,12 @@
|
||||
<version>1.2.17</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
|
||||
<dependency>
|
||||
<groupId>commons-validator</groupId>
|
||||
<artifactId>commons-validator</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<!-- Only for test purposes -->
|
||||
<dependency>
|
||||
<groupId>org.hsqldb</groupId>
|
||||
@@ -250,7 +235,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.11.3</version>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
@@ -277,7 +262,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>fluent-hc</artifactId>
|
||||
<version>4.5.5</version>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@@ -102,22 +102,28 @@ public class UserManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public User createUser(@NotNull User user, @NotNull Collaborator col) {
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
assert user != null : "Trying to store a null user";
|
||||
public User createUser(@NotNull User user, @NotNull Collaborator collaborator) {
|
||||
this.createUser(user);
|
||||
|
||||
final Set<Collaboration> set = col.getCollaborations();
|
||||
for (Collaboration collaboration : set) {
|
||||
Collaboration newMapUser = new Collaboration();
|
||||
newMapUser.setRoleId(collaboration.getRole().ordinal());
|
||||
newMapUser.setMindMap(collaboration.getMindMap());
|
||||
newMapUser.setCollaborator(user);
|
||||
user.addCollaboration(newMapUser);
|
||||
// Migrate from previous temporal collab to new user ...
|
||||
final Set<Collaboration> collaborations = collaborator.getCollaborations();
|
||||
for (Collaboration oldCollab : collaborations) {
|
||||
Collaboration newCollab = new Collaboration();
|
||||
newCollab.setRoleId(oldCollab.getRole().ordinal());
|
||||
newCollab.setMindMap(oldCollab.getMindMap());
|
||||
newCollab.setCollaborator(user);
|
||||
user.addCollaboration(newCollab);
|
||||
getHibernateTemplate().save(newCollab);
|
||||
|
||||
// Delete collaborations on this collaborator ...
|
||||
getHibernateTemplate().delete(oldCollab);
|
||||
}
|
||||
|
||||
getHibernateTemplate().delete(col);
|
||||
// Delete collaboration ...
|
||||
getHibernateTemplate().delete(collaborator);
|
||||
getHibernateTemplate().flush();
|
||||
getHibernateTemplate().saveOrUpdate(user);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -136,8 +142,7 @@ public class UserManagerImpl
|
||||
|
||||
// Does the password need to be encrypted ?
|
||||
final String password = user.getPassword();
|
||||
if(password!=null && (!password.startsWith(LegacyPasswordEncoder.ENC_PREFIX) && !password.startsWith( "{"+ DefaultPasswordEncoderFactories.ENCODING_ID)))
|
||||
{
|
||||
if (password != null && (!password.startsWith(LegacyPasswordEncoder.ENC_PREFIX) && !password.startsWith("{" + DefaultPasswordEncoderFactories.ENCODING_ID))) {
|
||||
user.setPassword(passwordEncoder.encode(user.getPassword()));
|
||||
}
|
||||
|
||||
@@ -152,7 +157,7 @@ public class UserManagerImpl
|
||||
query.setParameter("activationCode", code);
|
||||
final List users = query.list();
|
||||
|
||||
if(users != null && !users.isEmpty()) {
|
||||
if (users != null && !users.isEmpty()) {
|
||||
|
||||
assert users.size() == 1 : "More than one user with the same username!";
|
||||
user = (User) users.get(0);
|
||||
|
@@ -41,7 +41,7 @@ public final class Mailer {
|
||||
|
||||
//~ Methods ..............................................................................................
|
||||
|
||||
public Mailer(@NotNull String siteEmail, @NotNull String supportEmail,@NotNull String errorReporterEmail) {
|
||||
public Mailer(@NotNull String siteEmail, @NotNull String supportEmail, @NotNull String errorReporterEmail) {
|
||||
this.serverFromEmail = siteEmail;
|
||||
this.supportEmail = supportEmail;
|
||||
this.errorReporterEmail = errorReporterEmail;
|
||||
@@ -51,7 +51,7 @@ public final class Mailer {
|
||||
return serverFromEmail;
|
||||
}
|
||||
|
||||
public void sendEmail(final String from, final String to, final String subject, final Map model,
|
||||
public void sendEmail(final String from, final String to, final String subject, final Map<String, Object> model,
|
||||
@NotNull final String templateMail) {
|
||||
final MimeMessagePreparator preparator =
|
||||
new MimeMessagePreparator() {
|
||||
|
@@ -22,6 +22,7 @@ import com.wisemapping.filter.SupportedUserAgent;
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.rest.model.RestLogItem;
|
||||
import com.wisemapping.util.VelocityEngineUtils;
|
||||
import com.wisemapping.util.VelocityEngineWrapper;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -37,6 +38,7 @@ import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
final public class NotificationService {
|
||||
final private static Logger logger = Logger.getLogger(Mailer.class);
|
||||
@@ -65,7 +67,7 @@ final public class NotificationService {
|
||||
final String subject = "[WiseMapping] " + user.getFullName() + " has shared a mindmap with you";
|
||||
|
||||
// Fill template properties ...
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
final Map<String, Object> model = new HashMap<>();
|
||||
model.put("mindmap", mindmap);
|
||||
model.put("message", "message");
|
||||
model.put("ownerName", user.getFirstname());
|
||||
@@ -93,12 +95,6 @@ final public class NotificationService {
|
||||
sendTemplateMail(user, mailSubject, messageTitle, messageBody);
|
||||
}
|
||||
|
||||
private void logErrorMessage(final Map model,
|
||||
@NotNull final String templateMail) {
|
||||
final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model);
|
||||
logger.error("Unexpected editor error => " + messageBody);
|
||||
}
|
||||
|
||||
|
||||
public void passwordChanged(@NotNull User user) {
|
||||
final String mailSubject = "[WiseMapping] Your password has been changed";
|
||||
@@ -120,7 +116,7 @@ final public class NotificationService {
|
||||
private void sendTemplateMail(@NotNull User user, @NotNull String mailSubject, @NotNull String messageTitle, @NotNull String messageBody) {
|
||||
|
||||
try {
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
final Map<String, Object> model = new HashMap<>();
|
||||
model.put("firstName", user.getFirstname());
|
||||
model.put("messageTitle", messageTitle);
|
||||
model.put("messageBody", messageBody);
|
||||
@@ -145,7 +141,7 @@ final public class NotificationService {
|
||||
|
||||
|
||||
public void activateAccount(@NotNull User user) {
|
||||
final Map<String, User> model = new HashMap<String, User>();
|
||||
final Map<String, Object> model = new HashMap<>();
|
||||
model.put("user", user);
|
||||
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "[WiseMapping] Active account", model, "activationAccountMail.vm");
|
||||
}
|
||||
@@ -168,19 +164,24 @@ final public class NotificationService {
|
||||
this.velocityEngineWrapper = engine;
|
||||
}
|
||||
|
||||
public void reportJavascriptException(@Nullable Mindmap mindmap, @Nullable User user, @Nullable String jsErrorMsg, @NotNull HttpServletRequest request) {
|
||||
public void reportJavascriptException(@Nullable Mindmap mindmap, @Nullable User user, @NotNull RestLogItem errorItem, @NotNull HttpServletRequest request) {
|
||||
|
||||
final Map<String, String> model = new HashMap<>();
|
||||
model.put("errorMsg", jsErrorMsg);
|
||||
final Map<String, String> summary = new HashMap<>();
|
||||
summary.put("JS-MSG", errorItem.getJsErrorMsg());
|
||||
summary.put("JS-STACK", errorItem.getJsStack());
|
||||
|
||||
String mindmapXML = "";
|
||||
try {
|
||||
model.put("mapXML", StringEscapeUtils.escapeXml(mindmap == null ? "map not found" : mindmap.getXmlStr()));
|
||||
mindmapXML = StringEscapeUtils.escapeXml(mindmap == null ? "map not found" : mindmap.getXmlStr());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Ignore ...
|
||||
}
|
||||
model.put("mapId", Integer.toString(mindmap.getId()));
|
||||
model.put("mapTitle", mindmap.getTitle());
|
||||
summary.put("mapId", Integer.toString(mindmap.getId()));
|
||||
summary.put("mapTitle", mindmap.getTitle());
|
||||
|
||||
logError(model, user, request);
|
||||
logError(summary, user, request);
|
||||
logger.error("Unexpected editor mindmap => " + mindmapXML);
|
||||
logger.error("Unexpected editor JS Stack => " + errorItem.getJsErrorMsg() + "-" + errorItem.getJsStack());
|
||||
}
|
||||
|
||||
private void logError(@NotNull Map<String, String> model, @Nullable User user, @NotNull HttpServletRequest request) {
|
||||
@@ -194,12 +195,15 @@ final public class NotificationService {
|
||||
model.put("method", request.getMethod());
|
||||
model.put("remoteAddress", request.getRemoteAddr());
|
||||
|
||||
logErrorMessage(model,
|
||||
"errorNotification.vm");
|
||||
String errorAsString = model.keySet().stream()
|
||||
.map(key -> key + "=" + model.get(key))
|
||||
.collect(Collectors.joining(", ", "{", "}"));
|
||||
|
||||
logger.error("Unexpected editor info => " + errorAsString);
|
||||
}
|
||||
|
||||
public void reportJavaException(@NotNull Throwable exception, @Nullable User user, @NotNull HttpServletRequest request) {
|
||||
final Map<String, String> model = new HashMap<String, String>();
|
||||
final Map<String, String> model = new HashMap<>();
|
||||
model.put("errorMsg", stackTraceToString(exception));
|
||||
|
||||
logError(model, user, request);
|
||||
|
@@ -1,24 +1,27 @@
|
||||
/*
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
* Copyright [2015] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.model;
|
||||
|
||||
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
@@ -29,22 +32,23 @@ public class Collaboration implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;;
|
||||
private int id;
|
||||
;
|
||||
|
||||
@Column(name = "role_id",unique = true,nullable = true)
|
||||
@Column(name = "role_id", unique = true)
|
||||
private CollaborationRole role;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name="mindmap_id",nullable = false)
|
||||
@JoinColumn(name = "mindmap_id", nullable = false)
|
||||
private Mindmap mindMap;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name="colaborator_id",nullable = false)
|
||||
@JoinColumn(name = "colaborator_id", nullable = false)
|
||||
private Collaborator collaborator;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name="properties_id",nullable = false, unique = true)
|
||||
private CollaborationProperties collaborationProperties = new CollaborationProperties();;
|
||||
@JoinColumn(name = "properties_id", nullable = false, unique = true)
|
||||
private CollaborationProperties collaborationProperties = new CollaborationProperties();
|
||||
|
||||
public Collaboration() {
|
||||
}
|
||||
@@ -129,10 +133,9 @@ public class Collaboration implements Serializable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int) (id ^ (id >>> 32));
|
||||
int result = id ^ (id >>> 32);
|
||||
result = 31 * result + (role != null ? role.hashCode() : 0);
|
||||
result = 31 * result + (mindMap != null ? mindMap.hashCode() : 0);
|
||||
result = 31 * result + (collaborator != null ? collaborator.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -55,8 +55,6 @@ public class AccountController extends BaseController {
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
final Logger logger = Logger.getLogger(AccountController.class);
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT, value = "account/password", consumes = {"text/plain"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
@@ -133,8 +131,8 @@ public class AccountController extends BaseController {
|
||||
public void logError(@RequestBody RestLogItem item, @NotNull HttpServletRequest request) {
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(item.getMapId());
|
||||
final User user = Utils.getUser();
|
||||
logger.error("Unexpected editor error - " + item.getJsErrorMsg());
|
||||
notificationService.reportJavascriptException(mindmap, user, item.getJsErrorMsg() + "\n" + item.getJsStack(), request);
|
||||
|
||||
notificationService.reportJavascriptException(mindmap, user, item, request);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ import com.wisemapping.rest.model.*;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.*;
|
||||
import com.wisemapping.validator.MapInfoValidator;
|
||||
import org.apache.commons.validator.routines.EmailValidator;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -74,7 +75,7 @@ public class MindmapController extends BaseController {
|
||||
List<Mindmap> mindmaps = mindmapService.findMindmapsByUser(user);
|
||||
mindmaps = mindmaps
|
||||
.stream()
|
||||
.filter(m->filter.accept(m, user))
|
||||
.filter(m -> filter.accept(m, user))
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
|
||||
return new RestMindmapList(mindmaps, user);
|
||||
@@ -296,7 +297,14 @@ public class MindmapController extends BaseController {
|
||||
// Compare one by one if some of the elements has been changed ....
|
||||
final Set<Collaboration> collabsToRemove = new HashSet<>(mindMap.getCollaborations());
|
||||
for (RestCollaboration restCollab : restCollabs.getCollaborations()) {
|
||||
final Collaboration collaboration = mindMap.findCollaboration(restCollab.getEmail());
|
||||
final String email = restCollab.getEmail();
|
||||
|
||||
// Is a valid email address ?
|
||||
if (!EmailValidator.getInstance().isValid(email)) {
|
||||
throw new IllegalArgumentException(email + " is not valid email address");
|
||||
}
|
||||
|
||||
final Collaboration collaboration = mindMap.findCollaboration(email);
|
||||
// Validate role format ...
|
||||
String roleStr = restCollab.getRole();
|
||||
if (roleStr == null) {
|
||||
@@ -333,6 +341,17 @@ public class MindmapController extends BaseController {
|
||||
throw new IllegalArgumentException("No enough permissions");
|
||||
}
|
||||
|
||||
// Is valid email address ?
|
||||
final EmailValidator emailValidator = EmailValidator.getInstance();
|
||||
restCollabs
|
||||
.getCollaborations()
|
||||
.forEach(collab -> {
|
||||
// Is a valid email address ?
|
||||
if (!emailValidator.isValid(collab.getEmail())) {
|
||||
throw new IllegalArgumentException(collab.getEmail() + " is not valid email address");
|
||||
}
|
||||
});
|
||||
|
||||
// Has any role changed ?. Just removed it.
|
||||
final Map<String, Collaboration> mapsByEmail = mindMap
|
||||
.getCollaborations()
|
||||
@@ -432,6 +451,12 @@ public class MindmapController extends BaseController {
|
||||
public void deleteCollabByEmail(@PathVariable int id, @RequestParam(required = false) String email) throws IOException, WiseMappingException {
|
||||
logger.debug("Deleting permission for email:" + email);
|
||||
|
||||
// Is a valid email address ?
|
||||
final EmailValidator emailValidator = EmailValidator.getInstance();
|
||||
if (!emailValidator.isValid(email)) {
|
||||
throw new IllegalArgumentException(email + " is not valid email address");
|
||||
}
|
||||
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
@@ -496,46 +521,41 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps", consumes = {"application/xml", "application/json", "application/wisemapping+xml"})
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps", consumes = {"application/xml", "application/json"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void createMap(@RequestBody(required = false) RestMindmap restMindmap, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException {
|
||||
// If a default maps has not been defined, just create one ...
|
||||
if (restMindmap == null) {
|
||||
restMindmap = new RestMindmap();
|
||||
public void createMap(@RequestBody(required = false) String mapXml, @NotNull HttpServletResponse response, @RequestParam(required = false) String title, @RequestParam(required = false) String description) throws IOException, WiseMappingException {
|
||||
|
||||
final Mindmap mindmap = new Mindmap();
|
||||
if (title != null && !title.isEmpty()) {
|
||||
mindmap.setTitle(title);
|
||||
}
|
||||
|
||||
// Overwrite title and description if they where specified by parameter.
|
||||
if (title != null && !title.isEmpty()) {
|
||||
restMindmap.setTitle(title);
|
||||
}
|
||||
if (description != null && !description.isEmpty()) {
|
||||
restMindmap.setDescription(description);
|
||||
mindmap.setDescription(description);
|
||||
} else {
|
||||
restMindmap.setDescription("");
|
||||
mindmap.setDescription("description");
|
||||
}
|
||||
|
||||
// Validate ...
|
||||
final BindingResult result = new BeanPropertyBindingResult(restMindmap, "");
|
||||
new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result);
|
||||
final BindingResult result = new BeanPropertyBindingResult(mindmap, "");
|
||||
new MapInfoValidator(mindmapService).validate(mindmap, result);
|
||||
if (result.hasErrors()) {
|
||||
throw new ValidationException(result);
|
||||
}
|
||||
|
||||
// If the user has not specified the xml content, add one ...
|
||||
final Mindmap delegated = restMindmap.getDelegated();
|
||||
String xml = restMindmap.getXml();
|
||||
if (xml == null || xml.isEmpty()) {
|
||||
xml = Mindmap.getDefaultMindmapXml(restMindmap.getTitle());
|
||||
if (mapXml == null || mapXml.isEmpty()) {
|
||||
mapXml = Mindmap.getDefaultMindmapXml(mindmap.getTitle());
|
||||
}
|
||||
delegated.setXmlStr(xml);
|
||||
mindmap.setXmlStr(mapXml);
|
||||
|
||||
// Add new mindmap ...
|
||||
final User user = Utils.getUser();
|
||||
mindmapService.addMindmap(delegated, user);
|
||||
mindmapService.addMindmap(mindmap, user);
|
||||
|
||||
// Return the new created map ...
|
||||
response.setHeader("Location", "/service/maps/" + delegated.getId());
|
||||
response.setHeader("ResourceId", Integer.toString(delegated.getId()));
|
||||
response.setHeader("Location", "/service/maps/" + mindmap.getId());
|
||||
response.setHeader("ResourceId", Integer.toString(mindmap.getId()));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"}, produces = {"application/xml", "application/json", "text/plain"})
|
||||
@@ -578,9 +598,9 @@ public class MindmapController extends BaseController {
|
||||
return new ValidationException(result);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}/labels/{lid)}")
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = "/maps/{id}/labels/{lid}")
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void removeLabelFromMap(@PathVariable int id, @RequestBody int lid) throws WiseMappingException {
|
||||
public void removeLabelFromMap(@PathVariable int id, @PathVariable int lid) throws WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
final Label label = labelService.findLabelById(lid, user);
|
||||
@@ -590,7 +610,7 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
mindmap.removeLabel(label);
|
||||
mindmapService.updateMindmap(mindmap,false);
|
||||
mindmapService.updateMindmap(mindmap, false);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/labels", consumes = {"application/xml", "application/json"})
|
||||
@@ -604,6 +624,6 @@ public class MindmapController extends BaseController {
|
||||
|
||||
final Mindmap mindmap = findMindmapById(id);
|
||||
mindmap.addLabel(label);
|
||||
mindmapService.updateMindmap(mindmap,false);
|
||||
mindmapService.updateMindmap(mindmap, false);
|
||||
}
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ public class UserController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/users", produces = {"application/json", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void registerUser(@RequestBody RestUserRegistration registration, @NotNull HttpServletRequest request, @NotNull HttpServletResponse response) throws WiseMappingException, BindException {
|
||||
logger.info("Register new user:" + registration.getEmail());
|
||||
logger.debug("Register new user:" + registration.getEmail());
|
||||
|
||||
// If tomcat is behind a reverse proxy, ip needs to be found in other header.
|
||||
String remoteIp = request.getHeader(REAL_IP_ADDRESS_HEADER);
|
||||
|
@@ -156,7 +156,7 @@ public class MindmapServiceImpl
|
||||
|
||||
@Override
|
||||
public void removeMindmap(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException {
|
||||
if (mindmap.getCreator().identityEquality(user) || isAdmin(user)) {
|
||||
if (mindmap.getCreator().identityEquality(user)) {
|
||||
mindmapManager.removeMindmap(mindmap);
|
||||
} else {
|
||||
final Optional<Collaboration> collaboration = mindmap.findCollaboration(user);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.wisemapping.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wisemapping.validator.Messages;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.fluent.Form;
|
||||
@@ -22,6 +23,8 @@ public class RecaptchaService {
|
||||
"https://www.google.com/recaptcha/api/siteverify";
|
||||
|
||||
private final static ObjectMapper objectMapper = new ObjectMapper();
|
||||
public static final String CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE = "timeout-or-duplicate";
|
||||
public static final String CATCHA_ERROR_CODE_INPUT_RESPONSE = "invalid-input-response";
|
||||
private String recaptchaSecret;
|
||||
|
||||
@Nullable
|
||||
@@ -48,12 +51,21 @@ public class RecaptchaService {
|
||||
.asBytes();
|
||||
|
||||
final Map responseBody = objectMapper.readValue(body, HashMap.class);
|
||||
logger.warn("Response from recaptcha after parse: " + responseBody);
|
||||
logger.debug("Response from recaptcha after parse: " + responseBody);
|
||||
|
||||
final Boolean success = (Boolean) responseBody.get("success");
|
||||
if (success!=null && !success) {
|
||||
if (success != null && !success) {
|
||||
final List<String> errorCodes = (List<String>) responseBody.get("error-codes");
|
||||
result = RecaptchaUtil.codeToDescription(errorCodes.get(0));
|
||||
String errorCode = errorCodes.get(0);
|
||||
if (errorCode.equals(CATCH_ERROR_CODE_TIMEOUT_OR_DUPLICATE)) {
|
||||
result = Messages.CAPTCHA_TIMEOUT_OUT_DUPLICATE;
|
||||
|
||||
} else if (errorCode.equals("invalid-input-response")) {
|
||||
result = Messages.CAPTCHA_INVALID_INPUT_RESPONSE;
|
||||
} else {
|
||||
result = Messages.CAPTCHA_LOADING_ERROR;
|
||||
logger.error("Unexpected error during catch resolution:" + errorCodes);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
@@ -68,30 +80,4 @@ public class RecaptchaService {
|
||||
public void setRecaptchaSecret(String recaptchaSecret) {
|
||||
this.recaptchaSecret = recaptchaSecret;
|
||||
}
|
||||
}
|
||||
|
||||
class RecaptchaUtil {
|
||||
|
||||
private static final Map<String, String>
|
||||
RECAPTCHA_ERROR_CODE = new HashMap<>();
|
||||
|
||||
static String codeToDescription(final String code)
|
||||
{
|
||||
return RECAPTCHA_ERROR_CODE.getOrDefault(code,"Unexpected error validating code. Please, refresh the page and try again.");
|
||||
}
|
||||
|
||||
static {
|
||||
RECAPTCHA_ERROR_CODE.put("missing-input-secret",
|
||||
"The secret parameter is missing");
|
||||
RECAPTCHA_ERROR_CODE.put("invalid-input-secret",
|
||||
"The secret parameter is invalid or malformed");
|
||||
RECAPTCHA_ERROR_CODE.put("missing-input-response",
|
||||
"The response parameter is missing");
|
||||
RECAPTCHA_ERROR_CODE.put("invalid-input-response",
|
||||
"The response parameter is invalid or malformed");
|
||||
RECAPTCHA_ERROR_CODE.put("bad-request",
|
||||
"The request is invalid or malformed");
|
||||
RECAPTCHA_ERROR_CODE.put("timeout-or-duplicate",
|
||||
"Please, refresh the page and try again.");
|
||||
}
|
||||
}
|
@@ -119,13 +119,11 @@ public class UserServiceImpl
|
||||
|
||||
if (emailConfirmEnabled) {
|
||||
user.setActivationDate(null);
|
||||
|
||||
} else {
|
||||
user.setActivationDate(Calendar.getInstance());
|
||||
}
|
||||
|
||||
Collaborator col = userManager.getCollaboratorBy(user.getEmail());
|
||||
|
||||
final Collaborator col = userManager.getCollaboratorBy(user.getEmail());
|
||||
if (col != null) {
|
||||
userManager.createUser(user, col);
|
||||
} else {
|
||||
|
@@ -26,4 +26,7 @@ public interface Messages {
|
||||
String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS";
|
||||
String PASSWORD_MISMATCH = "PASSWORD_MISMATCH";
|
||||
String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR";
|
||||
|
||||
String CAPTCHA_TIMEOUT_OUT_DUPLICATE = "CAPTCHA_TIMEOUT_OUT_DUPLICATE";
|
||||
String CAPTCHA_INVALID_INPUT_RESPONSE = "CAPTCHA_INVALID_INPUT_RESPONSE";
|
||||
}
|
||||
|
@@ -18,32 +18,14 @@
|
||||
|
||||
package com.wisemapping.webmvc;
|
||||
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
public class PublicPagesController {
|
||||
@Qualifier("mindmapService")
|
||||
@Autowired
|
||||
private MindmapService mindmapService;
|
||||
|
||||
@RequestMapping(value = "keyboard")
|
||||
public String newsPage() {
|
||||
return "keyboard";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "home")
|
||||
public String home() {
|
||||
return "homepage";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "iframeWrapper")
|
||||
public ModelAndView showIframePage(@RequestParam(required = true) String url) {
|
||||
return new ModelAndView("iframeWrapper", "url", url);
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +0,0 @@
|
||||
User Name: ${fullName} -
|
||||
Email: ${email} -
|
||||
Server: ${server} -
|
||||
RequestURI: ${requestURI} -
|
||||
Method: ${method} -
|
||||
User Agent: ${userAgent} -
|
||||
Remote Address: ${remoteAddress} -
|
||||
#if($mapId)
|
||||
Mindmap Id: ${mapId} -
|
||||
#end
|
||||
#if($mapTitle)
|
||||
Mindmap Title: ${mapTitle} -
|
||||
#end
|
||||
${errorMsg}
|
||||
|
||||
#if($mapXML)
|
||||
${mapXML}
|
||||
#end
|
@@ -48,4 +48,6 @@ MINDMAP_IS_LOCKED = Mindmap ist für die Bearbeitung gesperrt.
|
||||
# Confirmed
|
||||
RESET_PASSWORD_INVALID_EMAIL = Die angegebene E-Mail-Adresse ist kein gültiges Benutzerkonto. Bitte versuchen Sie es erneut mit einer gültigen E-Mail-Adresse.
|
||||
TRY_WELCOME = Dieser Ausgabebereich zeigt einige der Mindmap-Editor-Funktionen \!.
|
||||
UNEXPECTED_ERROR_DETAILS = Unerwarteter Fehler bei der Verarbeitung der Anforderung.
|
||||
UNEXPECTED_ERROR_DETAILS = Unerwarteter Fehler bei der Verarbeitung der Anforderung.
|
||||
NO_ENOUGH_PERMISSIONS=Diese map ist nicht mehr verfügbar.
|
||||
NO_ENOUGH_PERMISSIONS_DETAILS=Sie haben nicht die erforderlichen Rechte, um sich diese map anzusehen. Diese map ist entweder privat oder wurde gelöscht.
|
||||
|
@@ -48,4 +48,8 @@ MINDMAP_IS_LOCKED = Mindmap is locked for edition.
|
||||
# Confirmed
|
||||
RESET_PASSWORD_INVALID_EMAIL = The email provided is not a valid user account. Please, try again with a valid email.
|
||||
TRY_WELCOME = This edition space showcases some of the mindmap editor capabilities \!.
|
||||
UNEXPECTED_ERROR_DETAILS = Unexpected error processing request.
|
||||
UNEXPECTED_ERROR_DETAILS = Unexpected error processing request.
|
||||
NO_ENOUGH_PERMISSIONS=This mind map can opened.
|
||||
NO_ENOUGH_PERMISSIONS_DETAILS=You do not have enough right access to see this map. This map has been changed to private or deleted.
|
||||
CAPTCHA_TIMEOUT_OUT_DUPLICATE=Please, refresh the page and try again.
|
||||
CAPTCHA_INVALID_INPUT_RESPONSE="Invalid input response, refresh the page and try again.
|
@@ -48,4 +48,7 @@ MINDMAP_IS_LOCKED = Mindmap está bloqueado para la edición.
|
||||
# Confirmed
|
||||
RESET_PASSWORD_INVALID_EMAIL = El correo electrónico proporcionado no es una cuenta de usuario válida. Por favor, intente nuevamente con un correo electrónico válido.
|
||||
TRY_WELCOME = ¡Este espacio de edición muestra algunas de las capacidades del editor de mapas mentales\!.
|
||||
UNEXPECTED_ERROR_DETAILS = Error inesperado procesando tu pedido.
|
||||
UNEXPECTED_ERROR_DETAILS = Error inesperado procesando tu pedido.
|
||||
NO_ENOUGH_PERMISSIONS=El mapa buscado no se encuentra disponible.
|
||||
NO_ENOUGH_PERMISSIONS_DETAILS=No tiene suficiente permisos de acceso para ver este mapa. El mapa no es mas publico o ha sido borrado.
|
||||
|
||||
|
@@ -48,4 +48,6 @@ MINDMAP_IS_LOCKED = Mindmap est verrouillé pour l'édition.
|
||||
# Confirmed
|
||||
RESET_PASSWORD_INVALID_EMAIL = L'e-mail fourni n'est pas un compte d'utilisateur valide. Veuillez réessayer avec un e-mail valide.
|
||||
TRY_WELCOME = Cet espace d'édition présente certaines des fonctionnalités de l'éditeur de cartes mentales \!.
|
||||
UNEXPECTED_ERROR_DETAILS = Erreur inattendue lors du traitement de la demande.
|
||||
UNEXPECTED_ERROR_DETAILS = Erreur inattendue lors du traitement de la demande.
|
||||
NO_ENOUGH_PERMISSIONS=Cette carte n'est plus accessible.
|
||||
NO_ENOUGH_PERMISSIONS_DETAILS=Vous n'avez pas les droits d'accès suffisants pour voir cette carte. Cette carte est devenue privée, ou a été détruite.
|
||||
|
@@ -8,6 +8,13 @@
|
||||
http://www.springframework.org/schema/security
|
||||
http://www.springframework.org/schema/security/spring-security.xsd">
|
||||
|
||||
<bean id="custom-firewall" class="org.springframework.security.web.firewall.StrictHttpFirewall">
|
||||
<property name="allowSemicolon" value="true"/>
|
||||
</bean>
|
||||
|
||||
<sec:http-firewall ref="custom-firewall"/>
|
||||
|
||||
|
||||
<sec:http pattern="/static/webapp/**" security="none"/>
|
||||
<sec:http pattern="/static/mindplot/**" security="none"/>
|
||||
<sec:http pattern="/c/login" security="none"/>
|
||||
|
@@ -64,12 +64,6 @@
|
||||
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
|
||||
</bean>
|
||||
|
||||
<bean id="multipartResolver"
|
||||
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
|
||||
<!-- one of the properties available; the maximum file size in bytes -->
|
||||
<property name="maxUploadSize" value="522240"/>
|
||||
</bean>
|
||||
|
||||
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
|
||||
<property name="basenames">
|
||||
<list>
|
||||
|
1
wise-webapp/src/main/webapp/ads.txt
Normal file
1
wise-webapp/src/main/webapp/ads.txt
Normal file
@@ -0,0 +1 @@
|
||||
google.com, pub-4996113942657337, DIRECT, f08c47fec0942fa0
|
@@ -1,13 +1,16 @@
|
||||
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
|
||||
|
||||
<c:if test="${requestScope['google.analytics.enabled']}">
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-2347723-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
gtag('config', );
|
||||
</script>
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '${requestScope['google.analytics.account']}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
<!-- End Google Analytics -->
|
||||
</c:if>
|
||||
|
||||
|
@@ -38,7 +38,6 @@
|
||||
var readOnly = ${readOnlyMode};
|
||||
var lockTimestamp = '${lockTimestamp}';
|
||||
var lockSession = '${lockSession}';
|
||||
var locale = '${locale}';
|
||||
var mindmapLocked = ${mindmapLocked};
|
||||
var mindmapLockedMsg = '<spring:message code="MINDMAP_LOCKED" arguments="${lockInfo.user.fullName},${lockInfo.user.email}"/>';
|
||||
var userOptions = ${mindmap.properties};
|
||||
@@ -47,7 +46,6 @@
|
||||
var accountEmail = '${principal.email}';
|
||||
var mapTitle = '${mindmap.title}';
|
||||
</script>
|
||||
<%@ include file="/jsp/googleAnalytics.jsf" %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@@ -1,95 +0,0 @@
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
|
||||
|
||||
<div id="toolbar">
|
||||
<div id="backToList">
|
||||
<img src="../../images/editor/back-icon.svg" />
|
||||
</div>
|
||||
<c:if test="${!memoryPersistence}">
|
||||
<div id="persist" class="buttonContainer">
|
||||
<div id="save" class="buttonOn">
|
||||
<img src="../../images/editor/save.svg"/>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${!readOnlyMode}">
|
||||
<div id="edit" class="buttonContainer">
|
||||
<div id="undoEdition" class="buttonOn">
|
||||
<img src="../../images/editor/undo.svg"/>
|
||||
</div>
|
||||
<div id="redoEdition" class="buttonOn">
|
||||
<img src="../../images/editor/redo.svg"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="nodeStyle" class="buttonContainer">
|
||||
<div id="addTopic" class="buttonOn">
|
||||
<img src="../../images/editor/topic-add.svg"/>
|
||||
</div>
|
||||
<div id="deleteTopic" class="buttonOn">
|
||||
<img src="../../images/editor/topic-delete.svg"/>
|
||||
</div>
|
||||
<div id="topicBorder" class="buttonExtOn">
|
||||
<img src="../../images/editor/topic-border.svg"/>
|
||||
</div>
|
||||
<div id="topicColor" class="buttonExtOn">
|
||||
<img src="../../images/editor/topic-color.svg"/>
|
||||
</div>
|
||||
<div id="topicShape" class="buttonExtOn">
|
||||
<img src="../../images/editor/topic-shape.svg"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="font" class="buttonContainer">
|
||||
<div id="fontFamily" class="buttonOn">
|
||||
<img src="../../images/editor/font-type.svg"/>
|
||||
</div>
|
||||
<div id="fontSize" class="buttonExtOn">
|
||||
<img src="../../images/editor/font-size.svg"/>
|
||||
</div>
|
||||
<div id="fontBold" class="buttonOn">
|
||||
<img src="../../images/editor/font-bold.svg"/>
|
||||
</div>
|
||||
<div id="fontItalic" class="buttonOn">
|
||||
<img src="../../images/editor/font-italic.svg"/>
|
||||
</div>
|
||||
<div id="fontColor" class="buttonExtOn">
|
||||
<img src="../../images/editor/font-color.svg"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="nodeContent" class="buttonContainer">
|
||||
<div id="topicIcon" class="buttonExtOn">
|
||||
<img src="../../images/editor/topic-icon.svg"/>
|
||||
</div>
|
||||
<div id="topicNote" class="buttonOn" >
|
||||
<img src="../../images/editor/topic-note.svg"/>
|
||||
</div>
|
||||
<div id="topicLink" class="buttonOn">
|
||||
<img src="../../images/editor/topic-link.svg"/>
|
||||
</div>
|
||||
<div id="topicRelation" class="buttonOn">
|
||||
<img src="../../images/editor/topic-relation.svg"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="separator" class="buttonContainer"></div>
|
||||
</c:if>
|
||||
<c:if test="${!memoryPersistence}">
|
||||
<div id="toolbarRight">
|
||||
<div id="export" class="buttonOn">
|
||||
<img src="../../images/editor/export.svg" />
|
||||
</div>
|
||||
<div id="publishIt" class="buttonOn">
|
||||
<img src="../../images/editor/public.svg" />
|
||||
</div>
|
||||
<div id="history" class="buttonOn">
|
||||
<img src="../../images/editor/history.svg" />
|
||||
</div>
|
||||
<div id="print" class="buttonOn">
|
||||
<img src="../../images/editor/print.svg" />
|
||||
</div>
|
||||
<div id="account">
|
||||
<img src="../../images/editor/account.svg"/>
|
||||
</div>
|
||||
<div id="share" class="actionButton">
|
||||
<spring:message code="SHARE"/>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
</div>
|
@@ -52,8 +52,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Hock zoom events ...
|
||||
// Hook zoom events ...
|
||||
const zoomInButton = document.getElementById('zoom-plus');
|
||||
if (zoomInButton) {
|
||||
zoomInButton.addEventListener('click', () => {
|
||||
|
@@ -23,8 +23,6 @@
|
||||
};
|
||||
|
||||
</script>
|
||||
<%@ include file="/jsp/googleAnalytics.jsf" %>
|
||||
|
||||
<c:if test="${requestScope['google.analytics.enabled']}">
|
||||
<!-- Google Ads Sense Config-->
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4996113942657337" crossorigin="anonymous"></script>
|
||||
|
@@ -35,16 +35,16 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void listMaps(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void listMaps(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final String title1 = "List Maps 1 - " + mediaType;
|
||||
addNewMap(requestHeaders, template, title1);
|
||||
addNewMap(template, title1);
|
||||
|
||||
final String title2 = "List Maps 2 - " + mediaType;
|
||||
addNewMap(requestHeaders, template, title2);
|
||||
addNewMap(template, title2);
|
||||
|
||||
// Check that the map has been created ...
|
||||
final HttpEntity findMapEntity = new HttpEntity(requestHeaders);
|
||||
@@ -68,13 +68,13 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void deleteMap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void deleteMap(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final String title1 = "Map to delete - " + mediaType;
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, title1);
|
||||
final URI resourceUri = addNewMap(template, title1);
|
||||
|
||||
// Now remove it ...
|
||||
template.delete(HOST_PORT + resourceUri.toString());
|
||||
@@ -84,21 +84,22 @@ public class RestMindmapITCase {
|
||||
findMap(requestHeaders, template, resourceUri);
|
||||
fail("Map could not be removed:" + resourceUri);
|
||||
} catch (Exception e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void changeMapTitle(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void changeMapTitle(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map to change title - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map to change title - " + mediaType);
|
||||
|
||||
// Change map title ...
|
||||
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
final String newTitle = "New map to change title - " + mediaType;
|
||||
final HttpEntity<String> updateEntity = new HttpEntity<String>(newTitle, requestHeaders);
|
||||
final HttpEntity<String> updateEntity = new HttpEntity<>(newTitle, requestHeaders);
|
||||
template.put(HOST_PORT + resourceUri + "/title", updateEntity);
|
||||
|
||||
// Load map again ..
|
||||
@@ -107,22 +108,18 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void validateMapsCreation(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void validateMapsCreation(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final String title = "Map to Validate Creation - " + mediaType;
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, title);
|
||||
|
||||
// Try to create a map with the same title ..
|
||||
final RestMindmap restMindmap = new RestMindmap();
|
||||
restMindmap.setTitle(title);
|
||||
restMindmap.setDescription("My Map Desc");
|
||||
addNewMap(template, title);
|
||||
|
||||
// Add map with same name ...
|
||||
try {
|
||||
HttpEntity<RestMindmap> createUserEntity = new HttpEntity<RestMindmap>(restMindmap, requestHeaders);
|
||||
template.postForLocation(BASE_REST_URL + "/maps", createUserEntity);
|
||||
HttpEntity<RestMindmap> createUserEntity = new HttpEntity<>(requestHeaders);
|
||||
template.postForLocation(BASE_REST_URL + "/maps?title=" + title, createUserEntity);
|
||||
} catch (HttpClientErrorException cause) {
|
||||
final String responseBodyAsString = cause.getResponseBodyAsString();
|
||||
assert (responseBodyAsString.contains("You have already a map"));
|
||||
@@ -134,17 +131,17 @@ public class RestMindmapITCase {
|
||||
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void changeMapDescription(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void changeMapDescription(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map to change Description - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map to change Description - " + mediaType);
|
||||
|
||||
// Change map title ...
|
||||
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
final String newDescription = "New map to change description - " + mediaType;
|
||||
final HttpEntity<String> updateEntity = new HttpEntity<String>(newDescription, requestHeaders);
|
||||
final HttpEntity<String> updateEntity = new HttpEntity<>(newDescription, requestHeaders);
|
||||
template.put(HOST_PORT + resourceUri + "/description", updateEntity);
|
||||
|
||||
// Load map again ..
|
||||
@@ -153,19 +150,19 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void updateMapXml(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void updateMapXml(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final String title = "Update XML sample " + mediaType;
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, title);
|
||||
final URI resourceUri = addNewMap(template, title);
|
||||
|
||||
// Update map xml content ...
|
||||
final String resourceUrl = HOST_PORT + resourceUri.toString();
|
||||
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
final String newXmlContent = "<map>this is not valid</map>";
|
||||
HttpEntity<String> updateEntity = new HttpEntity<String>(newXmlContent, requestHeaders);
|
||||
HttpEntity<String> updateEntity = new HttpEntity<>(newXmlContent, requestHeaders);
|
||||
template.put(resourceUrl + "/document/xml", updateEntity);
|
||||
|
||||
// Check that the map has been updated ...
|
||||
@@ -174,14 +171,14 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void cloneMap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void cloneMap(final @NotNull MediaType mediaType) throws IOException { // Configure media types ...
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final String title = "Map to clone sample " + mediaType;
|
||||
final String xml = "<map><node text='this is a cloned map'></map>";
|
||||
final URI newMapUri = addNewMap(requestHeaders, template, title, xml);
|
||||
final URI newMapUri = addNewMap(template, title, xml);
|
||||
|
||||
// Clone map ...
|
||||
final RestMindmapInfo restMindmap = new RestMindmapInfo();
|
||||
@@ -189,7 +186,7 @@ public class RestMindmapITCase {
|
||||
restMindmap.setDescription("Cloned map desc");
|
||||
|
||||
// Create a new map ...
|
||||
final HttpEntity<RestMindmapInfo> cloneEntity = new HttpEntity<RestMindmapInfo>(restMindmap, requestHeaders);
|
||||
final HttpEntity<RestMindmapInfo> cloneEntity = new HttpEntity<>(restMindmap, requestHeaders);
|
||||
final URI clonedMapUri = template.postForLocation(HOST_PORT + newMapUri, cloneEntity);
|
||||
|
||||
// Check that the map has been updated ...
|
||||
@@ -198,7 +195,7 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void verifyMapOwnership(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void verifyMapOwnership(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
throw new SkipException("missing test: removeUserShouldOnlyDeleteOnwedMap");
|
||||
}
|
||||
|
||||
@@ -213,7 +210,7 @@ public class RestMindmapITCase {
|
||||
|
||||
// Create a sample map ...
|
||||
final String title = "Update sample " + mediaType;
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, title);
|
||||
final URI resourceUri = addNewMap(template, title);
|
||||
|
||||
// Build map to update ...
|
||||
final RestMindmap mapToUpdate = new RestMindmap();
|
||||
@@ -223,23 +220,23 @@ public class RestMindmapITCase {
|
||||
// Update map ...
|
||||
final String resourceUrl = HOST_PORT + resourceUri.toString() + "/document";
|
||||
requestHeaders.setContentType(MediaType.APPLICATION_XML);
|
||||
final HttpEntity<RestMindmap> updateEntity = new HttpEntity<RestMindmap>(mapToUpdate, requestHeaders);
|
||||
final HttpEntity<RestMindmap> updateEntity = new HttpEntity<>(mapToUpdate, requestHeaders);
|
||||
template.put(resourceUrl, updateEntity);
|
||||
|
||||
// Check that the map has been updated ...
|
||||
HttpEntity<RestUser> findMapEntity = new HttpEntity<RestUser>(requestHeaders);
|
||||
HttpEntity<RestUser> findMapEntity = new HttpEntity<>(requestHeaders);
|
||||
final ResponseEntity<RestMindmap> response = template.exchange(HOST_PORT + resourceUri, HttpMethod.GET, findMapEntity, RestMindmap.class);
|
||||
assertEquals(response.getBody().getXml(), mapToUpdate.getXml());
|
||||
assertEquals(response.getBody().getProperties(), mapToUpdate.getProperties());
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void addCollabs(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||
public void addCollabs(final @NotNull MediaType mediaType) {
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map for addCollabs - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map for addCollabs - " + mediaType);
|
||||
|
||||
// Add a new collaboration ...
|
||||
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -270,12 +267,12 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void updateCollabType(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||
public void updateCollabType(final @NotNull MediaType mediaType) {
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map for updateCollabType - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map for updateCollabType - " + mediaType);
|
||||
|
||||
// Add a new collaboration ...
|
||||
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -310,12 +307,12 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void deleteCollabs(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||
public void deleteCollabs(final @NotNull MediaType mediaType) {
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map for deleteCollabs - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map for deleteCollabs - " + mediaType);
|
||||
|
||||
// Add a new collaboration ...
|
||||
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -355,13 +352,13 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, expectedExceptions = {HttpClientErrorException.class}, dataProvider = "ContentType-Provider-Function")
|
||||
public void addCollabsInvalidOwner(final @NotNull MediaType mediaType) throws IOException, WiseMappingException {
|
||||
public void addCollabsInvalidOwner(final @NotNull MediaType mediaType) {
|
||||
|
||||
final HttpHeaders requestHeaders = createHeaders(mediaType);
|
||||
final RestTemplate template = createTemplate(userEmail);
|
||||
|
||||
// Create a sample map ...
|
||||
final URI resourceUri = addNewMap(requestHeaders, template, "Map for Collaboration - " + mediaType);
|
||||
final URI resourceUri = addNewMap(template, "Map for Collaboration - " + mediaType);
|
||||
|
||||
// Add a new collaboration ...
|
||||
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
|
||||
@@ -380,12 +377,12 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void removeLabelFromMindmap(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void removeLabelFromMindmap(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
throw new SkipException("missing test: label removal from map");
|
||||
}
|
||||
|
||||
@Test(dataProviderClass = RestHelper.class, dataProvider = "ContentType-Provider-Function")
|
||||
public void deleteMapAndCheckLabels(final @NotNull MediaType mediaType) throws IOException, WiseMappingException { // Configure media types ...
|
||||
public void deleteMapAndCheckLabels(final @NotNull MediaType mediaType) { // Configure media types ...
|
||||
throw new SkipException("missing test: delete map should not affects others labels");
|
||||
}
|
||||
|
||||
@@ -404,7 +401,7 @@ public class RestMindmapITCase {
|
||||
|
||||
// Create a sample map ...
|
||||
final String mapTitle = "Maps 1 - " + mediaType;
|
||||
final URI mindmapUri = addNewMap(requestHeaders, template, mapTitle);
|
||||
final URI mindmapUri = addNewMap(template, mapTitle);
|
||||
final String mapId = mindmapUri.getPath().replace("/service/maps/", "");
|
||||
|
||||
// Assign label to map ...
|
||||
@@ -432,22 +429,15 @@ public class RestMindmapITCase {
|
||||
}
|
||||
|
||||
|
||||
private URI addNewMap(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @NotNull String title, @Nullable String xml) throws IOException, WiseMappingException {
|
||||
final RestMindmap restMindmap = new RestMindmap();
|
||||
restMindmap.setTitle(title);
|
||||
restMindmap.setDescription("My Map Desc");
|
||||
|
||||
if (xml != null) {
|
||||
restMindmap.setXml(xml);
|
||||
}
|
||||
|
||||
private URI addNewMap(@NotNull RestTemplate template, @NotNull String title, @Nullable String xml) {
|
||||
// Create a new map ...
|
||||
HttpEntity<RestMindmap> createUserEntity = new HttpEntity<>(restMindmap, requestHeaders);
|
||||
return template.postForLocation(BASE_REST_URL + "/maps", createUserEntity);
|
||||
final HttpHeaders requestHeaders = createHeaders(MediaType.APPLICATION_XML);
|
||||
HttpEntity<String> createUserEntity = new HttpEntity<>(xml, requestHeaders);
|
||||
return template.postForLocation(BASE_REST_URL + "/maps?title=" + title, createUserEntity);
|
||||
}
|
||||
|
||||
private URI addNewMap(@NotNull HttpHeaders requestHeaders, @NotNull RestTemplate template, @NotNull String title) throws IOException, WiseMappingException {
|
||||
return addNewMap(requestHeaders, template, title, null);
|
||||
private URI addNewMap(@NotNull RestTemplate template, @NotNull String title) {
|
||||
return addNewMap(template, title, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user