Project

General

Profile

« Previous | Next » 

Revision 60034

[Trunk | Admin tools]:
1. NotificationsService.java: [NEW] service for notifications with updatePid and deleteByPid methods.
2. LayoutService.java & StatisticsService.java & SubscriberService.java: Logs added.
3. CommunityController.java:
a. [Bug fix] On "updateCommunity()" (/update) method update pid for related notifications, layout, statistics and subscribers (old_pid had the value of new_pid, not the old one).
b. Add update pid for notifications when updating portal pid | Delete related notifications by pid when deleting a portal.

View differences:

CommunityController.java
2 2

  
3 3
import eu.dnetlib.uoaadmintools.entities.Layout;
4 4
import eu.dnetlib.uoaadmintools.services.LayoutService;
5
import eu.dnetlib.uoaadmintools.services.NotificationsService;
5 6
import eu.dnetlib.uoaadmintools.services.StatisticsService;
6 7
import eu.dnetlib.uoaadmintools.services.SubscriberService;
7 8
import eu.dnetlib.uoaadmintoolslibrary.entities.Portal;
......
23 24
    private LayoutService layoutService;
24 25

  
25 26
    @Autowired
27
    private NotificationsService notificationsService;
28

  
29
    @Autowired
26 30
    private StatisticsService statisticsService;
27 31

  
28 32
    @Autowired
......
44 48
//    @PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN)")
45 49
    @RequestMapping(value = "/update", method = RequestMethod.POST)
46 50
    public PortalResponse updateCommunity(@RequestBody Portal portal) {
51
        String old_pid = portalService.getPortalById(portal.getId()).getPid();
52
        String new_pid = portal.getPid();
53

  
47 54
        PortalResponse portalResponse = portalService.updatePortal(portal);
48 55

  
49
        String old_pid = portalResponse.getPid();
50
        String new_pid = portal.getPid();
51 56
        if(!old_pid.equals(new_pid)) {
57
            log.debug("update portal pid - old: "+old_pid + " - new: "+new_pid);
52 58
            statisticsService.updatePid(old_pid, new_pid);
53 59
            subscriberService.updatePid(old_pid, new_pid);
54 60
            layoutService.updatePid(old_pid, new_pid);
61
            notificationsService.updatePid(old_pid, new_pid);
55 62
        }
56 63

  
57 64
        return portalResponse;
......
78 85
            statisticsService.deleteByPid(pid);
79 86
            subscriberService.deletePortalSubscribers(pid);
80 87
            layoutService.deleteByPid(pid);
88
            notificationsService.deleteByPid(pid);
81 89
        }
82 90

  
83 91
        return true;

Also available in: Unified diff