mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
Update to HSQLDB driver
Remove DWR Remove native SVG tables Add new REST services for persistence.
This commit is contained in:
parent
89f7fd8d3c
commit
fb3f9946ae
@ -171,12 +171,6 @@
|
|||||||
<version>1.7</version>
|
<version>1.7</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.directwebremoting</groupId>
|
|
||||||
<artifactId>dwr</artifactId>
|
|
||||||
<version>2.0.3</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.xmlgraphics</groupId>
|
<groupId>org.apache.xmlgraphics</groupId>
|
||||||
<artifactId>batik-svg-dom</artifactId>
|
<artifactId>batik-svg-dom</artifactId>
|
||||||
@ -245,9 +239,9 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<!-- Only for test purposes -->
|
<!-- Only for test purposes -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
<version>1.8.0.10</version>
|
<version>2.2.8</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -274,10 +268,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>sql-maven-plugin</artifactId>
|
<artifactId>sql-maven-plugin</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.5</version>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<driver>org.hsqldb.jdbcDriver</driver>
|
<driver>org.hsqldb.jdbc.JDBCDriver</driver>
|
||||||
<url>jdbc:hsqldb:file:${basedir}/target/db/wisemapping</url>
|
<url>jdbc:hsqldb:file:${basedir}/target/db/wisemapping</url>
|
||||||
<username>sa</username>
|
<username>sa</username>
|
||||||
<!--all executions are ignored if -Dmaven.test.skipDB=true
|
<!--all executions are ignored if -Dmaven.test.skipDB=true
|
||||||
@ -293,9 +287,9 @@
|
|||||||
<version>5.1.5</version>
|
<version>5.1.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>hsqldb</groupId>
|
<groupId>org.hsqldb</groupId>
|
||||||
<artifactId>hsqldb</artifactId>
|
<artifactId>hsqldb</artifactId>
|
||||||
<version>1.8.0.1</version>
|
<version>2.2.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class EmbeddedViewController extends BaseMultiActionController {
|
|||||||
if (userAgent.isBrowserSupported()) {
|
if (userAgent.isBrowserSupported()) {
|
||||||
view = new ModelAndView("embeddedView");
|
view = new ModelAndView("embeddedView");
|
||||||
view.addObject("mindmap", mindmap);
|
view.addObject("mindmap", mindmap);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||||
view.addObject("mapXml", xmlMap);
|
view.addObject("mapXml", xmlMap);
|
||||||
|
|
||||||
final String zoomStr = httpServletRequest.getParameter("zoom");
|
final String zoomStr = httpServletRequest.getParameter("zoom");
|
||||||
|
@ -50,8 +50,8 @@ public class MindmapCooker extends BaseMultiActionController {
|
|||||||
final int mapId = Integer.parseInt(mindmapId);
|
final int mapId = Integer.parseInt(mindmapId);
|
||||||
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
final MindMap mindmap = getMindmapService().getMindmapById(mapId);
|
||||||
|
|
||||||
String nativeXml = httpServletRequest.getParameter("nativeXml");
|
String xml = httpServletRequest.getParameter("xml");
|
||||||
mindmap.setNativeXml(nativeXml);
|
mindmap.setXmlStr(xml);
|
||||||
|
|
||||||
getMindmapService().updateMindmap(mindmap, false);
|
getMindmapService().updateMindmap(mindmap, false);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class MindmapEditorController extends BaseMultiActionController {
|
|||||||
view.addObject("editorTryMode", false);
|
view.addObject("editorTryMode", false);
|
||||||
final boolean showHelp = isWelcomeMap(mindmap);
|
final boolean showHelp = isWelcomeMap(mindmap);
|
||||||
view.addObject("showHelp", showHelp);
|
view.addObject("showHelp", showHelp);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||||
view.addObject(MAP_XML_PARAM, xmlMap);
|
view.addObject(MAP_XML_PARAM, xmlMap);
|
||||||
view.addObject("user", Utils.getUser());
|
view.addObject("user", Utils.getUser());
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ public class NewMindmapController
|
|||||||
mindmap.setTitle(title);
|
mindmap.setTitle(title);
|
||||||
mindmap.setOwner(user);
|
mindmap.setOwner(user);
|
||||||
|
|
||||||
final String defaultNativeMap = getDefaultMindmapXml(title);
|
final String xml = getDefaultMindmapXml(title);
|
||||||
mindmap.setNativeXml(defaultNativeMap);
|
mindmap.setXmlStr(xml);
|
||||||
|
|
||||||
final User dbUSer = getUserService().getUserBy(user.getId());
|
final User dbUSer = getUserService().getUserBy(user.getId());
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class PublicPagesController extends BaseMultiActionController {
|
|||||||
final MindMap mindmap = getMindmapService().getMindmapById(TRY_EXAMPLE_MINDMAP_ID);
|
final MindMap mindmap = getMindmapService().getMindmapById(TRY_EXAMPLE_MINDMAP_ID);
|
||||||
|
|
||||||
ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
||||||
final String xmlMap = mindmap.getNativeXmlAsJsLiteral();
|
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||||
view.addObject(MindmapEditorController.MAP_XML_PARAM, xmlMap);
|
view.addObject(MindmapEditorController.MAP_XML_PARAM, xmlMap);
|
||||||
view.addObject("editorTryMode", true);
|
view.addObject("editorTryMode", true);
|
||||||
view.addObject("showHelp", true);
|
view.addObject("showHelp", true);
|
||||||
|
@ -24,11 +24,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface MindmapManager {
|
public interface MindmapManager {
|
||||||
|
|
||||||
Colaborator getColaboratorBy(String email);
|
Collaborator getCollaboratorBy(String email);
|
||||||
|
|
||||||
Colaborator getColaboratorBy(long id);
|
Collaborator getCollaboratorBy(long id);
|
||||||
|
|
||||||
List<MindmapUser> getMindmapUserByColaborator(final long colaboratorId);
|
List<MindmapUser> getMindmapUserByCollaborator(final long collaboratorId);
|
||||||
|
|
||||||
List<MindmapUser> getMindmapUserByRole(final UserRole userRole);
|
List<MindmapUser> getMindmapUserByRole(final UserRole userRole);
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
MindMap getMindmapByTitle(final String name, final User user);
|
MindMap getMindmapByTitle(final String name, final User user);
|
||||||
|
|
||||||
void addColaborator (Colaborator colaborator);
|
void addCollaborator(Collaborator collaborator);
|
||||||
|
|
||||||
void addMindmap(User user, MindMap mindMap);
|
void addMindmap(User user, MindMap mindMap);
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
void updateMindmap(MindMap mindMap, boolean saveHistory);
|
void updateMindmap(MindMap mindMap, boolean saveHistory);
|
||||||
|
|
||||||
void removeColaborator(Colaborator colaborator);
|
void removeCollaborator(Collaborator collaborator);
|
||||||
|
|
||||||
void removeMindmap(MindMap mindap);
|
void removeMindmap(MindMap mindap);
|
||||||
|
|
||||||
|
@ -33,16 +33,16 @@ public class MindmapManagerImpl
|
|||||||
extends HibernateDaoSupport
|
extends HibernateDaoSupport
|
||||||
implements MindmapManager {
|
implements MindmapManager {
|
||||||
|
|
||||||
public Colaborator getColaboratorBy(final String email) {
|
public Collaborator getCollaboratorBy(final String email) {
|
||||||
final Colaborator colaborator;
|
final Collaborator collaborator;
|
||||||
final List colaborators = getHibernateTemplate().find("from com.wisemapping.model.Colaborator colaborator where email=?", email);
|
final List colaborators = getHibernateTemplate().find("from com.wisemapping.model.Collaborator collaborator where email=?", email);
|
||||||
if (colaborators != null && !colaborators.isEmpty()) {
|
if (colaborators != null && !colaborators.isEmpty()) {
|
||||||
assert colaborators.size() == 1 : "More than one user with the same username!";
|
assert colaborators.size() == 1 : "More than one user with the same username!";
|
||||||
colaborator = (Colaborator) colaborators.get(0);
|
collaborator = (Collaborator) colaborators.get(0);
|
||||||
} else {
|
} else {
|
||||||
colaborator = null;
|
collaborator = null;
|
||||||
}
|
}
|
||||||
return colaborator;
|
return collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindMap> search(MindMapCriteria criteria) {
|
public List<MindMap> search(MindMapCriteria criteria) {
|
||||||
@ -104,11 +104,11 @@ public class MindmapManagerImpl
|
|||||||
return hibernateCriteria.list();
|
return hibernateCriteria.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Colaborator getColaboratorBy(long id) {
|
public Collaborator getCollaboratorBy(long id) {
|
||||||
return (Colaborator) getHibernateTemplate().get(Colaborator.class, id);
|
return (Collaborator) getHibernateTemplate().get(Collaborator.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByColaborator(final long colaboratorId) {
|
public List<MindmapUser> getMindmapUserByCollaborator(final long colaboratorId) {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where colaborator_id=?", colaboratorId);
|
return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where colaborator_id=?", colaboratorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,17 +129,17 @@ public class MindmapManagerImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addColaborator(Colaborator colaborator) {
|
public void addCollaborator(Collaborator collaborator) {
|
||||||
assert colaborator != null : "ADD MINDMAP COLABORATOR: Colaborator is required!";
|
assert collaborator != null : "ADD MINDMAP COLABORATOR: Collaborator is required!";
|
||||||
getHibernateTemplate().save(colaborator);
|
getHibernateTemplate().save(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMindmapUser(MindmapUser mindmapUser) {
|
public void removeMindmapUser(MindmapUser mindmapUser) {
|
||||||
getHibernateTemplate().delete(mindmapUser);
|
getHibernateTemplate().delete(mindmapUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeColaborator(Colaborator colaborator) {
|
public void removeCollaborator(Collaborator collaborator) {
|
||||||
getHibernateTemplate().delete(colaborator);
|
getHibernateTemplate().delete(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindMap> getAllMindmaps() {
|
public List<MindMap> getAllMindmaps() {
|
||||||
@ -172,13 +172,11 @@ public class MindmapManagerImpl
|
|||||||
|
|
||||||
public void saveMindmap(MindMap mindMap) {
|
public void saveMindmap(MindMap mindMap) {
|
||||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||||
getSession().saveOrUpdate(mindMap.getNativeBrowser());
|
|
||||||
getSession().save(mindMap);
|
getSession().save(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMindmap(MindMap mindMap, boolean saveHistory) {
|
public void updateMindmap(MindMap mindMap, boolean saveHistory) {
|
||||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||||
getHibernateTemplate().saveOrUpdate(mindMap.getNativeBrowser());
|
|
||||||
getHibernateTemplate().saveOrUpdate(mindMap);
|
getHibernateTemplate().saveOrUpdate(mindMap);
|
||||||
if (saveHistory)
|
if (saveHistory)
|
||||||
{
|
{
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
package com.wisemapping.dao;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.UserLogin;
|
import com.wisemapping.model.UserLogin;
|
||||||
import com.wisemapping.model.Colaborator;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public interface UserManager {
|
|||||||
|
|
||||||
User getUserByActivationCode(long code);
|
User getUserByActivationCode(long code);
|
||||||
|
|
||||||
public Colaborator getColaboratorBy(String email);
|
public Collaborator getCollaboratorBy(String email);
|
||||||
|
|
||||||
public User createUser(User user, Colaborator col);
|
public User createUser(User user, Collaborator col);
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
|
|
||||||
package com.wisemapping.dao;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
import com.wisemapping.model.Colaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.MindmapUser;
|
import com.wisemapping.model.MindmapUser;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.UserLogin;
|
import com.wisemapping.model.UserLogin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
//import org.acegisecurity.providers.encoding.PasswordEncoder;
|
//import org.acegisecurity.providers.encoding.PasswordEncoder;
|
||||||
|
|
||||||
@ -55,12 +56,12 @@ public class UserManagerImpl
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Colaborator getColaboratorBy(final String email) {
|
public Collaborator getCollaboratorBy(final String email) {
|
||||||
final Colaborator cola;
|
final Collaborator cola;
|
||||||
final List cols = getHibernateTemplate().find("from com.wisemapping.model.Colaborator colaborator where email=?", email);
|
final List cols = getHibernateTemplate().find("from com.wisemapping.model.Collaborator colaborator where email=?", email);
|
||||||
if (cols != null && !cols.isEmpty()) {
|
if (cols != null && !cols.isEmpty()) {
|
||||||
assert cols.size() == 1 : "More than one colaborator with the same email!";
|
assert cols.size() == 1 : "More than one colaborator with the same email!";
|
||||||
cola = (Colaborator) cols.get(0);
|
cola = (Collaborator) cols.get(0);
|
||||||
} else {
|
} else {
|
||||||
cola = null;
|
cola = null;
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ public class UserManagerImpl
|
|||||||
getHibernateTemplate().saveOrUpdate(user);
|
getHibernateTemplate().saveOrUpdate(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public User createUser(User user, Colaborator 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";
|
||||||
@ -107,7 +108,7 @@ public class UserManagerImpl
|
|||||||
MindmapUser newMapUser = new MindmapUser();
|
MindmapUser newMapUser = new MindmapUser();
|
||||||
newMapUser.setRoleId(mindmapUser.getRole().ordinal());
|
newMapUser.setRoleId(mindmapUser.getRole().ordinal());
|
||||||
newMapUser.setMindMap(mindmapUser.getMindMap());
|
newMapUser.setMindMap(mindmapUser.getMindMap());
|
||||||
newMapUser.setColaborator(user);
|
newMapUser.setCollaborator(user);
|
||||||
user.addMindmapUser(newMapUser);
|
user.addMindmapUser(newMapUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.dwr;
|
|
||||||
|
|
||||||
import com.wisemapping.service.MindmapService;
|
|
||||||
import com.wisemapping.service.UserService;
|
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import com.wisemapping.security.Utils;
|
|
||||||
import org.directwebremoting.WebContextFactory;
|
|
||||||
import org.directwebremoting.WebContext;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
abstract public class BaseDwrService {
|
|
||||||
private MindmapService mindmapService;
|
|
||||||
private UserService userService;
|
|
||||||
|
|
||||||
public MindmapService getMindmapService() {
|
|
||||||
return mindmapService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMindmapService(MindmapService mindmapService) {
|
|
||||||
this.mindmapService = mindmapService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserService getUserService() {
|
|
||||||
return userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserService(UserService userService) {
|
|
||||||
this.userService = userService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUser() {
|
|
||||||
|
|
||||||
WebContext ctx = WebContextFactory.get();
|
|
||||||
final HttpServletRequest request = ctx.getHttpServletRequest();
|
|
||||||
|
|
||||||
return Utils.getUser(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -16,30 +16,15 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-08-01 19:08:20 (-0300), by: imanzano. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.dwr;
|
package com.wisemapping.dwr;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.directwebremoting.WebContext;
|
|
||||||
import org.directwebremoting.WebContextFactory;
|
|
||||||
import com.wisemapping.model.User;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
public class JavaScriptErrorLoggerService
|
public class JavaScriptErrorLoggerService
|
||||||
extends BaseDwrService {
|
{
|
||||||
|
|
||||||
final Log logger = LogFactory.getLog(JavaScriptErrorLoggerService.class);
|
final Log logger = LogFactory.getLog(JavaScriptErrorLoggerService.class);
|
||||||
private static final int ERROR_MESSAGE = 3;
|
private static final int ERROR_MESSAGE = 3;
|
||||||
private static final int FATAL_MESSAGE = 4;
|
private static final int FATAL_MESSAGE = 4;
|
||||||
@ -53,27 +38,24 @@ public class JavaScriptErrorLoggerService
|
|||||||
public void logError(final int severity, final String logMsg)
|
public void logError(final int severity, final String logMsg)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
final User user = getUser();
|
// final User user = getUser();
|
||||||
|
|
||||||
final WebContext ctx = WebContextFactory.get();
|
|
||||||
final HttpServletRequest request = ctx.getHttpServletRequest();
|
|
||||||
|
|
||||||
|
|
||||||
final String userAgent = request.getHeader(USER_AGENT);
|
// final String userAgent = request.getHeader(USER_AGENT);
|
||||||
synchronized (logger) {
|
// synchronized (logger) {
|
||||||
// Log user info ...
|
// // Log user info ...
|
||||||
if (user != null) {
|
// if (user != null) {
|
||||||
log(severity, "UserId:" + user.getId() + ", UserEmail:" + user.getEmail());
|
// log(severity, "UserId:" + user.getId() + ", UserEmail:" + user.getEmail());
|
||||||
} else {
|
// } else {
|
||||||
log(severity, "Anonymous user");
|
// log(severity, "Anonymous user");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// Log browser details ...
|
// // Log browser details ...
|
||||||
log(severity, "Browser:" + userAgent);
|
// log(severity, "Browser:" + userAgent);
|
||||||
|
//
|
||||||
// Log error message ...
|
// // Log error message ...
|
||||||
log(severity, logMsg);
|
// log(severity, logMsg);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void log(final int severity, final String msg) {
|
void log(final int severity, final String msg) {
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ...........................................................................................................
|
|
||||||
// (C) Copyright 1996/2007 Fuego Inc. All Rights Reserved
|
|
||||||
// THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Fuego Inc.
|
|
||||||
// The copyright notice above does not evidence any actual or intended
|
|
||||||
// publication of such source code.
|
|
||||||
//
|
|
||||||
// Last changed on 2007-08-01 19:08:21 (-0300), by: imanzano. $Revision$
|
|
||||||
// ...........................................................................................................
|
|
||||||
|
|
||||||
package com.wisemapping.dwr;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.wisemapping.model.MindMap;
|
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import com.wisemapping.service.MindmapService;
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
|
||||||
|
|
||||||
public class MapEditorService
|
|
||||||
extends BaseDwrService {
|
|
||||||
|
|
||||||
//~ Methods ..............................................................................................
|
|
||||||
|
|
||||||
public ResponseMessage draftMap(final int mapId, final String nativeXml) {
|
|
||||||
final ResponseMessage response = new ResponseMessage();
|
|
||||||
response.setMsgCode(ResponseMessage.Code.OK.name());
|
|
||||||
response.setMsgDetails("Map Saved Successfully");
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResponseMessage saveMap(final int mapId, final String nativeXml,
|
|
||||||
final String editorProperties,boolean saveHistory)
|
|
||||||
throws IOException, WiseMappingException {
|
|
||||||
final MindmapService serservice = getMindmapService();
|
|
||||||
final MindMap mindMap = serservice.getMindmapById(mapId);
|
|
||||||
final User user = this.getUser();
|
|
||||||
|
|
||||||
mindMap.setProperties(editorProperties);
|
|
||||||
|
|
||||||
final Calendar now = Calendar.getInstance();
|
|
||||||
mindMap.setLastModificationTime(now);
|
|
||||||
mindMap.setLastModifierUser(user.getUsername());
|
|
||||||
|
|
||||||
final Calendar lastModification = Calendar.getInstance();
|
|
||||||
lastModification.setTime(new Date());
|
|
||||||
mindMap.setLastModificationTime(lastModification);
|
|
||||||
|
|
||||||
mindMap.setNativeXml(nativeXml);
|
|
||||||
serservice.updateMindmap(mindMap,saveHistory);
|
|
||||||
|
|
||||||
final ResponseMessage response = new ResponseMessage();
|
|
||||||
response.setMsgCode(ResponseMessage.Code.OK.name());
|
|
||||||
response.setMsgDetails("Map Saved Successfully");
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.dwr;
|
|
||||||
|
|
||||||
public class ResponseMessage {
|
|
||||||
private ResponseMessage.Code msgCode;
|
|
||||||
private String msgDetails;
|
|
||||||
private String content;
|
|
||||||
private String contentType;
|
|
||||||
|
|
||||||
public ResponseMessage() {
|
|
||||||
this.contentType = "text/xml;charset=UTF-8";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsgCode() {
|
|
||||||
return msgCode.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsgCode(String msgCode) {
|
|
||||||
this.msgCode = Code.valueOf(msgCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsgDetails() {
|
|
||||||
return msgDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMsgDetails(String msgDetails) {
|
|
||||||
this.msgDetails = msgDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Code {
|
|
||||||
OK, ERROR
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContentType() {
|
|
||||||
return contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContentType(String contentType) {
|
|
||||||
this.contentType = contentType;
|
|
||||||
}
|
|
||||||
}
|
|
@ -55,7 +55,7 @@ public class ExporterFactory {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void export(@NotNull ExportProperties properties, @NotNull String xml, @NotNull OutputStream output, @NotNull String mapSvg) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
public static void export(@NotNull ExportProperties properties, @Nullable String xml, @NotNull OutputStream output, @Nullable String mapSvg) throws TranscoderException, IOException, ParserConfigurationException, SAXException, XMLStreamException, TransformerException, JAXBException, ExportException {
|
||||||
final ExportFormat format = properties.getFormat();
|
final ExportFormat format = properties.getFormat();
|
||||||
|
|
||||||
final String imgPath = properties.getBaseImgPath();
|
final String imgPath = properties.getBaseImgPath();
|
||||||
|
@ -30,7 +30,6 @@ import com.wisemapping.xml.mindmap.Icon;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
@ -50,11 +49,7 @@ public class FreemindExporter
|
|||||||
private Map<String, Node> nodesMap = null;
|
private Map<String, Node> nodesMap = null;
|
||||||
|
|
||||||
public void export(MindMap map, OutputStream outputStream) throws ExportException {
|
public void export(MindMap map, OutputStream outputStream) throws ExportException {
|
||||||
try {
|
export(map.getXml(), outputStream);
|
||||||
export(map.getUnzippedXml().getBytes("UTF-8"), outputStream);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new ExportException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(byte[] xml, OutputStream outputStream) throws ExportException {
|
public void export(byte[] xml, OutputStream outputStream) throws ExportException {
|
||||||
|
@ -142,7 +142,7 @@ public class FreemindImporter
|
|||||||
wiseXml = new String(baos.toByteArray(), UTF_8_CHARSET);
|
wiseXml = new String(baos.toByteArray(), UTF_8_CHARSET);
|
||||||
|
|
||||||
|
|
||||||
result.setNativeXml(wiseXml);
|
result.setXmlStr(wiseXml);
|
||||||
result.setTitle(mapName);
|
result.setTitle(mapName);
|
||||||
result.setDescription(description);
|
result.setDescription(description);
|
||||||
|
|
||||||
|
@ -23,15 +23,15 @@ import java.util.Set;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
|
||||||
public class Colaborator {
|
public class Collaborator {
|
||||||
private long id;
|
private long id;
|
||||||
private String email;
|
private String email;
|
||||||
private Calendar creationDate;
|
private Calendar creationDate;
|
||||||
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
||||||
|
|
||||||
public Colaborator() {}
|
public Collaborator() {}
|
||||||
|
|
||||||
public Colaborator(Set<MindmapUser> mindmapUsers) {
|
public Collaborator(Set<MindmapUser> mindmapUsers) {
|
||||||
this.mindmapUsers = mindmapUsers;
|
this.mindmapUsers = mindmapUsers;
|
||||||
}
|
}
|
||||||
|
|
@ -32,16 +32,17 @@ import org.apache.log4j.Logger;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MindMap {
|
public class MindMap {
|
||||||
|
private static final String UTF_8 = "UTF-8";
|
||||||
|
|
||||||
//~ Instance fields ......................................................................................
|
//~ Instance fields ......................................................................................
|
||||||
|
|
||||||
final Logger logger = Logger.getLogger(MindMap.class.getName());
|
|
||||||
private Calendar creationTime;
|
private Calendar creationTime;
|
||||||
private String creator;
|
private String creator;
|
||||||
private String description;
|
private String description;
|
||||||
@ -52,24 +53,12 @@ public class MindMap {
|
|||||||
private String lastModifierUser;
|
private String lastModifierUser;
|
||||||
|
|
||||||
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
||||||
private MindMapNative nativeBrowser = new MindMapNative();
|
|
||||||
private User owner;
|
private User owner;
|
||||||
private String properties;
|
private String properties;
|
||||||
private String tags;
|
private String tags;
|
||||||
private String title;
|
private String title;
|
||||||
private byte[] xml;
|
private byte[] xml;
|
||||||
|
|
||||||
public static void main(String argv[]) {
|
|
||||||
|
|
||||||
String xml = "pepe\n hole";
|
|
||||||
xml = xml.replace("'", "\\'");
|
|
||||||
xml = xml.replace("\n", "");
|
|
||||||
xml = xml.trim();
|
|
||||||
|
|
||||||
System.out.println("xml:" + xml);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//~ Constructors .........................................................................................
|
//~ Constructors .........................................................................................
|
||||||
|
|
||||||
public MindMap() {
|
public MindMap() {
|
||||||
@ -85,13 +74,27 @@ public class MindMap {
|
|||||||
this.xml = xml;
|
this.xml = xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setXmlStr(@NotNull String xml)
|
||||||
|
throws IOException {
|
||||||
|
this.xml = xml.getBytes(UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
public byte[] getXml() {
|
public byte[] getXml() {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnzippedXml()
|
public String getXmlStr() throws UnsupportedEncodingException {
|
||||||
|
return new String(this.xml, UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getZippedXml()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return ZipUtils.zipToString(xml);
|
return ZipUtils.stringToZip(new String(this.xml, UTF_8));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZippedXml(byte[] xml)
|
||||||
|
throws IOException {
|
||||||
|
this.xml = ZipUtils.zipToString(xml).getBytes(UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperties(String properties) {
|
public void setProperties(String properties) {
|
||||||
@ -117,8 +120,8 @@ public class MindMap {
|
|||||||
this.mindmapUsers = mindmapUsers;
|
this.mindmapUsers = mindmapUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMindmapUser(MindmapUser mindmaUser) {
|
public void addMindmapUser(MindmapUser mindmapUser) {
|
||||||
mindmapUsers.add(mindmaUser);
|
mindmapUsers.add(mindmapUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPublic() {
|
public boolean isPublic() {
|
||||||
@ -173,15 +176,9 @@ public class MindMap {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNativeXml()
|
public String getXmlAsJsLiteral()
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return getUnzippedXml();
|
String xml = this.getXmlStr();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getNativeXmlAsJsLiteral()
|
|
||||||
throws IOException {
|
|
||||||
String xml = getNativeXml();
|
|
||||||
if (xml != null) {
|
if (xml != null) {
|
||||||
xml = xml.replace("'", "\\'");
|
xml = xml.replace("'", "\\'");
|
||||||
xml = xml.replaceAll("\\r|\\n", "");
|
xml = xml.replaceAll("\\r|\\n", "");
|
||||||
@ -190,10 +187,6 @@ public class MindMap {
|
|||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNativeXml(@NotNull String nativeXml)
|
|
||||||
throws IOException {
|
|
||||||
this.xml = ZipUtils.stringToZip(nativeXml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTags(String tags) {
|
public void setTags(String tags) {
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
@ -226,12 +219,4 @@ public class MindMap {
|
|||||||
public User getOwner() {
|
public User getOwner() {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindMapNative getNativeBrowser() {
|
|
||||||
return nativeBrowser;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNativeBrowser(MindMapNative nativeBrowser) {
|
|
||||||
this.nativeBrowser = nativeBrowser;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,4 @@ public class MindMapHistory {
|
|||||||
public void setXml(byte[] xml) {
|
public void setXml(byte[] xml) {
|
||||||
this.xml = xml;
|
this.xml = xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNativeXml()
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
return ZipUtils.zipToString(xml);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.model;
|
|
||||||
|
|
||||||
import com.wisemapping.util.ZipUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class contains the SVG and VML representation of the MindMap
|
|
||||||
*/
|
|
||||||
public class MindMapNative {
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
private byte[] svgXml;
|
|
||||||
private byte[] vmlXml;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getSvgXml() {
|
|
||||||
return svgXml;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSvgXml(byte[] svgXml) {
|
|
||||||
this.svgXml = svgXml;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getVmlXml() {
|
|
||||||
return vmlXml;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVmlXml(byte[] vmlXml) {
|
|
||||||
this.vmlXml = vmlXml;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnzippedVmlXml()
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
return ZipUtils.zipToString(vmlXml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUnzippedSvgXml()
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
return ZipUtils.zipToString(svgXml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVmlXml(String xml) throws IOException {
|
|
||||||
// compress and set
|
|
||||||
vmlXml = ZipUtils.stringToZip(xml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSvgXml(String xml) throws IOException {
|
|
||||||
// compress and set
|
|
||||||
svgXml = ZipUtils.stringToZip(xml);
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,19 +23,19 @@ public class MindmapUser {
|
|||||||
private int id;
|
private int id;
|
||||||
private int roleId;
|
private int roleId;
|
||||||
private MindMap mindMap;
|
private MindMap mindMap;
|
||||||
private Colaborator colaborator;
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public MindmapUser(){ }
|
public MindmapUser(){ }
|
||||||
|
|
||||||
public MindmapUser(int role, Colaborator colaborator , MindMap mindmap)
|
public MindmapUser(int role, Collaborator collaborator, MindMap mindmap)
|
||||||
{
|
{
|
||||||
this.roleId = role;
|
this.roleId = role;
|
||||||
this.mindMap =mindmap;
|
this.mindMap =mindmap;
|
||||||
this.colaborator = colaborator;
|
this.collaborator = collaborator;
|
||||||
|
|
||||||
// Guarantee referential integrity
|
// Guarantee referential integrity
|
||||||
mindmap.addMindmapUser(this);
|
mindmap.addMindmapUser(this);
|
||||||
colaborator.addMindmapUser(this);
|
collaborator.addMindmapUser(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@ -78,11 +78,11 @@ public class MindmapUser {
|
|||||||
this.mindMap = mindMap;
|
this.mindMap = mindMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Colaborator getColaborator() {
|
public Collaborator getCollaborator() {
|
||||||
return colaborator;
|
return collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColaborator(Colaborator colaborator) {
|
public void setCollaborator(Collaborator collaborator) {
|
||||||
this.colaborator = colaborator;
|
this.collaborator = collaborator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,12 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@XmlRootElement(name="user")
|
@XmlRootElement(name = "user")
|
||||||
public class User
|
public class User
|
||||||
extends Colaborator
|
extends Collaborator
|
||||||
implements Serializable
|
implements Serializable {
|
||||||
{
|
|
||||||
|
|
||||||
|
private static final String ADMIN_EMAIL = "test@wisemapping.org";
|
||||||
private String firstname;
|
private String firstname;
|
||||||
private String lastname;
|
private String lastname;
|
||||||
private String password;
|
private String password;
|
||||||
@ -40,13 +40,11 @@ public class User
|
|||||||
public User() {
|
public User() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTags(Set<String> tags)
|
public void setTags(Set<String> tags) {
|
||||||
{
|
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getTags()
|
public Set<String> getTags() {
|
||||||
{
|
|
||||||
return tags;
|
return tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,18 +92,15 @@ public class User
|
|||||||
return activationDate;
|
return activationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowSendEmail()
|
public boolean isAllowSendEmail() {
|
||||||
{
|
|
||||||
return allowSendEmail;
|
return allowSendEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowSendEmail(boolean allowSendEmail)
|
public void setAllowSendEmail(boolean allowSendEmail) {
|
||||||
{
|
|
||||||
this.allowSendEmail = allowSendEmail;
|
this.allowSendEmail = allowSendEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getAllowSendEmail()
|
public boolean getAllowSendEmail() {
|
||||||
{
|
|
||||||
return allowSendEmail;
|
return allowSendEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,4 +134,8 @@ public class User
|
|||||||
public void setUsername(String username) {
|
public void setUsername(String username) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin() {
|
||||||
|
return ADMIN_EMAIL.equals(this.getEmail());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
|
import com.wisemapping.model.User;
|
||||||
|
import com.wisemapping.rest.model.RestUser;
|
||||||
|
import com.wisemapping.service.UserService;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class AdminController {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/{id}", produces = {"application/xml", "application/json"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserById(@PathVariable int id) throws IOException {
|
||||||
|
final User userBy = userService.getUserBy(id);
|
||||||
|
if (userBy == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "admin/users/email/{email}", produces = {"application/xml", "application/json"})
|
||||||
|
@ResponseBody
|
||||||
|
public ModelAndView getUserByEmail(@PathVariable String email) throws IOException {
|
||||||
|
final User userBy = userService.getUserBy(email);
|
||||||
|
if (userBy == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
return new ModelAndView("userView", "user", new RestUser(userBy));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.POST, value = "admin/users", consumes = {"application/xml", "application/json"})
|
||||||
|
public void getUserByEmail(@RequestBody RestUser user) throws IOException, WiseMappingException {
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User could not be found");
|
||||||
|
}
|
||||||
|
userService.createUser(user.getDelegated(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,22 +1,24 @@
|
|||||||
package com.wisemapping.rest;
|
package com.wisemapping.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindmapUser;
|
import com.wisemapping.model.MindmapUser;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.rest.model.RestMindmap;
|
import com.wisemapping.rest.model.RestMindmap;
|
||||||
import com.wisemapping.rest.model.RestMindmapList;
|
import com.wisemapping.rest.model.RestMindmapList;
|
||||||
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ -24,7 +26,7 @@ public class MindmapController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/map/{id}", produces = {"text/xml", "application/json", "text/html"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/xml", "application/json", "text/html"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView getMindmap(@PathVariable int id) throws IOException {
|
public ModelAndView getMindmap(@PathVariable int id) throws IOException {
|
||||||
final MindMap mindMap = mindmapService.getMindmapById(id);
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||||
@ -32,7 +34,7 @@ public class MindmapController {
|
|||||||
return new ModelAndView("mapView", "map", map);
|
return new ModelAndView("mapView", "map", map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/maps", produces = {"text/xml", "application/json", "text/html"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps", produces = {"application/xml", "application/json", "text/html"})
|
||||||
public ModelAndView getMindmaps() throws IOException {
|
public ModelAndView getMindmaps() throws IOException {
|
||||||
final User user = com.wisemapping.security.Utils.getUser();
|
final User user = com.wisemapping.security.Utils.getUser();
|
||||||
|
|
||||||
@ -45,4 +47,29 @@ public class MindmapController {
|
|||||||
final RestMindmapList restMindmapList = new RestMindmapList(mindmaps);
|
final RestMindmapList restMindmapList = new RestMindmapList(mindmaps);
|
||||||
return new ModelAndView("mapsView", "list", restMindmapList);
|
return new ModelAndView("mapsView", "list", restMindmapList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
|
||||||
|
public ModelAndView updateMap(@RequestBody RestMindmap restMindmap, @PathVariable int id) throws IOException, WiseMappingException {
|
||||||
|
|
||||||
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||||
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
|
final String properties = restMindmap.getProperties();
|
||||||
|
mindMap.setProperties(properties);
|
||||||
|
|
||||||
|
final Calendar now = Calendar.getInstance();
|
||||||
|
mindMap.setLastModificationTime(now);
|
||||||
|
mindMap.setLastModifierUser(user.getUsername());
|
||||||
|
|
||||||
|
final Calendar lastModification = Calendar.getInstance();
|
||||||
|
lastModification.setTime(new Date());
|
||||||
|
mindMap.setLastModificationTime(lastModification);
|
||||||
|
|
||||||
|
final String xml = restMindmap.getXml();
|
||||||
|
mindMap.setXmlStr(xml);
|
||||||
|
mindmapService.updateMindmap(mindMap, true);
|
||||||
|
|
||||||
|
return new ModelAndView("responseView", "message", "Map has been updated successfully");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class TransformerController {
|
|||||||
return new ModelAndView("transformViewJpeg", values);
|
return new ModelAndView("transformViewJpeg", values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/freemind"}, consumes = {"text/xml"})
|
@RequestMapping(method = RequestMethod.POST, value = "/transform", produces = {"application/freemind"}, consumes = {"application/xml"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView transformFreemind(@RequestBody @Nullable final String content) throws IOException {
|
public ModelAndView transformFreemind(@RequestBody @Nullable final String content) throws IOException {
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
|
@ -3,9 +3,7 @@ package com.wisemapping.rest.model;
|
|||||||
|
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
import org.codehaus.jackson.annotate.*;
|
||||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
@ -17,14 +15,19 @@ import java.util.Date;
|
|||||||
|
|
||||||
@XmlRootElement(name = "map")
|
@XmlRootElement(name = "map")
|
||||||
@XmlAccessorType(XmlAccessType.PROPERTY)
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
@JsonAutoDetect(
|
||||||
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
|
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
|
||||||
|
isGetterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY
|
||||||
|
)
|
||||||
public class RestMindmap {
|
public class RestMindmap {
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
private MindMap mindmap;
|
private MindMap mindmap;
|
||||||
|
|
||||||
public RestMindmap() {
|
public RestMindmap() {
|
||||||
this(null);
|
this(new MindMap());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,12 +76,12 @@ public class RestMindmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getXml() throws IOException {
|
public String getXml() throws IOException {
|
||||||
return mindmap.getNativeXml();
|
return mindmap.getXmlStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setXml(String xml) throws IOException {
|
public void setXml(@NotNull String xml) throws IOException {
|
||||||
|
|
||||||
mindmap.setNativeXml(xml);
|
mindmap.setXmlStr(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
@ -105,6 +108,7 @@ public class RestMindmap {
|
|||||||
mindmap.setCreator(creatorUser);
|
mindmap.setCreator(creatorUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setProperties(String properties) {
|
public void setProperties(String properties) {
|
||||||
mindmap.setProperties(properties);
|
mindmap.setProperties(properties);
|
||||||
}
|
}
|
||||||
@ -117,6 +121,10 @@ public class RestMindmap {
|
|||||||
mindmap.setLastModifierUser(lastModifierUser);
|
mindmap.setLastModifierUser(lastModifierUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getProperties() {
|
||||||
|
return mindmap.getProperties();
|
||||||
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public MindMap getDelegated() {
|
public MindMap getDelegated() {
|
||||||
return this.mindmap;
|
return this.mindmap;
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.model.MindMap;
|
||||||
|
import com.wisemapping.model.User;
|
||||||
|
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "user")
|
||||||
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
|
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
|
||||||
|
public class RestUser {
|
||||||
|
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
public RestUser() {
|
||||||
|
this(new User());
|
||||||
|
}
|
||||||
|
|
||||||
|
public RestUser(@NotNull User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Calendar getCreationDate() {
|
||||||
|
return user.getCreationDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTags(Set<String> tags) {
|
||||||
|
user.setTags(tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> getTags() {
|
||||||
|
return user.getTags();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstname() {
|
||||||
|
return user.getFirstname();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstname(String firstname) {
|
||||||
|
user.setFirstname(firstname);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastname() {
|
||||||
|
return user.getLastname();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastname(String lastname) {
|
||||||
|
user.setLastname(lastname);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return user.isActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return user.getUsername();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
user.setUsername(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return user.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
user.setId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return user.getEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
user.setEmail(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreationDate(Calendar creationDate) {
|
||||||
|
// user.setCreationDate(creationDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(@NotNull final String password){
|
||||||
|
this.user.setPassword(password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public User getDelegated(){
|
||||||
|
return this.user;
|
||||||
|
}
|
||||||
|
}
|
@ -34,8 +34,12 @@ public class UserDetails implements org.springframework.security.core.userdetail
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
final SimpleGrantedAuthority role_user = new SimpleGrantedAuthority("ROLE_USER");
|
|
||||||
final Collection<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
final Collection<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
||||||
|
if(this.getUser().isAdmin()) {
|
||||||
|
final SimpleGrantedAuthority role_admin = new SimpleGrantedAuthority("ROLE_ADMIN");
|
||||||
|
result.add(role_admin);
|
||||||
|
}
|
||||||
|
final SimpleGrantedAuthority role_user = new SimpleGrantedAuthority("ROLE_USER");
|
||||||
result.add(role_user);
|
result.add(role_user);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class MindmapServiceImpl
|
|||||||
final Set<MindmapUser> users = map.getMindmapUsers();
|
final Set<MindmapUser> users = map.getMindmapUsers();
|
||||||
UserRole rol = null;
|
UserRole rol = null;
|
||||||
for (MindmapUser mindmapUser : users) {
|
for (MindmapUser mindmapUser : users) {
|
||||||
if (mindmapUser.getColaborator().getId() == user.getId()) {
|
if (mindmapUser.getCollaborator().getId() == user.getId()) {
|
||||||
rol = mindmapUser.getRole();
|
rol = mindmapUser.getRole();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByUser(User user) {
|
public List<MindmapUser> getMindmapUserByUser(User user) {
|
||||||
return mindmapManager.getMindmapUserByColaborator(user.getId());
|
return mindmapManager.getMindmapUserByCollaborator(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException {
|
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException {
|
||||||
@ -115,10 +115,10 @@ public class MindmapServiceImpl
|
|||||||
Set<MindmapUser> mindmapusers = mindmap.getMindmapUsers();
|
Set<MindmapUser> mindmapusers = mindmap.getMindmapUsers();
|
||||||
MindmapUser mindmapuserToDelete = null;
|
MindmapUser mindmapuserToDelete = null;
|
||||||
for (MindmapUser mindmapuser : mindmapusers) {
|
for (MindmapUser mindmapuser : mindmapusers) {
|
||||||
if (mindmapuser.getColaborator().getId() == colaboratorId) {
|
if (mindmapuser.getCollaborator().getId() == colaboratorId) {
|
||||||
mindmapuserToDelete = mindmapuser;
|
mindmapuserToDelete = mindmapuser;
|
||||||
//@TODO evaluar si el colaborador no tiene mas asociaciones si hay que eliminarlo, por ahora NO
|
//@TODO evaluar si el colaborador no tiene mas asociaciones si hay que eliminarlo, por ahora NO
|
||||||
// final List<MindmapUser> otherAsociations = mindmapManager.getMindmapUserByColaborator(colaboratorId);
|
// final List<MindmapUser> otherAsociations = mindmapManager.getMindmapUserByCollaborator(colaboratorId);
|
||||||
// if (otherAsociations != null)
|
// if (otherAsociations != null)
|
||||||
// {
|
// {
|
||||||
//
|
//
|
||||||
@ -126,8 +126,8 @@ public class MindmapServiceImpl
|
|||||||
// // Is not a User
|
// // Is not a User
|
||||||
// if (user == null)
|
// if (user == null)
|
||||||
// {
|
// {
|
||||||
// final Colaborator col = mindmapManager.getColaboratorBy(colaboratorId);
|
// final Collaborator col = mindmapManager.getCollaboratorBy(colaboratorId);
|
||||||
// mindmapManager.removeColaborator(col);
|
// mindmapManager.removeCollaborator(col);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
@ -178,7 +178,7 @@ public class MindmapServiceImpl
|
|||||||
public void addColaborators(MindMap mindmap, String[] colaboratorEmails, UserRole role, ColaborationEmail email)
|
public void addColaborators(MindMap mindmap, String[] colaboratorEmails, UserRole role, ColaborationEmail email)
|
||||||
throws InvalidColaboratorException {
|
throws InvalidColaboratorException {
|
||||||
if (colaboratorEmails != null && colaboratorEmails.length > 0) {
|
if (colaboratorEmails != null && colaboratorEmails.length > 0) {
|
||||||
final Colaborator owner = mindmap.getOwner();
|
final Collaborator owner = mindmap.getOwner();
|
||||||
final Set<MindmapUser> mindmapUsers = mindmap.getMindmapUsers();
|
final Set<MindmapUser> mindmapUsers = mindmap.getMindmapUsers();
|
||||||
|
|
||||||
for (String colaboratorEmail : colaboratorEmails) {
|
for (String colaboratorEmail : colaboratorEmails) {
|
||||||
@ -244,7 +244,7 @@ public class MindmapServiceImpl
|
|||||||
public void revertMapToHistory(MindMap map, int historyId)
|
public void revertMapToHistory(MindMap map, int historyId)
|
||||||
throws IOException, WiseMappingException {
|
throws IOException, WiseMappingException {
|
||||||
final MindMapHistory history = mindmapManager.getHistory(historyId);
|
final MindMapHistory history = mindmapManager.getHistory(historyId);
|
||||||
map.setNativeXml(history.getNativeXml());
|
map.setXml(history.getXml());
|
||||||
updateMindmap(map, false);
|
updateMindmap(map, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +252,7 @@ public class MindmapServiceImpl
|
|||||||
MindmapUser mindmapUser = null;
|
MindmapUser mindmapUser = null;
|
||||||
|
|
||||||
for (MindmapUser user : mindmapUsers) {
|
for (MindmapUser user : mindmapUsers) {
|
||||||
if (user.getColaborator().getEmail().equals(email)) {
|
if (user.getCollaborator().getEmail().equals(email)) {
|
||||||
mindmapUser = user;
|
mindmapUser = user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -262,15 +262,15 @@ public class MindmapServiceImpl
|
|||||||
|
|
||||||
private void addColaborator(String colaboratorEmail, UserRole role, MindMap mindmap, ColaborationEmail email) {
|
private void addColaborator(String colaboratorEmail, UserRole role, MindMap mindmap, ColaborationEmail email) {
|
||||||
|
|
||||||
Colaborator colaborator = mindmapManager.getColaboratorBy(colaboratorEmail);
|
Collaborator collaborator = mindmapManager.getCollaboratorBy(colaboratorEmail);
|
||||||
if (colaborator == null) {
|
if (collaborator == null) {
|
||||||
colaborator = new Colaborator();
|
collaborator = new Collaborator();
|
||||||
colaborator.setEmail(colaboratorEmail);
|
collaborator.setEmail(colaboratorEmail);
|
||||||
colaborator.setCreationDate(Calendar.getInstance());
|
collaborator.setCreationDate(Calendar.getInstance());
|
||||||
mindmapManager.addColaborator(colaborator);
|
mindmapManager.addCollaborator(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
final MindmapUser newMindmapUser = new MindmapUser(role.ordinal(), colaborator, mindmap);
|
final MindmapUser newMindmapUser = new MindmapUser(role.ordinal(), collaborator, mindmap);
|
||||||
mindmap.getMindmapUsers().add(newMindmapUser);
|
mindmap.getMindmapUsers().add(newMindmapUser);
|
||||||
|
|
||||||
mindmapManager.saveMindmap(mindmap);
|
mindmapManager.saveMindmap(mindmap);
|
||||||
|
@ -21,8 +21,8 @@ package com.wisemapping.service;
|
|||||||
import com.wisemapping.dao.UserManager;
|
import com.wisemapping.dao.UserManager;
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.mail.Mailer;
|
import com.wisemapping.mail.Mailer;
|
||||||
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.Colaborator;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -102,7 +102,7 @@ public class UserServiceImpl
|
|||||||
user.setActivationDate(Calendar.getInstance());
|
user.setActivationDate(Calendar.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
Colaborator col = userManager.getColaboratorBy(user.getEmail());
|
Collaborator col = userManager.getCollaboratorBy(user.getEmail());
|
||||||
if (col != null) {
|
if (col != null) {
|
||||||
userManager.createUser(user, col);
|
userManager.createUser(user, col);
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,26 +18,26 @@
|
|||||||
|
|
||||||
package com.wisemapping.view;
|
package com.wisemapping.view;
|
||||||
|
|
||||||
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.UserRole;
|
import com.wisemapping.model.UserRole;
|
||||||
import com.wisemapping.model.Colaborator;
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
|
|
||||||
public class ColaboratorBean
|
public class ColaboratorBean
|
||||||
{
|
{
|
||||||
private UserRole userRole;
|
private UserRole userRole;
|
||||||
private boolean isUser;
|
private boolean isUser;
|
||||||
private Colaborator colaborator;
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public ColaboratorBean(Colaborator colaborator, UserRole role)
|
public ColaboratorBean(Collaborator collaborator, UserRole role)
|
||||||
{
|
{
|
||||||
this.colaborator = colaborator;
|
this.collaborator = collaborator;
|
||||||
this.userRole = role;
|
this.userRole = role;
|
||||||
this.isUser = false;
|
this.isUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColaboratorBean(User user, UserRole role)
|
public ColaboratorBean(User user, UserRole role)
|
||||||
{
|
{
|
||||||
this.colaborator = user;
|
this.collaborator = user;
|
||||||
this.userRole = role;
|
this.userRole = role;
|
||||||
this.isUser = true;
|
this.isUser = true;
|
||||||
}
|
}
|
||||||
@ -54,16 +54,16 @@ public class ColaboratorBean
|
|||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
{
|
{
|
||||||
return isUser ? ((User)colaborator).getUsername() : colaborator.getEmail();
|
return isUser ? ((User) collaborator).getUsername() : collaborator.getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEmail()
|
public String getEmail()
|
||||||
{
|
{
|
||||||
return colaborator.getEmail();
|
return collaborator.getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId()
|
public long getId()
|
||||||
{
|
{
|
||||||
return colaborator.getId();
|
return collaborator.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class MindMapBean {
|
|||||||
if (source != null) {
|
if (source != null) {
|
||||||
for (MindmapUser mu : source) {
|
for (MindmapUser mu : source) {
|
||||||
if (mu.getRole() == role) {
|
if (mu.getRole() == role) {
|
||||||
col.add(new ColaboratorBean(mu.getColaborator(), mu.getRole()));
|
col.add(new ColaboratorBean(mu.getCollaborator(), mu.getRole()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<hibernate-mapping>
|
<hibernate-mapping>
|
||||||
|
|
||||||
<class name="com.wisemapping.model.Colaborator" table="COLABORATOR">
|
<class name="com.wisemapping.model.Collaborator" table="COLABORATOR">
|
||||||
<id name="id">
|
<id name="id">
|
||||||
<generator class="increment"/>
|
<generator class="increment"/>
|
||||||
</id>
|
</id>
|
@ -12,7 +12,7 @@
|
|||||||
<property name="title"/>
|
<property name="title"/>
|
||||||
<property name="public"/>
|
<property name="public"/>
|
||||||
<property name="description"/>
|
<property name="description"/>
|
||||||
<property name="xml" column="XML"/>
|
<property name="zippedXml" column="XML"/>
|
||||||
<property name="lastModifierUser" column="last_editor"/>
|
<property name="lastModifierUser" column="last_editor"/>
|
||||||
<property name="lastModificationTime" column="edition_date"/>
|
<property name="lastModificationTime" column="edition_date"/>
|
||||||
<property name="creationTime" column="creation_date"/>
|
<property name="creationTime" column="creation_date"/>
|
||||||
@ -21,7 +21,6 @@
|
|||||||
<property name="properties" column="editor_properties"/>
|
<property name="properties" column="editor_properties"/>
|
||||||
|
|
||||||
<many-to-one name="owner" column="owner_id" unique="true" not-null="true"/>
|
<many-to-one name="owner" column="owner_id" unique="true" not-null="true"/>
|
||||||
<many-to-one name="nativeBrowser" column="mindMapNative_id" unique="true" not-null="true"/>
|
|
||||||
|
|
||||||
<set name="mindmapUsers"
|
<set name="mindmapUsers"
|
||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE hibernate-mapping PUBLIC
|
|
||||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
|
||||||
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
|
||||||
|
|
||||||
<hibernate-mapping>
|
|
||||||
|
|
||||||
<class name="com.wisemapping.model.MindMapNative" table="MINDMAP_NATIVE">
|
|
||||||
<id name="id">
|
|
||||||
<generator class="increment"/>
|
|
||||||
</id>
|
|
||||||
|
|
||||||
<property name="svgXml" type="binary">
|
|
||||||
<column name="SVG_XML" sql-type="blob"/>
|
|
||||||
</property>
|
|
||||||
<property name="vmlXml" type="binary">
|
|
||||||
<column name="VML_XML" sql-type="blob"/>
|
|
||||||
</property>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
</hibernate-mapping>
|
|
@ -19,10 +19,10 @@
|
|||||||
class="com.wisemapping.model.MindMap"
|
class="com.wisemapping.model.MindMap"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<many-to-one name="colaborator"
|
<many-to-one name="collaborator"
|
||||||
column="COLABORATOR_ID"
|
column="COLABORATOR_ID"
|
||||||
not-null="true"
|
not-null="true"
|
||||||
class="com.wisemapping.model.Colaborator"
|
class="com.wisemapping.model.Collaborator"
|
||||||
/>
|
/>
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
# HSQL Configuration properties
|
# HSQL Configuration properties
|
||||||
database.url=jdbc:hsqldb:file:target/db/wisemapping
|
database.url=jdbc:hsqldb:file:target/db/wisemapping
|
||||||
database.driver=org.hsqldb.jdbcDriver
|
database.driver=org.hsqldb.jdbc.JDBCDriver
|
||||||
database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
||||||
database.username=sa
|
database.username=sa
|
||||||
database.password=
|
database.password=
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
log4j.rootLogger=WARN, stdout, R
|
log4j.rootLogger=WARN, stdout, R
|
||||||
log4j.logger.net.sf=FATAL,stdout, R
|
|
||||||
log4j.logger.com.wisemapping=WARN,stdout,R
|
log4j.logger.com.wisemapping=WARN,stdout,R
|
||||||
log4j.logger.org.springframework=WARN,stdout,R
|
log4j.logger.org.springframework=WARN,stdout,R
|
||||||
|
log4j.logger.org.codehaus.jackson=WARN,stdout,R
|
||||||
|
|
||||||
# Stdout logger <20>
|
# Stdout logger <20>
|
||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN" "http://getahead.org/dwr//dwr20.dtd">
|
|
||||||
<dwr>
|
|
||||||
<allow>
|
|
||||||
<create creator="spring" javascript="MapEditorService">
|
|
||||||
<param name="beanName" value="mapEditorService"/>
|
|
||||||
<include method="saveMap"/>
|
|
||||||
<include method="loadMap"/>
|
|
||||||
</create>
|
|
||||||
<create creator="spring" javascript="LoggerService">
|
|
||||||
<param name="beanName" value="loggerService"/>
|
|
||||||
<include method="logError"/>
|
|
||||||
</create>
|
|
||||||
|
|
||||||
<convert converter="bean" match="com.wisemapping.dwr.ResponseMessage"/>
|
|
||||||
</allow>
|
|
||||||
|
|
||||||
</dwr>
|
|
@ -0,0 +1,11 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Message: ${message}</h1>
|
||||||
|
<br/>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -110,15 +110,6 @@
|
|||||||
|
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>dwr-invoker</servlet-name>
|
|
||||||
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>debug</param-name>
|
|
||||||
<param-value>true</param-value>
|
|
||||||
</init-param>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>mvc-servlet</servlet-name>
|
<servlet-name>mvc-servlet</servlet-name>
|
||||||
<url-pattern>*.htm</url-pattern>
|
<url-pattern>*.htm</url-pattern>
|
||||||
@ -129,11 +120,6 @@
|
|||||||
<url-pattern>/service/*</url-pattern>
|
<url-pattern>/service/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>dwr-invoker</servlet-name>
|
|
||||||
<url-pattern>/dwr/*</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>
|
<welcome-file>
|
||||||
index.jsp
|
index.jsp
|
||||||
|
@ -24,11 +24,10 @@
|
|||||||
<property name="dataSource" ref="wiseDataSource"/>
|
<property name="dataSource" ref="wiseDataSource"/>
|
||||||
<property name="mappingResources">
|
<property name="mappingResources">
|
||||||
<list>
|
<list>
|
||||||
<value>com/wisemapping/model/Colaborator.hbm.xml</value>
|
<value>com/wisemapping/model/Collaborator.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindMap.hbm.xml</value>
|
<value>com/wisemapping/model/MindMap.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindmapUser.hbm.xml</value>
|
<value>com/wisemapping/model/MindmapUser.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindmapNative.hbm.xml</value>
|
|
||||||
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<list>
|
<list>
|
||||||
<value>com.wisemapping.rest.model.RestMindmap</value>
|
<value>com.wisemapping.rest.model.RestMindmap</value>
|
||||||
<value>com.wisemapping.rest.model.RestMindmapList</value>
|
<value>com.wisemapping.rest.model.RestMindmapList</value>
|
||||||
|
<value>com.wisemapping.rest.model.RestUser</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<sec:http pattern="/css/**" security="none"/>
|
<sec:http pattern="/css/**" security="none"/>
|
||||||
<sec:http pattern="/js/**" security="none"/>
|
<sec:http pattern="/js/**" security="none"/>
|
||||||
<sec:http pattern="/images/**" security="none"/>
|
<sec:http pattern="/images/**" security="none"/>
|
||||||
|
<sec:http pattern="/icons/**" security="none"/>
|
||||||
<sec:http pattern="/favicon.ico" security="none"/>
|
<sec:http pattern="/favicon.ico" security="none"/>
|
||||||
<sec:http pattern="/c/login.htm" security="none"/>
|
<sec:http pattern="/c/login.htm" security="none"/>
|
||||||
<sec:http pattern="/c/userregistration.htm" security="none"/>
|
<sec:http pattern="/c/userregistration.htm" security="none"/>
|
||||||
@ -26,12 +27,10 @@
|
|||||||
<sec:http pattern="/c/embeddedview.htm" security="none"/>
|
<sec:http pattern="/c/embeddedview.htm" security="none"/>
|
||||||
<sec:http pattern="/c/export.htm" security="none"/>
|
<sec:http pattern="/c/export.htm" security="none"/>
|
||||||
<sec:http pattern="/c/publicview.htm" security="none"/>
|
<sec:http pattern="/c/publicview.htm" security="none"/>
|
||||||
<sec:http pattern="/dwr/engine.js" security="none"/>
|
|
||||||
<sec:http pattern="/dwr/interface/loggerservice.js" security="none"/>
|
|
||||||
<sec:http pattern="/dwr/call/plaincall/loggerservice.logerror.dwr" security="none"/>
|
|
||||||
<sec:http pattern="/service/transform.*" security="none"/>
|
<sec:http pattern="/service/transform.*" security="none"/>
|
||||||
|
|
||||||
<sec:http use-expressions="true" create-session="never" pattern="/service/**">
|
<sec:http use-expressions="true" create-session="never" pattern="/service/**">
|
||||||
|
<sec:intercept-url pattern="/service/admin/users/**" access="isAuthenticated() and hasRole('ROLE_ADMIN')"/>
|
||||||
<sec:intercept-url pattern="/service/**" access="isAuthenticated()"/>
|
<sec:intercept-url pattern="/service/**" access="isAuthenticated()"/>
|
||||||
<sec:http-basic/>
|
<sec:http-basic/>
|
||||||
</sec:http>
|
</sec:http>
|
||||||
|
@ -40,24 +40,6 @@
|
|||||||
<property name="target" ref="mindMapServiceTarget"/>
|
<property name="target" ref="mindMapServiceTarget"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="mapEditorService" class="com.wisemapping.dwr.MapEditorService">
|
|
||||||
<property name="mindmapService">
|
|
||||||
<ref local="mindmapService"/>
|
|
||||||
</property>
|
|
||||||
<property name="userService">
|
|
||||||
<ref local="userService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="loggerService" class="com.wisemapping.dwr.JavaScriptErrorLoggerService">
|
|
||||||
<property name="mindmapService">
|
|
||||||
<ref local="mindmapService"/>
|
|
||||||
</property>
|
|
||||||
<property name="userService">
|
|
||||||
<ref local="userService"/>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="smtpAuthenticator" class="com.wisemapping.mail.SmtpAuthenticator">
|
<bean id="smtpAuthenticator" class="com.wisemapping.mail.SmtpAuthenticator">
|
||||||
<constructor-arg value="${mail.user}"/>
|
<constructor-arg value="${mail.user}"/>
|
||||||
<constructor-arg value="${mail.password}"/>
|
<constructor-arg value="${mail.password}"/>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
Native XML:
|
Native XML:
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<textarea name="nativeXml" id="xml" rows="20" cols="70">${mindmap.nativeXml}</textarea>
|
<textarea name="xml" id="xml" rows="20" cols="70">${mindmap.xml}</textarea>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
// Configure designer options ...
|
// Configure designer options ...
|
||||||
var options = loadDesignerOptions();
|
var options = loadDesignerOptions();
|
||||||
options.persistenceManager = "mindplot.DwrPersitenceManager";
|
options.persistenceManager = new mindplot.RESTPersistenceManager("service/maps/");
|
||||||
var userOptions = ${mindmap.properties};
|
var userOptions = ${mindmap.properties};
|
||||||
options.zoom = userOptions.zoom;
|
options.zoom = userOptions.zoom;
|
||||||
|
|
||||||
|
@ -73,7 +73,6 @@ public class ExportTest {
|
|||||||
|
|
||||||
final MindMap result = new MindMap();
|
final MindMap result = new MindMap();
|
||||||
result.setXml(content.toString().getBytes("UTF-8"));
|
result.setXml(content.toString().getBytes("UTF-8"));
|
||||||
result.setNativeXml(content.toString());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ public class ImportExportTest {
|
|||||||
final String recContent = readFile(wiseFile);
|
final String recContent = readFile(wiseFile);
|
||||||
|
|
||||||
// Export mile content ...
|
// Export mile content ...
|
||||||
Assert.assertEquals(mindMap.getUnzippedXml(), recContent);
|
Assert.assertEquals(mindMap.getXmlStr(), recContent);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
final FileOutputStream fos = new FileOutputStream(wiseFile);
|
final FileOutputStream fos = new FileOutputStream(wiseFile);
|
||||||
fos.write(mindMap.getUnzippedXml().getBytes("UTF-8"));
|
fos.write(mindMap.getXmlStr().getBytes("UTF-8"));
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.wisemapping.test.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.rest.model.RestMindmap;
|
||||||
|
import org.codehaus.jackson.map.DeserializationConfig;
|
||||||
|
import org.codehaus.jackson.map.ObjectMapper;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public class JsonTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void deserialize() throws IOException {
|
||||||
|
String json = "{\"id\":\"1\",\"xml\":\"<map name=\\\"1\\\" version=\\\"tango\\\"><topic central=\\\"true\\\" text=\\\"ss\\\" id=\\\"1\\\"/></map>\",\"properties\":\"{\\\"zoom\\\":0.85}\"}";
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
final RestMindmap restMindmap = mapper.readValue(json, RestMindmap.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,10 @@
|
|||||||
CREATE TABLE COLABORATOR (
|
CREATE TABLE COLABORATOR (
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
id INTEGER NOT NULL IDENTITY,
|
||||||
email varchar(255) NOT NULL,
|
email varchar(255) NOT NULL,
|
||||||
creation_date date
|
creation_date date);
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE USER (
|
CREATE TABLE USER (
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
id INTEGER NOT NULL IDENTITY,
|
||||||
colaborator_id INTEGER NOT NULL,
|
colaborator_id INTEGER NOT NULL,
|
||||||
username varchar(255) NOT NULL,
|
username varchar(255) NOT NULL,
|
||||||
firstname varchar(255) NOT NULL,
|
firstname varchar(255) NOT NULL,
|
||||||
@ -18,12 +17,11 @@ FOREIGN KEY(colaborator_id) REFERENCES colaborator(id)
|
|||||||
) ;
|
) ;
|
||||||
|
|
||||||
CREATE TABLE MINDMAP (
|
CREATE TABLE MINDMAP (
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
id INTEGER NOT NULL IDENTITY,
|
||||||
title VARCHAR(255) NOT NULL,
|
title VARCHAR(255) NOT NULL,
|
||||||
description VARCHAR(255) NOT NULL,
|
description VARCHAR(255) NOT NULL,
|
||||||
xml LONGVARBINARY NOT NULL,
|
xml LONGVARBINARY NOT NULL,
|
||||||
public BOOLEAN not null,
|
public BOOLEAN not null,
|
||||||
mindMapNative_id INTEGER NOT NULL,
|
|
||||||
creation_date date,
|
creation_date date,
|
||||||
edition_date date,
|
edition_date date,
|
||||||
owner_id INTEGER not null,
|
owner_id INTEGER not null,
|
||||||
@ -32,44 +30,34 @@ last_editor varchar(255) ,
|
|||||||
creator_user varchar(255) ,
|
creator_user varchar(255) ,
|
||||||
editor_properties varchar(512)
|
editor_properties varchar(512)
|
||||||
--FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
--FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
||||||
) ;
|
);
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_NATIVE
|
|
||||||
(
|
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
|
||||||
svg_xml LONGVARBINARY,
|
|
||||||
vml_xml LONGVARBINARY
|
|
||||||
) ;
|
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_HISTORY
|
CREATE TABLE MINDMAP_HISTORY
|
||||||
(
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
|
||||||
xml LONGVARBINARY NOT NULL,
|
xml LONGVARBINARY NOT NULL,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
creation_date datetime,
|
creation_date datetime,
|
||||||
creator_user varchar(255)
|
creator_user varchar(255));
|
||||||
) ;
|
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_COLABORATOR (
|
CREATE TABLE MINDMAP_COLABORATOR
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
colaborator_id INTEGER NOT NULL,
|
colaborator_id INTEGER NOT NULL,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
role_id INTEGER NOT NULL,
|
role_id INTEGER NOT NULL,
|
||||||
FOREIGN KEY(colaborator_id) REFERENCES colaborator(id),
|
FOREIGN KEY(colaborator_id) REFERENCES colaborator(id),
|
||||||
FOREIGN KEY(mindmap_id) REFERENCES mindmap(id)
|
FOREIGN KEY(mindmap_id) REFERENCES mindmap(id)
|
||||||
) ;
|
);
|
||||||
|
|
||||||
CREATE TABLE TAG(
|
CREATE TABLE TAG
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
name varchar(255) NOT NULL,
|
name varchar(255) NOT NULL,
|
||||||
user_id INTEGER NOT NULL
|
user_id INTEGER NOT NULL,
|
||||||
--FOREIGN KEY(user_id) REFERENCES user(colaborator_id)
|
--FOREIGN KEY(user_id) REFERENCES user(colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE USER_LOGIN (
|
CREATE TABLE USER_LOGIN
|
||||||
id INTEGER NOT NULL IDENTITY PRIMARY KEY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
email varchar(255) ,
|
email varchar(255),
|
||||||
login_date date
|
login_date date);
|
||||||
) ;
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
SHUTDOWN;
|
SHUTDOWN;
|
@ -1,5 +1,4 @@
|
|||||||
DROP TABLE TAG;
|
DROP TABLE TAG;
|
||||||
DROP TABLE MINDMAP_NATIVE;
|
|
||||||
DROP TABLE MINDMAP_COLABORATOR;
|
DROP TABLE MINDMAP_COLABORATOR;
|
||||||
DROP TABLE MINDMAP_HISTORY;
|
DROP TABLE MINDMAP_HISTORY;
|
||||||
DROP TABLE MINDMAP;
|
DROP TABLE MINDMAP;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
|
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURDATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
||||||
values(1,'Wise Mapping Test User','Wise','test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
|
values(1,'WiseMapping Test User','Wise','test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURDATE(),1);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
SHUTDOWN;
|
SHUTDOWN;
|
@ -23,7 +23,6 @@ title varchar(255) CHARACTER SET utf8 NOT NULL,
|
|||||||
description varchar(255) CHARACTER SET utf8 NOT NULL,
|
description varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||||
xml blob NOT NULL,
|
xml blob NOT NULL,
|
||||||
public BOOL not null default 0,
|
public BOOL not null default 0,
|
||||||
mindMapNative_id INTEGER NOT NULL default 0,
|
|
||||||
creation_date date,
|
creation_date date,
|
||||||
edition_date date,
|
edition_date date,
|
||||||
owner_id INTEGER not null,
|
owner_id INTEGER not null,
|
||||||
@ -34,13 +33,6 @@ editor_properties varchar(512) CHARACTER SET utf8 ,
|
|||||||
FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_NATIVE
|
|
||||||
(
|
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
svg_xml blob,
|
|
||||||
vml_xml blob
|
|
||||||
) CHARACTER SET utf8 ;
|
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_HISTORY
|
CREATE TABLE MINDMAP_HISTORY
|
||||||
(
|
(
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
DROP TABLE TAG;
|
DROP TABLE TAG;
|
||||||
DROP TABLE MINDMAP_NATIVE;
|
|
||||||
DROP TABLE MINDMAP_COLABORATOR;
|
DROP TABLE MINDMAP_COLABORATOR;
|
||||||
DROP TABLE MINDMAP_HISTORY;
|
DROP TABLE MINDMAP_HISTORY;
|
||||||
DROP TABLE MINDMAP;
|
DROP TABLE MINDMAP;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE());
|
INSERT INTO COLABORATOR(id,email,creation_date) values (1,'test@wisemapping.org',CURRENT_DATE());
|
||||||
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
INSERT INTO USER (colaborator_id,username,firstname, lastname, password, activationCode,activation_date,allowSendEmail)
|
||||||
values(1,'Wise Mapping Test User','Wise','Test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1);
|
values(1,'WiseMapping Test User','Wise','Test', 'ENC:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',1237,CURRENT_DATE(),1);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
Loading…
Reference in New Issue
Block a user