View Javadoc

1   package org.cateproject.controller.common.annotation;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import java.util.UUID;
6   
7   import org.cateproject.controller.Cacheable;
8   import org.cateproject.controller.GenericController;
9   import org.cateproject.controller.common.AnnotatableController;
10  import org.springframework.beans.factory.annotation.Autowired;
11  import org.springframework.stereotype.Controller;
12  import org.springframework.web.bind.annotation.PathVariable;
13  import org.springframework.web.bind.annotation.RequestMapping;
14  import org.springframework.web.bind.annotation.RequestMethod;
15  import org.springframework.web.servlet.ModelAndView;
16  
17  import eu.etaxonomy.cdm.api.service.IAnnotationService;
18  import eu.etaxonomy.cdm.model.common.Annotation;
19  
20  @Controller
21  @RequestMapping(value = {"/annotation/{uuid}"})
22  public class AnnotationController extends AnnotatableController<Annotation,IAnnotationService> {
23  	
24  	public AnnotationController() {
25  		super(Annotation.class);
26  	}
27  
28  	@Override
29  	@Autowired
30  	public void setService(IAnnotationService service) {
31  		this.service = service;
32  	}
33  	
34  	@Override
35  	@RequestMapping(method = RequestMethod.GET)
36  	@Cacheable(value="annotation/index")
37  	public ModelAndView get(@PathVariable(value = "uuid") UUID uuid) {
38  		List<String> propertyPaths = new ArrayList<String>();
39  		propertyPaths.add("$");
40  		propertyPaths.add("annotations");
41  		Annotation object = handleLoad(uuid,propertyPaths);
42  		
43  		ModelAndView modelAndView = new ModelAndView("annotation/index");
44  		modelAndView.addObject(GenericController.RESOURCE_KEY,object);
45  		
46  		return modelAndView;
47  	}
48  }