38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package eu.dnetlib.uoaadmintools.services;
|
|
|
|
import eu.dnetlib.uoaadmintools.dao.LayoutDAO;
|
|
import eu.dnetlib.uoaadmintools.entities.Layout;
|
|
import org.apache.log4j.Logger;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class LayoutService {
|
|
private final Logger log = Logger.getLogger(this.getClass());
|
|
|
|
@Autowired
|
|
private LayoutDAO layoutDAO;
|
|
|
|
public void updatePid(String old_pid, String new_pid) {
|
|
Layout layout = layoutDAO.findByPortalPid(old_pid);
|
|
layout.setPortalPid(new_pid);
|
|
layoutDAO.save(layout);
|
|
}
|
|
|
|
public void deleteByPid(String pid) {
|
|
// TODO check maybe we can delete by portalId without find first
|
|
Layout layout = layoutDAO.findByPortalPid(pid);
|
|
if(layout != null) {
|
|
layoutDAO.delete(layout.getId());
|
|
}
|
|
}
|
|
|
|
public Layout findByPid(String pid) {
|
|
return layoutDAO.findByPortalPid(pid);
|
|
}
|
|
|
|
public Layout save(Layout layout) {
|
|
return layoutDAO.save(layout);
|
|
}
|
|
}
|