2 * Copyright (C) 2016 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
.Arrays
;
13 import java
.util
.UUID
;
15 import javax
.servlet
.http
.HttpServletRequest
;
16 import javax
.servlet
.http
.HttpServletResponse
;
18 import org
.apache
.commons
.io
.FilenameUtils
;
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
;
26 import eu
.etaxonomy
.cdm
.api
.service
.INameService
;
27 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalStatus
;
28 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
29 import io
.swagger
.annotations
.Api
;
32 * @author a.kohlbecker
37 @Api("nomenclaturalStatus")
38 @RequestMapping(value
= {"/nomenclaturalStatus/{uuid}"})
39 public class NomenclaturalStatusController
extends AbstractController
<TaxonName
, INameService
> {
42 private static final Logger logger
= Logger
.getLogger(NomenclaturalStatusController
.class);
49 public void setService(INameService service
) {
50 this.service
= service
;
53 @RequestMapping(method
= RequestMethod
.GET
)
54 public NomenclaturalStatus
doGetMethod(
55 @PathVariable("uuid") UUID uuid
,
56 HttpServletRequest request
,
57 HttpServletResponse response
) throws IOException
{
59 String servletPath
= request
.getServletPath();
60 String propertyName
= FilenameUtils
.getBaseName(servletPath
);
62 logger
.info("doGet() - " + requestPathAndQuery(request
));
64 NomenclaturalStatus nomstatus
= service
.loadNomenclaturalStatus(uuid
, Arrays
.asList("$", "source.citation.inReference"));
65 if(nomstatus
== null){
66 HttpStatusMessage
.UUID_NOT_FOUND
.send(response
);