1
|
/**
|
2
|
* Copyright (C) 2016 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.remote.controller;
|
10
|
|
11
|
import java.io.IOException;
|
12
|
import java.util.Arrays;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import javax.servlet.http.HttpServletRequest;
|
16
|
import javax.servlet.http.HttpServletResponse;
|
17
|
|
18
|
import org.apache.log4j.Logger;
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
20
|
import org.springframework.stereotype.Controller;
|
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.INameService;
|
26
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
27
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
28
|
import io.swagger.annotations.Api;
|
29
|
|
30
|
/**
|
31
|
* @author a.kohlbecker
|
32
|
* @since Oct 11, 2016
|
33
|
*/
|
34
|
@Controller
|
35
|
@Api("nomenclaturalStatus")
|
36
|
@RequestMapping(value = {"/nomenclaturalStatus/{uuid}"})
|
37
|
public class NomenclaturalStatusController extends AbstractController<TaxonName, INameService> {
|
38
|
|
39
|
private static final Logger logger = Logger.getLogger(NomenclaturalStatusController.class);
|
40
|
|
41
|
@Override
|
42
|
@Autowired
|
43
|
public void setService(INameService service) {
|
44
|
this.service = service;
|
45
|
}
|
46
|
|
47
|
@RequestMapping(method = RequestMethod.GET)
|
48
|
public NomenclaturalStatus doGetMethod(
|
49
|
@PathVariable("uuid") UUID uuid,
|
50
|
HttpServletRequest request,
|
51
|
HttpServletResponse response) throws IOException {
|
52
|
|
53
|
logger.info("doGet() - " + requestPathAndQuery(request));
|
54
|
|
55
|
NomenclaturalStatus nomstatus = service.loadNomenclaturalStatus(uuid, Arrays.asList("$", "source.citation.inReference"));
|
56
|
if(nomstatus == null){
|
57
|
HttpStatusMessage.UUID_NOT_FOUND.send(response);
|
58
|
}
|
59
|
return nomstatus;
|
60
|
}
|
61
|
}
|