mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 07:27:56 +01:00
Handle deleted maps propertly.
This commit is contained in:
parent
bd80d95d22
commit
8e66c97aa3
@ -20,6 +20,7 @@ package com.wisemapping.dao;
|
|||||||
|
|
||||||
import com.wisemapping.model.*;
|
import com.wisemapping.model.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -38,7 +39,7 @@ public interface MindmapManager {
|
|||||||
|
|
||||||
List<Mindmap> getAllMindmaps();
|
List<Mindmap> getAllMindmaps();
|
||||||
|
|
||||||
@NotNull
|
@Nullable
|
||||||
Mindmap getMindmapById(int mindmapId);
|
Mindmap getMindmapById(int mindmapId);
|
||||||
|
|
||||||
Mindmap getMindmapByTitle(final String name, final User user);
|
Mindmap getMindmapByTitle(final String name, final User user);
|
||||||
|
@ -21,6 +21,7 @@ package com.wisemapping.dao;
|
|||||||
import com.wisemapping.model.*;
|
import com.wisemapping.model.*;
|
||||||
import com.wisemapping.util.ZipUtils;
|
import com.wisemapping.util.ZipUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.hibernate.criterion.SimpleExpression;
|
import org.hibernate.criterion.SimpleExpression;
|
||||||
@ -195,7 +196,7 @@ public class MindmapManagerImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@Nullable
|
||||||
public Mindmap getMindmapById(int id) {
|
public Mindmap getMindmapById(int id) {
|
||||||
return getHibernateTemplate().get(Mindmap.class, id);
|
return getHibernateTemplate().get(Mindmap.class, id);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,11 @@ abstract public class ClientException extends WiseMappingException {
|
|||||||
String getMsgBundleKey();
|
String getMsgBundleKey();
|
||||||
|
|
||||||
public String getMessage(@NotNull final MessageSource messageSource, final @NotNull Locale locale) {
|
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(){
|
protected Object[] getMsgBundleArgs(){
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -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<String, String> model = new HashMap<String, String>();
|
final Map<String, String> model = new HashMap<String, String>();
|
||||||
model.put("errorMsg", jsErrorMsg);
|
model.put("errorMsg", jsErrorMsg);
|
||||||
try {
|
try {
|
||||||
model.put("mapXML", StringEscapeUtils.escapeXml(mindmap.getXmlStr()));
|
model.put("mapXML", StringEscapeUtils.escapeXml(mindmap == null ? "map not found" : mindmap.getXmlStr()));
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
// Ignore ...
|
// Ignore ...
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class AccountController extends BaseController {
|
|||||||
throw new IllegalArgumentException("Password can not be null");
|
throw new IllegalArgumentException("Password can not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser(true);
|
||||||
user.setPassword(password);
|
user.setPassword(password);
|
||||||
userService.changePassword(user);
|
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);
|
user.setLocale(language);
|
||||||
userService.updateUser(user);
|
userService.updateUser(user);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieve(@PathVariable int id) throws WiseMappingException {
|
public ModelAndView retrieve(@PathVariable int id) throws WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final RestMindmap map = new RestMindmap(mindMap, user);
|
final RestMindmap map = new RestMindmap(mindMap, user);
|
||||||
|
|
||||||
return new ModelAndView("mapView", "map", map);
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/wisemapping+xml"}, params = {"download=wxml"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveAsWise(@PathVariable int id) throws WiseMappingException {
|
public ModelAndView retrieveAsWise(@PathVariable int id) throws WiseMappingException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
|
|
||||||
final User user = Utils.getUser();
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/freemind"}, params = {"download=mm"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException {
|
public ModelAndView retrieveDocumentAsFreemind(@PathVariable int id) throws IOException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
values.put("content", mindMap.getXmlStr());
|
values.put("content", mindMap.getXmlStr());
|
||||||
values.put("filename", mindMap.getTitle());
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"text/plain"}, params = {"download=txt"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveDocumentAsText(@PathVariable int id) throws IOException {
|
public ModelAndView retrieveDocumentAsText(@PathVariable int id) throws IOException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
values.put("content", mindMap.getXmlStr());
|
values.put("content", mindMap.getXmlStr());
|
||||||
values.put("filename", mindMap.getTitle());
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.mindjet.mindmanager"}, params = {"download=mmap"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveDocumentAsMindJet(@PathVariable int id) throws IOException {
|
public ModelAndView retrieveDocumentAsMindJet(@PathVariable int id) throws IOException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
values.put("content", mindMap.getXmlStr());
|
values.put("content", mindMap.getXmlStr());
|
||||||
values.put("filename", mindMap.getTitle());
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.ms-excel"}, params = {"download=xls"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException {
|
public ModelAndView retrieveDocumentAsExcel(@PathVariable int id) throws IOException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
values.put("content", mindMap.getXmlStr());
|
values.put("content", mindMap.getXmlStr());
|
||||||
values.put("filename", mindMap.getTitle());
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}", produces = {"application/vnd.oasis.opendocument.text"}, params = {"download=odt"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ModelAndView retrieveDocumentAsOdt(@PathVariable int id) throws IOException {
|
public ModelAndView retrieveDocumentAsOdt(@PathVariable int id) throws IOException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Map<String, Object> values = new HashMap<String, Object>();
|
final Map<String, Object> values = new HashMap<String, Object>();
|
||||||
values.put("content", mindMap.getXmlStr());
|
values.put("content", mindMap.getXmlStr());
|
||||||
values.put("filename", mindMap.getTitle());
|
values.put("filename", mindMap.getTitle());
|
||||||
@ -164,7 +164,7 @@ public class MindmapController extends BaseController {
|
|||||||
@RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST)
|
@RequestMapping(value = "maps/{id}/history/{hid}", method = RequestMethod.POST)
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateRevertMindmap(@PathVariable int id, @PathVariable String hid) throws WiseMappingException, IOException {
|
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();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
if (LATEST_HISTORY_REVISION.equals(hid)) {
|
if (LATEST_HISTORY_REVISION.equals(hid)) {
|
||||||
@ -184,7 +184,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseBody
|
@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 {
|
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();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Validate arguments ...
|
// Validate arguments ...
|
||||||
@ -221,7 +221,7 @@ public class MindmapController extends BaseController {
|
|||||||
public byte[] retrieveDocument(@PathVariable int id, @NotNull HttpServletResponse response) throws WiseMappingException, IOException {
|
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.
|
// I should not return byte, but there is some encoding issue here. Further research needed.
|
||||||
response.setCharacterEncoding("UTF-8");
|
response.setCharacterEncoding("UTF-8");
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
|
|
||||||
String xmlStr = mindmap.getXmlStr();
|
String xmlStr = mindmap.getXmlStr();
|
||||||
return xmlStr.getBytes("UTF-8");
|
return xmlStr.getBytes("UTF-8");
|
||||||
@ -271,7 +271,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void update(@RequestBody RestMindmap restMindmap, @PathVariable int id, @RequestParam(required = false) boolean minor) throws IOException, WiseMappingException {
|
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 User user = Utils.getUser();
|
||||||
|
|
||||||
final String xml = restMindmap.getXml();
|
final String xml = restMindmap.getXml();
|
||||||
@ -310,12 +310,21 @@ public class MindmapController extends BaseController {
|
|||||||
saveMindmapDocument(minor, mindmap, user);
|
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"})
|
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/title", consumes = {"text/plain"}, produces = {"application/json", "text/html", "application/xml"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateTitle(@RequestBody String title, @PathVariable int id) throws WiseMappingException {
|
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();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Is there a map with the same name ?
|
// Is there a map with the same name ?
|
||||||
@ -325,15 +334,15 @@ public class MindmapController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update map ...
|
// Update map ...
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
mindmap.setTitle(title);
|
mindmap.setTitle(title);
|
||||||
mindmapService.updateMindmap(mindMap, !true);
|
mindmapService.updateMindmap(mindMap, !true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.PUT, value = "/maps/{id}/collabs", consumes = {"application/json", "application/xml"}, produces = {"application/json", "text/html", "application/xml"})
|
@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)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException {
|
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
|
|
||||||
// Only owner can change collaborators...
|
// Only owner can change collaborators...
|
||||||
final User user = Utils.getUser();
|
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"})
|
@RequestMapping(method = RequestMethod.GET, value = "/maps/{id}/collabs", produces = {"application/json", "text/html", "application/xml"})
|
||||||
public ModelAndView retrieveList(@PathVariable int id) {
|
public ModelAndView retrieveList(@PathVariable int id) throws MapCouldNotFoundException {
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
|
|
||||||
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
final Set<Collaboration> collaborations = mindMap.getCollaborations();
|
||||||
final List<RestCollaboration> collabs = new ArrayList<RestCollaboration>();
|
final List<RestCollaboration> collabs = new ArrayList<RestCollaboration>();
|
||||||
@ -392,11 +401,11 @@ public class MindmapController extends BaseController {
|
|||||||
@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 {
|
||||||
|
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Update map ...
|
// Update map ...
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
mindmap.setDescription(description);
|
mindmap.setDescription(description);
|
||||||
mindmapService.updateMindmap(mindMap, !true);
|
mindmapService.updateMindmap(mindMap, !true);
|
||||||
}
|
}
|
||||||
@ -405,7 +414,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updatePublishState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
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();
|
final User user = Utils.getUser();
|
||||||
if (!mindMap.hasPermissions(user, CollaborationRole.OWNER)) {
|
if (!mindMap.hasPermissions(user, CollaborationRole.OWNER)) {
|
||||||
@ -422,7 +431,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException {
|
public void deleteMapById(@PathVariable int id) throws IOException, WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
mindmapService.removeMindmap(mindmap, user);
|
mindmapService.removeMindmap(mindmap, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,7 +439,7 @@ public class MindmapController extends BaseController {
|
|||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
public void updateStarredState(@RequestBody String value, @PathVariable int id) throws WiseMappingException {
|
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();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Update map status ...
|
// Update map status ...
|
||||||
@ -448,7 +457,7 @@ public class MindmapController extends BaseController {
|
|||||||
public void updateMapLock(@RequestBody String value, @PathVariable int id) throws IOException, WiseMappingException {
|
public void updateMapLock(@RequestBody String value, @PathVariable int id) throws IOException, WiseMappingException {
|
||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final LockManager lockManager = mindmapService.getLockManager();
|
final LockManager lockManager = mindmapService.getLockManager();
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
|
|
||||||
final boolean lock = Boolean.parseBoolean(value);
|
final boolean lock = Boolean.parseBoolean(value);
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
@ -464,7 +473,7 @@ public class MindmapController extends BaseController {
|
|||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
final String[] mapsIds = ids.split(",");
|
final String[] mapsIds = ids.split(",");
|
||||||
for (final String mapId : mapsIds) {
|
for (final String mapId : mapsIds) {
|
||||||
final Mindmap mindmap = mindmapService.findMindmapById(Integer.parseInt(mapId));
|
final Mindmap mindmap = findMindmapById(Integer.parseInt(mapId));
|
||||||
mindmapService.removeMindmap(mindmap, user);
|
mindmapService.removeMindmap(mindmap, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -540,7 +549,7 @@ public class MindmapController extends BaseController {
|
|||||||
final User user = Utils.getUser();
|
final User user = Utils.getUser();
|
||||||
|
|
||||||
// Create a shallowCopy of the map ...
|
// Create a shallowCopy of the map ...
|
||||||
final Mindmap mindMap = mindmapService.findMindmapById(id);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
final Mindmap clonedMap = mindMap.shallowClone();
|
final Mindmap clonedMap = mindMap.shallowClone();
|
||||||
clonedMap.setTitle(restMindmap.getTitle());
|
clonedMap.setTitle(restMindmap.getTitle());
|
||||||
clonedMap.setDescription(restMindmap.getDescription());
|
clonedMap.setDescription(restMindmap.getDescription());
|
||||||
|
@ -30,7 +30,7 @@ public interface MindmapService {
|
|||||||
|
|
||||||
static final String TAG_SEPARATOR = " ";
|
static final String TAG_SEPARATOR = " ";
|
||||||
|
|
||||||
@NotNull
|
@Nullable
|
||||||
Mindmap findMindmapById(int id);
|
Mindmap findMindmapById(int id);
|
||||||
|
|
||||||
Mindmap getMindmapByTitle(String title, User user);
|
Mindmap getMindmapByTitle(String title, User user);
|
||||||
|
@ -93,7 +93,7 @@ public class MindmapServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@Nullable
|
||||||
public Mindmap findMindmapById(int id) {
|
public Mindmap findMindmapById(int id) {
|
||||||
return mindmapManager.getMindmapById(id);
|
return mindmapManager.getMindmapById(id);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.wisemapping.webmvc;
|
|||||||
|
|
||||||
|
|
||||||
import com.wisemapping.exceptions.AccessDeniedSecurityException;
|
import com.wisemapping.exceptions.AccessDeniedSecurityException;
|
||||||
|
import com.wisemapping.exceptions.MapCouldNotFoundException;
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
import com.wisemapping.exceptions.WiseMappingException;
|
||||||
import com.wisemapping.model.CollaborationRole;
|
import com.wisemapping.model.CollaborationRole;
|
||||||
import com.wisemapping.model.Mindmap;
|
import com.wisemapping.model.Mindmap;
|
||||||
@ -29,7 +30,6 @@ import com.wisemapping.service.LockManager;
|
|||||||
import com.wisemapping.service.MindmapService;
|
import com.wisemapping.service.MindmapService;
|
||||||
import com.wisemapping.view.MindMapBean;
|
import com.wisemapping.view.MindMapBean;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
@ -59,7 +59,7 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/details")
|
@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);
|
final MindMapBean mindmap = findMindmapBean(id);
|
||||||
model.addAttribute("mindmap", mindmap);
|
model.addAttribute("mindmap", mindmap);
|
||||||
model.addAttribute("baseUrl", request.getAttribute("site.baseurl"));
|
model.addAttribute("baseUrl", request.getAttribute("site.baseurl"));
|
||||||
@ -67,7 +67,7 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/print")
|
@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);
|
final MindMapBean mindmap = findMindmapBean(id);
|
||||||
model.addAttribute("principal", Utils.getUser());
|
model.addAttribute("principal", Utils.getUser());
|
||||||
model.addAttribute("mindmap", mindmap);
|
model.addAttribute("mindmap", mindmap);
|
||||||
@ -77,33 +77,33 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/export")
|
@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);
|
final Mindmap mindmap = findMindmap(id);
|
||||||
model.addAttribute("mindmap", mindmap);
|
model.addAttribute("mindmap", mindmap);
|
||||||
return "mindmapExport";
|
return "mindmapExport";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/exportf")
|
@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);
|
showExportPage(id, model);
|
||||||
return "mindmapExportFull";
|
return "mindmapExportFull";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/share")
|
@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);
|
final Mindmap mindmap = findMindmap(id);
|
||||||
model.addAttribute("mindmap", mindmap);
|
model.addAttribute("mindmap", mindmap);
|
||||||
return "mindmapShare";
|
return "mindmapShare";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/sharef")
|
@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);
|
showSharePage(id, model);
|
||||||
return "mindmapShareFull";
|
return "mindmapShareFull";
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/publish")
|
@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);
|
final Mindmap mindmap = findMindmap(id);
|
||||||
model.addAttribute("mindmap", mindmap);
|
model.addAttribute("mindmap", mindmap);
|
||||||
model.addAttribute("baseUrl", request.getAttribute("site.baseurl"));
|
model.addAttribute("baseUrl", request.getAttribute("site.baseurl"));
|
||||||
@ -111,7 +111,7 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/publishf")
|
@RequestMapping(value = "maps/{id}/publishf")
|
||||||
public String showPublishPageFull(@PathVariable int id, @NotNull Model model,@NotNull HttpServletRequest request) throws AccessDeniedSecurityException {
|
public String showPublishPageFull(@PathVariable int id, @NotNull Model model, @NotNull HttpServletRequest request) throws MapCouldNotFoundException {
|
||||||
showPublishPage(id, model, request);
|
showPublishPage(id, model, request);
|
||||||
return "mindmapPublishFull";
|
return "mindmapPublishFull";
|
||||||
}
|
}
|
||||||
@ -198,7 +198,7 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "maps/{id}/embed")
|
@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;
|
ModelAndView view;
|
||||||
final MindMapBean mindmap = findMindmapBean(id);
|
final MindMapBean mindmap = findMindmapBean(id);
|
||||||
view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap);
|
view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap);
|
||||||
@ -226,17 +226,17 @@ public class MindmapController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Mindmap findMindmap(long mapId) throws AccessDeniedSecurityException {
|
private Mindmap findMindmap(long mapId) throws MapCouldNotFoundException {
|
||||||
final Mindmap result = mindmapService.findMindmapById((int) mapId);
|
final Mindmap result = mindmapService.findMindmapById((int) mapId);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new AccessDeniedSecurityException("Map could not be found " + mapId);
|
throw new MapCouldNotFoundException("Map could not be found " + mapId);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private MindMapBean findMindmapBean(long mapId) throws AccessDeniedSecurityException {
|
private MindMapBean findMindmapBean(long mapId) throws MapCouldNotFoundException {
|
||||||
final Mindmap mindmap = findMindmap(mapId);
|
final Mindmap mindmap = findMindmap(mapId);
|
||||||
return new MindMapBean(mindmap, Utils.getUser());
|
return new MindMapBean(mindmap, Utils.getUser());
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,7 @@ CONTACT_US=Contact Us
|
|||||||
#Pending for translation ...
|
#Pending for translation ...
|
||||||
CAPTCHA_LOADING_ERROR=ReCaptcha could not be loaded. You must have access to Google ReCaptcha service.
|
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.
|
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
|
LICENSE=License
|
||||||
WELCOME_TO_WISEMAPPING=Welcome to WiseMapping
|
WELCOME_TO_WISEMAPPING=Welcome to WiseMapping
|
||||||
WELCOME_DETAILS=WiseMapping will enable you to create and read your mind maps everywhere. With WiseMapping you can: <ul><li>Embed mind map it in web pages and blogs</li><li>Link mind map and documents</li><li>Share your maps with friend and colleagues</li><li>Export your maps SVG,PNG,JPG and FreeMind</li></ul>.
|
WELCOME_DETAILS=WiseMapping will enable you to create and read your mind maps everywhere. With WiseMapping you can: <ul><li>Embed mind map it in web pages and blogs</li><li>Link mind map and documents</li><li>Share your maps with friend and colleagues</li><li>Export your maps SVG,PNG,JPG and FreeMind</li></ul>.
|
||||||
|
Loading…
Reference in New Issue
Block a user