Improve collaboration mail.

This commit is contained in:
Paulo Gustavo Veiga 2012-06-13 23:04:29 -03:00
parent c4d2acec7b
commit 226a7a0ff9
23 changed files with 260 additions and 137 deletions

View File

@ -36,8 +36,7 @@ public class UserManagerImpl
private PasswordEncoder passwordEncoder; private PasswordEncoder passwordEncoder;
public void setEncoder(PasswordEncoder passwordEncoder) public void setEncoder(PasswordEncoder passwordEncoder) {
{
this.passwordEncoder = passwordEncoder; this.passwordEncoder = passwordEncoder;
} }
@ -47,14 +46,12 @@ public class UserManagerImpl
@Override @Override
public User getUserBy(final String email) { public User getUserBy(@NotNull final String email) {
final User user; User user = null;
final List users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where email=?", email); final List<User> users = getHibernateTemplate().find("from com.wisemapping.model.User colaborator where email=?", email);
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 = (User) users.get(0); user = users.get(0);
} else {
user = null;
} }
return user; return user;
} }
@ -100,13 +97,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.encodePassword(user.getPassword(), null));
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.encodePassword(user.getPassword(), null));
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();
@ -139,7 +136,7 @@ public class UserManagerImpl
public void updateUser(User user) { public void updateUser(User user) {
assert user != null : "user is null"; assert user != null : "user is null";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(),null)); user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
getHibernateTemplate().update(user); getHibernateTemplate().update(user);
} }

View File

@ -39,19 +39,16 @@ public final class Mailer {
//~ Methods .............................................................................................. //~ Methods ..............................................................................................
public Mailer(String registrationEmail, String siteEmail) public Mailer(String registrationEmail, String siteEmail) {
{
this.registrationEmail = registrationEmail; this.registrationEmail = registrationEmail;
this.siteEmail = siteEmail; this.siteEmail = siteEmail;
} }
public String getRegistrationEmail() public String getRegistrationEmail() {
{
return registrationEmail; return registrationEmail;
} }
public String getSiteEmail() public String getSiteEmail() {
{
return siteEmail; return siteEmail;
} }
@ -66,11 +63,12 @@ public final class Mailer {
message.setFrom(from); message.setFrom(from);
message.setSubject(subject); message.setSubject(subject);
final String text = final String messageBody =
VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail, VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, "/mail/" + templateMail,
model); model);
System.out.println(message);
message.setText(text, true); message.setText(messageBody, true);
} }
}; };

View File

@ -0,0 +1,83 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.mail;
import com.wisemapping.model.Collaboration;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
final public class NotificationService {
@Autowired
private Mailer mailer;
private String baseUrl;
public NotificationService() {
}
public void newCollaboration(@NotNull Collaboration collaboration, @NotNull MindMap mindmap, @NotNull User user, @Nullable String message) {
try {
// Sent collaboration email ...
final String formMail = mailer.getSiteEmail();
// Is the user already registered user ?.
final String collabEmail = collaboration.getCollaborator().getEmail();
// Build the subject ...
final String subject = user.getFullName() + " has shared a mindmap with you";
// Fill template properties ...
final Map<String, Object> model = new HashMap<String, Object>();
model.put("mindmap", mindmap);
model.put("message", "message");
model.put("ownerName", user.getFirstname());
model.put("mapEditUrl", baseUrl + "/c/maps/" + mindmap.getId() + "/edit");
model.put("baseUrl", baseUrl + "/c/maps/" + mindmap.getId() + "/edit");
mailer.sendEmail(formMail, collabEmail, subject, model, "newCollaboration.vm");
} catch (Exception e) {
handleException(e);
}
}
private void handleException(Exception e) {
e.printStackTrace();
}
public void setBaseUrl(String baseUrl) {
this.baseUrl = baseUrl;
}
public void setMailer(Mailer mailer) {
this.mailer = mailer;
}
}

View File

@ -45,6 +45,10 @@ public class User
return tags; return tags;
} }
public String getFullName() {
return this.getFirstname() + " " + this.getLastname();
}
public String getFirstname() { public String getFirstname() {
return firstname; return firstname;
} }

View File

@ -238,7 +238,7 @@ public class MindmapController extends BaseController {
// Remove all collaborations that no applies anymore .. // Remove all collaborations that no applies anymore ..
for (final Collaboration collaboration : collabsToRemove) { for (final Collaboration collaboration : collabsToRemove) {
mindmapService.removeCollaboration(collaboration); mindmapService.removeCollaboration(mindMap, collaboration);
} }
} }

View File

@ -25,6 +25,8 @@ import com.wisemapping.exceptions.UnexpectedArgumentException;
import com.wisemapping.security.Utils; import com.wisemapping.security.Utils;
import com.wisemapping.service.MindmapService; import com.wisemapping.service.MindmapService;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class BaseSecurityAdvice { public abstract class BaseSecurityAdvice {
private MindmapService mindmapService = null; private MindmapService mindmapService = null;
@ -47,9 +49,9 @@ public abstract class BaseSecurityAdvice {
} }
} }
protected abstract boolean isAllowed(User user, MindMap map); protected abstract boolean isAllowed(@Nullable User user, MindMap map);
protected abstract boolean isAllowed(User user, int mapId); protected abstract boolean isAllowed(@Nullable User user, int mapId);
protected MindmapService getMindmapService() { protected MindmapService getMindmapService() {
return mindmapService; return mindmapService;

View File

@ -25,6 +25,7 @@ import com.wisemapping.model.MindMap;
import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class UpdateSecurityAdvise public class UpdateSecurityAdvise
extends BaseSecurityAdvice extends BaseSecurityAdvice
@ -35,7 +36,7 @@ public class UpdateSecurityAdvise
return methodInvocation.proceed(); return methodInvocation.proceed();
} }
protected boolean isAllowed(@NotNull User user, @NotNull MindMap map) { protected boolean isAllowed(@Nullable User user, @NotNull MindMap map) {
boolean result; boolean result;
if (map.getCreator() == null) { if (map.getCreator() == null) {
// This means that the map is new and is an add operation. // This means that the map is new and is an add operation.
@ -46,7 +47,7 @@ public class UpdateSecurityAdvise
return result; return result;
} }
protected boolean isAllowed(User user, int mapId) { protected boolean isAllowed(@Nullable User user, int mapId) {
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.EDITOR); return getMindmapService().hasPermissions(user, mapId, CollaborationRole.EDITOR);
} }
} }

View File

@ -34,11 +34,11 @@ public class ViewBaseSecurityAdvise
return methodInvocation.proceed(); return methodInvocation.proceed();
} }
protected boolean isAllowed(User user, MindMap map) { protected boolean isAllowed(@NotNull User user, MindMap map) {
return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER); return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER);
} }
protected boolean isAllowed(User user, int mapId) { protected boolean isAllowed(@NotNull User user, int mapId) {
return getMindmapService().hasPermissions(user, mapId, CollaborationRole.VIEWER); return getMindmapService().hasPermissions(user, mapId, CollaborationRole.VIEWER);
} }
} }

View File

@ -21,6 +21,7 @@ package com.wisemapping.service;
import com.wisemapping.model.*; import com.wisemapping.model.*;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
import java.io.IOException; import java.io.IOException;
@ -42,7 +43,7 @@ public interface MindmapService {
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role) public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role)
throws CollaborationException; throws CollaborationException;
public void removeCollaboration(@NotNull Collaboration collaboration) throws CollaborationException; public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
public void addTags(MindMap mindmap, String tags); public void addTags(MindMap mindmap, String tags);
@ -52,9 +53,9 @@ public interface MindmapService {
public List<MindMapHistory> getMindMapHistory(int mindmapId); public List<MindMapHistory> getMindMapHistory(int mindmapId);
public boolean hasPermissions(User user, MindMap map, CollaborationRole allowedRole); public boolean hasPermissions(@Nullable User user, MindMap map, CollaborationRole allowedRole);
public boolean hasPermissions(User user, int mapId, CollaborationRole allowedRole); public boolean hasPermissions(@Nullable User user, int mapId, CollaborationRole allowedRole);
public void addWelcomeMindmap(User user) throws WiseMappingException; public void addWelcomeMindmap(User user) throws WiseMappingException;

View File

@ -21,9 +21,13 @@ package com.wisemapping.service;
import com.wisemapping.dao.MindmapManager; import com.wisemapping.dao.MindmapManager;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.mail.Mailer; import com.wisemapping.mail.Mailer;
import com.wisemapping.mail.NotificationService;
import com.wisemapping.model.*; import com.wisemapping.model.*;
import com.wisemapping.security.Utils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -32,9 +36,15 @@ import java.util.*;
public class MindmapServiceImpl public class MindmapServiceImpl
implements MindmapService { implements MindmapService {
@Autowired
private MindmapManager mindmapManager; private MindmapManager mindmapManager;
@Autowired
@Qualifier("userService")
private UserService userService; private UserService userService;
private Mailer mailer;
@Autowired
private NotificationService notificationService;
@Override @Override
public boolean hasPermissions(@NotNull User user, int mapId, @NotNull CollaborationRole grantedRole) { public boolean hasPermissions(@NotNull User user, int mapId, @NotNull CollaborationRole grantedRole) {
@ -89,7 +99,7 @@ public class MindmapServiceImpl
} }
@Override @Override
public void removeCollaboration(@NotNull Collaboration collaboration) throws CollaborationException { public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException {
// remove collaborator association // remove collaborator association
final MindMap mindMap = collaboration.getMindMap(); final MindMap mindMap = collaboration.getMindMap();
final Set<Collaboration> collaborations = mindMap.getCollaborations(); final Set<Collaboration> collaborations = mindMap.getCollaborations();
@ -110,7 +120,7 @@ public class MindmapServiceImpl
} else { } else {
final Collaboration collaboration = mindmap.findCollaboration(user); final Collaboration collaboration = mindmap.findCollaboration(user);
if (collaboration != null) { if (collaboration != null) {
this.removeCollaboration(collaboration); this.removeCollaboration(mindmap, collaboration);
} }
} }
} }
@ -166,16 +176,9 @@ public class MindmapServiceImpl
mindmap.getCollaborations().add(collaboration); mindmap.getCollaborations().add(collaboration);
mindmapManager.saveMindmap(mindmap); mindmapManager.saveMindmap(mindmap);
try { // Notify by email ...
// Sent collaboration email ... final User user = Utils.getUser();
final Map<String, Object> model = new HashMap<String, Object>(); notificationService.newCollaboration(collaboration, mindmap, user, null);
model.put("role", role);
model.put("map", mindmap);
model.put("message", "message");
mailer.sendEmail(mailer.getSiteEmail(), email, "Collaboration", model, "newColaborator.vm");
} catch (Exception e) {
e.printStackTrace();
}
} else if (collaboration.getRole() != role) { } else if (collaboration.getRole() != role) {
// If the relationship already exists and the role changed then only update the role // If the relationship already exists and the role changed then only update the role
@ -264,7 +267,7 @@ public class MindmapServiceImpl
this.userService = userService; this.userService = userService;
} }
public void setMailer(Mailer mailer) { public void setNotificationService(NotificationService notificationService) {
this.mailer = mailer; this.notificationService = notificationService;
} }
} }

View File

@ -24,33 +24,21 @@ database.password=
#------------------------ #------------------------
# Plain SMTP Server Configuration # Plain SMTP Server Configuration
#------------------------ #------------------------
#mail.smtp.socketFactory.class=javax.net.DefaultSocketFactory
#mail.smtp.socketFactory.port=25
#mail.smtp.auth = false
#mail.host=localhost
#mail.user=
#mail.password=
#------------------------ #------------------------
# SSL SMTP Server Configuration # SSL SMTP Server Configuration
#------------------------ #------------------------
# mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
#mail.smtp.socketFactory.port=465
#mail.smtp.auth = false
#mail.host=localhost
#mail.user=
#mail.password=
#------------------------ #------------------------
# GMAIL SMTP Configuration # GMAIL SMTP Configuration
#------------------------ #------------------------
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory mail.smtp.port=587
mail.smtp.socketFactory.port=587 mail.smtp.host=smtp.gmail.com
mail.smtp.auth = true mail.username=pveiga@gmail.com
mail.host=smtp.gmail.com mail.password=p0w3rwdgg
mail.user=example@gmail.com mail.smtp.auth=true
mail.password=
mail.smtp.starttls.enable=true mail.smtp.starttls.enable=true
mail.smtp.quitwait=false
#------------------------ #------------------------
# Domain address # Domain address

View File

@ -1,6 +1,6 @@
log4j.rootLogger=WARN, stdout, R log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=DEBUG,stdout,R log4j.logger.org.springframework=WARN,stdout,R
log4j.logger.org.codehaus.jackson=WARN,stdout,R log4j.logger.org.codehaus.jackson=WARN,stdout,R
log4j.additivity.org.hibernate.SQL=false log4j.additivity.org.hibernate.SQL=false

View File

@ -1,22 +1,41 @@
<html> <html>
<body> <body>
<h3>Welcome to WiseMapping!</h3> <div style="background-color: #d1e4f0; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<p> <div style="height: 36px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
Your account has been activated. <table style="display: inline;width: 100%;">
First Name: ${user.firstname} <tbody>
Last Name: ${user.lastname} <tr>
Username: ${user.username} <td height="35px" width="2px" style="padding: 0; padding-right: 5px; text-align:center">
</p> <img src="https://ssl.gstatic.com/docs/documents/share/images/services/document-1.png"
<p> alt="Document"/>
Thank you for using WiseMapping. </td>
</p> <td valign="middle" height="32px" style="padding: 0;">I've shared <a
<p> href='https://docs.google.com/document/d/1kx48Yhpt01y2LZnIVGJNgKTg_IlvQMh=47R2NIwRn4Hg/edit'>Untitled
For questions or concerns regarding your account, send us an email to support@wisemapping.com. document
</p> </a>
<p> </td>
Best regards, <br/> </tr>
WiseMapping Team </tbody>
<a href="http://www.wisemapping.com">WiseMapping Site</a> </table>
</p> </div>
<div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px;">
Click to open:
<ul style="list-style-type: none; padding: 0; margin: 0;">
<li style="margin: 0;">
<a href="https://docs.google.com/document/d/1kx48Yhpt01y2LZnIVG=JNgKTg_IlvQMh47R2NIwRn4Hg/edit">Untitled
document</a></li>
</ul>
<span style="color: #898989;">Google Docs makes it easy to create, store and share online documents, spreadsheets and presentations.</span>
<div style="text-align: right;">
<a href="https://docs.google.com">
<img style="border: 0;margin-top: 10px;"
src="https://ssl.gstatic.com/docs/documents/share/images/services/docs_logo-1.gif"
alt="Logo for Google Docs"/>
</a>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@ -1,24 +1,29 @@
<html> <html>
<body> <body>
<h3>Welcome to WiseMapping!</h3> <h3>Welcome to WiseMapping!</h3>
<p> <p>
To active your account and verify your e-mail address, please click on the following link. To active your account and verify your e-mail address, please click on the following link.
</p> </p>
<a href="${emailcheck}">${emailcheck}</a> <a href="${emailcheck}">${emailcheck}</a>
</p> </p>
<p> <p>
If you have received this mail by error, you do not need to take any action to cancel the account. The account will not be activated, and you will not receive any futher emails. If you have received this mail by error, you do not need to take any action to cancel the account. The account will
not be activated, and you will not receive any futher emails.
</p> </p>
<p> <p>
If clicking the link above does not work, copy and paste the URL in a new browser window instead. If clicking the link above does not work, copy and paste the URL in a new browser window instead.
</p> </p>
<p> <p>
For questions or concerns regarding your account, send us an email to support@wisemapping.com. For questions or concerns regarding your account, send us an email to support@wisemapping.com.
</p> </p>
<p> <p>
Cheers, <br/> Cheers, <br/>
The WiseMapping Team. The WiseMapping Team.
<a href="http://www.wisemapping.com">WiseMapping Site</a> <a href="http://www.wisemapping.com">WiseMapping Site</a>
</p> </p>
</body> </body>
</html> </html>

View File

@ -1,7 +0,0 @@
<html>
<body>
<p>
${message}
</p>
</body>
</html>

View File

@ -0,0 +1,37 @@
<html>
<body>
<div style="background-color: #fbeed5; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<div style="height: 36px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
<table style="display: inline;width: 100%;">
<tbody>
<tr>
<td height="35px" width="2px" style="padding: 0; padding-right: 5px; text-align:center">
<img src="${mapEditUrl}" alt="Mindmap"/>
</td>
<td valign="middle" height="32px" style="padding: 0;">I've shared <a href='${mapEditUrl}'>
${mindmap.title}</a> mindmap with you.
</td>
</tr>
</tbody>
</table>
</div>
<div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px;">
#if( ! $message )
<p>${message}</p>
#end
<p>Click to open: <a href="${mapEditUrl}">${mindmap.title}</a></p>
<span style="color: #898989;">WiseMapping makes it easy to create, store and share online mindmap.</span>
<div style="text-align: right;">
<a href="${baseUrl}">
<img style="border: 0;margin-top: 10px;"
src="${baseUrl}/images/logo-small.png"
alt="WiseMapping Log"/>
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -2,6 +2,12 @@
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans> <beans>
<bean id="mailer" class="com.wisemapping.mail.Mailer" singleton="true">
<constructor-arg index="0" value="${mail.registrationEmail}"/>
<constructor-arg index="1" value="${mail.siteEmail}"/>
<property name="mailSender" ref="mailSender"/>
<property name="velocityEngine" ref="velocityEngine"/>
</bean>
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl"> <bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
<property name="userManager" ref="userManager"/> <property name="userManager" ref="userManager"/>
@ -24,7 +30,7 @@
<bean id="mindMapServiceTarget" class="com.wisemapping.service.MindmapServiceImpl"> <bean id="mindMapServiceTarget" class="com.wisemapping.service.MindmapServiceImpl">
<property name="mindmapManager" ref="mindmapManager"/> <property name="mindmapManager" ref="mindmapManager"/>
<property name="userService" ref="userService"/> <property name="userService" ref="userService"/>
<property name="mailer" ref="mailer"/> <property name="notificationService" ref="notificationService"/>
</bean> </bean>
<bean id="mindmapService" <bean id="mindmapService"
@ -40,37 +46,19 @@
<property name="target" ref="mindMapServiceTarget"/> <property name="target" ref="mindMapServiceTarget"/>
</bean> </bean>
<bean id="smtpAuthenticator" class="com.wisemapping.mail.SmtpAuthenticator"> <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<constructor-arg value="${mail.user}"/> <property name="host" value="${mail.smtp.host}"/>
<constructor-arg value="${mail.password}"/> <property name="port" value="${mail.smtp.port}"/>
</bean> <property name="protocol" value="smtp"/>
<property name="username" value="${mail.username}"/>
<bean id="mailSession" class="javax.mail.Session" factory-method="getInstance"> <property name="password" value="${mail.password}"/>
<constructor-arg> <property name="javaMailProperties">
<props> <props>
<prop key="mail.smtp.auth">${mail.smtp.auth}</prop> <prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
<prop key="mail.smtp.socketFactory.port">${mail.smtp.socketFactory.port}</prop>
<prop key="mail.smtp.socketFactory.class">${mail.smtp.socketFactory.class}</prop>
<prop key="mail.smtp.socketFactory.fallback">false</prop>
<prop key="mail.smtp.quitwait">false</prop>
<prop key="mail.smtp.debug">true</prop>
<prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop> <prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
<prop key="mail.smtp.quitwait">${mail.smtp.quitwait}</prop>
</props> </props>
</constructor-arg> </property>
<constructor-arg ref="smtpAuthenticator"/>
</bean>
<bean id="mailer" class="com.wisemapping.mail.Mailer" singleton="true">
<constructor-arg index="0" value="${mail.registrationEmail}"/>
<constructor-arg index="1" value="${mail.siteEmail}"/>
<property name="mailSender" ref="mailSender"/>
<property name="velocityEngine" ref="velocityEngine"/>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.host}"/>
<property name="session" ref="mailSession"/>
</bean> </bean>
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean"> <bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
@ -81,4 +69,10 @@
</value> </value>
</property> </property>
</bean> </bean>
<bean id="notificationService" class="com.wisemapping.mail.NotificationService" singleton="true">
<property name="baseUrl" value="${site.baseurl}"/>
<property name="mailer" ref="mailer"/>
</bean>
</beans> </beans>

View File

@ -136,7 +136,7 @@ $(function() {
success : function(data, textStatus, jqXHR) { success : function(data, textStatus, jqXHR) {
// Owner roles is the first in the table ... // Owner roles is the first in the table ...
var collabs = data.collaborations.sort(function(a, b) { var collabs = data.collaborations.sort(function(a, b) {
return a.role > b.role; return a.role <= b.role;
}); });
// Add all the colums in the table ... // Add all the colums in the table ...

View File

@ -29,12 +29,11 @@ public class JsonTest {
@Test @Test
void serialize() throws IOException { void serialize() throws IOException {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
//
final RestMindmap value = new RestMindmap(); // final RestMindmap value = new RestMindmap();
value.setTitle("titl"); // value.setTitle("titl");
value.setTitle("desck"); // value.setTitle("desck");
final String restMindmap = mapper.writeValueAsString(value); // final String restMindmap = mapper.writeValueAsString(value);
System.out.println(restMindmap);
} }
@Test @Test

View File

@ -31,7 +31,6 @@ editor_properties varchar(512)
--FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id) --FOREIGN KEY(creator_id) REFERENCES USER(colaborator_id)
); );
CREATE TABLE MINDMAP_HISTORY CREATE TABLE MINDMAP_HISTORY
(id INTEGER NOT NULL IDENTITY, (id INTEGER NOT NULL IDENTITY,
xml LONGVARBINARY NOT NULL, xml LONGVARBINARY NOT NULL,
@ -41,7 +40,7 @@ creator_user varchar(255));
CREATE TABLE COLLABORATION_PROPERTIES CREATE TABLE COLLABORATION_PROPERTIES
(id INTEGER NOT NULL IDENTITY, (id INTEGER NOT NULL IDENTITY,
starred BOOLEAN NOT NULL, starred BOOLEAN NOT NULL
); );
CREATE TABLE COLLABORATION CREATE TABLE COLLABORATION

View File

@ -1,6 +1,6 @@
DROP TABLE TAG; DROP TABLE TAG;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE COLLABORATION; DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY; DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP; DROP TABLE MINDMAP;
DROP TABLE USER; DROP TABLE USER;

View File

@ -43,7 +43,7 @@ creator_user varchar(255) CHARACTER SET utf8
CREATE TABLE COLLABORATION_PROPERTIES( CREATE TABLE COLLABORATION_PROPERTIES(
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
starred BOOL NOT NULL default 0, starred BOOL NOT NULL default 0
) CHARACTER SET utf8; ) CHARACTER SET utf8;
CREATE TABLE COLLABORATION ( CREATE TABLE COLLABORATION (

View File

@ -1,6 +1,6 @@
DROP TABLE TAG; DROP TABLE TAG;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE COLLABORATION; DROP TABLE COLLABORATION;
DROP TABLE COLLABORATION_PROPERTIES;
DROP TABLE MINDMAP_HISTORY; DROP TABLE MINDMAP_HISTORY;
DROP TABLE MINDMAP; DROP TABLE MINDMAP;
DROP TABLE USER; DROP TABLE USER;