Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
search
Commits
c5220d2b
Commit
c5220d2b
authored
Jan 19, 2022
by
Gradl, Tobias
Browse files
Updated some dependency versions
parent
667728cd
Pipeline
#31158
passed with stage
in 1 minute and 17 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
search-core/src/main/java/eu/dariah/de/search/controller/CollectionController.java
View file @
c5220d2b
...
...
@@ -28,12 +28,14 @@ import eu.dariah.de.search.pojo.DatasetPojo;
import
eu.dariah.de.search.pojo.DatasourcePojo
;
import
eu.dariah.de.search.pojo.EndpointPojo
;
import
eu.dariah.de.search.pojo.conversion.CollectionConverter
;
import
eu.dariah.de.search.query.execution.AggregationService
;
import
eu.dariah.de.search.service.CollectionService
;
import
eu.dariah.de.search.service.DatamodelService
;
@Controller
@RequestMapping
(
"/collections"
)
public
class
CollectionController
extends
BaseController
{
@Autowired
private
AggregationService
aggregationService
;
@Autowired
private
CollectionService
collectionService
;
@Autowired
private
CollectionConverter
collectionConverter
;
@Autowired
private
CollectionSyncService
crSyncService
;
...
...
@@ -72,7 +74,7 @@ public class CollectionController extends BaseController {
for
(
EndpointPojo
ep
:
c
.
getEndpoints
())
{
for
(
DatasetPojo
ds
:
ep
.
getDatasetPojos
())
{
if
(
ds
.
getDatamodelPojo
().
getIndexName
()!=
null
&&
!
ds
.
getDatamodelPojo
().
getIndexName
().
isEmpty
())
{
ds
.
setDocs
(
datamodel
Service
.
getDocumentCount
(
ds
.
getDatamodelPojo
().
getIndexName
(),
ep
.
getId
()));
ds
.
setDocs
(
aggregation
Service
.
getDocumentCount
(
ds
.
getDatamodelPojo
().
getIndexName
(),
ep
.
getId
()));
}
datasources
.
add
(
new
DatasourcePojo
(
c
,
ep
,
ds
));
}
...
...
search-core/src/main/java/eu/dariah/de/search/controller/CollectionEditorController.java
View file @
c5220d2b
...
...
@@ -33,6 +33,7 @@ import eu.dariah.de.search.pojo.DatasetPojo;
import
eu.dariah.de.search.pojo.EndpointPojo
;
import
eu.dariah.de.search.pojo.conversion.CollectionConverter
;
import
eu.dariah.de.search.pojo.conversion.CrawlConverter
;
import
eu.dariah.de.search.query.execution.AggregationService
;
import
eu.dariah.de.search.query.execution.DocumentService
;
import
eu.dariah.de.search.service.CrawlService
;
import
eu.dariah.de.search.service.CrawlService.CrawlCompleteFlag
;
...
...
@@ -44,7 +45,7 @@ import eu.dariah.de.search.service.DatamodelService;
@Controller
@RequestMapping
(
"/collections/{cId}/"
)
public
class
CollectionEditorController
extends
BaseController
{
@Autowired
private
AggregationService
aggregationService
;
@Autowired
private
CollectionService
collectionService
;
@Autowired
private
CollectionConverter
collectionConverter
;
...
...
@@ -86,7 +87,7 @@ public class CollectionEditorController extends BaseController {
ExtendedDatamodelContainer
esc
=
datamodelService
.
findById
(
dmId
);
ModelActionPojo
result
=
new
ModelActionPojo
();
if
(
esc
!=
null
)
{
result
.
setPojo
(
datamodel
Service
.
getDocumentCount
(
esc
.
getIndexName
(),
epId
));
result
.
setPojo
(
aggregation
Service
.
getDocumentCount
(
esc
.
getIndexName
(),
epId
));
result
.
setSuccess
(
true
);
}
return
result
;
...
...
@@ -233,7 +234,7 @@ public class CollectionEditorController extends BaseController {
for
(
DatasetPojo
ds
:
ep
.
getDatasetPojos
())
{
esc
=
datamodelService
.
findById
(
ds
.
getId
());
if
(
esc
!=
null
)
{
ds
.
setDocs
(
datamodel
Service
.
getDocumentCount
(
esc
.
getIndexName
(),
ep
.
getId
()));
ds
.
setDocs
(
aggregation
Service
.
getDocumentCount
(
esc
.
getIndexName
(),
ep
.
getId
()));
}
if
(
dmId
==
null
||
ds
.
getId
().
equals
(
dmId
))
{
dmId
=
ds
.
getId
();
...
...
search-core/src/main/java/eu/dariah/de/search/controller/DatamodelController.java
View file @
c5220d2b
...
...
@@ -32,11 +32,13 @@ import eu.dariah.de.search.mapping.MappingGenerationService;
import
eu.dariah.de.search.model.ExtendedDatamodelContainer
;
import
eu.dariah.de.search.pojo.DatamodelPojo
;
import
eu.dariah.de.search.pojo.conversion.DatamodelConverter
;
import
eu.dariah.de.search.query.execution.AggregationService
;
import
eu.dariah.de.search.service.DatamodelService
;
@Controller
@RequestMapping
(
"/datamodels"
)
public
class
DatamodelController
extends
BaseController
{
@Autowired
private
AggregationService
aggregationService
;
@Autowired
private
DatamodelService
datamodelService
;
@Autowired
private
DatamodelConverter
datamodelConverter
;
@Autowired
private
MappingGenerationService
mappingGenerationService
;
...
...
@@ -79,7 +81,7 @@ public class DatamodelController extends BaseController {
}
dmPojo
=
datamodelConverter
.
convert
(
dm
);
if
(!
dmPojo
.
isDeleted
())
{
dmPojo
.
setDocs
(
datamodel
Service
.
getDocumentCount
(
dmPojo
.
getIndexName
()));
dmPojo
.
setDocs
(
aggregation
Service
.
getDocumentCount
(
dmPojo
.
getIndexName
()));
}
dmPojos
.
add
(
dmPojo
);
}
...
...
search-core/src/main/java/eu/dariah/de/search/query/execution/AggregationService.java
View file @
c5220d2b
...
...
@@ -16,6 +16,8 @@ public interface AggregationService {
// Count all of index
public
long
getDocumentCount
(
String
indexName
);
// Count for index and endpointId
public
long
getDocumentCount
(
String
indexName
,
String
endpointId
);
// Count all by query and index
public
long
getDocumentCount
(
String
indexName
,
QueryBuilder
qry
);
...
...
search-core/src/main/java/eu/dariah/de/search/query/execution/AggregationServiceImpl.java
View file @
c5220d2b
...
...
@@ -48,6 +48,11 @@ public class AggregationServiceImpl extends BaseQueryService implements Aggregat
return
searchService
.
count
(
qry
,
indexName
);
}
@Override
public
long
getDocumentCount
(
String
indexName
,
String
endpointId
)
{
return
this
.
getDocumentCount
(
indexName
,
QueryBuilders
.
termQuery
(
Constants
.
ELEMENT_KEY_ENDPOINT_ID
,
endpointId
));
}
@Override
public
long
getDocumentCount
(
QueryBuilder
qry
)
{
return
searchService
.
count
(
qry
);
...
...
search-core/src/main/java/eu/dariah/de/search/service/DatamodelService.java
View file @
c5220d2b
...
...
@@ -29,11 +29,7 @@ public interface DatamodelService {
public
List
<
ExtendedDatamodelContainer
>
findAll
(
boolean
rebuildCache
);
//public void saveOrUpdate(ExtendedDatamodelContainer sc, JsonNode mapping);
public
long
getDocumentCount
(
String
indexName
);
public
long
getDocumentCount
(
String
indexName
,
String
endpointId
);
/**
* Loads individual datamodel from storage. All caching mechanisms of the DatamodelService are bypassed.
*
...
...
search-core/src/main/java/eu/dariah/de/search/service/DatamodelServiceImpl.java
View file @
c5220d2b
...
...
@@ -4,22 +4,17 @@ import java.util.ArrayList;
import
java.util.Hashtable
;
import
java.util.List
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
de.unibamberg.minf.dme.model.datamodel.base.Datamodel
;
import
eu.dariah.de.search.Constants
;
import
eu.dariah.de.search.dao.fs.DatamodelConfigDao
;
import
eu.dariah.de.search.es.service.AdminService
;
import
eu.dariah.de.search.model.ExtendedDatamodelContainer
;
import
eu.dariah.de.search.query.execution.AggregationService
;
@Component
public
class
DatamodelServiceImpl
implements
DatamodelService
,
InitializingBean
{
...
...
@@ -27,7 +22,6 @@ public class DatamodelServiceImpl implements DatamodelService, InitializingBean
@Autowired
private
DatamodelConfigDao
datamodelConfigDao
;
@Autowired
private
AdminService
adminService
;
@Autowired
private
AggregationService
aggregationService
;
// Hashtable is synchronized
private
Hashtable
<
String
,
ExtendedDatamodelContainer
>
schemaMap
;
...
...
@@ -158,18 +152,6 @@ public class DatamodelServiceImpl implements DatamodelService, InitializingBean
logger
.
error
(
"Failed to drop index of deleted datamodel"
,
e
);
}
}
@Override
public
long
getDocumentCount
(
String
indexName
,
String
endpointId
)
{
Assert
.
notNull
(
endpointId
);
return
aggregationService
.
getDocumentCount
(
indexName
,
QueryBuilders
.
termQuery
(
Constants
.
ELEMENT_KEY_ENDPOINT_ID
,
endpointId
));
}
@Override
public
long
getDocumentCount
(
String
indexName
)
{
return
aggregationService
.
getDocumentCount
(
indexName
);
}
@Override
public
boolean
clearIndex
(
ExtendedDatamodelContainer
sc
,
JsonNode
mapping
)
{
...
...
search-ui/src/main/java/eu/dariah/de/search/config/WebConfig.java
View file @
c5220d2b
...
...
@@ -133,12 +133,12 @@ public class WebConfig implements WebMvcConfigurer {
return
initService
;
}
@Bean
/*
@Bean
public LocaleResolver localeResolver() {
final SessionLocaleResolver localeResolver = new SessionLocaleResolver();
localeResolver.setDefaultLocale(new Locale("de", "DE"));
return localeResolver;
}
}
*/
@Bean
public
UserLocaleChangeInterceptor
localeChangeInterceptor
()
{
...
...
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