package eu.dnetlib.server.adminpanel;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import eu.dnetlib.client.adminpanel.DashboardDataService;
import eu.dnetlib.espas.gui.server.user.UserDAO;
import eu.dnetlib.shared.dashboard.DashboardData;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;

/**
 * Created by antleb on 11/9/15.
 */
public class DashboardDataServiceImpl extends RemoteServiceServlet implements DashboardDataService {
	private DashboardServiceCore core;

	public void init(ServletConfig config) throws ServletException {

		super.init(config);
		ApplicationContext context = WebApplicationContextUtils
				.getWebApplicationContext(getServletContext());

			core = (DashboardServiceCore) context.getBean("espas.admin.dashboardCore");
	}

	@Override
	public DashboardData getDashboardData() throws Exception {
		return core.getDashboardData();
	}
}
