Add duplicate action.
This commit is contained in:
@@ -98,14 +98,6 @@ public class MindmapController {
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "delete")
|
||||
public ModelAndView delete(@RequestParam(required = true) long mapId, @NotNull HttpServletRequest request) throws WiseMappingException {
|
||||
final User user = Utils.getUser();
|
||||
final MindMap mindmap = findMindmap(mapId);
|
||||
mindmapService.removeCollaboratorFromMindmap(mindmap, user.getId());
|
||||
return list(request);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "updateMindmap")
|
||||
public ModelAndView updateMindmap(@RequestParam(required = true) long mapId, @RequestParam(required = true) String title, @RequestParam(required = true) String description, @NotNull HttpServletRequest request) throws WiseMappingException {
|
||||
final MindMap mindmap = findMindmap(mapId);
|
||||
|
@@ -187,23 +187,15 @@ public class MindmapController extends BaseController {
|
||||
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}", consumes = {"application/xml", "application/json"})
|
||||
@ResponseStatus(value = HttpStatus.CREATED)
|
||||
public void copyMap(@RequestBody RestMindmapInfo restMindmap, @PathVariable int id, @NotNull HttpServletResponse response) throws IOException, WiseMappingException {
|
||||
|
||||
final String title = restMindmap.getTitle();
|
||||
if (title == null || title.isEmpty()) {
|
||||
throw new IllegalArgumentException("Map title can not be null");
|
||||
}
|
||||
|
||||
final String description = restMindmap.getDescription();
|
||||
if (description == null || description.isEmpty()) {
|
||||
throw new IllegalArgumentException("Map details can not be null");
|
||||
// Validate ...
|
||||
final BindingResult result = new BeanPropertyBindingResult(restMindmap, "");
|
||||
new MapInfoValidator(mindmapService).validate(restMindmap.getDelegated(), result);
|
||||
if (result.hasErrors()) {
|
||||
throw new ValidationException(result);
|
||||
}
|
||||
|
||||
// Some basic validations ...
|
||||
final User user = Utils.getUser();
|
||||
final MindMap searchByMap = mindmapService.getMindmapByTitle(title, user);
|
||||
if (searchByMap != null) {
|
||||
throw new IllegalArgumentException("Map already exists with title '" + title + "'");
|
||||
}
|
||||
|
||||
// Create a shallowCopy of the map ...
|
||||
final MindMap mindMap = mindmapService.getMindmapById(id);
|
||||
|
Reference in New Issue
Block a user