Skip to content

Commit

Permalink
Merge branch 'master' into dev_jdk8
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Jun 10, 2024
2 parents 6e5e7e8 + 9daea0d commit e8c0be0
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>vocabulary-parent</artifactId>
<groupId>org.gbif.vocabulary</groupId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gbif.vocabulary</groupId>
<artifactId>vocabulary-parent</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>

<artifactId>core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gbif.vocabulary</groupId>
<artifactId>vocabulary-parent</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>

<artifactId>model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<groupId>org.gbif.vocabulary</groupId>
<artifactId>vocabulary-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>

<modules>
<module>core</module>
Expand Down
2 changes: 1 addition & 1 deletion tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>vocabulary-parent</artifactId>
<groupId>org.gbif.vocabulary</groupId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion vocabulary-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>vocabulary-parent</artifactId>
<groupId>org.gbif.vocabulary</groupId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 1 addition & 3 deletions vocabulary-importer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,10 @@ This tool can be run via command line by sending these params:
* *--csvDelimiter, -d (Optional)*

Delimiter of the CSV files for concepts and hidden labels. If not specified it uses a comma (",").
Note that some delimiters may need to be escaped for Java, e.g.: \\\\|

* *--listDelimiter, -ld (Optional)*

Delimiter to specify multiple values in the alternative labels. If not specified it uses a pipe ("|").
Note that some delimiters may need to be escaped for Java, e.g.: \\\\|
Delimiter to specify multiple values in the alternative labels. If not specified it uses a pipe ("|")

* *--apiUrl, -a*

Expand Down
4 changes: 2 additions & 2 deletions vocabulary-importer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<parent>
<groupId>org.gbif.vocabulary</groupId>
<artifactId>vocabulary-parent</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>vocabulary-importer</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>

<properties>
<main.basedir>${project.parent.basedir}</main.basedir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ public class Fields {
static final String TAGS = "TAGS";

static final List<String> CONCEPT_FIELDS =
Arrays.asList(CONCEPT, PARENT, SAME_AS_URIS, EXTERNAL_DEFINITIONS);
Arrays.asList(CONCEPT, PARENT, SAME_AS_URIS, EXTERNAL_DEFINITIONS, TAGS);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;

Expand Down Expand Up @@ -566,7 +567,8 @@ private ConceptData parseConceptFields(
if (headersIndexes.containsKey(SAME_AS_URIS)
&& !Strings.isNullOrEmpty(values[headersIndexes.get(SAME_AS_URIS)])) {
Set<URI> sameAsUris = new HashSet<>();
String[] urisValues = values[headersIndexes.get(SAME_AS_URIS)].split(listDelimiter);
String[] urisValues =
values[headersIndexes.get(SAME_AS_URIS)].split(Pattern.quote(listDelimiter));
for (String uri : urisValues) {
try {
sameAsUris.add(URI.create(uri.trim()));
Expand All @@ -582,7 +584,8 @@ private ConceptData parseConceptFields(
if (headersIndexes.containsKey(EXTERNAL_DEFINITIONS)
&& !Strings.isNullOrEmpty(values[headersIndexes.get(SAME_AS_URIS)])) {
Set<URI> externalDefinitions = new HashSet<>();
String[] externalDefsValues = values[headersIndexes.get(SAME_AS_URIS)].split(listDelimiter);
String[] externalDefsValues =
values[headersIndexes.get(SAME_AS_URIS)].split(Pattern.quote(listDelimiter));
for (String definition : externalDefsValues) {
try {
externalDefinitions.add(URI.create(definition.trim()));
Expand All @@ -597,7 +600,7 @@ private ConceptData parseConceptFields(
// tags
if (headersIndexes.containsKey(TAGS)
&& !Strings.isNullOrEmpty(values[headersIndexes.get(TAGS)])) {
String[] tagsValues = values[headersIndexes.get(TAGS)].split(listDelimiter);
String[] tagsValues = values[headersIndexes.get(TAGS)].split(Pattern.quote(listDelimiter));
conceptData.tags =
Arrays.stream(tagsValues)
.filter(s -> !Strings.isNullOrEmpty(s))
Expand Down Expand Up @@ -628,7 +631,7 @@ private static List<Label> parseAlternativeLabels(
List<Label> alternativeLabels = new ArrayList<>();
alternativeLabelsIndexes.forEach(
(lang, index) ->
Stream.of(values[index].split(listDelimiter))
Stream.of(values[index].split(Pattern.quote(listDelimiter)))
.filter(s -> !s.isEmpty())
.map(String::trim)
.forEach(
Expand Down
2 changes: 1 addition & 1 deletion vocabulary-lookup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>vocabulary-parent</artifactId>
<groupId>org.gbif.vocabulary</groupId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion vocabulary-rest-ws-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>vocabulary-parent</artifactId>
<groupId>org.gbif.vocabulary</groupId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion vocabulary-rest-ws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.gbif.vocabulary</groupId>
<artifactId>vocabulary-parent</artifactId>
<version>1.0.8-SNAPSHOT</version>
<version>1.0.9-SNAPSHOT</version>
</parent>

<artifactId>vocabulary-rest-ws</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@
RequestHeaderParamUpdateFilter.class
})
@ComponentScan(
basePackages = {"org.gbif.vocabulary.restws", "org.gbif.ws.remoteauth"},
basePackages = {
"org.gbif.vocabulary.restws",
"org.gbif.ws.remoteauth",
"org.gbif.ws.server.interceptor"
},
excludeFilters = {@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE)})
@EnableConfigurationProperties({
ExportConfig.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package org.gbif.vocabulary.restws.resources;

import org.gbif.api.annotation.Trim;
import org.gbif.api.model.common.paging.Pageable;
import org.gbif.api.model.common.paging.PagingResponse;
import org.gbif.vocabulary.model.Tag;
Expand Down Expand Up @@ -97,7 +98,7 @@ public Tag getTag(@PathVariable("name") String tagName) {
@Docs.DefaultUnsuccessfulReadResponses
@Docs.DefaultUnsuccessfulWriteResponses
@PostMapping
public Tag create(@RequestBody Tag tag) {
public Tag create(@RequestBody @Trim Tag tag) {
int key = tagService.create(tag);
return tagService.get(key);
}
Expand All @@ -115,7 +116,7 @@ public Tag create(@RequestBody Tag tag) {
@Docs.DefaultUnsuccessfulReadResponses
@Docs.DefaultUnsuccessfulWriteResponses
@PutMapping("{name}")
public Tag update(@PathVariable("name") String tagName, @RequestBody Tag tag) {
public Tag update(@PathVariable("name") String tagName, @RequestBody @Trim Tag tag) {
Tag oldTag = tagService.getByName(tagName);
checkArgument(oldTag != null, "Tag not found for name " + tagName);
checkArgument(
Expand Down

0 comments on commit e8c0be0

Please sign in to comment.