Project

General

Profile

Download (1.79 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.cdm.remote.controller;
12

    
13
import java.io.IOException;
14
import java.util.Arrays;
15
import java.util.List;
16
import java.util.UUID;
17

    
18
import javax.servlet.http.HttpServletRequest;
19
import javax.servlet.http.HttpServletResponse;
20

    
21
import org.springframework.web.bind.annotation.PathVariable;
22
import org.springframework.web.bind.annotation.RequestMapping;
23
import org.springframework.web.bind.annotation.RequestMethod;
24

    
25
import eu.etaxonomy.cdm.api.service.IAnnotatableService;
26
import eu.etaxonomy.cdm.api.service.pager.Pager;
27
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
28
import eu.etaxonomy.cdm.model.common.Annotation;
29

    
30
/**
31
 * based on org.cateproject.controller.common
32
 * 
33
 * @author a.kohlbecker
34
 *
35
 * @param <T>
36
 * @param <DAO>
37
 */
38
public abstract class AnnotatableController<T extends AnnotatableEntity, SERVICE extends IAnnotatableService<T>> extends BaseController<T,SERVICE> {
39
	
40
	protected static final List<String> ANNOTATION_INIT_STRATEGY = Arrays.asList(new String []{
41
			"$"
42
	});
43

    
44
	@RequestMapping(value = "annotation", method = RequestMethod.GET)
45
	public Pager<Annotation> getAnnotations(
46
			@PathVariable("uuid") UUID uuid,
47
			HttpServletRequest request,
48
			HttpServletResponse response) throws IOException {
49
		logger.info("getAnnotations() - " + request.getServletPath());
50
		T annotatableEntity = service.find(uuid);
51
		Pager<Annotation> annotations = service.getAnnotations(annotatableEntity, null, null, 0, null, ANNOTATION_INIT_STRATEGY);
52
		return annotations;
53
	}
54

    
55

    
56
}
(6-6/43)