mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 07:44:56 +01:00
- IE window.open does not support base href tag. Fixed.
This commit is contained in:
parent
dde7806b38
commit
5f441c2c20
@ -35,29 +35,29 @@ public interface MindmapManager {
|
||||
|
||||
Collaboration findCollaboration(final int mindmapId, final User user);
|
||||
|
||||
List<MindMap> getAllMindmaps();
|
||||
List<Mindmap> getAllMindmaps();
|
||||
|
||||
MindMap getMindmapById(int mindmapId);
|
||||
Mindmap getMindmapById(int mindmapId);
|
||||
|
||||
MindMap getMindmapByTitle(final String name, final User user);
|
||||
Mindmap getMindmapByTitle(final String name, final User user);
|
||||
|
||||
void addCollaborator(Collaborator collaborator);
|
||||
|
||||
void addMindmap(User user, MindMap mindMap);
|
||||
void addMindmap(User user, Mindmap mindMap);
|
||||
|
||||
void saveMindmap(MindMap mindMap);
|
||||
void saveMindmap(Mindmap mindMap);
|
||||
|
||||
void updateMindmap(@NotNull MindMap mindMap, boolean saveHistory);
|
||||
void updateMindmap(@NotNull Mindmap mindMap, boolean saveHistory);
|
||||
|
||||
void removeCollaborator(@NotNull Collaborator collaborator);
|
||||
|
||||
void removeMindmap(MindMap mindap);
|
||||
void removeMindmap(Mindmap mindap);
|
||||
|
||||
void removeCollaboration(Collaboration collaboration);
|
||||
|
||||
public List<MindMap> search(MindMapCriteria criteria);
|
||||
public List<Mindmap> search(MindMapCriteria criteria);
|
||||
|
||||
public List<MindMap> search(MindMapCriteria criteria, int maxResult);
|
||||
public List<Mindmap> search(MindMapCriteria criteria, int maxResult);
|
||||
|
||||
public List<MindMapHistory> getHistoryFrom(int mindmapId);
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class MindmapManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MindMap> search(MindMapCriteria criteria) {
|
||||
public List<Mindmap> search(MindMapCriteria criteria) {
|
||||
return search(criteria, -1);
|
||||
}
|
||||
|
||||
@ -75,8 +75,8 @@ public class MindmapManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MindMap> search(MindMapCriteria criteria, int maxResult) {
|
||||
final Criteria hibernateCriteria = getSession().createCriteria(MindMap.class);
|
||||
public List<Mindmap> search(MindMapCriteria criteria, int maxResult) {
|
||||
final Criteria hibernateCriteria = getSession().createCriteria(Mindmap.class);
|
||||
//always search public maps
|
||||
hibernateCriteria.add(Restrictions.like("public", Boolean.TRUE));
|
||||
|
||||
@ -159,19 +159,19 @@ public class MindmapManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MindMap> getAllMindmaps() {
|
||||
return getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping");
|
||||
public List<Mindmap> getAllMindmaps() {
|
||||
return getHibernateTemplate().find("from com.wisemapping.model.Mindmap wisemapping");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MindMap getMindmapById(int mindmapId) {
|
||||
return getHibernateTemplate().get(MindMap.class, mindmapId);
|
||||
public Mindmap getMindmapById(int mindmapId) {
|
||||
return getHibernateTemplate().get(Mindmap.class, mindmapId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MindMap getMindmapByTitle(final String title, final User user) {
|
||||
final MindMap result;
|
||||
List<MindMap> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.MindMap wisemapping where title=? and creator=?", new Object[]{title, user});
|
||||
public Mindmap getMindmapByTitle(final String title, final User user) {
|
||||
final Mindmap result;
|
||||
List<Mindmap> mindMaps = getHibernateTemplate().find("from com.wisemapping.model.Mindmap wisemapping where title=? and creator=?", new Object[]{title, user});
|
||||
if (mindMaps != null && !mindMaps.isEmpty()) {
|
||||
result = mindMaps.get(0);
|
||||
} else {
|
||||
@ -181,18 +181,18 @@ public class MindmapManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMindmap(User user, MindMap mindMap) {
|
||||
public void addMindmap(User user, Mindmap mindMap) {
|
||||
saveMindmap(mindMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveMindmap(MindMap mindMap) {
|
||||
public void saveMindmap(Mindmap mindMap) {
|
||||
assert mindMap != null : "Save Mindmap: Mindmap is required!";
|
||||
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!";
|
||||
getHibernateTemplate().saveOrUpdate(mindMap);
|
||||
if (saveHistory) {
|
||||
@ -201,11 +201,11 @@ public class MindmapManagerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMindmap(@NotNull final MindMap mindMap) {
|
||||
public void removeMindmap(@NotNull final Mindmap mindMap) {
|
||||
getHibernateTemplate().delete(mindMap);
|
||||
}
|
||||
|
||||
private void saveHistory(@NotNull final MindMap mindMap) {
|
||||
private void saveHistory(@NotNull final Mindmap mindMap) {
|
||||
final MindMapHistory history = new MindMapHistory();
|
||||
|
||||
history.setXml(mindMap.getXml());
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
package com.wisemapping.exporter;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
public interface Exporter {
|
||||
public void export(byte[] xml, OutputStream outputStream) throws ExportException;
|
||||
public void export(MindMap map, OutputStream outputStream) throws ExportException;
|
||||
public void export(Mindmap map, OutputStream outputStream) throws ExportException;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ package com.wisemapping.exporter;
|
||||
|
||||
|
||||
import com.wisemapping.importer.freemind.FreemindIconConverter;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.ShapeStyle;
|
||||
import com.wisemapping.util.JAXBUtils;
|
||||
import com.wisemapping.jaxb.freemind.*;
|
||||
@ -48,7 +48,7 @@ public class FreemindExporter
|
||||
|
||||
private Map<String, Node> nodesMap = null;
|
||||
|
||||
public void export(MindMap map, OutputStream outputStream) throws ExportException {
|
||||
public void export(Mindmap map, OutputStream outputStream) throws ExportException {
|
||||
export(map.getXml(), outputStream);
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,11 @@
|
||||
|
||||
package com.wisemapping.importer;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface Importer {
|
||||
public MindMap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException;
|
||||
public Mindmap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import com.sun.org.apache.xerces.internal.dom.TextImpl;
|
||||
import com.wisemapping.importer.Importer;
|
||||
import com.wisemapping.importer.ImporterException;
|
||||
import com.wisemapping.importer.VersionNumber;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.ShapeStyle;
|
||||
import com.wisemapping.util.JAXBUtils;
|
||||
import com.wisemapping.jaxb.freemind.*;
|
||||
@ -94,9 +94,9 @@ public class FreemindImporter
|
||||
|
||||
}
|
||||
|
||||
public MindMap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException {
|
||||
public Mindmap importMap(@NotNull String mapName, @NotNull String description, @NotNull InputStream input) throws ImporterException {
|
||||
|
||||
final MindMap result = new MindMap();
|
||||
final Mindmap result = new Mindmap();
|
||||
nodesMap = new HashMap<String, TopicType>();
|
||||
relationships = new ArrayList<RelationshipType>();
|
||||
mindmapObjectFactory = new com.wisemapping.jaxb.wisemap.ObjectFactory();
|
||||
|
@ -19,14 +19,13 @@
|
||||
package com.wisemapping.mail;
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.HashMap;
|
||||
@ -43,7 +42,7 @@ final public class NotificationService {
|
||||
|
||||
}
|
||||
|
||||
public void newCollaboration(@NotNull Collaboration collaboration, @NotNull MindMap mindmap, @NotNull User user, @Nullable String message) {
|
||||
public void newCollaboration(@NotNull Collaboration collaboration, @NotNull Mindmap mindmap, @NotNull User user, @Nullable String message) {
|
||||
|
||||
try {
|
||||
// Sent collaboration email ...
|
||||
@ -151,7 +150,7 @@ final public class NotificationService {
|
||||
// }
|
||||
}
|
||||
|
||||
public void reportMindmapEditorError(@NotNull MindMap mindmap, @NotNull User user, @NotNull String userAgent, @Nullable String jsErrorMsg) {
|
||||
public void reportMindmapEditorError(@NotNull Mindmap mindmap, @NotNull User user, @NotNull String userAgent, @Nullable String jsErrorMsg) {
|
||||
|
||||
try {
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
|
@ -24,14 +24,14 @@ public class Collaboration {
|
||||
|
||||
private long id;
|
||||
private CollaborationRole role;
|
||||
private MindMap mindMap;
|
||||
private Mindmap mindMap;
|
||||
private Collaborator collaborator;
|
||||
private CollaborationProperties collaborationProperties;
|
||||
|
||||
public Collaboration() {
|
||||
}
|
||||
|
||||
public Collaboration(@NotNull CollaborationRole role, @NotNull Collaborator collaborator, @NotNull MindMap mindmap) {
|
||||
public Collaboration(@NotNull CollaborationRole role, @NotNull Collaborator collaborator, @NotNull Mindmap mindmap) {
|
||||
this.role = role;
|
||||
this.mindMap = mindmap;
|
||||
this.collaborator = collaborator;
|
||||
@ -65,11 +65,11 @@ public class Collaboration {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public MindMap getMindMap() {
|
||||
public Mindmap getMindMap() {
|
||||
return mindMap;
|
||||
}
|
||||
|
||||
public void setMindMap(MindMap mindMap) {
|
||||
public void setMindMap(Mindmap mindMap) {
|
||||
this.mindMap = mindMap;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ package com.wisemapping.model;
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.util.ZipUtils;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -30,7 +31,7 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class MindMap {
|
||||
public class Mindmap {
|
||||
private static final String UTF_8 = "UTF-8";
|
||||
|
||||
//~ Instance fields ......................................................................................
|
||||
@ -51,7 +52,7 @@ public class MindMap {
|
||||
|
||||
//~ Constructors .........................................................................................
|
||||
|
||||
public MindMap() {
|
||||
public Mindmap() {
|
||||
}
|
||||
|
||||
//~ Methods ..............................................................................................
|
||||
@ -173,9 +174,7 @@ public class MindMap {
|
||||
throws IOException {
|
||||
String xml = this.getXmlStr();
|
||||
if (xml != null) {
|
||||
xml = xml.replace("'", "\\'");
|
||||
xml = xml.replaceAll("\\r|\\n", "");
|
||||
xml = xml.trim();
|
||||
xml = StringEscapeUtils.escapeJavaScript(xml);
|
||||
}
|
||||
return xml;
|
||||
}
|
||||
@ -249,13 +248,13 @@ public class MindMap {
|
||||
final StringBuilder result = new StringBuilder();
|
||||
result.append("<map version=\"tango\">");
|
||||
result.append("<topic central=\"true\" text=\"");
|
||||
result.append(title);
|
||||
result.append(StringEscapeUtils.escapeXml(title));
|
||||
result.append("\"/></map>");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public MindMap shallowClone() {
|
||||
final MindMap result = new MindMap();
|
||||
public Mindmap shallowClone() {
|
||||
final Mindmap result = new Mindmap();
|
||||
result.setDescription(this.getDescription());
|
||||
result.setTitle(this.getTitle());
|
||||
result.setXml(this.getXml());
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.wisemapping.ncontroller;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@ -37,7 +37,7 @@ public class ExtensionsController {
|
||||
@RequestMapping(value = "try")
|
||||
public ModelAndView tryEditor() throws IOException {
|
||||
|
||||
final MindMap mindmap = mindmapService.findMindmapById(TRY_EXAMPLE_MINDMAP_ID);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(TRY_EXAMPLE_MINDMAP_ID);
|
||||
|
||||
ModelAndView view = new ModelAndView("mindmapEditor", "mindmap", mindmap);
|
||||
final String xmlMap = mindmap.getXmlAsJsLiteral();
|
||||
|
@ -21,9 +21,8 @@ package com.wisemapping.ncontroller;
|
||||
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.model.CollaborationRole;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.MindMapHistory;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import com.wisemapping.view.MindMapBean;
|
||||
@ -77,7 +76,7 @@ public class MindmapController {
|
||||
|
||||
@RequestMapping(value = "maps/{id}/export")
|
||||
public String showExportPage(@PathVariable int id, @NotNull Model model) throws IOException {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
final Mindmap mindmap = findMindmap(id);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapExport";
|
||||
}
|
||||
@ -90,7 +89,7 @@ public class MindmapController {
|
||||
|
||||
@RequestMapping(value = "maps/{id}/share")
|
||||
public String showSharePage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
final Mindmap mindmap = findMindmap(id);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
return "mindmapShare";
|
||||
}
|
||||
@ -103,7 +102,7 @@ public class MindmapController {
|
||||
|
||||
@RequestMapping(value = "maps/{id}/publish")
|
||||
public String showPublishPage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMap mindmap = findMindmap(id);
|
||||
final Mindmap mindmap = findMindmap(id);
|
||||
model.addAttribute("mindmap", mindmap);
|
||||
model.addAttribute("baseUrl", siteBaseUrl);
|
||||
return "mindmapPublish";
|
||||
@ -137,7 +136,7 @@ public class MindmapController {
|
||||
@RequestMapping(value = "maps/{id}/edit", method = RequestMethod.GET)
|
||||
public String showMindmapEditorPage(@PathVariable int id, @NotNull Model model) {
|
||||
final MindMapBean mindmapBean = findMindmapBean(id);
|
||||
final MindMap mindmap = mindmapBean.getDelegated();
|
||||
final Mindmap mindmap = mindmapBean.getDelegated();
|
||||
|
||||
String result;
|
||||
if (mindmap.hasPermissions(Utils.getUser(), CollaborationRole.EDITOR)) {
|
||||
@ -202,8 +201,8 @@ public class MindmapController {
|
||||
return "redirect:maps/" + mapId + "/embed?zoom=" + zoom;
|
||||
}
|
||||
|
||||
private MindMap findMindmap(long mapId) {
|
||||
final MindMap mindmap = mindmapService.findMindmapById((int) mapId);
|
||||
private Mindmap findMindmap(long mapId) {
|
||||
final Mindmap mindmap = mindmapService.findMindmapById((int) mapId);
|
||||
if (mindmap == null) {
|
||||
throw new IllegalArgumentException("Mindmap could not be found");
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.wisemapping.mail.NotificationService;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.rest.model.RestLogItem;
|
||||
import com.wisemapping.security.Utils;
|
||||
@ -96,7 +96,7 @@ public class AccountController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "logger/editor", consumes = {"application/xml", "application/json"}, produces = {"application/json", "text/html", "application/xml"})
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void changePassword(@RequestBody RestLogItem item) {
|
||||
final MindMap mindmap = mindmapService.findMindmapById(item.getMapId());
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(item.getMapId());
|
||||
final User user = Utils.getUser();
|
||||
notificationService.reportMindmapEditorError(mindmap, user, item.getUserAgent(), item.getJsErrorMsg() + "\n" + item.getJsStack());
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseBody
|
||||
public ModelAndView retrieve(@PathVariable int id) throws WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final RestMindmap map = new RestMindmap(mindMap, user);
|
||||
|
||||
return new ModelAndView("mapView", "map", map);
|
||||
@ -66,7 +66,7 @@ public class MindmapController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/wisemapping+xml"}, params = {"download=wxml"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveAsWise(@PathVariable int id) throws WiseMappingException {
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
|
||||
final User user = Utils.getUser();
|
||||
@ -78,7 +78,7 @@ public class MindmapController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/freemind"}, params = {"download=mm"})
|
||||
@ResponseBody
|
||||
public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException {
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Map<String, Object> values = new HashMap<String, Object>();
|
||||
values.put("content", mindMap.getXmlStr());
|
||||
values.put("filename", mindMap.getTitle());
|
||||
@ -92,9 +92,9 @@ public class MindmapController extends BaseController {
|
||||
final MindmapFilter filter = MindmapFilter.parse(q);
|
||||
final List<Collaboration> collaborations = mindmapService.findCollaborations(user);
|
||||
|
||||
final List<MindMap> mindmaps = new ArrayList<MindMap>();
|
||||
final List<Mindmap> mindmaps = new ArrayList<Mindmap>();
|
||||
for (Collaboration collaboration : collaborations) {
|
||||
final MindMap mindmap = collaboration.getMindMap();
|
||||
final Mindmap mindmap = collaboration.getMindMap();
|
||||
if (filter.accept(mindmap, user)) {
|
||||
mindmaps.add(mindmap);
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class MindmapController extends BaseController {
|
||||
@RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST)
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException {
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
if (LATEST_HISTORY_REVISION.equals(hid)) {
|
||||
@ -138,7 +138,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws WiseMappingException, IOException {
|
||||
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
// Validate arguments ...
|
||||
@ -169,7 +169,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void update(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
||||
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
final String xml = restMindmap.getXml();
|
||||
@ -213,7 +213,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
|
||||
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
// Is there a map with the same name ?
|
||||
@ -223,7 +223,7 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
// Update map ...
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
mindmap.setTitle(title);
|
||||
saveMindmap(true, mindMap, user);
|
||||
}
|
||||
@ -231,7 +231,7 @@ public class MindmapController extends BaseController {
|
||||
@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, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException {
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
|
||||
// Only owner can change collaborators...
|
||||
final User user = Utils.getUser();
|
||||
@ -271,7 +271,7 @@ public class MindmapController extends BaseController {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json", "text/html", "application/xml"})
|
||||
public ModelAndView retrieveList(@PathVariable int id) {
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
|
||||
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||
final List<RestCollaboration> collabs = new ArrayList<RestCollaboration>();
|
||||
@ -290,11 +290,11 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateDescription(@RequestBody String description, @PathVariable int id) throws WiseMappingException {
|
||||
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
// Update map ...
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
mindmap.setDescription(description);
|
||||
saveMindmap(true, mindMap, user);
|
||||
}
|
||||
@ -303,7 +303,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
|
||||
final User user = Utils.getUser();
|
||||
if (!mindMap.hasPermissions(user, CollaborationRole.OWNER)) {
|
||||
@ -320,7 +320,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
||||
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
final User user = Utils.getUser();
|
||||
|
||||
// Update map status ...
|
||||
@ -337,7 +337,7 @@ public class MindmapController extends BaseController {
|
||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||
public void updateMap(@PathVariable int id) throws IOException, WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final MindMap mindmap = mindmapService.findMindmapById(id);
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
||||
mindmapService.removeMindmap(mindmap, user);
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ public class MindmapController extends BaseController {
|
||||
final User user = Utils.getUser();
|
||||
final String[] mapsIds = ids.split(",");
|
||||
for (final String mapId : mapsIds) {
|
||||
final MindMap mindmap = mindmapService.findMindmapById(Integer.parseInt(mapId));
|
||||
final Mindmap mindmap = mindmapService.findMindmapById(Integer.parseInt(mapId));
|
||||
mindmapService.removeMindmap(mindmap, user);
|
||||
}
|
||||
}
|
||||
@ -372,10 +372,10 @@ public class MindmapController extends BaseController {
|
||||
}
|
||||
|
||||
// If the user has not specified the xml content, add one ...
|
||||
final MindMap delegated = restMindmap.getDelegated();
|
||||
final Mindmap delegated = restMindmap.getDelegated();
|
||||
String xml = restMindmap.getXml();
|
||||
if (xml == null || xml.isEmpty()) {
|
||||
xml = MindMap.getDefaultMindmapXml(restMindmap.getTitle());
|
||||
xml = Mindmap.getDefaultMindmapXml(restMindmap.getTitle());
|
||||
}
|
||||
delegated.setXmlStr(xml);
|
||||
|
||||
@ -393,7 +393,7 @@ public class MindmapController extends BaseController {
|
||||
public void createMapFromFreemind(@RequestBody byte[] freemindXml, @RequestParam(required = true) String title, @RequestParam(required = false) String description, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
||||
|
||||
// Convert map ...
|
||||
final MindMap mindMap;
|
||||
final Mindmap mindMap;
|
||||
try {
|
||||
final Importer importer = ImporterFactory.getInstance().getImporter(ImportFormat.FREEMIND);
|
||||
final ByteArrayInputStream stream = new ByteArrayInputStream(freemindXml);
|
||||
@ -421,8 +421,8 @@ public class MindmapController extends BaseController {
|
||||
final User user = Utils.getUser();
|
||||
|
||||
// Create a shallowCopy of the map ...
|
||||
final MindMap mindMap = mindmapService.findMindmapById(id);
|
||||
final MindMap clonedMap = mindMap.shallowClone();
|
||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
||||
final Mindmap clonedMap = mindMap.shallowClone();
|
||||
clonedMap.setTitle(restMindmap.getTitle());
|
||||
clonedMap.setDescription(restMindmap.getDescription());
|
||||
|
||||
@ -434,7 +434,7 @@ public class MindmapController extends BaseController {
|
||||
response.setHeader("ResourceId", Integer.toString(clonedMap.getId()));
|
||||
}
|
||||
|
||||
private void saveMindmap(boolean minor, @NotNull final MindMap mindMap, @NotNull final User user) throws WiseMappingException {
|
||||
private void saveMindmap(boolean minor, @NotNull final Mindmap mindMap, @NotNull final User user) throws WiseMappingException {
|
||||
final Calendar now = Calendar.getInstance();
|
||||
mindMap.setLastModificationTime(now);
|
||||
mindMap.setLastEditor(user);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
package com.wisemapping.rest;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -28,32 +28,32 @@ import org.jetbrains.annotations.Nullable;
|
||||
public enum MindmapFilter {
|
||||
ALL("all") {
|
||||
@Override
|
||||
public boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
public boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
MY_MAPS("my_maps") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
|
||||
return mindmap.getCreator().equals(user);
|
||||
}
|
||||
},
|
||||
STARRED("starred") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
|
||||
return mindmap.isStarred(user);
|
||||
}
|
||||
},
|
||||
SHARED_WITH_ME("shared_with_me") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
|
||||
return !MY_MAPS.accept(mindmap, user);
|
||||
}
|
||||
},
|
||||
PUBLIC("public") {
|
||||
@Override
|
||||
boolean accept(@NotNull MindMap mindmap, @NotNull User user) {
|
||||
boolean accept(@NotNull Mindmap mindmap, @NotNull User user) {
|
||||
return mindmap.isPublic();
|
||||
}
|
||||
};
|
||||
@ -76,6 +76,6 @@ public enum MindmapFilter {
|
||||
return result;
|
||||
}
|
||||
|
||||
abstract boolean accept(@NotNull MindMap mindmap, @NotNull User user);
|
||||
abstract boolean accept(@NotNull Mindmap mindmap, @NotNull User user);
|
||||
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
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;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public class RestMindmap {
|
||||
@JsonIgnore
|
||||
private Collaborator collaborator;
|
||||
@JsonIgnore
|
||||
private MindMap mindmap;
|
||||
private Mindmap mindmap;
|
||||
@JsonIgnore
|
||||
static private SimpleDateFormat sdf;
|
||||
private String properties;
|
||||
@ -38,11 +38,11 @@ public class RestMindmap {
|
||||
}
|
||||
|
||||
public RestMindmap() throws WiseMappingException {
|
||||
this(new MindMap(), null);
|
||||
this(new Mindmap(), null);
|
||||
|
||||
}
|
||||
|
||||
public RestMindmap(@NotNull MindMap mindmap, @Nullable Collaborator collaborator) throws WiseMappingException {
|
||||
public RestMindmap(@NotNull Mindmap mindmap, @Nullable Collaborator collaborator) throws WiseMappingException {
|
||||
this.mindmap = mindmap;
|
||||
this.collaborator = collaborator;
|
||||
if (collaborator != null) {
|
||||
@ -172,7 +172,7 @@ public class RestMindmap {
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public MindMap getDelegated() {
|
||||
public Mindmap getDelegated() {
|
||||
return this.mindmap;
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,10 @@
|
||||
package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.MindMapHistory;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.codehaus.jackson.annotate.JsonIgnore;
|
||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -3,7 +3,7 @@ package com.wisemapping.rest.model;
|
||||
|
||||
import com.wisemapping.model.Collaboration;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.security.Utils;
|
||||
import org.codehaus.jackson.annotate.*;
|
||||
@ -30,7 +30,7 @@ import java.util.TimeZone;
|
||||
public class RestMindmapInfo {
|
||||
|
||||
@JsonIgnore
|
||||
private MindMap mindmap;
|
||||
private Mindmap mindmap;
|
||||
private Collaborator collaborator;
|
||||
@JsonIgnore
|
||||
static private SimpleDateFormat sdf;
|
||||
@ -41,11 +41,11 @@ public class RestMindmapInfo {
|
||||
}
|
||||
|
||||
public RestMindmapInfo() {
|
||||
this(new MindMap(), null);
|
||||
this(new Mindmap(), null);
|
||||
|
||||
}
|
||||
|
||||
public RestMindmapInfo(@NotNull MindMap mindmap, @Nullable Collaborator collaborator) {
|
||||
public RestMindmapInfo(@NotNull Mindmap mindmap, @Nullable Collaborator collaborator) {
|
||||
this.mindmap = mindmap;
|
||||
this.collaborator = collaborator;
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class RestMindmapInfo {
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public MindMap getDelegated() {
|
||||
public Mindmap getDelegated() {
|
||||
return this.mindmap;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.wisemapping.rest.model;
|
||||
|
||||
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ -26,12 +26,12 @@ public class RestMindmapList {
|
||||
private List<RestMindmapInfo> mindmapsInfo;
|
||||
|
||||
public RestMindmapList() {
|
||||
this(Collections.<MindMap>emptyList(), null);
|
||||
this(Collections.<Mindmap>emptyList(), null);
|
||||
}
|
||||
|
||||
public RestMindmapList(@NotNull List<MindMap> mindmaps, @NotNull Collaborator collaborator) {
|
||||
public RestMindmapList(@NotNull List<Mindmap> mindmaps, @NotNull Collaborator collaborator) {
|
||||
this.mindmapsInfo = new ArrayList<RestMindmapInfo>();
|
||||
for (MindMap mindMap : mindmaps) {
|
||||
for (Mindmap mindMap : mindmaps) {
|
||||
this.mindmapsInfo.add(new RestMindmapInfo(mindMap, collaborator));
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ import com.wisemapping.importer.ImportFormat;
|
||||
import com.wisemapping.importer.Importer;
|
||||
import com.wisemapping.importer.ImporterException;
|
||||
import com.wisemapping.importer.ImporterFactory;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.web.servlet.view.AbstractView;
|
||||
|
||||
@ -51,7 +51,7 @@ public class ImportTransformationView extends AbstractView {
|
||||
|
||||
// Convert to map ...
|
||||
final InputStream is = new ByteArrayInputStream(content.getBytes("UTF-8"));
|
||||
final MindMap mindMap = importer.importMap("filename", "filename", is);
|
||||
final Mindmap mindMap = importer.importMap("filename", "filename", is);
|
||||
|
||||
// Set file name...
|
||||
final String fileName = (filename != null ? filename : "map") + "." + "xwise";
|
||||
|
@ -19,14 +19,13 @@
|
||||
package com.wisemapping.security.aop;
|
||||
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.exceptions.AccessDeniedSecurityException;
|
||||
import com.wisemapping.exceptions.UnexpectedArgumentException;
|
||||
import com.wisemapping.security.Utils;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class BaseSecurityAdvice {
|
||||
@ -37,8 +36,8 @@ public abstract class BaseSecurityAdvice {
|
||||
final Object argument = methodInvocation.getArguments()[0];
|
||||
boolean isAllowed;
|
||||
|
||||
if (argument instanceof MindMap) {
|
||||
isAllowed = isAllowed(user, (MindMap) argument);
|
||||
if (argument instanceof Mindmap) {
|
||||
isAllowed = isAllowed(user, (Mindmap) argument);
|
||||
} else if (argument instanceof Integer) {
|
||||
isAllowed = isAllowed(user, ((Integer) argument));
|
||||
} else if (argument instanceof Collaborator) {
|
||||
@ -53,7 +52,7 @@ public abstract class BaseSecurityAdvice {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean isAllowed(@Nullable User user, MindMap map);
|
||||
protected abstract boolean isAllowed(@Nullable User user, Mindmap map);
|
||||
|
||||
protected abstract boolean isAllowed(@Nullable User user, int mapId);
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
package com.wisemapping.security.aop;
|
||||
|
||||
import com.wisemapping.model.CollaborationRole;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.model.MindMap;
|
||||
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
@ -36,7 +36,7 @@ public class UpdateSecurityAdvise
|
||||
return methodInvocation.proceed();
|
||||
}
|
||||
|
||||
protected boolean isAllowed(@Nullable User user, @NotNull MindMap map) {
|
||||
protected boolean isAllowed(@Nullable User user, @NotNull Mindmap map) {
|
||||
boolean result;
|
||||
if (map.getCreator() == null) {
|
||||
// This means that the map is new and is an add operation.
|
||||
|
@ -18,11 +18,11 @@
|
||||
|
||||
package com.wisemapping.security.aop;
|
||||
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import com.wisemapping.model.CollaborationRole;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -35,7 +35,7 @@ public class ViewBaseSecurityAdvise
|
||||
return methodInvocation.proceed();
|
||||
}
|
||||
|
||||
protected boolean isAllowed(@Nullable User user, MindMap map) {
|
||||
protected boolean isAllowed(@Nullable User user, Mindmap map) {
|
||||
return getMindmapService().hasPermissions(user, map, CollaborationRole.VIEWER);
|
||||
}
|
||||
|
||||
|
@ -24,40 +24,39 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface MindmapService {
|
||||
|
||||
static final String TAG_SEPARATOR = " ";
|
||||
|
||||
MindMap findMindmapById(int mindmapId);
|
||||
Mindmap findMindmapById(int mindmapId);
|
||||
|
||||
MindMap getMindmapByTitle(String title, User user);
|
||||
Mindmap getMindmapByTitle(String title, User user);
|
||||
|
||||
List<Collaboration> findCollaborations(@NotNull User user);
|
||||
|
||||
void updateMindmap(MindMap mindMap, boolean saveHistory) throws WiseMappingException;
|
||||
void updateMindmap(Mindmap mindMap, boolean saveHistory) throws WiseMappingException;
|
||||
|
||||
void addMindmap(MindMap map, User user) throws WiseMappingException;
|
||||
void addMindmap(Mindmap map, User user) throws WiseMappingException;
|
||||
|
||||
void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
||||
void addCollaboration(@NotNull Mindmap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
||||
throws CollaborationException;
|
||||
|
||||
void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
|
||||
void removeCollaboration(@NotNull Mindmap mindmap, @NotNull Collaboration collaboration) throws CollaborationException;
|
||||
|
||||
void addTags(@NotNull MindMap mindmap, String tags);
|
||||
void addTags(@NotNull Mindmap mindmap, String tags);
|
||||
|
||||
void removeMindmap(@NotNull final MindMap mindmap, @NotNull final User user) throws WiseMappingException;
|
||||
void removeMindmap(@NotNull final Mindmap mindmap, @NotNull final User user) throws WiseMappingException;
|
||||
|
||||
List<MindMap> search(MindMapCriteria criteria);
|
||||
List<Mindmap> search(MindMapCriteria criteria);
|
||||
|
||||
List<MindMapHistory> findMindmapHistory(int mindmapId);
|
||||
|
||||
boolean hasPermissions(@Nullable User user, MindMap map, CollaborationRole allowedRole);
|
||||
boolean hasPermissions(@Nullable User user, Mindmap map, CollaborationRole allowedRole);
|
||||
|
||||
boolean hasPermissions(@Nullable User user, int mapId, CollaborationRole allowedRole);
|
||||
|
||||
void revertChange(@NotNull MindMap map, int historyId) throws WiseMappingException;
|
||||
void revertChange(@NotNull Mindmap map, int historyId) throws WiseMappingException;
|
||||
|
||||
MindMapHistory findMindmapHistory(int id, int hid) throws WiseMappingException;
|
||||
|
||||
|
@ -46,12 +46,12 @@ public class MindmapServiceImpl
|
||||
|
||||
@Override
|
||||
public boolean hasPermissions(@Nullable User user, int mapId, @NotNull CollaborationRole grantedRole) {
|
||||
final MindMap map = mindmapManager.getMindmapById(mapId);
|
||||
final Mindmap map = mindmapManager.getMindmapById(mapId);
|
||||
return hasPermissions(user, map, grantedRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermissions(@Nullable User user, @Nullable MindMap map, @NotNull CollaborationRole role) {
|
||||
public boolean hasPermissions(@Nullable User user, @Nullable Mindmap map, @NotNull CollaborationRole role) {
|
||||
boolean result = false;
|
||||
if (map != null) {
|
||||
if (map.isPublic() && role == CollaborationRole.VIEWER) {
|
||||
@ -68,12 +68,12 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public MindMap getMindmapByTitle(String title, User user) {
|
||||
public Mindmap getMindmapByTitle(String title, User user) {
|
||||
return mindmapManager.getMindmapByTitle(title, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MindMap findMindmapById(int mindmapId) {
|
||||
public Mindmap findMindmapById(int mindmapId) {
|
||||
return mindmapManager.getMindmapById(mindmapId);
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMindmap(@NotNull MindMap mindMap, boolean saveHistory) throws WiseMappingException {
|
||||
public void updateMindmap(@NotNull Mindmap mindMap, boolean saveHistory) throws WiseMappingException {
|
||||
if (mindMap.getTitle() == null || mindMap.getTitle().length() == 0) {
|
||||
throw new WiseMappingException("The tile can not be empty");
|
||||
}
|
||||
@ -91,14 +91,14 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MindMap> search(MindMapCriteria criteria) {
|
||||
public List<Mindmap> search(MindMapCriteria criteria) {
|
||||
return mindmapManager.search(criteria);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCollaboration(@NotNull MindMap mindmap, @NotNull Collaboration collaboration) throws CollaborationException {
|
||||
public void removeCollaboration(@NotNull Mindmap mindmap, @NotNull Collaboration collaboration) throws CollaborationException {
|
||||
// remove collaborator association
|
||||
final MindMap mindMap = collaboration.getMindMap();
|
||||
final Mindmap mindMap = collaboration.getMindMap();
|
||||
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||
|
||||
if (mindMap.getCreator().getEmail().equals(collaboration.getCollaborator().getEmail())) {
|
||||
@ -111,7 +111,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeMindmap(@NotNull MindMap mindmap, @NotNull User user) throws WiseMappingException {
|
||||
public void removeMindmap(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException {
|
||||
if (mindmap.getCreator().equals(user)) {
|
||||
mindmapManager.removeMindmap(mindmap);
|
||||
} else {
|
||||
@ -123,7 +123,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMindmap(@NotNull MindMap map, @NotNull User user) throws WiseMappingException {
|
||||
public void addMindmap(@NotNull Mindmap map, @NotNull User user) throws WiseMappingException {
|
||||
|
||||
final String title = map.getTitle();
|
||||
|
||||
@ -151,7 +151,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollaboration(@NotNull MindMap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
||||
public void addCollaboration(@NotNull Mindmap mindmap, @NotNull String email, @NotNull CollaborationRole role, @Nullable String message)
|
||||
throws CollaborationException {
|
||||
|
||||
// Validate
|
||||
@ -197,7 +197,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTags(@NotNull MindMap mindmap, String tags) {
|
||||
public void addTags(@NotNull Mindmap mindmap, String tags) {
|
||||
mindmap.setTags(tags);
|
||||
mindmapManager.updateMindmap(mindmap, false);
|
||||
if (tags != null && tags.length() > 0) {
|
||||
@ -226,7 +226,7 @@ public class MindmapServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revertChange(@NotNull MindMap mindmap, int historyId)
|
||||
public void revertChange(@NotNull Mindmap mindmap, int historyId)
|
||||
throws WiseMappingException {
|
||||
final MindMapHistory history = mindmapManager.getHistory(historyId);
|
||||
mindmap.setXml(history.getXml());
|
||||
|
@ -23,9 +23,8 @@ import com.wisemapping.exceptions.WiseMappingException;
|
||||
import com.wisemapping.mail.NotificationService;
|
||||
import com.wisemapping.model.AccessAuditory;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.MessageSource;
|
||||
@ -33,8 +32,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.*;
|
||||
|
||||
public class UserServiceImpl
|
||||
@ -130,7 +127,7 @@ public class UserServiceImpl
|
||||
}
|
||||
|
||||
//create welcome map
|
||||
final MindMap mindMap = buildWelcomeMindmap(user.getFirstname());
|
||||
final Mindmap mindMap = buildWelcomeMindmap(user.getFirstname());
|
||||
mindmapService.addMindmap(mindMap, user);
|
||||
|
||||
|
||||
@ -145,13 +142,13 @@ public class UserServiceImpl
|
||||
return user;
|
||||
}
|
||||
|
||||
public MindMap buildWelcomeMindmap(@NotNull String firstName) {
|
||||
public Mindmap buildWelcomeMindmap(@NotNull String firstName) {
|
||||
//To change body of created methods use File | Settings | File Templates.
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
|
||||
// @TODO: Remove this once is translated
|
||||
locale = Locale.ENGLISH;
|
||||
MindMap result = new MindMap();
|
||||
Mindmap result = new Mindmap();
|
||||
final Map<String, Object> model = new HashMap<String, Object>();
|
||||
model.put("messages", messageSource);
|
||||
model.put("noArgs", new Object[]{});
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
package com.wisemapping.validator;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.model.Constants;
|
||||
import com.wisemapping.service.MindmapService;
|
||||
@ -46,7 +46,7 @@ public class MapInfoValidator implements Validator {
|
||||
}
|
||||
|
||||
public void validate(Object obj, @NotNull Errors errors) {
|
||||
final MindMap map = (MindMap) obj;
|
||||
final Mindmap map = (Mindmap) obj;
|
||||
|
||||
|
||||
if (map == null) {
|
||||
@ -73,7 +73,7 @@ public class MapInfoValidator implements Validator {
|
||||
// Map already exists ?
|
||||
final MindmapService service = this.getMindmapService();
|
||||
final User user = com.wisemapping.security.Utils.getUser();
|
||||
final MindMap mindMap = service.getMindmapByTitle(title, user);
|
||||
final Mindmap mindMap = service.getMindmapByTitle(title, user);
|
||||
if (mindMap != null) {
|
||||
errors.rejectValue("title", Messages.MAP_TITLE_ALREADY_EXISTS);
|
||||
}
|
||||
|
@ -28,12 +28,12 @@ import java.text.DateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class MindMapBean {
|
||||
private MindMap mindmap;
|
||||
private Mindmap mindmap;
|
||||
private List<CollaboratorBean> viewers;
|
||||
private List<CollaboratorBean> collaborators;
|
||||
private Collaborator collaborator;
|
||||
|
||||
public MindMapBean(@NotNull final MindMap mindmap, @Nullable final Collaborator collaborator) {
|
||||
public MindMapBean(@NotNull final Mindmap mindmap, @Nullable final Collaborator collaborator) {
|
||||
this.mindmap = mindmap;
|
||||
this.collaborator = collaborator;
|
||||
this.collaborators = filterCollaboratorBy(mindmap.getCollaborations(), CollaborationRole.EDITOR);
|
||||
@ -155,7 +155,7 @@ public class MindMapBean {
|
||||
}
|
||||
|
||||
|
||||
public MindMap getDelegated() {
|
||||
public Mindmap getDelegated() {
|
||||
return mindmap;
|
||||
}
|
||||
|
||||
|
@ -18,15 +18,15 @@
|
||||
|
||||
package com.wisemapping.view;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
|
||||
|
||||
public class MindMapInfoBean {
|
||||
private String title;
|
||||
private String description;
|
||||
private MindMap mindMap;
|
||||
private Mindmap mindMap;
|
||||
|
||||
public MindMapInfoBean(MindMap map) {
|
||||
public MindMapInfoBean(Mindmap map) {
|
||||
this.title = map.getTitle();
|
||||
this.description = map.getDescription();
|
||||
|
||||
@ -55,7 +55,7 @@ public class MindMapInfoBean {
|
||||
}
|
||||
|
||||
|
||||
public MindMap getMindMap() {
|
||||
public Mindmap getMindMap() {
|
||||
if (mindMap != null) {
|
||||
mindMap.setTitle(title);
|
||||
mindMap.setDescription(description);
|
||||
|
@ -16,7 +16,7 @@
|
||||
<many-to-one name="mindMap"
|
||||
column="MINDMAP_ID"
|
||||
not-null="true"
|
||||
class="com.wisemapping.model.MindMap"
|
||||
class="com.wisemapping.model.Mindmap"
|
||||
/>
|
||||
|
||||
<many-to-one name="collaborator"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<hibernate-mapping>
|
||||
|
||||
<class name="com.wisemapping.model.MindMap" table="MINDMAP">
|
||||
<class name="com.wisemapping.model.Mindmap" table="MINDMAP">
|
||||
<id name="id">
|
||||
<generator class="increment"/>
|
||||
</id>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<property name="mappingResources">
|
||||
<list>
|
||||
<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/Collaboration.hbm.xml</value>
|
||||
<value>com/wisemapping/model/CollaborationProperties.hbm.xml</value>
|
||||
<value>com/wisemapping/model/AccessAuditory.hbm.xml</value>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
|
||||
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
|
||||
|
||||
<div id="toolbar">
|
||||
<div id="persist" class="buttonContainer">
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<!DOCTYPE HTML>
|
||||
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
|
||||
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<%@page pageEncoding="UTF-8" %>
|
||||
<%@include file="/jsp/init.jsp" %>
|
||||
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.MindMap"--%>
|
||||
<%--@elvariable id="mindmap" type="com.wisemapping.model.Mindmap"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.Boolean"--%>
|
||||
<%--@elvariable id="editorTryMode" type="java.lang.String"--%>
|
||||
<%--@elvariable id="mapXml" type="com.wisemapping.model.User"--%>
|
||||
|
@ -4,7 +4,7 @@ import com.wisemapping.exporter.ExportException;
|
||||
import com.wisemapping.exporter.FreemindExporter;
|
||||
import com.wisemapping.importer.ImporterException;
|
||||
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.testng.Assert;
|
||||
@ -22,7 +22,7 @@ public class ExportTest {
|
||||
public void exportImportExportTest(@NotNull final File wisemap, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
|
||||
|
||||
|
||||
final MindMap mindmap = load(wisemap);
|
||||
final Mindmap mindmap = load(wisemap);
|
||||
|
||||
final FreemindExporter freemindExporter = new FreemindExporter();
|
||||
if (recFile.exists()) {
|
||||
@ -43,9 +43,9 @@ public class ExportTest {
|
||||
}
|
||||
}
|
||||
|
||||
private MindMap load(@NotNull File wisemap) throws IOException {
|
||||
private Mindmap load(@NotNull File wisemap) throws IOException {
|
||||
final byte[] recContent = FileUtils.readFileToByteArray(wisemap);
|
||||
final MindMap result = new MindMap();
|
||||
final Mindmap result = new Mindmap();
|
||||
result.setXml(recContent);
|
||||
return result;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.wisemapping.importer.ImportFormat;
|
||||
import com.wisemapping.importer.Importer;
|
||||
import com.wisemapping.importer.ImporterException;
|
||||
import com.wisemapping.importer.ImporterFactory;
|
||||
import com.wisemapping.model.MindMap;
|
||||
import com.wisemapping.model.Mindmap;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.testng.Assert;
|
||||
@ -33,7 +33,7 @@ public class ImportExportTest {
|
||||
@Test(dataProvider = "Data-Provider-Function")
|
||||
public void exportImportTest(@NotNull final File freeMindFile, @NotNull final File wiseFile, @NotNull final File freeRecFile) throws ImporterException, IOException, ExportException {
|
||||
final FileInputStream fileInputStream = new FileInputStream(freeMindFile.getAbsolutePath());
|
||||
final MindMap mindMap = importer.importMap("basic", "basic", fileInputStream);
|
||||
final Mindmap mindMap = importer.importMap("basic", "basic", fileInputStream);
|
||||
|
||||
|
||||
// Compare mindmap output ...
|
||||
|
Loading…
Reference in New Issue
Block a user