1 |
59815
|
konstantin
|
package eu.dnetlib.uoamonitorservice.controllers;
|
2 |
|
|
|
3 |
|
|
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
|
4 |
|
|
import eu.dnetlib.uoaadmintoolslibrary.entities.fullEntities.*;
|
5 |
|
|
import eu.dnetlib.uoaadmintoolslibrary.services.PortalService;
|
6 |
|
|
import org.apache.log4j.Logger;
|
7 |
|
|
import org.springframework.web.bind.annotation.*;
|
8 |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
9 |
|
|
|
10 |
|
|
import java.util.*;
|
11 |
|
|
|
12 |
|
|
@RestController
|
13 |
61288
|
konstantin
|
@RequestMapping(value={"/monitor", "/funder", "/project", "/ri", "/organization"})
|
14 |
59815
|
konstantin
|
@CrossOrigin(origins = "*")
|
15 |
|
|
public class MonitorController {
|
16 |
|
|
private final Logger log = Logger.getLogger(this.getClass());
|
17 |
|
|
//
|
18 |
|
|
// @Autowired
|
19 |
|
|
// private LayoutService layoutService;
|
20 |
|
|
|
21 |
|
|
@Autowired
|
22 |
|
|
private PortalService portalService;
|
23 |
|
|
|
24 |
|
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
25 |
|
|
public PortalResponse updatePortal(@RequestBody Portal portal) {
|
26 |
|
|
PortalResponse portalResponse = portalService.updatePortal(portal);
|
27 |
|
|
|
28 |
|
|
// String old_pid = portalResponse.getPid();
|
29 |
|
|
// String new_pid = portal.getPid();
|
30 |
|
|
// if(!old_pid.equals(new_pid)) {
|
31 |
|
|
// layoutService.updatePid(old_pid, new_pid);
|
32 |
|
|
// }
|
33 |
|
|
|
34 |
|
|
return portalResponse;
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
38 |
|
|
public PortalResponse insertPortal(@RequestBody Portal portal) {
|
39 |
|
|
PortalResponse portalResponse = portalService.insertPortal(portal);
|
40 |
|
|
return portalResponse;
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
44 |
|
|
public Boolean deletePortals(@RequestBody List<String> portals) {
|
45 |
|
|
for (String id: portals) {
|
46 |
|
|
String pid = portalService.deletePortal(id);
|
47 |
|
|
// layoutService.deleteByPid(pid);
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
return true;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
// @RequestMapping(value = "/{pid}/layout", method = RequestMethod.GET)
|
54 |
|
|
// public Layout getLayoutForCommunity(@PathVariable(value = "pid") String pid) {
|
55 |
|
|
// return layoutService.findByPid(pid);
|
56 |
|
|
// }
|
57 |
|
|
//
|
58 |
|
|
// @RequestMapping(value = "/{pid}/layout", method = RequestMethod.POST)
|
59 |
|
|
// public Layout updateLayoutForCommunity(@PathVariable(value = "pid") String pid, @RequestBody Layout layout) {
|
60 |
|
|
// return layoutService.save(layout);
|
61 |
|
|
// }
|
62 |
|
|
|
63 |
|
|
}
|