Commit cf3dfc99 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

446: Reimplement automatic online and offline crawl capabilities

(OPENED)

Task-Url: #446
parent acfdbe19
......@@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import de.unibamberg.minf.core.web.controller.DataTableList;
import de.unibamberg.minf.core.web.pojo.ModelActionPojo;
import eu.dariah.de.search.automation.CollectionSyncService;
import eu.dariah.de.search.config.CrawlingConfigProperties;
import eu.dariah.de.search.pojo.CollectionPojo;
import eu.dariah.de.search.pojo.DatasetPojo;
import eu.dariah.de.search.pojo.DatasourcePojo;
......@@ -33,9 +34,11 @@ import eu.dariah.de.search.service.DatamodelService;
public class CollectionController extends BaseController {
@Autowired private CollectionService collectionService;
@Autowired private CollectionConverter collectionConverter;
@Autowired private CollectionSyncService syncService;
@Autowired private CollectionSyncService crSyncService;
@Autowired private DatamodelService datamodelService;
@Autowired private CrawlingConfigProperties crawlingConfig;
public CollectionController() {
super("collections");
}
......@@ -49,6 +52,10 @@ public class CollectionController extends BaseController {
@RequestMapping(method=GET, value="/")
public String listDatasources(Model model, Locale locale) {
model.addAttribute("colregUrl", apiConfig.getColreg().getBaseUrl());
model.addAttribute("autoOnline", crawlingConfig.getAutomation().isOnline());
model.addAttribute("autoOffline", crawlingConfig.getAutomation().isOffline());
model.addAttribute("autoSyncCr", crSyncService.isAutosync());
return "collections/list";
}
......@@ -74,7 +81,7 @@ public class CollectionController extends BaseController {
@RequestMapping(method=GET, value={"/async/triggerColregSync"})
public @ResponseBody ModelActionPojo triggerColRegSync(Model model, Locale locale) {
syncService.callAsync();
crSyncService.callAsync();
ModelActionPojo result = new ModelActionPojo();
result.setSuccess(true);
......@@ -85,7 +92,7 @@ public class CollectionController extends BaseController {
public @ResponseBody ModelActionPojo getColregStatus(Model model, Locale locale) {
ModelActionPojo result = new ModelActionPojo(true);
result.setPojo(syncService.getServiceStatus());
result.setPojo(crSyncService.getServiceStatus());
return result;
}
......@@ -95,9 +102,9 @@ public class CollectionController extends BaseController {
ModelActionPojo result = new ModelActionPojo(true);
ObjectNode pojo = objectMapper.createObjectNode();
pojo.put("last", syncService.getTimestampOfLastExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(syncService.getTimestampOfLastExecution()));
pojo.put("next", syncService.getTimestampOfPlannedExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(syncService.getTimestampOfPlannedExecution()));
pojo.put("active", syncService.isInProgress());
pojo.put("last", crSyncService.getTimestampOfLastExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(crSyncService.getTimestampOfLastExecution()));
pojo.put("next", crSyncService.getTimestampOfPlannedExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(crSyncService.getTimestampOfPlannedExecution()));
pojo.put("active", crSyncService.isInProgress());
result.setPojo(pojo);
......
......@@ -25,6 +25,7 @@ import de.unibamberg.minf.core.web.controller.DataTableList;
import de.unibamberg.minf.core.web.pojo.MessagePojo;
import de.unibamberg.minf.core.web.pojo.ModelActionPojo;
import eu.dariah.de.search.automation.DmeSyncService;
import eu.dariah.de.search.config.CrawlingConfigProperties;
import eu.dariah.de.search.config.MainConfigProperties;
import eu.dariah.de.search.mapping.MappingGenerationService;
import eu.dariah.de.search.model.ExtendedDatamodelContainer;
......@@ -38,9 +39,10 @@ public class DatamodelController extends BaseController {
@Autowired private DatamodelService datamodelService;
@Autowired private DatamodelConverter datamodelConverter;
@Autowired private MappingGenerationService mappingGenerationService;
@Autowired private DmeSyncService syncService;
@Autowired private DmeSyncService dmeSyncService;
@Autowired private MainConfigProperties config;
@Autowired private CrawlingConfigProperties crawlingConfig;
public DatamodelController() {
super("datamodels");
......@@ -54,7 +56,11 @@ public class DatamodelController extends BaseController {
@RequestMapping(method=GET, value="/")
public String listDatamodels(Model model, Locale locale) {
model.addAttribute("dmeUrl", apiConfig.getDme().getBaseUrl());
model.addAttribute("dmeUrl", apiConfig.getDme().getBaseUrl());
model.addAttribute("autoOnline", crawlingConfig.getAutomation().isOnline());
model.addAttribute("autoOffline", crawlingConfig.getAutomation().isOffline());
model.addAttribute("autoSyncDme", dmeSyncService.isAutosync());
return "datamodels/list";
}
......@@ -103,7 +109,7 @@ public class DatamodelController extends BaseController {
@RequestMapping(method=GET, value={"/async/triggerSync"})
public @ResponseBody ModelActionPojo triggerColRegSync(Model model, Locale locale) {
syncService.callAsync();
dmeSyncService.callAsync();
ModelActionPojo result = new ModelActionPojo();
result.setSuccess(true);
......@@ -115,7 +121,7 @@ public class DatamodelController extends BaseController {
public @ResponseBody ModelActionPojo getDmeStatus(Model model, Locale locale) {
ModelActionPojo result = new ModelActionPojo(true);
result.setPojo(syncService.getServiceStatus());
result.setPojo(dmeSyncService.getServiceStatus());
return result;
}
......@@ -125,9 +131,9 @@ public class DatamodelController extends BaseController {
ModelActionPojo result = new ModelActionPojo(true);
ObjectNode pojo = objectMapper.createObjectNode();
pojo.put("last", syncService.getTimestampOfLastExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(syncService.getTimestampOfLastExecution()));
pojo.put("next", syncService.getTimestampOfPlannedExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(syncService.getTimestampOfPlannedExecution()));
pojo.put("active", syncService.isInProgress());
pojo.put("last", dmeSyncService.getTimestampOfLastExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(dmeSyncService.getTimestampOfLastExecution()));
pojo.put("next", dmeSyncService.getTimestampOfPlannedExecution()==null ? null : DateTimeFormat.forStyle("LL").withLocale(locale).print(dmeSyncService.getTimestampOfPlannedExecution()));
pojo.put("active", dmeSyncService.isInProgress());
result.setPojo(pojo);
......
Subproject commit 9b73506483a4159053f603fe949ffeba464e7761
Subproject commit 60db673cb20da87f563e04fc8aa05b09e72b89b4
Subproject commit 3691ef1e5a00f1519b68e040baa1d5cb88e705be
Subproject commit df67695877aa86e7ce77434952e886a616b7303e
Subproject commit e29ade95b184b3844aa31f2e06dace62022b1174
Subproject commit b951057e62d916791f2509a861e58f8c317c2e00
Supports Markdown
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