3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.remote
.controller
;
12 import java
.io
.IOException
;
13 import java
.util
.List
;
14 import java
.util
.UUID
;
16 import javax
.servlet
.http
.HttpServletRequest
;
17 import javax
.servlet
.http
.HttpServletResponse
;
19 import org
.apache
.log4j
.Logger
;
20 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
21 import org
.springframework
.stereotype
.Controller
;
22 import org
.springframework
.web
.bind
.annotation
.PathVariable
;
23 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
24 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
25 import org
.springframework
.web
.bind
.annotation
.RequestParam
;
27 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
28 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
29 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
30 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
31 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
32 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
33 import eu
.etaxonomy
.cdm
.remote
.controller
.util
.PagerParameters
;
36 * @author a.kohlbecker
41 @RequestMapping(value
= {"/polytomousKey"})
42 public class PolytomousKeyListController
extends IdentifiableListController
<PolytomousKey
, IPolytomousKeyService
> {
44 public static final Logger logger
= Logger
.getLogger(PolytomousKeyListController
.class);
46 private ITaxonService taxonService
;
49 public void setService(IPolytomousKeyService service
) {
50 this.service
= service
;
54 public void setService(ITaxonService taxonService
) {
55 this.taxonService
= taxonService
;
59 params
= {"findByTaxonomicScope"},
60 method
= RequestMethod
.GET
)
61 public Pager
<PolytomousKey
> doFindByTaxonomicScope(
62 @RequestParam(value
= "findByTaxonomicScope") UUID taxonUuid
,
63 @RequestParam(value
= "pageNumber", required
= false) Integer pageNumber
,
64 @RequestParam(value
= "pageSize", required
= false) Integer pageSize
,
65 HttpServletRequest request
,
66 HttpServletResponse response
)throws IOException
{
68 logger
.info("doFindByTaxonomicScope: " + request
.getRequestURI() + request
.getQueryString());
70 PagerParameters pagerParameters
= new PagerParameters(pageSize
, pageNumber
);
71 pagerParameters
.normalizeAndValidate(response
);
74 TaxonBase taxon
= taxonService
.find(taxonUuid
);
75 Pager
<PolytomousKey
> pager
= service
.findByTaxonomicScope(taxon
, pagerParameters
.getPageSize(), pagerParameters
.getPageIndex(), null, null);