2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.cdm
.remote
.controller
;
11 import java
.io
.IOException
;
12 import java
.util
.UUID
;
14 import javax
.servlet
.http
.HttpServletRequest
;
15 import javax
.servlet
.http
.HttpServletResponse
;
17 import org
.apache
.logging
.log4j
.LogManager
;import org
.apache
.logging
.log4j
.Logger
;
18 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
19 import org
.springframework
.stereotype
.Controller
;
20 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
21 import org
.springframework
.web
.bind
.annotation
.RequestMethod
;
22 import org
.springframework
.web
.bind
.annotation
.RequestParam
;
24 import eu
.etaxonomy
.cdm
.api
.service
.IPolytomousKeyService
;
25 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonService
;
26 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
27 import eu
.etaxonomy
.cdm
.model
.description
.PolytomousKey
;
28 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
29 import eu
.etaxonomy
.cdm
.remote
.controller
.util
.PagerParameters
;
30 import io
.swagger
.annotations
.Api
;
33 * @author a.kohlbecker
39 @RequestMapping(value
= {"/polytomousKey"})
40 public class PolytomousKeyListController
extends AbstractIdentifiableListController
<PolytomousKey
, IPolytomousKeyService
> {
42 public static final Logger logger
= LogManager
.getLogger(PolytomousKeyListController
.class);
44 private ITaxonService taxonService
;
48 public void setService(IPolytomousKeyService service
) {
49 this.service
= service
;
53 public void setService(ITaxonService taxonService
) {
54 this.taxonService
= taxonService
;
58 params
= {"findByTaxonomicScope"},
59 method
= RequestMethod
.GET
)
60 public Pager
<PolytomousKey
> doFindByTaxonomicScope(
61 @RequestParam(value
= "findByTaxonomicScope") UUID taxonUuid
,
62 @RequestParam(value
= "pageIndex", required
= false) Integer pageIndex
,
63 @RequestParam(value
= "pageSize", required
= false) Integer pageSize
,
64 HttpServletRequest request
,
65 HttpServletResponse response
)throws IOException
{
67 logger
.info("doFindByTaxonomicScope: " + request
.getRequestURI() + request
.getQueryString());
69 PagerParameters pagerParameters
= new PagerParameters(pageSize
, pageIndex
);
70 pagerParameters
.normalizeAndValidate(response
);
73 TaxonBase taxon
= taxonService
.find(taxonUuid
);
74 Pager
<PolytomousKey
> pager
= service
.findByTaxonomicScope(taxon
, pagerParameters
.getPageSize(), pagerParameters
.getPageIndex(), null, null);