Commit 632fd4da authored by Matija Obreza's avatar Matija Obreza
Browse files

Integrated GeoRegionListener with FirstRunListener

parent e97cbc83
......@@ -17,6 +17,7 @@
package org.genesys2.server.listener.sample;
import org.genesys2.server.listener.RunAsAdminListener;
import org.genesys2.server.service.GeoRegionService;
import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService;
import org.genesys2.server.service.worker.InstituteUpdater;
......@@ -45,6 +46,9 @@ public class FirstRunListener extends RunAsAdminListener {
@Autowired
InstituteUpdater instituteUpdater;
@Autowired
GeoRegionService geoRegionService;
@Override
protected void init() throws Exception {
if (!createContent) {
......@@ -61,5 +65,11 @@ public class FirstRunListener extends RunAsAdminListener {
_logger.info("No WIEWS institutes found. Loading.");
instituteUpdater.updateFaoInstitutes();
}
if (geoRegionService.findAll().isEmpty()) {
_logger.info("No geoRegion data found. Loading");
geoRegionService.updateGeoRegionData();
}
}
}
package org.genesys2.server.listener.sample;
import org.genesys2.server.listener.RunAsAdminListener;
import org.genesys2.server.service.GeoRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class GeoRegionListener extends RunAsAdminListener {
@Autowired
GeoRegionService geoRegionService;
@Override
protected void init() throws Exception {
if (geoRegionService.findAll().isEmpty()) {
_logger.info("No geoRegion data found. Loading");
geoRegionService.updateGeoRegionData();
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment