2012-02-12 21:57:11 -03:00
|
|
|
package com.wisemapping.rest;
|
|
|
|
|
|
|
|
|
|
|
|
import com.wisemapping.model.MindMap;
|
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-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;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@Controller
|
2012-02-16 01:16:51 -03:00
|
|
|
@RequestMapping("/map")
|
2012-02-12 21:57:11 -03:00
|
|
|
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-16 01:16:51 -03:00
|
|
|
@RequestMapping(method = RequestMethod.GET, value = "/{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
|
|
|
}
|
|
|
|
}
|