1
|
package eu.dnetlib.uoaadmintoolslibrary.controllers;
|
2
|
|
3
|
import eu.dnetlib.uoaadmintoolslibrary.entities.DivHelpContent;
|
4
|
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.DivHelpContentResponse;
|
5
|
import eu.dnetlib.uoaadmintoolslibrary.services.DivHelpContentService;
|
6
|
|
7
|
import org.apache.log4j.Logger;
|
8
|
import org.springframework.beans.factory.annotation.Autowired;
|
9
|
import org.springframework.web.bind.annotation.*;
|
10
|
|
11
|
import java.util.List;
|
12
|
|
13
|
@RestController
|
14
|
@CrossOrigin(origins = "*")
|
15
|
public class DivHelpContentController {
|
16
|
private final Logger log = Logger.getLogger(this.getClass());
|
17
|
|
18
|
@Autowired
|
19
|
private DivHelpContentService divHelpContentService;
|
20
|
|
21
|
@RequestMapping(value = "/divhelpcontent", method = RequestMethod.GET)
|
22
|
public List<DivHelpContentResponse> getDivHelpContents(@RequestParam(value = "portal", required = false) String pid,
|
23
|
@RequestParam(required = false) String page,
|
24
|
@RequestParam(required = false) String divId,
|
25
|
@RequestParam(required = false) String active) {
|
26
|
|
27
|
return divHelpContentService.getDivHelpContents(pid, page, divId, active);
|
28
|
}
|
29
|
|
30
|
@RequestMapping(value = "/divhelpcontent/{id}", method = RequestMethod.GET)
|
31
|
public DivHelpContent getDivHelpContent(@PathVariable(value = "id") String id) {
|
32
|
return divHelpContentService.getDivHelpContent(id);
|
33
|
}
|
34
|
|
35
|
@RequestMapping(value = "/divhelpcontent", method = RequestMethod.POST)
|
36
|
public DivHelpContent insertOrUpdateDivHelpContent(@RequestBody DivHelpContent divHelpContent) {
|
37
|
return divHelpContentService.insertOrUpdateDivHelpContent(divHelpContent);
|
38
|
}
|
39
|
|
40
|
@RequestMapping(value = "/divhelpcontent/{id}", method = RequestMethod.DELETE)
|
41
|
public void deleteDivHelpContent(@PathVariable(value = "id") String id) {
|
42
|
divHelpContentService.deleteDivHelpContent(id);
|
43
|
}
|
44
|
|
45
|
@RequestMapping(value = "/divhelpcontent/delete", method = RequestMethod.POST)
|
46
|
public Boolean deleteDivHelpContents(@RequestBody List<String> divHelpContents) throws Exception {
|
47
|
return divHelpContentService.deleteDivHelpContents(divHelpContents);
|
48
|
}
|
49
|
|
50
|
@RequestMapping(value = "/divhelpcontent/toggle", method = RequestMethod.POST)
|
51
|
public List<String> toggleDivHelpContent(@RequestBody List<String> divHelpContents, @RequestParam String status) throws Exception {
|
52
|
return divHelpContentService.toggleDivHelpContent(divHelpContents, status);
|
53
|
}
|
54
|
|
55
|
}
|