34 lines
1.2 KiB
Java
34 lines
1.2 KiB
Java
|
package eu.dnetlib.uoaadmintools.services;
|
||
|
|
||
|
import eu.dnetlib.uoaadmintools.dao.PortalSubscribersDAO;
|
||
|
import eu.dnetlib.uoaadmintools.entities.subscriber.PortalSubscribers;
|
||
|
import org.apache.log4j.Logger;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
@Service
|
||
|
public class SubscriberService {
|
||
|
private final Logger log = Logger.getLogger(this.getClass());
|
||
|
|
||
|
@Autowired
|
||
|
private PortalSubscribersDAO portalSubscribersDAO;
|
||
|
|
||
|
public void updatePid(String old_pid, String new_pid) {
|
||
|
PortalSubscribers portalSubscribers = portalSubscribersDAO.findByPid(old_pid);
|
||
|
portalSubscribers.setPid(new_pid);
|
||
|
portalSubscribersDAO.save(portalSubscribers);
|
||
|
}
|
||
|
|
||
|
public void createPortalSubscribers(String pid) {
|
||
|
PortalSubscribers portalSubscribers = new PortalSubscribers(pid);
|
||
|
portalSubscribersDAO.save(portalSubscribers);
|
||
|
}
|
||
|
|
||
|
public void deletePortalSubscribers(String pid) {
|
||
|
PortalSubscribers portalSubscribers = portalSubscribersDAO.findByPid(pid);
|
||
|
if(portalSubscribers != null) {
|
||
|
portalSubscribersDAO.delete(portalSubscribers.getId());
|
||
|
}
|
||
|
}
|
||
|
}
|