mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
Rename MindmapUser to Collaboration.
This commit is contained in:
parent
6f923656ee
commit
6c8664ada4
@ -333,7 +333,7 @@ mindplot.widget.Menu = new Class({
|
|||||||
var shareElem = $('shareIt');
|
var shareElem = $('shareIt');
|
||||||
if (shareElem) {
|
if (shareElem) {
|
||||||
this._addButton('shareIt', false, false, function() {
|
this._addButton('shareIt', false, false, function() {
|
||||||
var reqDialog = new MooDialog.Request('c/mymaps.htm?action=collaborator&mapId=' + mapId, null,
|
var reqDialog = new MooDialog.Request('c/iframeWrapper.htm?url=c/maps/' + mapId + "/publishf", null,
|
||||||
{'class': 'modalDialog shareItModalDialog',
|
{'class': 'modalDialog shareItModalDialog',
|
||||||
closeButton:true,
|
closeButton:true,
|
||||||
destroyOnClose:true,
|
destroyOnClose:true,
|
||||||
@ -344,9 +344,9 @@ mindplot.widget.Menu = new Class({
|
|||||||
reqDialog.setContent('loading...');
|
reqDialog.setContent('loading...');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
MooDialog.Request.active = reqDialog;
|
||||||
});
|
});
|
||||||
this._registerTooltip('shareIt', "Collaborators");
|
this._registerTooltip('shareIt', "Share");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,18 +19,11 @@
|
|||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindMapCriteria;
|
|
||||||
import com.wisemapping.model.MindmapUser;
|
|
||||||
import com.wisemapping.model.User;
|
|
||||||
import com.wisemapping.security.Utils;
|
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
import com.wisemapping.service.UserService;
|
import com.wisemapping.service.UserService;
|
||||||
import com.wisemapping.view.MindMapBean;
|
|
||||||
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
|
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public abstract class BaseMultiActionController
|
public abstract class BaseMultiActionController
|
||||||
extends MultiActionController {
|
extends MultiActionController {
|
||||||
@ -38,77 +31,16 @@ public abstract class BaseMultiActionController
|
|||||||
private MindmapService mindmapService;
|
private MindmapService mindmapService;
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
|
|
||||||
protected List<MindMap> getMindmapsFromRequest(HttpServletRequest request) {
|
|
||||||
List<MindMap> result = new ArrayList<MindMap>();
|
|
||||||
final String mindmapIds = request.getParameter("mindmapIds");
|
|
||||||
|
|
||||||
final String ids[] = mindmapIds.split(",");
|
|
||||||
for (String id : ids) {
|
|
||||||
MindMap map = mindmapService.getMindmapById(Integer.parseInt(id));
|
|
||||||
result.add(map);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected List<MindMapBean> getMindMapBeanList(User user) {
|
|
||||||
final List<MindmapUser> userMindmaps = getMindmapService().getMindmapUserByUser(user);
|
|
||||||
|
|
||||||
final List<MindMapBean> mindMapBeans = new ArrayList<MindMapBean>(userMindmaps.size());
|
|
||||||
for (MindmapUser mindmap : userMindmaps) {
|
|
||||||
mindMapBeans.add(new MindMapBean(mindmap.getMindMap()));
|
|
||||||
}
|
|
||||||
return mindMapBeans;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected MindMapCriteria getMindMapCriteriaFromRequest(HttpServletRequest request) {
|
|
||||||
final MindMapCriteria criteria = new MindMapCriteria();
|
|
||||||
|
|
||||||
final String titleOrTags = request.getParameter("titleOrTags");
|
|
||||||
if (titleOrTags != null && titleOrTags.length() != 0) {
|
|
||||||
criteria.orCriteria();
|
|
||||||
criteria.setTitle(titleOrTags);
|
|
||||||
final String tag[] = titleOrTags.split(MindmapService.TAG_SEPARATOR);
|
|
||||||
// Add new Tags to User
|
|
||||||
for (String searchTag : tag) {
|
|
||||||
criteria.getTags().add(searchTag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final String title = request.getParameter("name");
|
|
||||||
if (title != null && title.length() != 0) {
|
|
||||||
criteria.setTitle(title);
|
|
||||||
}
|
|
||||||
final String description = request.getParameter("description");
|
|
||||||
if (description != null && description.length() != 0) {
|
|
||||||
criteria.setDescription(description);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String tags = request.getParameter("tags");
|
|
||||||
if (tags != null && tags.length() != 0) {
|
|
||||||
final String tag[] = tags.split(MindmapService.TAG_SEPARATOR);
|
|
||||||
// Add new Tags to User
|
|
||||||
for (String searchTag : tag) {
|
|
||||||
criteria.getTags().add(searchTag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return criteria;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected MindMap getMindmapFromRequest(HttpServletRequest request) {
|
protected MindMap getMindmapFromRequest(HttpServletRequest request) {
|
||||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMNAME);
|
final String mapIdStr = request.getParameter(MAP_ID_PARAMNAME);
|
||||||
assert mapIdStr != null : "mapId parameter can not be null";
|
assert mapIdStr != null : "mapId parameter can not be null";
|
||||||
logger.info("MapIdStr:" + mapIdStr);
|
logger.info("MapIdStr:" + mapIdStr);
|
||||||
MindMap map = null;
|
MindMap map = null;
|
||||||
int mapId;
|
int mapId;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
mapId = Integer.parseInt(mapIdStr);
|
mapId = Integer.parseInt(mapIdStr);
|
||||||
map = mindmapService.getMindmapById(mapId);
|
map = mindmapService.getMindmapById(mapId);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
logger.debug("An error ocurred trying to get mapId " + mapIdStr + "'", e);
|
logger.debug("An error ocurred trying to get mapId " + mapIdStr + "'", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,13 +50,6 @@ public abstract class BaseMultiActionController
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MindmapUser getMindmapUser(Integer mapId, HttpServletRequest request) {
|
|
||||||
assert mapId != null : "EDIT action: mindmapId is required!";
|
|
||||||
assert request != null : "EDIT action: request is required!";
|
|
||||||
final User user = Utils.getUser(request);
|
|
||||||
return mindmapService.getMindmapUserBy(mapId, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MindmapService getMindmapService() {
|
public MindmapService getMindmapService() {
|
||||||
return mindmapService;
|
return mindmapService;
|
||||||
}
|
}
|
||||||
@ -143,5 +68,4 @@ public abstract class BaseMultiActionController
|
|||||||
|
|
||||||
public static final String MAP_ID_PARAMNAME = "mapId";
|
public static final String MAP_ID_PARAMNAME = "mapId";
|
||||||
public static final String MINDMAP_EMAILS_PARAMNAME = "userEmails";
|
public static final String MINDMAP_EMAILS_PARAMNAME = "userEmails";
|
||||||
public static final String MINDMAP_EMAIL_PARAMNAME = "userEmail";
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
package com.wisemapping.controller;
|
package com.wisemapping.controller;
|
||||||
|
|
||||||
import com.wisemapping.model.ColaborationEmail;
|
import com.wisemapping.model.ColaborationEmail;
|
||||||
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.UserRole;
|
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.InvalidColaboratorException;
|
import com.wisemapping.service.InvalidColaboratorException;
|
||||||
import com.wisemapping.view.MindMapBean;
|
import com.wisemapping.view.MindMapBean;
|
||||||
@ -36,14 +36,14 @@ public class MindmapSharingController extends BaseMultiActionController {
|
|||||||
public ModelAndView addCollaborator(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView addCollaborator(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws InvalidColaboratorException {
|
throws InvalidColaboratorException {
|
||||||
logger.info("Sharing Controller: add collaborators action");
|
logger.info("Sharing Controller: add collaborators action");
|
||||||
addColaborator(request, UserRole.COLLABORATOR);
|
addColaborator(request, CollaborationRole.EDITOR);
|
||||||
return new ModelAndView("closeDialog");
|
return new ModelAndView("closeDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelAndView addViewer(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView addViewer(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws InvalidColaboratorException {
|
throws InvalidColaboratorException {
|
||||||
logger.info("Sharing Controller: add viewer action");
|
logger.info("Sharing Controller: add viewer action");
|
||||||
addColaborator(request, UserRole.VIEWER);
|
addColaborator(request, CollaborationRole.VIEWER);
|
||||||
return new ModelAndView("closeDialog");
|
return new ModelAndView("closeDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ public class MindmapSharingController extends BaseMultiActionController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MindMapBean addColaborator(HttpServletRequest request, UserRole role) throws InvalidColaboratorException {
|
private MindMapBean addColaborator(HttpServletRequest request, CollaborationRole role) throws InvalidColaboratorException {
|
||||||
final MindMap mindMap = getMindmapFromRequest(request);
|
final MindMap mindMap = getMindmapFromRequest(request);
|
||||||
User user = Utils.getUser();
|
User user = Utils.getUser();
|
||||||
if (!mindMap.getOwner().equals(user)) {
|
if (!mindMap.getOwner().equals(user)) {
|
||||||
|
@ -28,11 +28,11 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
Collaborator getCollaboratorBy(long id);
|
Collaborator getCollaboratorBy(long id);
|
||||||
|
|
||||||
List<MindmapUser> getMindmapUserByCollaborator(final long collaboratorId);
|
List<Collaboration> getMindmapUserByCollaborator(final long collaboratorId);
|
||||||
|
|
||||||
List<MindmapUser> getMindmapUserByRole(final UserRole userRole);
|
List<Collaboration> getMindmapUserByRole(final CollaborationRole userRole);
|
||||||
|
|
||||||
MindmapUser getMindmapUserBy(final int mindmapId, final User user);
|
Collaboration getMindmapUserBy(final int mindmapId, final User user);
|
||||||
|
|
||||||
List<MindMap> getAllMindmaps();
|
List<MindMap> getAllMindmaps();
|
||||||
|
|
||||||
@ -44,8 +44,6 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
void addMindmap(User user, MindMap mindMap);
|
void addMindmap(User user, MindMap mindMap);
|
||||||
|
|
||||||
public void addView(int mapId);
|
|
||||||
|
|
||||||
void saveMindmap(MindMap mindMap);
|
void saveMindmap(MindMap mindMap);
|
||||||
|
|
||||||
void updateMindmap(MindMap mindMap, boolean saveHistory);
|
void updateMindmap(MindMap mindMap, boolean saveHistory);
|
||||||
@ -54,7 +52,7 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
void removeMindmap(MindMap mindap);
|
void removeMindmap(MindMap mindap);
|
||||||
|
|
||||||
void removeMindmapUser(MindmapUser mindmapUser);
|
void removeMindmapUser(Collaboration collaboration);
|
||||||
|
|
||||||
public List<MindMap> search(MindMapCriteria criteria);
|
public List<MindMap> search(MindMapCriteria criteria);
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ public class MindmapManagerImpl
|
|||||||
extends HibernateDaoSupport
|
extends HibernateDaoSupport
|
||||||
implements MindmapManager {
|
implements MindmapManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collaborator getCollaboratorBy(final String email) {
|
public Collaborator getCollaboratorBy(final String email) {
|
||||||
final Collaborator collaborator;
|
final Collaborator collaborator;
|
||||||
final List<Collaborator> collaborators = getHibernateTemplate().find("from com.wisemapping.model.Collaborator collaborator where email=?", email);
|
final List<Collaborator> collaborators = getHibernateTemplate().find("from com.wisemapping.model.Collaborator collaborator where email=?", email);
|
||||||
@ -46,10 +47,12 @@ public class MindmapManagerImpl
|
|||||||
return collaborator;
|
return collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MindMap> search(MindMapCriteria criteria) {
|
public List<MindMap> search(MindMapCriteria criteria) {
|
||||||
return search(criteria, -1);
|
return search(criteria, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MindMapHistory> getHistoryFrom(int mindmapId) {
|
public List<MindMapHistory> getHistoryFrom(int mindmapId) {
|
||||||
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
|
final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class);
|
||||||
hibernateCriteria.add(Restrictions.eq("mindmapId", mindmapId));
|
hibernateCriteria.add(Restrictions.eq("mindmapId", mindmapId));
|
||||||
@ -61,10 +64,12 @@ public class MindmapManagerImpl
|
|||||||
return list.subList(0, (10 < list.size() ? 10 : list.size()));
|
return list.subList(0, (10 < list.size() ? 10 : list.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MindMapHistory getHistory(int historyId) {
|
public MindMapHistory getHistory(int historyId) {
|
||||||
return (MindMapHistory) getHibernateTemplate().get(MindMapHistory.class, historyId);
|
return getHibernateTemplate().get(MindMapHistory.class, historyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MindMap> search(MindMapCriteria criteria, int maxResult) {
|
public List<MindMap> search(MindMapCriteria criteria, int maxResult) {
|
||||||
final Criteria hibernateCriteria = getSession().createCriteria(MindMap.class);
|
final Criteria hibernateCriteria = getSession().createCriteria(MindMap.class);
|
||||||
//always search public maps
|
//always search public maps
|
||||||
@ -103,22 +108,25 @@ public class MindmapManagerImpl
|
|||||||
return hibernateCriteria.list();
|
return hibernateCriteria.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Collaborator getCollaboratorBy(long id) {
|
public Collaborator getCollaboratorBy(long id) {
|
||||||
return (Collaborator) getHibernateTemplate().get(Collaborator.class, id);
|
return getHibernateTemplate().get(Collaborator.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByCollaborator(final long colaboratorId) {
|
@Override
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where colaborator_id=?", colaboratorId);
|
public List<Collaboration> getMindmapUserByCollaborator(final long colaboratorId) {
|
||||||
|
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where colaborator_id=?", colaboratorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByRole(final UserRole userRole) {
|
@Override
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where roleId=?", userRole.ordinal());
|
public List<Collaboration> getMindmapUserByRole(final CollaborationRole collaborationRole) {
|
||||||
|
return getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where roleId=?", collaborationRole.ordinal());
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public Collaboration getMindmapUserBy(final int mindmapId, final User user) {
|
||||||
|
final Collaboration result;
|
||||||
|
|
||||||
public MindmapUser getMindmapUserBy(final int mindmapId, final User user) {
|
final List<Collaboration> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Collaboration mindmapUser where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()});
|
||||||
final MindmapUser result;
|
|
||||||
|
|
||||||
final List<MindmapUser> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindmapUser mindmapUser where mindMap.id=? and colaborator_id=?", new Object[]{mindmapId, user.getId()});
|
|
||||||
if (mindMaps != null && !mindMaps.isEmpty()) {
|
if (mindMaps != null && !mindMaps.isEmpty()) {
|
||||||
result = mindMaps.get(0);
|
result = mindMaps.get(0);
|
||||||
} else {
|
} else {
|
||||||
@ -128,27 +136,33 @@ public class MindmapManagerImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addCollaborator(Collaborator collaborator) {
|
public void addCollaborator(Collaborator collaborator) {
|
||||||
assert collaborator != null : "ADD MINDMAP COLABORATOR: Collaborator is required!";
|
assert collaborator != null : "ADD MINDMAP COLABORATOR: Collaborator is required!";
|
||||||
getHibernateTemplate().save(collaborator);
|
getHibernateTemplate().save(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMindmapUser(MindmapUser mindmapUser) {
|
@Override
|
||||||
getHibernateTemplate().delete(mindmapUser);
|
public void removeMindmapUser(Collaboration collaboration) {
|
||||||
|
getHibernateTemplate().delete(collaboration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeCollaborator(Collaborator collaborator) {
|
public void removeCollaborator(Collaborator collaborator) {
|
||||||
getHibernateTemplate().delete(collaborator);
|
getHibernateTemplate().delete(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<MindMap> getAllMindmaps() {
|
public List<MindMap> getAllMindmaps() {
|
||||||
return getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping");
|
return getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MindMap getMindmapById(int mindmapId) {
|
public MindMap getMindmapById(int mindmapId) {
|
||||||
return getHibernateTemplate().get(MindMap.class, mindmapId);
|
return getHibernateTemplate().get(MindMap.class, mindmapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MindMap getMindmapByTitle(final String title, final User user) {
|
public MindMap getMindmapByTitle(final String title, final User user) {
|
||||||
final MindMap result;
|
final MindMap result;
|
||||||
List<MindMap> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping where title=? and creator=?", new Object[]{title, user.getUsername()});
|
List<MindMap> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping where title=? and creator=?", new Object[]{title, user.getUsername()});
|
||||||
@ -160,19 +174,18 @@ public class MindmapManagerImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addView(int mapId) {
|
@Override
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMindmap(User user, MindMap mindMap) {
|
public void addMindmap(User user, MindMap mindMap) {
|
||||||
saveMindmap(mindMap);
|
saveMindmap(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void saveMindmap(MindMap mindMap) {
|
public void saveMindmap(MindMap mindMap) {
|
||||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||||
getSession().save(mindMap);
|
getSession().save(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateMindmap(@NotNull MindMap mindMap, boolean saveHistory) {
|
public void updateMindmap(@NotNull MindMap mindMap, boolean saveHistory) {
|
||||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||||
getHibernateTemplate().saveOrUpdate(mindMap);
|
getHibernateTemplate().saveOrUpdate(mindMap);
|
||||||
@ -181,11 +194,12 @@ public class MindmapManagerImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeMindmap(MindMap mindMap) {
|
public void removeMindmap(MindMap mindMap) {
|
||||||
getHibernateTemplate().delete(mindMap);
|
getHibernateTemplate().delete(mindMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveHistory(MindMap mindMap) {
|
private void saveHistory(MindMap mindMap) {
|
||||||
final MindMapHistory history = new MindMapHistory();
|
final MindMapHistory history = new MindMapHistory();
|
||||||
|
|
||||||
history.setXml(mindMap.getXml());
|
history.setXml(mindMap.getXml());
|
||||||
|
@ -18,11 +18,10 @@
|
|||||||
|
|
||||||
package com.wisemapping.dao;
|
package com.wisemapping.dao;
|
||||||
|
|
||||||
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
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 com.wisemapping.security.CustomPasswordEncoder;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
||||||
@ -110,11 +109,11 @@ public class UserManagerImpl
|
|||||||
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<MindmapUser> set = col.getMindmapUsers();
|
final Set<Collaboration> set = col.getCollaborations();
|
||||||
for (MindmapUser mindmapUser : set) {
|
for (Collaboration collaboration : set) {
|
||||||
MindmapUser newMapUser = new MindmapUser();
|
Collaboration newMapUser = new Collaboration();
|
||||||
newMapUser.setRoleId(mindmapUser.getRole().ordinal());
|
newMapUser.setRoleId(collaboration.getRole().ordinal());
|
||||||
newMapUser.setMindMap(mindmapUser.getMindMap());
|
newMapUser.setMindMap(collaboration.getMindMap());
|
||||||
newMapUser.setCollaborator(user);
|
newMapUser.setCollaborator(user);
|
||||||
user.addMindmapUser(newMapUser);
|
user.addMindmapUser(newMapUser);
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,20 @@
|
|||||||
|
|
||||||
package com.wisemapping.model;
|
package com.wisemapping.model;
|
||||||
|
|
||||||
public class MindmapUser {
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class Collaboration {
|
||||||
|
|
||||||
private int id;
|
private int id;
|
||||||
private int roleId;
|
private CollaborationRole role;
|
||||||
private MindMap mindMap;
|
private MindMap mindMap;
|
||||||
private Collaborator collaborator;
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public MindmapUser(){ }
|
public Collaboration() {
|
||||||
|
}
|
||||||
|
|
||||||
public MindmapUser(int role, Collaborator collaborator, MindMap mindmap)
|
public Collaboration(@NotNull CollaborationRole role, @NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
||||||
{
|
this.role = role;
|
||||||
this.roleId = role;
|
|
||||||
this.mindMap = mindmap;
|
this.mindMap = mindmap;
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
|
|
||||||
@ -47,27 +49,27 @@ public class MindmapUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getRoleId() {
|
public int getRoleId() {
|
||||||
return roleId;
|
return role.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoleId(int roleId) {
|
public void setRoleId(int roleId) {
|
||||||
this.roleId = roleId;
|
this.role = CollaborationRole.values()[roleId];
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserRole getRole() {
|
public CollaborationRole getRole() {
|
||||||
return UserRole.values()[roleId];
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOwner() {
|
public boolean isOwner() {
|
||||||
return getRole() == UserRole.OWNER;
|
return getRole() == CollaborationRole.OWNER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isColaborator() {
|
public boolean isEditor() {
|
||||||
return getRole() == UserRole.COLLABORATOR;
|
return getRole() == CollaborationRole.EDITOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isViewer() {
|
public boolean isViewer() {
|
||||||
return getRole() == UserRole.VIEWER;
|
return getRole() == CollaborationRole.VIEWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindMap getMindMap() {
|
public MindMap getMindMap() {
|
||||||
@ -78,11 +80,12 @@ public class MindmapUser {
|
|||||||
this.mindMap = mindMap;
|
this.mindMap = mindMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public Collaborator getCollaborator() {
|
public Collaborator getCollaborator() {
|
||||||
return collaborator;
|
return collaborator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollaborator(Collaborator collaborator) {
|
public void setCollaborator(@NotNull Collaborator collaborator) {
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,14 +18,14 @@
|
|||||||
|
|
||||||
package com.wisemapping.model;
|
package com.wisemapping.model;
|
||||||
|
|
||||||
public enum UserRole {
|
public enum CollaborationRole {
|
||||||
OWNER(true, true, true), COLLABORATOR(true, true, false), VIEWER(false, true, false);
|
OWNER(true, true, true), EDITOR(true, true, false), VIEWER(false, true, false);
|
||||||
|
|
||||||
private final boolean hasEditPermission;
|
private final boolean hasEditPermission;
|
||||||
private final boolean hasViewPermission;
|
private final boolean hasViewPermission;
|
||||||
private final boolean hasDeletePermission;
|
private final boolean hasDeletePermission;
|
||||||
|
|
||||||
private UserRole(boolean hasEditPermission, boolean hasViewPermission, boolean hasDeletePermission) {
|
private CollaborationRole(boolean hasEditPermission, boolean hasViewPermission, boolean hasDeletePermission) {
|
||||||
this.hasEditPermission = hasEditPermission;
|
this.hasEditPermission = hasEditPermission;
|
||||||
this.hasViewPermission = hasViewPermission;
|
this.hasViewPermission = hasViewPermission;
|
||||||
this.hasDeletePermission = hasDeletePermission;
|
this.hasDeletePermission = hasDeletePermission;
|
@ -27,27 +27,27 @@ 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<Collaboration> collaborations = new HashSet<Collaboration>();
|
||||||
|
|
||||||
public Collaborator() {}
|
public Collaborator() {}
|
||||||
|
|
||||||
public Collaborator(Set<MindmapUser> mindmapUsers) {
|
public Collaborator(Set<Collaboration> collaborations) {
|
||||||
this.mindmapUsers = mindmapUsers;
|
this.collaborations = collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMindmapUsers(Set<MindmapUser> mindmapUsers)
|
public void setCollaborations(Set<Collaboration> collaborations)
|
||||||
{
|
{
|
||||||
this.mindmapUsers = mindmapUsers;
|
this.collaborations = collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMindmapUser(MindmapUser mindmaUser)
|
public void addMindmapUser(Collaboration mindmaUser)
|
||||||
{
|
{
|
||||||
mindmapUsers.add(mindmaUser);
|
collaborations.add(mindmaUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<MindmapUser> getMindmapUsers()
|
public Set<Collaboration> getCollaborations()
|
||||||
{
|
{
|
||||||
return mindmapUsers;
|
return collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
|
@ -41,8 +41,8 @@ public class MindMap {
|
|||||||
private Calendar lastModificationTime;
|
private Calendar lastModificationTime;
|
||||||
private String lastModifierUser;
|
private String lastModifierUser;
|
||||||
|
|
||||||
private Set<MindmapUser> mindmapUsers = new HashSet<MindmapUser>();
|
private Set<Collaboration> collaborations = new HashSet<Collaboration>();
|
||||||
private Set<CollaboratorProperties> collaboratorProperties = new HashSet<CollaboratorProperties>();
|
private Set<MindmapCollaborationProperties> collaboratorProperties = new HashSet<MindmapCollaborationProperties>();
|
||||||
|
|
||||||
private User owner;
|
private User owner;
|
||||||
private String properties;
|
private String properties;
|
||||||
@ -55,8 +55,8 @@ public class MindMap {
|
|||||||
public MindMap() {
|
public MindMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindMap(Set<MindmapUser> mindmapUsers) {
|
public MindMap(Set<Collaboration> collaborations) {
|
||||||
this.mindmapUsers = mindmapUsers;
|
this.collaborations = collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~ Methods ..............................................................................................
|
//~ Methods ..............................................................................................
|
||||||
@ -111,16 +111,16 @@ public class MindMap {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<MindmapUser> getMindmapUsers() {
|
public Set<Collaboration> getCollaborations() {
|
||||||
return mindmapUsers;
|
return collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMindmapUsers(Set<MindmapUser> mindmapUsers) {
|
public void setCollaborations(Set<Collaboration> collaborations) {
|
||||||
this.mindmapUsers = mindmapUsers;
|
this.collaborations = collaborations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMindmapUser(MindmapUser mindmapUser) {
|
public void addMindmapUser(Collaboration collaboration) {
|
||||||
mindmapUsers.add(mindmapUser);
|
collaborations.add(collaboration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPublic() {
|
public boolean isPublic() {
|
||||||
@ -222,18 +222,18 @@ public class MindMap {
|
|||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<CollaboratorProperties> getCollaboratorProperties() {
|
public Set<MindmapCollaborationProperties> getCollaboratorProperties() {
|
||||||
return collaboratorProperties;
|
return collaboratorProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCollaboratorProperties(@NotNull Set<CollaboratorProperties> collaboratorProperties) {
|
public void setCollaboratorProperties(@NotNull Set<MindmapCollaborationProperties> collaboratorProperties) {
|
||||||
this.collaboratorProperties = collaboratorProperties;
|
this.collaboratorProperties = collaboratorProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CollaboratorProperties findUserProperty(@NotNull Collaborator collaborator) {
|
private MindmapCollaborationProperties findUserProperty(@NotNull Collaborator collaborator) {
|
||||||
final Set<CollaboratorProperties> collaboratorProperties = this.getCollaboratorProperties();
|
final Set<MindmapCollaborationProperties> collaboratorProperties = this.getCollaboratorProperties();
|
||||||
CollaboratorProperties result = null;
|
MindmapCollaborationProperties result = null;
|
||||||
for (CollaboratorProperties collaboratorProperty : collaboratorProperties) {
|
for (MindmapCollaborationProperties collaboratorProperty : collaboratorProperties) {
|
||||||
final Collaborator propCollab = collaboratorProperty.getCollaborator();
|
final Collaborator propCollab = collaboratorProperty.getCollaborator();
|
||||||
if (propCollab != null && propCollab.getEmail().equals(collaborator.getEmail())) {
|
if (propCollab != null && propCollab.getEmail().equals(collaborator.getEmail())) {
|
||||||
result = collaboratorProperty;
|
result = collaboratorProperty;
|
||||||
@ -248,16 +248,16 @@ public class MindMap {
|
|||||||
throw new IllegalStateException("Collaborator can not be null");
|
throw new IllegalStateException("Collaborator can not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
CollaboratorProperties collaboratorProperties = this.findUserProperty(collaborator);
|
MindmapCollaborationProperties collaboratorProperties = this.findUserProperty(collaborator);
|
||||||
if (collaboratorProperties == null) {
|
if (collaboratorProperties == null) {
|
||||||
collaboratorProperties = new CollaboratorProperties(collaborator, this);
|
collaboratorProperties = new MindmapCollaborationProperties(collaborator, this);
|
||||||
}
|
}
|
||||||
collaboratorProperties.setStarred(value);
|
collaboratorProperties.setStarred(value);
|
||||||
this.getCollaboratorProperties().add(collaboratorProperties);
|
this.getCollaboratorProperties().add(collaboratorProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStarred(@NotNull Collaborator collaborator) {
|
public boolean isStarred(@NotNull Collaborator collaborator) {
|
||||||
final CollaboratorProperties collaboratorProperty = this.findUserProperty(collaborator);
|
final MindmapCollaborationProperties collaboratorProperty = this.findUserProperty(collaborator);
|
||||||
return collaboratorProperty != null && collaboratorProperty.getStarred();
|
return collaboratorProperty != null && collaboratorProperty.getStarred();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,19 +20,19 @@ package com.wisemapping.model;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class CollaboratorProperties {
|
public class MindmapCollaborationProperties {
|
||||||
private long id;
|
private long id;
|
||||||
private boolean starred;
|
private boolean starred;
|
||||||
private Collaborator collaborator;
|
private Collaborator collaborator;
|
||||||
private MindMap mindmap;
|
private MindMap mindmap;
|
||||||
|
|
||||||
|
|
||||||
public CollaboratorProperties(@NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
public MindmapCollaborationProperties(@NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
this.mindmap = mindmap;
|
this.mindmap = mindmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollaboratorProperties(){
|
public MindmapCollaborationProperties(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ package com.wisemapping.ncontroller;
|
|||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.filter.UserAgent;
|
import com.wisemapping.filter.UserAgent;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindmapUser;
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
@ -186,10 +186,10 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<MindMapBean> findMindMapBeanList(@NotNull User user) {
|
private List<MindMapBean> findMindMapBeanList(@NotNull User user) {
|
||||||
final List<MindmapUser> userMindmaps = mindmapService.getMindmapUserByUser(user);
|
final List<Collaboration> userMindmaps = mindmapService.getMindmapUserByUser(user);
|
||||||
|
|
||||||
final List<MindMapBean> mindMapBeans = new ArrayList<MindMapBean>(userMindmaps.size());
|
final List<MindMapBean> mindMapBeans = new ArrayList<MindMapBean>(userMindmaps.size());
|
||||||
for (MindmapUser mindmap : userMindmaps) {
|
for (Collaboration mindmap : userMindmaps) {
|
||||||
mindMapBeans.add(new MindMapBean(mindmap.getMindMap()));
|
mindMapBeans.add(new MindMapBean(mindmap.getMindMap()));
|
||||||
}
|
}
|
||||||
return mindMapBeans;
|
return mindMapBeans;
|
||||||
|
@ -24,8 +24,8 @@ import com.wisemapping.importer.ImportFormat;
|
|||||||
import com.wisemapping.importer.Importer;
|
import com.wisemapping.importer.Importer;
|
||||||
import com.wisemapping.importer.ImporterException;
|
import com.wisemapping.importer.ImporterException;
|
||||||
import com.wisemapping.importer.ImporterFactory;
|
import com.wisemapping.importer.ImporterFactory;
|
||||||
|
import com.wisemapping.model.Collaboration;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
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.RestMindmapInfo;
|
import com.wisemapping.rest.model.RestMindmapInfo;
|
||||||
@ -92,10 +92,10 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
final MindmapFilter filter = MindmapFilter.parse(q);
|
final MindmapFilter filter = MindmapFilter.parse(q);
|
||||||
|
|
||||||
final List<MindmapUser> mapsByUser = mindmapService.getMindmapUserByUser(user);
|
final List<Collaboration> mapsByUser = mindmapService.getMindmapUserByUser(user);
|
||||||
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
||||||
for (MindmapUser mindmapUser : mapsByUser) {
|
for (Collaboration collaboration : mapsByUser) {
|
||||||
final MindMap mindmap = mindmapUser.getMindMap();
|
final MindMap mindmap = collaboration.getMindMap();
|
||||||
if (filter.accept(mindmap, user)) {
|
if (filter.accept(mindmap, user)) {
|
||||||
mindmaps.add(mindmap);
|
mindmaps.add(mindmap);
|
||||||
}
|
}
|
||||||
@ -201,6 +201,25 @@ public class MindmapController extends BaseController {
|
|||||||
saveMindmap(true, mindMap, user);
|
saveMindmap(true, mindMap, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
|
public void updateCollabs(@PathVariable int id) throws WiseMappingException {
|
||||||
|
|
||||||
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||||
|
final User user = Utils.getUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json", "text/html", "application/xml"})
|
||||||
|
public ModelAndView retrieveList(@PathVariable int id) throws IOException {
|
||||||
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||||
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
|
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||||
|
|
||||||
|
return new ModelAndView("mapsView", "list", collaborations);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"})
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/description", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
|
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.model.CollaborationRole;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "collaborators")
|
||||||
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
|
@JsonAutoDetect(
|
||||||
|
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
|
||||||
|
isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
|
||||||
|
public class RestCollaboration {
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private CollaborationRole role;
|
||||||
|
|
||||||
|
public RestCollaboration() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(@NotNull final String value) {
|
||||||
|
if (value == null) {
|
||||||
|
throw new IllegalStateException("role can not be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
role = CollaborationRole.valueOf(value.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRole() {
|
||||||
|
return role.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.wisemapping.rest.model;
|
||||||
|
|
||||||
|
|
||||||
|
import com.wisemapping.model.Collaborator;
|
||||||
|
import com.wisemapping.model.MindMap;
|
||||||
|
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "collaboration")
|
||||||
|
@XmlAccessorType(XmlAccessType.PROPERTY)
|
||||||
|
@JsonAutoDetect(
|
||||||
|
fieldVisibility = JsonAutoDetect.Visibility.NONE,
|
||||||
|
getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY,
|
||||||
|
isGetterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
|
||||||
|
public class RestCollaborationList {
|
||||||
|
|
||||||
|
private List<RestCollaboration> collaborations;
|
||||||
|
|
||||||
|
public RestCollaborationList() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return this.collaborations.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "collaborate")
|
||||||
|
public List<RestCollaboration> getCollaborations() {
|
||||||
|
return collaborations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollaborations(@NotNull List<RestCollaboration> collaborations) {
|
||||||
|
this.collaborations = collaborations;
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package com.wisemapping.security.aop;
|
package com.wisemapping.security.aop;
|
||||||
|
|
||||||
import com.wisemapping.model.UserRole;
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ public class UpdateSecurityAdvise
|
|||||||
extends BaseSecurityAdvice
|
extends BaseSecurityAdvice
|
||||||
implements MethodInterceptor {
|
implements MethodInterceptor {
|
||||||
|
|
||||||
private UserRole grantedRole = UserRole.COLLABORATOR;
|
private CollaborationRole grantedRole = CollaborationRole.EDITOR;
|
||||||
|
|
||||||
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
|
||||||
checkRole(methodInvocation);
|
checkRole(methodInvocation);
|
||||||
|
@ -20,7 +20,7 @@ package com.wisemapping.security.aop;
|
|||||||
|
|
||||||
import org.aopalliance.intercept.MethodInterceptor;
|
import org.aopalliance.intercept.MethodInterceptor;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
import com.wisemapping.model.UserRole;
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class ViewBaseSecurityAdvise
|
public class ViewBaseSecurityAdvise
|
||||||
extends BaseSecurityAdvice
|
extends BaseSecurityAdvice
|
||||||
implements MethodInterceptor {
|
implements MethodInterceptor {
|
||||||
private UserRole grantedRole = UserRole.VIEWER;
|
private CollaborationRole grantedRole = CollaborationRole.VIEWER;
|
||||||
|
|
||||||
public Object invoke(@NotNull MethodInvocation methodInvocation) throws Throwable {
|
public Object invoke(@NotNull MethodInvocation methodInvocation) throws Throwable {
|
||||||
checkRole(methodInvocation);
|
checkRole(methodInvocation);
|
||||||
|
@ -29,19 +29,19 @@ public interface MindmapService {
|
|||||||
|
|
||||||
public static final String TAG_SEPARATOR = " ";
|
public static final String TAG_SEPARATOR = " ";
|
||||||
|
|
||||||
public MindmapUser getMindmapUserBy(int mindmapId, User user);
|
public Collaboration getMindmapUserBy(int mindmapId, User user);
|
||||||
|
|
||||||
public MindMap getMindmapById(int mindmapId);
|
public MindMap getMindmapById(int mindmapId);
|
||||||
|
|
||||||
public MindMap getMindmapByTitle(String title, User user);
|
public MindMap getMindmapByTitle(String title, User user);
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByUser(User user);
|
public List<Collaboration> getMindmapUserByUser(User user);
|
||||||
|
|
||||||
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
|
public void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
|
||||||
|
|
||||||
public void addMindmap(MindMap map, User user) throws WiseMappingException;
|
public void addMindmap(MindMap map, User user) throws WiseMappingException;
|
||||||
|
|
||||||
public void addCollaborators(MindMap mindmap, String[] collaboratorEmails, UserRole role, ColaborationEmail email)
|
public void addCollaborators(MindMap mindmap, String[] collaboratorEmails, CollaborationRole role, ColaborationEmail email)
|
||||||
throws InvalidColaboratorException;
|
throws InvalidColaboratorException;
|
||||||
|
|
||||||
public void addTags(MindMap mindmap, String tags);
|
public void addTags(MindMap mindmap, String tags);
|
||||||
@ -56,17 +56,15 @@ public interface MindmapService {
|
|||||||
|
|
||||||
public List<MindMapHistory> getMindMapHistory(int mindmapId);
|
public List<MindMapHistory> getMindMapHistory(int mindmapId);
|
||||||
|
|
||||||
public boolean isAllowedToView(User user, MindMap map, UserRole allowedRole);
|
public boolean isAllowedToView(User user, MindMap map, CollaborationRole allowedRole);
|
||||||
|
|
||||||
public boolean isAllowedToView(User user, int mapId, UserRole allowedRole);
|
public boolean isAllowedToView(User user, int mapId, CollaborationRole allowedRole);
|
||||||
|
|
||||||
public boolean isAllowedToCollaborate(User user, int mapId, UserRole grantedRole);
|
public boolean isAllowedToCollaborate(User user, int mapId, CollaborationRole grantedRole);
|
||||||
|
|
||||||
public boolean isAllowedToCollaborate(User user, MindMap map, UserRole grantedRole);
|
public boolean isAllowedToCollaborate(User user, MindMap map, CollaborationRole grantedRole);
|
||||||
|
|
||||||
public void addWelcomeMindmap(User user) throws WiseMappingException;
|
public void addWelcomeMindmap(User user) throws WiseMappingException;
|
||||||
|
|
||||||
public void addView(int mapId);
|
|
||||||
|
|
||||||
public void revertMapToHistory(MindMap map, int historyId) throws IOException, WiseMappingException;
|
public void revertMapToHistory(MindMap map, int historyId) throws IOException, WiseMappingException;
|
||||||
}
|
}
|
||||||
|
@ -36,17 +36,17 @@ public class MindmapServiceImpl
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
private Mailer mailer;
|
private Mailer mailer;
|
||||||
|
|
||||||
public boolean isAllowedToCollaborate(@NotNull User user, int mapId, @NotNull UserRole grantedRole) {
|
public boolean isAllowedToCollaborate(@NotNull User user, int mapId, @NotNull CollaborationRole grantedRole) {
|
||||||
final MindMap map = mindmapManager.getMindmapById(mapId);
|
final MindMap map = mindmapManager.getMindmapById(mapId);
|
||||||
return isAllowedToCollaborate(user, map, grantedRole);
|
return isAllowedToCollaborate(user, map, grantedRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowedToView(User user, int mapId, UserRole grantedRole) {
|
public boolean isAllowedToView(User user, int mapId, CollaborationRole grantedRole) {
|
||||||
final MindMap map = mindmapManager.getMindmapById(mapId);
|
final MindMap map = mindmapManager.getMindmapById(mapId);
|
||||||
return isAllowedToView(user, map, grantedRole);
|
return isAllowedToView(user, map, grantedRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowedToView(@NotNull User user, @NotNull MindMap map, @NotNull UserRole grantedRole) {
|
public boolean isAllowedToView(@NotNull User user, @NotNull MindMap map, @NotNull CollaborationRole grantedRole) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
if (map.isPublic()) {
|
if (map.isPublic()) {
|
||||||
@ -58,17 +58,17 @@ public class MindmapServiceImpl
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowedToCollaborate(@NotNull User user, @Nullable MindMap map, UserRole grantedRole) {
|
public boolean isAllowedToCollaborate(@NotNull User user, @Nullable MindMap map, CollaborationRole grantedRole) {
|
||||||
boolean isAllowed = false;
|
boolean isAllowed = false;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
if (map.getOwner().getId() == user.getId()) {
|
if (map.getOwner().getId() == user.getId()) {
|
||||||
isAllowed = true;
|
isAllowed = true;
|
||||||
} else {
|
} else {
|
||||||
final Set<MindmapUser> users = map.getMindmapUsers();
|
final Set<Collaboration> users = map.getCollaborations();
|
||||||
UserRole rol = null;
|
CollaborationRole rol = null;
|
||||||
for (MindmapUser mindmapUser : users) {
|
for (Collaboration collaboration : users) {
|
||||||
if (mindmapUser.getCollaborator().getId() == user.getId()) {
|
if (collaboration.getCollaborator().getId() == user.getId()) {
|
||||||
rol = mindmapUser.getRole();
|
rol = collaboration.getRole();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public class MindmapServiceImpl
|
|||||||
return isAllowed;
|
return isAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindmapUser getMindmapUserBy(int mindmapId, User user) {
|
public Collaboration getMindmapUserBy(int mindmapId, User user) {
|
||||||
return mindmapManager.getMindmapUserBy(mindmapId, user);
|
return mindmapManager.getMindmapUserBy(mindmapId, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ public class MindmapServiceImpl
|
|||||||
return mindmapManager.getMindmapById(mindmapId);
|
return mindmapManager.getMindmapById(mindmapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MindmapUser> getMindmapUserByUser(@NotNull User user) {
|
public List<Collaboration> getMindmapUserByUser(@NotNull User user) {
|
||||||
return mindmapManager.getMindmapUserByCollaborator(user.getId());
|
return mindmapManager.getMindmapUserByCollaborator(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,10 +113,10 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeCollaboratorFromMindmap(@NotNull MindMap mindmap, long userId) {
|
public void removeCollaboratorFromMindmap(@NotNull MindMap mindmap, long userId) {
|
||||||
// remove colaborator association
|
// remove collaborator association
|
||||||
Set<MindmapUser> mindmapusers = mindmap.getMindmapUsers();
|
Set<Collaboration> mindmapusers = mindmap.getCollaborations();
|
||||||
MindmapUser mindmapuserToDelete = null;
|
Collaboration mindmapuserToDelete = null;
|
||||||
for (MindmapUser mindmapuser : mindmapusers) {
|
for (Collaboration mindmapuser : mindmapusers) {
|
||||||
if (mindmapuser.getCollaborator().getId() == userId) {
|
if (mindmapuser.getCollaborator().getId() == userId) {
|
||||||
mindmapuserToDelete = mindmapuser;
|
mindmapuserToDelete = mindmapuser;
|
||||||
break;
|
break;
|
||||||
@ -159,28 +159,28 @@ public class MindmapServiceImpl
|
|||||||
|
|
||||||
// Hack to reload dbuser ...
|
// Hack to reload dbuser ...
|
||||||
final User dbUser = userService.getUserBy(user.getId());
|
final User dbUser = userService.getUserBy(user.getId());
|
||||||
final MindmapUser mindmapUser = new MindmapUser(UserRole.OWNER.ordinal(), dbUser, map);
|
final Collaboration collaboration = new Collaboration(CollaborationRole.OWNER, dbUser, map);
|
||||||
map.getMindmapUsers().add(mindmapUser);
|
map.getCollaborations().add(collaboration);
|
||||||
|
|
||||||
mindmapManager.addMindmap(dbUser, map);
|
mindmapManager.addMindmap(dbUser, map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCollaborators(MindMap mindmap, String[] collaboratorEmails, UserRole role, ColaborationEmail email)
|
public void addCollaborators(MindMap mindmap, String[] collaboratorEmails, CollaborationRole role, ColaborationEmail email)
|
||||||
throws InvalidColaboratorException {
|
throws InvalidColaboratorException {
|
||||||
if (collaboratorEmails != null && collaboratorEmails.length > 0) {
|
if (collaboratorEmails != null && collaboratorEmails.length > 0) {
|
||||||
final Collaborator owner = mindmap.getOwner();
|
final Collaborator owner = mindmap.getOwner();
|
||||||
final Set<MindmapUser> mindmapUsers = mindmap.getMindmapUsers();
|
final Set<Collaboration> collaborations = mindmap.getCollaborations();
|
||||||
|
|
||||||
for (String colaboratorEmail : collaboratorEmails) {
|
for (String colaboratorEmail : collaboratorEmails) {
|
||||||
if (owner.getEmail().equals(colaboratorEmail)) {
|
if (owner.getEmail().equals(colaboratorEmail)) {
|
||||||
throw new InvalidColaboratorException("The user " + owner.getEmail() + " is the owner");
|
throw new InvalidColaboratorException("The user " + owner.getEmail() + " is the owner");
|
||||||
}
|
}
|
||||||
MindmapUser mindmapUser = getMindmapUserBy(colaboratorEmail, mindmapUsers);
|
Collaboration collaboration = getMindmapUserBy(colaboratorEmail, collaborations);
|
||||||
if (mindmapUser == null) {
|
if (collaboration == null) {
|
||||||
addCollaborator(colaboratorEmail, role, mindmap, email);
|
addCollaborator(colaboratorEmail, role, mindmap, email);
|
||||||
} else if (mindmapUser.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
|
||||||
mindmapUser.setRoleId(role.ordinal());
|
collaboration.setRoleId(role.ordinal());
|
||||||
mindmapManager.updateMindmap(mindmap, false);
|
mindmapManager.updateMindmap(mindmap, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,10 +222,6 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addView(int mapId) {
|
|
||||||
mindmapManager.addView(mapId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<MindMapHistory> getMindMapHistory(int mindmapId) {
|
public List<MindMapHistory> getMindMapHistory(int mindmapId) {
|
||||||
return mindmapManager.getHistoryFrom(mindmapId);
|
return mindmapManager.getHistoryFrom(mindmapId);
|
||||||
}
|
}
|
||||||
@ -237,19 +233,19 @@ public class MindmapServiceImpl
|
|||||||
updateMindmap(map, false);
|
updateMindmap(map, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MindmapUser getMindmapUserBy(String email, Set<MindmapUser> mindmapUsers) {
|
private Collaboration getMindmapUserBy(String email, Set<Collaboration> collaborations) {
|
||||||
MindmapUser mindmapUser = null;
|
Collaboration collaboration = null;
|
||||||
|
|
||||||
for (MindmapUser user : mindmapUsers) {
|
for (Collaboration user : collaborations) {
|
||||||
if (user.getCollaborator().getEmail().equals(email)) {
|
if (user.getCollaborator().getEmail().equals(email)) {
|
||||||
mindmapUser = user;
|
collaboration = user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mindmapUser;
|
return collaboration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCollaborator(String colaboratorEmail, UserRole role, MindMap mindmap, ColaborationEmail email) {
|
private void addCollaborator(String colaboratorEmail, CollaborationRole role, MindMap mindmap, ColaborationEmail email) {
|
||||||
|
|
||||||
Collaborator collaborator = mindmapManager.getCollaboratorBy(colaboratorEmail);
|
Collaborator collaborator = mindmapManager.getCollaboratorBy(colaboratorEmail);
|
||||||
if (collaborator == null) {
|
if (collaborator == null) {
|
||||||
@ -259,8 +255,8 @@ public class MindmapServiceImpl
|
|||||||
mindmapManager.addCollaborator(collaborator);
|
mindmapManager.addCollaborator(collaborator);
|
||||||
}
|
}
|
||||||
|
|
||||||
final MindmapUser newMindmapUser = new MindmapUser(role.ordinal(), collaborator, mindmap);
|
final Collaboration newCollaboration = new Collaboration(role, collaborator, mindmap);
|
||||||
mindmap.getMindmapUsers().add(newMindmapUser);
|
mindmap.getCollaborations().add(newCollaboration);
|
||||||
|
|
||||||
mindmapManager.saveMindmap(mindmap);
|
mindmapManager.saveMindmap(mindmap);
|
||||||
|
|
||||||
|
@ -18,27 +18,27 @@
|
|||||||
|
|
||||||
package com.wisemapping.view;
|
package com.wisemapping.view;
|
||||||
|
|
||||||
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.Collaborator;
|
import com.wisemapping.model.Collaborator;
|
||||||
import com.wisemapping.model.UserRole;
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
|
|
||||||
public class ColaboratorBean
|
public class ColaboratorBean
|
||||||
{
|
{
|
||||||
private UserRole userRole;
|
private CollaborationRole collaborationRole;
|
||||||
private boolean isUser;
|
private boolean isUser;
|
||||||
private Collaborator collaborator;
|
private Collaborator collaborator;
|
||||||
|
|
||||||
public ColaboratorBean(Collaborator collaborator, UserRole role)
|
public ColaboratorBean(Collaborator collaborator, CollaborationRole role)
|
||||||
{
|
{
|
||||||
this.collaborator = collaborator;
|
this.collaborator = collaborator;
|
||||||
this.userRole = role;
|
this.collaborationRole = role;
|
||||||
this.isUser = false;
|
this.isUser = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColaboratorBean(User user, UserRole role)
|
public ColaboratorBean(User user, CollaborationRole role)
|
||||||
{
|
{
|
||||||
this.collaborator = user;
|
this.collaborator = user;
|
||||||
this.userRole = role;
|
this.collaborationRole = role;
|
||||||
this.isUser = true;
|
this.isUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class ColaboratorBean
|
|||||||
|
|
||||||
public String getRole()
|
public String getRole()
|
||||||
{
|
{
|
||||||
return userRole.name();
|
return collaborationRole.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername()
|
public String getUsername()
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
package com.wisemapping.view;
|
package com.wisemapping.view;
|
||||||
|
|
||||||
|
import com.wisemapping.model.Collaboration;
|
||||||
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.MindMap;
|
import com.wisemapping.model.MindMap;
|
||||||
import com.wisemapping.model.MindmapUser;
|
|
||||||
import com.wisemapping.model.UserRole;
|
|
||||||
import com.wisemapping.model.User;
|
import com.wisemapping.model.User;
|
||||||
import com.wisemapping.security.Utils;
|
import com.wisemapping.security.Utils;
|
||||||
|
|
||||||
@ -34,8 +34,8 @@ public class MindMapBean {
|
|||||||
|
|
||||||
public MindMapBean(final MindMap mindmap) {
|
public MindMapBean(final MindMap mindmap) {
|
||||||
this.mindMap = mindmap;
|
this.mindMap = mindmap;
|
||||||
this.colaborators = getColaboratorBy(mindmap.getMindmapUsers(), UserRole.COLLABORATOR);
|
this.colaborators = getColaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
||||||
this.viewers = getColaboratorBy(mindmap.getMindmapUsers(), UserRole.VIEWER);
|
this.viewers = getColaboratorBy(mindmap.getCollaborations(), CollaborationRole.VIEWER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MindMap getMindMap() {
|
public MindMap getMindMap() {
|
||||||
@ -104,10 +104,10 @@ public class MindMapBean {
|
|||||||
return mindMap.getTags();
|
return mindMap.getTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ColaboratorBean> getColaboratorBy(Set<MindmapUser> source, UserRole role) {
|
private List<ColaboratorBean> getColaboratorBy(Set<Collaboration> source, CollaborationRole role) {
|
||||||
List<ColaboratorBean> col = new ArrayList<ColaboratorBean>();
|
List<ColaboratorBean> col = new ArrayList<ColaboratorBean>();
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
for (MindmapUser mu : source) {
|
for (Collaboration mu : source) {
|
||||||
if (mu.getRole() == role) {
|
if (mu.getRole() == role) {
|
||||||
col.add(new ColaboratorBean(mu.getCollaborator(), mu.getRole()));
|
col.add(new ColaboratorBean(mu.getCollaborator(), mu.getRole()));
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
<property name="email"/>
|
<property name="email"/>
|
||||||
<property name="creationDate" column="creation_date"/>
|
<property name="creationDate" column="creation_date"/>
|
||||||
|
|
||||||
<set name="mindmapUsers"
|
<set name="collaborations"
|
||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
inverse="true">
|
inverse="true">
|
||||||
<key column="COLABORATOR_ID" not-null="true"/>
|
<key column="COLABORATOR_ID" not-null="true"/>
|
||||||
<one-to-many class="com.wisemapping.model.MindmapUser"/>
|
<one-to-many class="com.wisemapping.model.Collaboration"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
<joined-subclass name="com.wisemapping.model.User" table="USER">
|
<joined-subclass name="com.wisemapping.model.User" table="USER">
|
||||||
|
@ -22,18 +22,18 @@
|
|||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
<set name="mindmapUsers"
|
<set name="collaborations"
|
||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
inverse="true">
|
inverse="true">
|
||||||
<key column="MINDMAP_ID" not-null="true"/>
|
<key column="MINDMAP_ID" not-null="true"/>
|
||||||
<one-to-many class="com.wisemapping.model.MindmapUser"/>
|
<one-to-many class="com.wisemapping.model.Collaboration"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
<set name="collaboratorProperties"
|
<set name="collaboratorProperties"
|
||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
inverse="true">
|
inverse="true">
|
||||||
<key column="MINDMAP_ID" not-null="true"/>
|
<key column="MINDMAP_ID" not-null="true"/>
|
||||||
<one-to-many class="com.wisemapping.model.CollaboratorProperties"/>
|
<one-to-many class="com.wisemapping.model.MindmapCollaborationProperties"/>
|
||||||
</set>
|
</set>
|
||||||
|
|
||||||
</class>
|
</class>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<hibernate-mapping>
|
<hibernate-mapping>
|
||||||
|
|
||||||
<class name="com.wisemapping.model.MindmapUser" table="MINDMAP_COLABORATOR">
|
<class name="com.wisemapping.model.Collaboration" table="MINDMAP_COLABORATOR">
|
||||||
<id name="id">
|
<id name="id">
|
||||||
<generator class="increment"/>
|
<generator class="increment"/>
|
||||||
</id>
|
</id>
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<hibernate-mapping>
|
<hibernate-mapping>
|
||||||
|
|
||||||
<class name="com.wisemapping.model.CollaboratorProperties" table="MINDMAP_COLLABORATOR_PROPERTIES">
|
<class name="com.wisemapping.model.MindmapCollaborationProperties" table="MINDMAP_COLLABORATION_PROPERTIES">
|
||||||
<id name="id">
|
<id name="id">
|
||||||
<generator class="increment"/>
|
<generator class="increment"/>
|
||||||
</id>
|
</id>
|
@ -26,8 +26,8 @@
|
|||||||
<list>
|
<list>
|
||||||
<value>com/wisemapping/model/Collaborator.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/MindmapCollaboration.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/CollaboratorProperties.hbm.xml</value>
|
<value>com/wisemapping/model/MindmapCollaborationProperties.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
<value>com/wisemapping/model/UserLogin.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
||||||
</list>
|
</list>
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
<value>com.wisemapping.rest.model.RestMindmapList</value>
|
<value>com.wisemapping.rest.model.RestMindmapList</value>
|
||||||
<value>com.wisemapping.rest.model.RestUser</value>
|
<value>com.wisemapping.rest.model.RestUser</value>
|
||||||
<value>com.wisemapping.rest.model.RestErrors</value>
|
<value>com.wisemapping.rest.model.RestErrors</value>
|
||||||
|
<value>com.wisemapping.rest.model.RestCollaboration</value>
|
||||||
|
<value>com.wisemapping.rest.model.RestCollaborationList</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -32,7 +32,7 @@ editor_properties varchar(512)
|
|||||||
--FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
--FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_COLLABORATOR_PROPERTIES
|
CREATE TABLE MINDMAP_COLLABORATION_PROPERTIES
|
||||||
(id INTEGER NOT NULL IDENTITY,
|
(id INTEGER NOT NULL IDENTITY,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
collaborator_id INTEGER NOT NULL,
|
collaborator_id INTEGER NOT NULL,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
DROP TABLE TAG;
|
DROP TABLE TAG;
|
||||||
DROP TABLE MINDMAP_COLLABORATOR_PROPERTIES;
|
DROP TABLE MINDMAP_COLLABORATION_PROPERTIES;
|
||||||
DROP TABLE MINDMAP_COLABORATOR;
|
DROP TABLE MINDMAP_COLABORATOR;
|
||||||
DROP TABLE MINDMAP_HISTORY;
|
DROP TABLE MINDMAP_HISTORY;
|
||||||
DROP TABLE MINDMAP;
|
DROP TABLE MINDMAP;
|
||||||
|
@ -34,7 +34,7 @@ FOREIGN KEY(owner_id) REFERENCES USER(colaborator_id)
|
|||||||
) CHARACTER SET utf8 ;
|
) CHARACTER SET utf8 ;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE MINDMAP_COLLABORATOR_PROPERTIES(
|
CREATE TABLE MINDMAP_COLLABORATION_PROPERTIES(
|
||||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
mindmap_id INTEGER NOT NULL,
|
mindmap_id INTEGER NOT NULL,
|
||||||
collaborator_id INTEGER NOT NULL,
|
collaborator_id INTEGER NOT NULL,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
DROP TABLE TAG;
|
DROP TABLE TAG;
|
||||||
DROP TABLE MINDMAP_COLLABORATOR_PROPERTIES;
|
DROP TABLE MINDMAP_COLLABORATION_PROPERTIES;
|
||||||
DROP TABLE MINDMAP_COLABORATOR;
|
DROP TABLE MINDMAP_COLABORATOR;
|
||||||
DROP TABLE MINDMAP_HISTORY;
|
DROP TABLE MINDMAP_HISTORY;
|
||||||
DROP TABLE MINDMAP;
|
DROP TABLE MINDMAP;
|
||||||
|
Loading…
Reference in New Issue
Block a user