Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search
Commits
cf3dfc99
Commit
cf3dfc99
authored
Jan 18, 2022
by
Gradl, Tobias
Browse files
446: Reimplement automatic online and offline crawl capabilities
(OPENED) Task-Url:
#446
parent
acfdbe19
Changes
5
Hide whitespace changes
Inline
Side-by-side
search-core/src/main/java/eu/dariah/de/search/controller/CollectionController.java
View file @
cf3dfc99
...
...
@@ -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
s
yncService
;
@Autowired
private
CollectionSyncService
crS
yncService
;
@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
)
{
s
yncService
.
callAsync
();
crS
yncService
.
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
(
s
yncService
.
getServiceStatus
());
result
.
setPojo
(
crS
yncService
.
getServiceStatus
());
return
result
;
}
...
...
@@ -95,9 +102,9 @@ public class CollectionController extends BaseController {
ModelActionPojo
result
=
new
ModelActionPojo
(
true
);
ObjectNode
pojo
=
objectMapper
.
createObjectNode
();
pojo
.
put
(
"last"
,
s
yncService
.
getTimestampOfLastExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
s
yncService
.
getTimestampOfLastExecution
()));
pojo
.
put
(
"next"
,
s
yncService
.
getTimestampOfPlannedExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
s
yncService
.
getTimestampOfPlannedExecution
()));
pojo
.
put
(
"active"
,
s
yncService
.
isInProgress
());
pojo
.
put
(
"last"
,
crS
yncService
.
getTimestampOfLastExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
crS
yncService
.
getTimestampOfLastExecution
()));
pojo
.
put
(
"next"
,
crS
yncService
.
getTimestampOfPlannedExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
crS
yncService
.
getTimestampOfPlannedExecution
()));
pojo
.
put
(
"active"
,
crS
yncService
.
isInProgress
());
result
.
setPojo
(
pojo
);
...
...
search-core/src/main/java/eu/dariah/de/search/controller/DatamodelController.java
View file @
cf3dfc99
...
...
@@ -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
s
yncService
;
@Autowired
private
DmeSyncService
dmeS
yncService
;
@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
)
{
s
yncService
.
callAsync
();
dmeS
yncService
.
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
(
s
yncService
.
getServiceStatus
());
result
.
setPojo
(
dmeS
yncService
.
getServiceStatus
());
return
result
;
}
...
...
@@ -125,9 +131,9 @@ public class DatamodelController extends BaseController {
ModelActionPojo
result
=
new
ModelActionPojo
(
true
);
ObjectNode
pojo
=
objectMapper
.
createObjectNode
();
pojo
.
put
(
"last"
,
s
yncService
.
getTimestampOfLastExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
s
yncService
.
getTimestampOfLastExecution
()));
pojo
.
put
(
"next"
,
s
yncService
.
getTimestampOfPlannedExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
s
yncService
.
getTimestampOfPlannedExecution
()));
pojo
.
put
(
"active"
,
s
yncService
.
isInProgress
());
pojo
.
put
(
"last"
,
dmeS
yncService
.
getTimestampOfLastExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
dmeS
yncService
.
getTimestampOfLastExecution
()));
pojo
.
put
(
"next"
,
dmeS
yncService
.
getTimestampOfPlannedExecution
()==
null
?
null
:
DateTimeFormat
.
forStyle
(
"LL"
).
withLocale
(
locale
).
print
(
dmeS
yncService
.
getTimestampOfPlannedExecution
()));
pojo
.
put
(
"active"
,
dmeS
yncService
.
isInProgress
());
result
.
setPojo
(
pojo
);
...
...
i18n
@
60db673c
Compare
9b735064
...
60db673c
Subproject commit
9b73506483a4159053f603fe949ffeba464e7761
Subproject commit
60db673cb20da87f563e04fc8aa05b09e72b89b4
_search-commons
@
df676958
Compare
3691ef1e
...
df676958
Subproject commit
3691ef1e5a00f1519b68e040baa1d5cb88e705b
e
Subproject commit
df67695877aa86e7ce77434952e886a616b7303
e
resources
@
b951057e
Compare
e29ade95
...
b951057e
Subproject commit
e29ade95b184b3844aa31f2e06dace62022b1174
Subproject commit
b951057e62d916791f2509a861e58f8c317c2e00
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment