Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
org.gradle.daemon=true
groovyVersion=4.0.27
spockVersion=2.3-groovy-4.0
groovyVersion=5.0.7
spockVersion=2.4-groovy-5.0
byteBuddyVersion = 1.17.6
codeNarcVersion=3.6.0-groovy-4.0
servletApiVersion = 4.0.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ class NotificationSender extends HouseKeeper {
private Map matches(String trigger, List changeObservationsForInstance) {
for (Object obj : changeObservationsForInstance) {
Map changeObservationMap = mapper.readValue( (String) obj, Map )
List graphList = changeObservationMap["@graph"]
Map mainEntity = graphList?[1]
String category = mainEntity?.category["@id"]
List graphList = (List) changeObservationMap["@graph"]
Map mainEntity = (Map) graphList?[1]
String category = (String) mainEntity?.category["@id"]
if (category && category == trigger)
return changeObservationMap
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class DatasetImporter {
continue
}
if (item[TYPE] == 'Dataset' && 'sourceData' in item) {
Map sourceRef = item['sourceData']
Map sourceRef = (Map) item['sourceData']

String sourceUrl = null
if (ID in sourceRef) {
Expand Down
6 changes: 3 additions & 3 deletions whelk-core/src/main/groovy/whelk/JsonLd.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class JsonLd {
static String getDisplayUri(String vocabUri, Map vocabData) {
for (Map node : (List<Map>) vocabData[GRAPH_KEY]) {
if (node[ID_KEY] == vocabUri) {
Map displayRef = node[DISPLAY_KEY]
Map displayRef = (Map) node[DISPLAY_KEY]
if (displayRef) {
return displayRef[ID_KEY]
}
Expand Down Expand Up @@ -620,7 +620,7 @@ class JsonLd {
else if (graphIndex > 1) {
p.add(0, graphIndex) // Normally there should only be @graph,0 and @graph,1
}
result.add(new Link(relation: p.join('.'), iri: value[ID_KEY]))
result.add(new Link(relation: p.join('.'), iri: (String) value[ID_KEY]))
}
return DocumentUtil.NOP
}
Expand Down Expand Up @@ -1394,7 +1394,7 @@ class JsonLd {

static void putRecordReferencesIntoThings(Map<String, Map> idMap) {
for (obj in idMap.values()) {
Map thingRef = obj[THING_KEY]
Map thingRef = (Map) obj[THING_KEY]
if (thingRef) {
String thingId = thingRef[ID_KEY]
Map thing = idMap[thingId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,17 @@ class DependencyCache {
log.info("dependenciesCache: ${dependenciesCache.stats()}")
}

private CacheLoader<Link, Set<String>> loader(BiFunction<String, String, Set> func) {
private CacheLoader<Link, Set<String>> loader(BiFunction<String, String, List<String>> func) {
return new CacheLoader<Link, Set<String>>() {
@Override
Set<String> load(Link link) {
try {
def iris = func.apply(storage.getSystemIdByThingId(link.iri), link.relation)
Collection<String> iris = func.apply(storage.getSystemIdByThingId(link.iri), link.relation)
.findResults (this.&tryGetThingMainIriBySystemId)

return iris.isEmpty()
? Collections.EMPTY_SET
: Collections.unmodifiableSet(new HashSet(iris))
: Collections.unmodifiableSet(new HashSet<String>(iris))
}
catch (MissingMainIriException e) {
log.warn("Missing Main IRI: $e")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ class ElasticSearch {
private final JsonLd jsonLd

private static final class DerivedLenses {
public static final FresnelUtil.Lens CARD_ONLY = new FresnelUtil.Lens(
public static final Lens CARD_ONLY = new FresnelUtil.Lens(
FresnelUtil.CARD_CHAIN,
FresnelUtil.Lenses.SEARCH_CHIP,
List.of(FresnelUtil.CHIP_CHAIN)
)

public static final FresnelUtil.Lens SEARCH_CARD_ONLY = new FresnelUtil.Lens(
public static final Lens SEARCH_CARD_ONLY = new FresnelUtil.Lens(
new FresnelUtil.LensGroupChain(FresnelUtil.SEARCH_CARDS),
FresnelUtil.Lenses.SEARCH_CHIP,
List.of(FresnelUtil.CHIP_CHAIN, FresnelUtil.CARD_CHAIN)
Expand Down Expand Up @@ -574,7 +574,7 @@ class ElasticSearch {
var embellishedNonIntegralGraphs = fullEmbellishedGraph.drop(mainGraph.size() + embellishedIntegralGraphs.size())
var shapedEmbellishedNonIntegralGraphs = shapeNonIntegralThings(whelk.fresnelUtil, embellishedNonIntegralGraphs)

copy.data[GRAPH_KEY] = shapedMainGraph + shapedEmbellishedIntegralGraphs + shapedEmbellishedNonIntegralGraphs
copy.data[GRAPH_KEY] = (List) shapedMainGraph + shapedEmbellishedIntegralGraphs + shapedEmbellishedNonIntegralGraphs

setIdentifiers(copy)
copy.setThingMeta(document.getCompleteId())
Expand Down
2 changes: 1 addition & 1 deletion whelk-core/src/main/groovy/whelk/search/ESQuery.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ class ESQuery {
private static Set getFieldsByCondition(Map mappings, Closure cond, String parentName) {
Set fields = [] as Set
if (mappings) {
(mappings['properties'] as Map)?.each { fieldName, fieldSettings ->
(mappings.get('properties') as Map)?.each { fieldName, fieldSettings ->
fields += getFieldsByCondition(fieldName as String, fieldSettings as Map, cond, parentName)
}
}
Expand Down
2 changes: 1 addition & 1 deletion whelk-core/src/main/groovy/whelk/search/ElasticFind.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ElasticFind {

private void fetchFirst() {
def firstResult = getter(0)
total = firstResult['totalHits']
total = (int) firstResult['totalHits']
if (total > esQuery.getMaxItems()) {
throw new ElasticSearch.TooManyResultsException(total, esQuery.getMaxItems())
}
Expand Down
14 changes: 7 additions & 7 deletions whelk-core/src/main/groovy/whelk/util/Romanizer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ class Romanizer {
Romanizer.class.getClassLoader().getResourceAsStream('romanizer/' + filename).getText("UTF-8")
}

interface Transform {
String sourceTag()
String targetTag()
String transform(String s)
default String toString() {"${getClass().getSimpleName().take(1)}(${sourceTag()} -> ${targetTag()})"}
static abstract class Transform {
abstract String sourceTag()
abstract String targetTag()
abstract String transform(String s)
String toString() {"${getClass().getSimpleName().take(1)}(${sourceTag()} -> ${targetTag()})"}
}

static class Auto implements Transform {
static class Auto extends Transform {
private String sourceTag
private Transliterator transliterator

Expand All @@ -138,7 +138,7 @@ class Romanizer {
}
}

static class Manual implements Transform {
static class Manual extends Transform {
private static final var SOURCE = Pattern.compile(".*-t-(.*?)(-\\p{Alpha}\\p{Digit}-.*)?\$")
private String sourceTag
private String targetTag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class QueryTreeSpec extends Specification {
given:
QueryTree queryTree = new QueryTree(q, disambiguate)
Node nodeToMatch = QueryTreeBuilder.buildTree(replace, disambiguate)
Node nodeToReplace = queryTree.allDescendants().find(nodeToMatch::equals)
Node nodeToReplace = queryTree.allDescendants().find { it == nodeToMatch }
Node replacementNode = QueryTreeBuilder.buildTree(replacement, disambiguate)

expect:
Expand Down
Loading