1
|
/**
|
2
|
* Copyright (C) 2018 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.util.List;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import javax.servlet.http.HttpServletRequest;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
import org.springframework.beans.factory.annotation.Autowired;
|
18
|
import org.springframework.stereotype.Controller;
|
19
|
import org.springframework.web.bind.WebDataBinder;
|
20
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
21
|
import org.springframework.web.bind.annotation.InitBinder;
|
22
|
import org.springframework.web.bind.annotation.RequestMapping;
|
23
|
import org.springframework.web.bind.annotation.RequestMethod;
|
24
|
import org.springframework.web.bind.annotation.RequestParam;
|
25
|
|
26
|
import eu.etaxonomy.cdm.api.service.taxonGraph.ITaxonGraphService;
|
27
|
import eu.etaxonomy.cdm.persistence.dao.taxonGraph.TaxonGraphException;
|
28
|
import eu.etaxonomy.cdm.persistence.dto.TaxonGraphEdgeDTO;
|
29
|
import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor;
|
30
|
import io.swagger.annotations.Api;
|
31
|
|
32
|
/**
|
33
|
* @author a.kohlbecker
|
34
|
* @since Oct 2, 2018
|
35
|
*
|
36
|
*/
|
37
|
@Controller
|
38
|
@Api("taxonGraph")
|
39
|
@RequestMapping(value = {"/taxonGraph"})
|
40
|
public class TaxonGraphController {
|
41
|
|
42
|
|
43
|
public static final Logger logger = Logger.getLogger(TaxonGraphController.class);
|
44
|
|
45
|
@Autowired
|
46
|
private ITaxonGraphService service;
|
47
|
|
48
|
@InitBinder
|
49
|
public void initBinder(WebDataBinder binder) {
|
50
|
binder.registerCustomEditor(UUID.class, new UUIDPropertyEditor());
|
51
|
}
|
52
|
|
53
|
@CrossOrigin
|
54
|
@RequestMapping(method = RequestMethod.GET, value="edges")
|
55
|
public List<TaxonGraphEdgeDTO> doEdges(
|
56
|
@RequestParam(value = "fromTaxonUuid", required = false) UUID fromTaxonUuid,
|
57
|
@RequestParam(value = "toTaxonUuid", required = false) UUID toTaxonUuid,
|
58
|
HttpServletRequest request) throws TaxonGraphException{
|
59
|
|
60
|
logger.info("doEdges() " + request.getRequestURL());
|
61
|
return service.edges(fromTaxonUuid, toTaxonUuid, false);
|
62
|
}
|
63
|
|
64
|
}
|