diff --git a/distribution/Dockerfile b/distribution/Dockerfile index 8a4c2427..dd487f39 100644 --- a/distribution/Dockerfile +++ b/distribution/Dockerfile @@ -10,7 +10,7 @@ ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT" ARG DB_BASE_DIR="/var/lib/wisemapping" # Default ENV configurations ... -ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80" +ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80 -Dfile.encoding=UTF-8" ENV database.base.url=${DB_BASE_DIR} # Copy wisemapping distribution ... diff --git a/pom.xml b/pom.xml index d292e7a1..2e655ed3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 5.0.10 + 5.0.11 ${project.basedir}/wise-webapps @@ -16,7 +16,7 @@ org.wisemapping wisemapping WiseMapping Project - 5.0.10 + 5.0.11 pom diff --git a/wise-ui/pom.xml b/wise-ui/pom.xml index 554593f2..e0899ebf 100644 --- a/wise-ui/pom.xml +++ b/wise-ui/pom.xml @@ -12,7 +12,7 @@ org.wisemapping wisemapping ../pom.xml - 5.0.10 + 5.0.11 @@ -29,11 +29,11 @@ - + - + @@ -42,11 +42,11 @@ - + - + diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 4108de7f..a7b30423 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -9,12 +9,12 @@ org.wisemapping wisemapping ../pom.xml - 5.0.10 + 5.0.11 - 5.3.14 - 5.3.5.RELEASE + 5.3.18 + 5.6.2 5.6.5.Final 6.0.21.Final 5.6.1 @@ -189,9 +189,9 @@ compile - javax.mail - mail - 1.4.3 + com.sun.mail + javax.mail + 1.6.2 mysql @@ -244,6 +244,7 @@ 2.13.1 + javax.servlet jstl 1.2 @@ -270,12 +271,6 @@ fluent-hc 4.5.13 - - junit - junit - RELEASE - test - @@ -401,23 +396,6 @@ - - org.codehaus.mojo - native2ascii-maven-plugin - - - - native2ascii - - - - - UTF-8 - - messages*.properties - - - org.apache.maven.plugins maven-war-plugin diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java index b3b02b47..4317910a 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java @@ -48,7 +48,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor { @Value("${site.homepage}") private String siteHomepage; - @Value("${site.baseurl:http://localhost:8080}") + @Value("${site.baseurl}") private String siteUrl; @Value("${security.type}") diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java index 2c7e9133..04b05f52 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java @@ -26,7 +26,7 @@ import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.mail.javamail.MimeMessagePreparator; -import javax.mail.internet.MimeMessage; +import java.nio.charset.StandardCharsets; import java.util.Map; public final class Mailer { @@ -54,17 +54,14 @@ public final class Mailer { public void sendEmail(final String from, final String to, final String subject, final Map model, @NotNull final String templateMail) { final MimeMessagePreparator preparator = - new MimeMessagePreparator() { - public void prepare(MimeMessage mimeMessage) - throws Exception { - final MimeMessageHelper message = new MimeMessageHelper(mimeMessage); - message.setTo(to); - message.setFrom(from); - message.setSubject(subject); + mimeMessage -> { + final MimeMessageHelper message = new MimeMessageHelper(mimeMessage, StandardCharsets.UTF_8.name()); + message.setTo(to); + message.setFrom(from); + message.setSubject(subject); - final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model); - message.setText(messageBody, true); - } + final String messageBody = VelocityEngineUtils.mergeTemplateIntoString(velocityEngineWrapper.getVelocityEngine(), "/mail/" + templateMail, model); + message.setText(messageBody, true); }; this.mailSender.send(preparator); diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java index 9845b901..a2f184eb 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java @@ -71,7 +71,7 @@ final public class NotificationService { model.put("baseUrl", getBaseUrl()); model.put("senderMail", user.getEmail()); model.put("message", message); - model.put("supportEmail", mailer.getSupportEmail()); + model.put("doNotReplay", messageSource.getMessage("EMAIL.DO_NOT_REPLAY", new Object[]{mailer.getSupportEmail()}, locale)); mailer.sendEmail(formMail, collabEmail, subject, model, "newCollaboration.vm"); } catch (Exception e) { @@ -111,6 +111,7 @@ final public class NotificationService { } private void sendTemplateMail(@NotNull User user, @NotNull String mailSubject, @NotNull String messageTitle, @NotNull String messageBody) { + final Locale locale = LocaleContextHolder.getLocale(); try { final Map model = new HashMap<>(); @@ -119,6 +120,7 @@ final public class NotificationService { model.put("messageBody", messageBody); model.put("baseUrl", getBaseUrl()); model.put("supportEmail", mailer.getSupportEmail()); + model.put("doNotReplay", messageSource.getMessage("EMAIL.DO_NOT_REPLAY", new Object[]{mailer.getSupportEmail()}, locale)); logger.debug("Email properties->" + model); mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm"); diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java index 8f766e25..a5bc1e44 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaboration.java @@ -19,9 +19,6 @@ 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; @@ -33,7 +30,6 @@ public class Collaboration implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; - ; @Column(name = "role_id", unique = true) private CollaborationRole role; diff --git a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java index d9af2e99..9499a794 100755 --- a/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/Collaborator.java @@ -32,8 +32,8 @@ import java.util.Set; @Entity @Table(name = "COLLABORATOR") @Inheritance(strategy = InheritanceType.JOINED) -@Cacheable -@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE) +//@Cacheable +//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Collaborator implements Serializable { @Id @GeneratedValue(strategy= GenerationType.IDENTITY) diff --git a/wise-webapp/src/main/java/com/wisemapping/model/User.java b/wise-webapp/src/main/java/com/wisemapping/model/User.java index 663c6a00..b90e0da6 100644 --- a/wise-webapp/src/main/java/com/wisemapping/model/User.java +++ b/wise-webapp/src/main/java/com/wisemapping/model/User.java @@ -18,6 +18,7 @@ package com.wisemapping.model; +import org.hibernate.annotations.CacheConcurrencyStrategy; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,6 +31,8 @@ import java.util.Set; @Entity @Table(name = "USER") @PrimaryKeyJoinColumn(name = "colaborator_id") +//@Cacheable +//@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class User extends Collaborator implements Serializable { diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java index b56605b4..b9f6d93c 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java @@ -1,31 +1,33 @@ /* -* Copyright [2022] [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 [2022] [wisemapping] + * + * Licensed under WiseMapping Public License, Version 1.0 (the "License"). + * It is basically the Apache License, Version 2.0 (the "License") plus the + * "powered by wisemapping" text requirement on every single page; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the license at + * + * http://www.wisemapping.org/license + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.wisemapping.rest; import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.mail.NotificationService; import com.wisemapping.model.Collaboration; +import com.wisemapping.model.Label; import com.wisemapping.model.Mindmap; import com.wisemapping.model.User; import com.wisemapping.rest.model.RestLogItem; import com.wisemapping.rest.model.RestUser; import com.wisemapping.security.Utils; +import com.wisemapping.service.LabelService; import com.wisemapping.service.MindmapService; import com.wisemapping.service.UserService; import org.apache.log4j.Logger; @@ -52,6 +54,10 @@ public class AccountController extends BaseController { @Autowired private MindmapService mindmapService; + @Qualifier("labelService") + @Autowired + private LabelService labelService; + @Autowired private NotificationService notificationService; @@ -68,7 +74,7 @@ public class AccountController extends BaseController { userService.changePassword(user); } - @RequestMapping(method = RequestMethod.GET, value = "/account", produces = {"application/json", "application/xml"}) + @RequestMapping(method = RequestMethod.GET, value = "/account", produces = {"application/json"}) public RestUser fetchAccount() { final User user = Utils.getUser(true); return new RestUser(user); @@ -113,15 +119,26 @@ public class AccountController extends BaseController { @RequestMapping(method = RequestMethod.DELETE, value = "account") @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void deleteUser() throws WiseMappingException - - { + public void deleteUser() throws WiseMappingException { + // Delete collaborations ... final User user = Utils.getUser(true); final List collaborations = mindmapService.findCollaborations(user); for (Collaboration collaboration : collaborations) { final Mindmap mindmap = collaboration.getMindMap(); - mindmapService.removeMindmap(mindmap,user); + mindmapService.removeMindmap(mindmap, user); } + + // Delete labels .... + List