1
|
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
2
|
|
3
|
import eu.dnetlib.uoaadmintoolslibrary.entities.*;
|
4
|
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
|
5
|
import eu.dnetlib.uoaadmintoolslibrary.services.*;
|
6
|
import org.springframework.web.bind.annotation.*;
|
7
|
import org.apache.log4j.Logger;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
|
10
|
import java.util.List;
|
11
|
import java.util.Map;
|
12
|
|
13
|
@RestController
|
14
|
@RequestMapping(value = "{portalType}")
|
15
|
@CrossOrigin(origins = "*")
|
16
|
public class PortalController {
|
17
|
private final Logger log = Logger.getLogger(this.getClass());
|
18
|
|
19
|
@Autowired
|
20
|
private PortalService portalService;
|
21
|
|
22
|
// // not used by portals
|
23
|
// @RequestMapping(value = {"/"}, method = RequestMethod.POST)
|
24
|
// public Portal insertOrUpdatePortal(@PathVariable PortalType portalType, @RequestBody Portal portal) {
|
25
|
// return portalService.insertOrUpdatePortal(portal);
|
26
|
// }
|
27
|
//
|
28
|
// // not used by portals
|
29
|
// @RequestMapping(value = {"/{id}"}, method = RequestMethod.DELETE)
|
30
|
// public void deletePortal(@PathVariable PortalType portalType, @PathVariable(value = "id") String id) {
|
31
|
// portalService.deletePortalId(id);
|
32
|
// }
|
33
|
|
34
|
// used
|
35
|
@RequestMapping(value = {"/{pid}"}, method = RequestMethod.GET)
|
36
|
public Portal getPortal(@PathVariable PortalType portalType, @PathVariable(value = "pid") String pid) {
|
37
|
log.debug("PID: "+ pid);
|
38
|
return portalService.getPortal(pid);
|
39
|
}
|
40
|
|
41
|
// used
|
42
|
@RequestMapping(value = {"/{pid}/full"}, method = RequestMethod.GET)
|
43
|
public PortalResponse getPortalFull(@PathVariable PortalType portalType, @PathVariable(value = "pid") String pid) {
|
44
|
return portalService.getPortalFull(pid);
|
45
|
}
|
46
|
|
47
|
// used
|
48
|
@RequestMapping(value = {"/{pid}/divhelpcontent/grouped"}, method = RequestMethod.GET)
|
49
|
public Map<String, List<DivHelpContentResponse>> getDivHelpContentsByPosition(@PathVariable PortalType portalType,
|
50
|
@PathVariable(value = "pid") String pid,
|
51
|
@RequestParam(required=true) String page,
|
52
|
@RequestParam(required=true) String active) {
|
53
|
return portalService.getDivHelpContentsByPosition(pid, page, active);
|
54
|
}
|
55
|
|
56
|
// used
|
57
|
@RequestMapping(value = {"/{pid}/pagehelpcontent/grouped"}, method = RequestMethod.GET)
|
58
|
public Map<String, List<PageHelpContentResponse>> getPageHelpContentsByPosition(@PathVariable PortalType portalType,
|
59
|
@PathVariable(value = "pid") String pid,
|
60
|
@RequestParam(required=true) String page,
|
61
|
@RequestParam(required=true) String active) {
|
62
|
return portalService.getPageHelpContentsByPosition(pid, page, active);
|
63
|
}
|
64
|
}
|