Revision 47a15e28
Added by Andreas Kohlbecker over 12 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/PolytomousKeyListController.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2009 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
30 | 30 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
31 | 31 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
32 | 32 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
33 |
import eu.etaxonomy.cdm.remote.controller.util.PagerParameters; |
|
33 | 34 |
|
34 | 35 |
/** |
35 | 36 |
* @author a.kohlbecker |
... | ... | |
39 | 40 |
@Controller |
40 | 41 |
@RequestMapping(value = {"/polytomousKey"}) |
41 | 42 |
public class PolytomousKeyListController extends BaseListController<PolytomousKey, IPolytomousKeyService> { |
42 |
|
|
43 |
public static final Logger logger = Logger.getLogger(PolytomousKeyListController.class); |
|
44 |
|
|
45 |
private ITaxonService taxonService; |
|
46 |
|
|
47 |
@Autowired |
|
48 |
public void setService(IPolytomousKeyService service) { |
|
49 |
this.service = service; |
|
50 |
} |
|
51 |
|
|
52 |
@Autowired |
|
53 |
public void setService(ITaxonService taxonService) { |
|
54 |
this.taxonService = taxonService; |
|
55 |
} |
|
56 |
|
|
57 |
@RequestMapping( |
|
58 |
params = {"findByTaxonomicScope"}, |
|
59 |
method = RequestMethod.GET) |
|
60 |
public Pager<PolytomousKey> doFindByTaxonomicScope( |
|
61 |
@RequestParam(value = "findByTaxonomicScope") UUID taxonUuid, |
|
62 |
@RequestParam(value = "pageNumber", required = false) Integer pageNumber, |
|
63 |
@RequestParam(value = "pageSize", required = false) Integer pageSize, |
|
64 |
HttpServletRequest request, |
|
65 |
HttpServletResponse response)throws IOException { |
|
66 |
|
|
67 |
logger.info("doFindByTaxonomicScope: " + request.getRequestURI() + request.getQueryString()); |
|
68 |
|
|
69 |
normalizeAndValidatePagerParameters(pageNumber, pageSize, response); |
|
70 |
|
|
71 |
TaxonBase taxon = taxonService.find(taxonUuid); |
|
72 |
Pager<PolytomousKey> pager = service.findByTaxonomicScope(taxon, pageSize, pageNumber, null); |
|
73 |
return pager; |
|
74 |
} |
|
75 |
|
|
43 |
|
|
44 |
public static final Logger logger = Logger.getLogger(PolytomousKeyListController.class); |
|
45 |
|
|
46 |
private ITaxonService taxonService; |
|
47 |
|
|
48 |
@Autowired |
|
49 |
public void setService(IPolytomousKeyService service) { |
|
50 |
this.service = service; |
|
51 |
} |
|
52 |
|
|
53 |
@Autowired |
|
54 |
public void setService(ITaxonService taxonService) { |
|
55 |
this.taxonService = taxonService; |
|
56 |
} |
|
57 |
|
|
58 |
@RequestMapping( |
|
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 { |
|
67 |
|
|
68 |
logger.info("doFindByTaxonomicScope: " + request.getRequestURI() + request.getQueryString()); |
|
69 |
|
|
70 |
PagerParameters pagerParameters = new PagerParameters(pageSize, pageNumber); |
|
71 |
pagerParameters.normalizeAndValidate(response); |
|
72 |
|
|
73 |
|
|
74 |
TaxonBase taxon = taxonService.find(taxonUuid); |
|
75 |
Pager<PolytomousKey> pager = service.findByTaxonomicScope(taxon, pagerParameters.getPageSize(), pagerParameters.getPageNumber(), null); |
|
76 |
return pager; |
|
77 |
} |
|
78 |
|
|
76 | 79 |
} |
77 |
|
|
80 |
|
Also available in: Unified diff
fixing #2565 (DataPortal CacheBot is broken)