1
|
package eu.dnetlib.uoaadmintools.services;
|
2
|
|
3
|
import eu.dnetlib.uoaadmintools.dao.LayoutDAO;
|
4
|
import eu.dnetlib.uoaadmintools.entities.Layout;
|
5
|
import org.apache.log4j.Logger;
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
7
|
import org.springframework.stereotype.Service;
|
8
|
|
9
|
@Service
|
10
|
public class LayoutService {
|
11
|
private final Logger log = Logger.getLogger(this.getClass());
|
12
|
|
13
|
@Autowired
|
14
|
private LayoutDAO layoutDAO;
|
15
|
|
16
|
public void updatePid(String old_pid, String new_pid) {
|
17
|
Layout layout = layoutDAO.findByPortalPid(old_pid);
|
18
|
layout.setPortalPid(new_pid);
|
19
|
layoutDAO.save(layout);
|
20
|
}
|
21
|
|
22
|
public void deleteByPid(String pid) {
|
23
|
// TODO check maybe we can delete by portalId without find first
|
24
|
Layout layout = layoutDAO.findByPortalPid(pid);
|
25
|
if(layout != null) {
|
26
|
layoutDAO.delete(layout.getId());
|
27
|
}
|
28
|
}
|
29
|
|
30
|
public Layout findByPid(String pid) {
|
31
|
return layoutDAO.findByPortalPid(pid);
|
32
|
}
|
33
|
|
34
|
public Layout save(Layout layout) {
|
35
|
return layoutDAO.save(layout);
|
36
|
}
|
37
|
}
|