2012-02-12 21:57:11 -03:00
|
|
|
package com.wisemapping.rest;
|
|
|
|
|
|
|
|
|
|
|
|
import com.wisemapping.model.MindMap;
|
2012-02-17 10:42:20 -03:00
|
|
|
import com.wisemapping.model.MindmapUser;
|
|
|
|
import com.wisemapping.model.User;
|
2012-02-16 01:16:51 -03:00
|
|
|
import com.wisemapping.rest.model.RestMindMap;
|
2012-02-12 21:57:11 -03:00
|
|
|
import com.wisemapping.service.MindmapService;
|
2012-02-17 10:42:20 -03:00
|
|
|
import com.wisemapping.validator.Utils;
|
2012-02-16 01:16:51 -03:00
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2012-02-12 21:57:11 -03:00
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
2012-02-16 01:16:51 -03:00
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
2012-02-12 21:57:11 -03:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.HashMap;
|
2012-02-17 10:42:20 -03:00
|
|
|
import java.util.List;
|
2012-02-12 21:57:11 -03:00
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
public class MindmapController {
|
2012-02-16 01:16:51 -03:00
|
|
|
@Autowired
|
2012-02-12 21:57:11 -03:00
|
|
|
private MindmapService mindmapService;
|
|
|
|
|
|
|
|
|
2012-02-17 10:42:20 -03:00
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/map/{id}")
|
2012-02-12 21:57:11 -03:00
|
|
|
@ResponseBody
|
2012-02-16 01:16:51 -03:00
|
|
|
public ModelAndView getMindmap(@PathVariable int id) throws IOException {
|
2012-02-12 21:57:11 -03:00
|
|
|
final MindMap mindMap = mindmapService.getMindmapById(id);
|
2012-02-16 01:16:51 -03:00
|
|
|
final RestMindMap map = new RestMindMap(mindMap);
|
|
|
|
return new ModelAndView("mapView", "map", map);
|
2012-02-12 21:57:11 -03:00
|
|
|
}
|
2012-02-17 10:42:20 -03:00
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/maps")
|
|
|
|
public ModelAndView getMindmaps() throws IOException {
|
|
|
|
final User user = com.wisemapping.security.Utils.getUser();
|
|
|
|
|
|
|
|
final List<MindmapUser> list = mindmapService.getMindmapUserByUser(user);
|
|
|
|
// final RestMindMap map = new RestMindMap(mindMap);
|
|
|
|
// return new ModelAndView("mapView", "map", map);
|
|
|
|
return null;
|
|
|
|
}
|
2012-02-12 21:57:11 -03:00
|
|
|
}
|