From 8e66c97aa32c6ecc4b2d8cca7729a9895a22f17b Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 29 Mar 2013 21:09:28 -0300 Subject: [PATCH] Handle deleted maps propertly. --- .../com/wisemapping/dao/MindmapManager.java | 3 +- .../wisemapping/dao/MindmapManagerImpl.java | 3 +- .../exceptions/ClientException.java | 6 +- .../exceptions/MapCouldNotFoundException.java | 38 ++++++++++ .../wisemapping/mail/NotificationService.java | 4 +- .../wisemapping/rest/AccountController.java | 4 +- .../wisemapping/rest/MindmapController.java | 69 +++++++++++-------- .../wisemapping/service/MindmapService.java | 2 +- .../service/MindmapServiceImpl.java | 2 +- .../wisemapping/webmvc/MindmapController.java | 32 ++++----- .../src/main/resources/messages_en.properties | 1 + 11 files changed, 109 insertions(+), 55 deletions(-) create mode 100755 wise-webapp/src/main/java/com/wisemapping/exceptions/MapCouldNotFoundException.java diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java index 8a01788a..b1c2c7bc 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManager.java @@ -20,6 +20,7 @@ package com.wisemapping.dao; import com.wisemapping.model.*; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.List; @@ -38,7 +39,7 @@ public interface MindmapManager { List getAllMindmaps(); - @NotNull + @Nullable Mindmap getMindmapById(int mindmapId); Mindmap getMindmapByTitle(final String name, final User user); diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java index 8ca59923..7fc8fdaf 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java @@ -21,6 +21,7 @@ package com.wisemapping.dao; import com.wisemapping.model.*; import com.wisemapping.util.ZipUtils; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.SimpleExpression; @@ -195,7 +196,7 @@ public class MindmapManagerImpl } @Override - @NotNull + @Nullable public Mindmap getMindmapById(int id) { return getHibernateTemplate().get(Mindmap.class, id); } diff --git a/wise-webapp/src/main/java/com/wisemapping/exceptions/ClientException.java b/wise-webapp/src/main/java/com/wisemapping/exceptions/ClientException.java index 65d91222..73a3c8c1 100644 --- a/wise-webapp/src/main/java/com/wisemapping/exceptions/ClientException.java +++ b/wise-webapp/src/main/java/com/wisemapping/exceptions/ClientException.java @@ -18,7 +18,11 @@ abstract public class ClientException extends WiseMappingException { String getMsgBundleKey(); public String getMessage(@NotNull final MessageSource messageSource, final @NotNull Locale locale) { - return messageSource.getMessage(this.getMsgBundleKey(), this.getMsgBundleArgs(), locale); + String message = messageSource.getMessage(this.getMsgBundleKey(), this.getMsgBundleArgs(), locale); + if(message==null){ + message = this.getMessage(); + } + return message; } protected Object[] getMsgBundleArgs(){ diff --git a/wise-webapp/src/main/java/com/wisemapping/exceptions/MapCouldNotFoundException.java b/wise-webapp/src/main/java/com/wisemapping/exceptions/MapCouldNotFoundException.java new file mode 100755 index 00000000..2c5e4243 --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/exceptions/MapCouldNotFoundException.java @@ -0,0 +1,38 @@ +/* +* Copyright [2012] [wisemapping] +* +* Licensed under WiseMapping Public License, Version 1.0 (the "License"). +* It is basically the Apache License, Version 2.0 (the "License") plus the +* "powered by wisemapping" text requirement on every single page; +* you may not use this file except in compliance with the License. +* You may obtain a copy of the license at +* +* http://www.wisemapping.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.wisemapping.exceptions; + +import org.jetbrains.annotations.NotNull; + +public class MapCouldNotFoundException + extends ClientException +{ + public static final String MSG_KEY = "MAP_CAN_NOT_BE_FOUND"; + + public MapCouldNotFoundException(@NotNull String msg) + { + super(msg,Severity.FATAL); + } + + @NotNull + @Override + protected String getMsgBundleKey() { + return MSG_KEY; + } +} diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java index bff76cc5..5b75bbf9 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java @@ -154,12 +154,12 @@ final public class NotificationService { // } } - public void reportJavascriptException(@NotNull Mindmap mindmap, @Nullable User user, @Nullable String jsErrorMsg, @NotNull HttpServletRequest request) { + public void reportJavascriptException(@Nullable Mindmap mindmap, @Nullable User user, @Nullable String jsErrorMsg, @NotNull HttpServletRequest request) { final Map model = new HashMap(); model.put("errorMsg", jsErrorMsg); try { - model.put("mapXML", StringEscapeUtils.escapeXml(mindmap.getXmlStr())); + model.put("mapXML", StringEscapeUtils.escapeXml(mindmap == null ? "map not found" : mindmap.getXmlStr())); } catch (UnsupportedEncodingException e) { // Ignore ... } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java index 9df6ed96..8a5bd969 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/AccountController.java @@ -58,7 +58,7 @@ public class AccountController extends BaseController { throw new IllegalArgumentException("Password can not be null"); } - final User user = Utils.getUser(); + final User user = Utils.getUser(true); user.setPassword(password); userService.changePassword(user); } @@ -95,7 +95,7 @@ public class AccountController extends BaseController { } - final User user = Utils.getUser(); + final User user = Utils.getUser(true); user.setLocale(language); userService.updateUser(user); } diff --git a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java index 87044cfa..499075f7 100644 --- a/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/rest/MindmapController.java @@ -60,7 +60,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 = findMindmapById(id); final RestMindmap map = new RestMindmap(mindMap, user); return new ModelAndView("mapView", "map", map); @@ -69,7 +69,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 = findMindmapById(id); final Map values = new HashMap(); final User user = Utils.getUser(); @@ -80,8 +80,8 @@ 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); + public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Map values = new HashMap(); values.put("content", mindMap.getXmlStr()); values.put("filename", mindMap.getTitle()); @@ -91,8 +91,8 @@ public class MindmapController extends BaseController { @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"text/plain"}, params = {"download=txt"}) @ResponseBody - public ModelAndView retrieveDocumentAsText(@PathVariable int id) throws IOException { - final Mindmap mindMap = mindmapService.findMindmapById(id); + public ModelAndView retrieveDocumentAsText(@PathVariable int id) throws IOException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Map values = new HashMap(); values.put("content", mindMap.getXmlStr()); values.put("filename", mindMap.getTitle()); @@ -101,8 +101,8 @@ public class MindmapController extends BaseController { @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.mindjet.mindmanager"}, params = {"download=mmap"}) @ResponseBody - public ModelAndView retrieveDocumentAsMindJet(@PathVariable int id) throws IOException { - final Mindmap mindMap = mindmapService.findMindmapById(id); + public ModelAndView retrieveDocumentAsMindJet(@PathVariable int id) throws IOException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Map values = new HashMap(); values.put("content", mindMap.getXmlStr()); values.put("filename", mindMap.getTitle()); @@ -112,8 +112,8 @@ public class MindmapController extends BaseController { @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.ms-excel"}, params = {"download=xls"}) @ResponseBody - public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException { - final Mindmap mindMap = mindmapService.findMindmapById(id); + public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Map values = new HashMap(); values.put("content", mindMap.getXmlStr()); values.put("filename", mindMap.getTitle()); @@ -122,8 +122,8 @@ public class MindmapController extends BaseController { @RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.oasis.opendocument.text"}, params = {"download=odt"}) @ResponseBody - public ModelAndView retrieveDocumentAsOdt(@PathVariable int id) throws IOException { - final Mindmap mindMap = mindmapService.findMindmapById(id); + public ModelAndView retrieveDocumentAsOdt(@PathVariable int id) throws IOException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Map values = new HashMap(); values.put("content", mindMap.getXmlStr()); values.put("filename", mindMap.getTitle()); @@ -164,7 +164,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, IOException { - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); final User user = Utils.getUser(); if (LATEST_HISTORY_REVISION.equals(hid)) { @@ -184,7 +184,7 @@ public class MindmapController extends BaseController { @ResponseBody public long updateDocument(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor, @RequestParam(required = false) Long timestamp, @RequestParam(required = false) Long session) throws WiseMappingException, IOException { - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); final User user = Utils.getUser(); // Validate arguments ... @@ -221,7 +221,7 @@ public class MindmapController extends BaseController { public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException { // I should not return byte, but there is some encoding issue here. Further research needed. response.setCharacterEncoding("UTF-8"); - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); String xmlStr = mindmap.getXmlStr(); return xmlStr.getBytes("UTF-8"); @@ -271,7 +271,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 = findMindmapById(id); final User user = Utils.getUser(); final String xml = restMindmap.getXml(); @@ -310,12 +310,21 @@ public class MindmapController extends BaseController { saveMindmapDocument(minor, mindmap, user); } + @NotNull + private Mindmap findMindmapById(int id) throws MapCouldNotFoundException { + Mindmap result = mindmapService.findMindmapById(id); + if(result==null){ + throw new MapCouldNotFoundException("Map could not be found. Id:" + id); + } + return result; + } + @RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"}) @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 = findMindmapById(id); final User user = Utils.getUser(); // Is there a map with the same name ? @@ -325,15 +334,15 @@ public class MindmapController extends BaseController { } // Update map ... - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); mindmap.setTitle(title); mindmapService.updateMindmap(mindMap, !true); } @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); + public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); // Only owner can change collaborators... final User user = Utils.getUser(); @@ -372,8 +381,8 @@ 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); + public ModelAndView retrieveList(@PathVariable int id) throws MapCouldNotFoundException { + final Mindmap mindMap = findMindmapById(id); final Set collaborations = mindMap.getCollaborations(); final List collabs = new ArrayList(); @@ -392,11 +401,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 = findMindmapById(id); final User user = Utils.getUser(); // Update map ... - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); mindmap.setDescription(description); mindmapService.updateMindmap(mindMap, !true); } @@ -405,7 +414,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 = findMindmapById(id); final User user = Utils.getUser(); if (!mindMap.hasPermissions(user, CollaborationRole.OWNER)) { @@ -422,7 +431,7 @@ public class MindmapController extends BaseController { @ResponseStatus(value = HttpStatus.NO_CONTENT) public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException { final User user = Utils.getUser(); - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); mindmapService.removeMindmap(mindmap, user); } @@ -430,7 +439,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 = findMindmapById(id); final User user = Utils.getUser(); // Update map status ... @@ -448,7 +457,7 @@ public class MindmapController extends BaseController { public void updateMapLock(@RequestBody String value, @PathVariable int id) throws IOException, WiseMappingException { final User user = Utils.getUser(); final LockManager lockManager = mindmapService.getLockManager(); - final Mindmap mindmap = mindmapService.findMindmapById(id); + final Mindmap mindmap = findMindmapById(id); final boolean lock = Boolean.parseBoolean(value); if (!lock) { @@ -464,7 +473,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 = findMindmapById(Integer.parseInt(mapId)); mindmapService.removeMindmap(mindmap, user); } } @@ -540,7 +549,7 @@ public class MindmapController extends BaseController { final User user = Utils.getUser(); // Create a shallowCopy of the map ... - final Mindmap mindMap = mindmapService.findMindmapById(id); + final Mindmap mindMap = findMindmapById(id); final Mindmap clonedMap = mindMap.shallowClone(); clonedMap.setTitle(restMindmap.getTitle()); clonedMap.setDescription(restMindmap.getDescription()); diff --git a/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java b/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java index 7236e1f3..a08b132d 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/MindmapService.java @@ -30,7 +30,7 @@ public interface MindmapService { static final String TAG_SEPARATOR = " "; - @NotNull + @Nullable Mindmap findMindmapById(int id); Mindmap getMindmapByTitle(String title, User user); diff --git a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java index aadccf07..2974474d 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/MindmapServiceImpl.java @@ -93,7 +93,7 @@ public class MindmapServiceImpl } @Override - @NotNull + @Nullable public Mindmap findMindmapById(int id) { return mindmapManager.getMindmapById(id); } diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java index 2e7b6ab1..768b8c14 100644 --- a/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/MindmapController.java @@ -20,6 +20,7 @@ package com.wisemapping.webmvc; import com.wisemapping.exceptions.AccessDeniedSecurityException; +import com.wisemapping.exceptions.MapCouldNotFoundException; import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.model.CollaborationRole; import com.wisemapping.model.Mindmap; @@ -29,7 +30,6 @@ import com.wisemapping.service.LockManager; import com.wisemapping.service.MindmapService; import com.wisemapping.view.MindMapBean; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.i18n.LocaleContextHolder; @@ -59,7 +59,7 @@ public class MindmapController { } @RequestMapping(value = "maps/{id}/details") - public String showDetails(@PathVariable int id, @NotNull Model model,@NotNull HttpServletRequest request) throws AccessDeniedSecurityException { + public String showDetails(@PathVariable int id, @NotNull Model model, @NotNull HttpServletRequest request) throws MapCouldNotFoundException { final MindMapBean mindmap = findMindmapBean(id); model.addAttribute("mindmap", mindmap); model.addAttribute("baseUrl", request.getAttribute("site.baseurl")); @@ -67,7 +67,7 @@ public class MindmapController { } @RequestMapping(value = "maps/{id}/print") - public String showPrintPage(@PathVariable int id, @NotNull Model model) throws AccessDeniedSecurityException { + public String showPrintPage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException { final MindMapBean mindmap = findMindmapBean(id); model.addAttribute("principal", Utils.getUser()); model.addAttribute("mindmap", mindmap); @@ -77,33 +77,33 @@ public class MindmapController { } @RequestMapping(value = "maps/{id}/export") - public String showExportPage(@PathVariable int id, @NotNull Model model) throws IOException, AccessDeniedSecurityException { + public String showExportPage(@PathVariable int id, @NotNull Model model) throws IOException, MapCouldNotFoundException { final Mindmap mindmap = findMindmap(id); model.addAttribute("mindmap", mindmap); return "mindmapExport"; } @RequestMapping(value = "maps/{id}/exportf") - public String showExportPageFull(@PathVariable int id, @NotNull Model model) throws IOException, AccessDeniedSecurityException { + public String showExportPageFull(@PathVariable int id, @NotNull Model model) throws IOException, MapCouldNotFoundException { showExportPage(id, model); return "mindmapExportFull"; } @RequestMapping(value = "maps/{id}/share") - public String showSharePage(@PathVariable int id, @NotNull Model model) throws AccessDeniedSecurityException { + public String showSharePage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException { final Mindmap mindmap = findMindmap(id); model.addAttribute("mindmap", mindmap); return "mindmapShare"; } @RequestMapping(value = "maps/{id}/sharef") - public String showSharePageFull(@PathVariable int id, @NotNull Model model) throws AccessDeniedSecurityException { + public String showSharePageFull(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException { showSharePage(id, model); return "mindmapShareFull"; } @RequestMapping(value = "maps/{id}/publish") - public String showPublishPage(@PathVariable int id, @NotNull Model model,@NotNull HttpServletRequest request) throws AccessDeniedSecurityException { + public String showPublishPage(@PathVariable int id, @NotNull Model model, @NotNull HttpServletRequest request) throws MapCouldNotFoundException { final Mindmap mindmap = findMindmap(id); model.addAttribute("mindmap", mindmap); model.addAttribute("baseUrl", request.getAttribute("site.baseurl")); @@ -111,8 +111,8 @@ public class MindmapController { } @RequestMapping(value = "maps/{id}/publishf") - public String showPublishPageFull(@PathVariable int id, @NotNull Model model,@NotNull HttpServletRequest request) throws AccessDeniedSecurityException { - showPublishPage(id, model,request); + public String showPublishPageFull(@PathVariable int id, @NotNull Model model, @NotNull HttpServletRequest request) throws MapCouldNotFoundException { + showPublishPage(id, model, request); return "mindmapPublishFull"; } @@ -193,12 +193,12 @@ public class MindmapController { final String result = showMindmapEditorPage(id, model); model.addAttribute("readOnlyMode", true); - model.addAttribute("hid",String.valueOf(hid)); + model.addAttribute("hid", String.valueOf(hid)); return result; } @RequestMapping(value = "maps/{id}/embed") - public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) throws AccessDeniedSecurityException { + public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) throws MapCouldNotFoundException { ModelAndView view; final MindMapBean mindmap = findMindmapBean(id); view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap); @@ -226,17 +226,17 @@ public class MindmapController { } @NotNull - private Mindmap findMindmap(long mapId) throws AccessDeniedSecurityException { + private Mindmap findMindmap(long mapId) throws MapCouldNotFoundException { final Mindmap result = mindmapService.findMindmapById((int) mapId); - if(result==null){ - throw new AccessDeniedSecurityException("Map could not be found " + mapId); + if (result == null) { + throw new MapCouldNotFoundException("Map could not be found " + mapId); } return result; } @NotNull - private MindMapBean findMindmapBean(long mapId) throws AccessDeniedSecurityException { + private MindMapBean findMindmapBean(long mapId) throws MapCouldNotFoundException { final Mindmap mindmap = findMindmap(mapId); return new MindMapBean(mindmap, Utils.getUser()); } diff --git a/wise-webapp/src/main/resources/messages_en.properties b/wise-webapp/src/main/resources/messages_en.properties index 008f7ff0..790a6525 100644 --- a/wise-webapp/src/main/resources/messages_en.properties +++ b/wise-webapp/src/main/resources/messages_en.properties @@ -242,6 +242,7 @@ CONTACT_US=Contact Us #Pending for translation ... CAPTCHA_LOADING_ERROR=ReCaptcha could not be loaded. You must have access to Google ReCaptcha service. ACCESS_HAS_BEEN_REVOKED= Upps. your access permissions to this map has been revoked. Contact map owner. +MAP_CAN_NOT_BE_FOUND= Upps. The map can not be found. It must have been deleted. LICENSE=License WELCOME_TO_WISEMAPPING=Welcome to WiseMapping WELCOME_DETAILS=WiseMapping will enable you to create and read your mind maps everywhere. With WiseMapping you can:
  • Embed mind map it in web pages and blogs
  • Link mind map and documents
  • Share your maps with friend and colleagues
  • Export your maps SVG,PNG,JPG and FreeMind
.