diff --git a/Roadmap for GBIF vocabularies.pdf b/Roadmap for GBIF vocabularies.pdf new file mode 100644 index 00000000..2c1a9ad6 Binary files /dev/null and b/Roadmap for GBIF vocabularies.pdf differ diff --git a/core/src/main/java/org/gbif/vocabulary/persistence/dto/LookupDto.java b/core/src/main/java/org/gbif/vocabulary/persistence/dto/LookupDto.java new file mode 100644 index 00000000..e69eea2d --- /dev/null +++ b/core/src/main/java/org/gbif/vocabulary/persistence/dto/LookupDto.java @@ -0,0 +1,16 @@ +package org.gbif.vocabulary.persistence.dto; + +import lombok.Data; +import org.gbif.vocabulary.model.LanguageRegion; + +@Data +public class LookupDto { + + private long key; + private String name; + private String label; + private LanguageRegion labelLang; + private String altLabel; + private LanguageRegion altLabelLang; + private String hiddenLabel; +} diff --git a/core/src/main/java/org/gbif/vocabulary/persistence/mappers/ConceptMapper.java b/core/src/main/java/org/gbif/vocabulary/persistence/mappers/ConceptMapper.java index bf17be3e..5ab80e89 100644 --- a/core/src/main/java/org/gbif/vocabulary/persistence/mappers/ConceptMapper.java +++ b/core/src/main/java/org/gbif/vocabulary/persistence/mappers/ConceptMapper.java @@ -13,6 +13,10 @@ */ package org.gbif.vocabulary.persistence.mappers; +import java.util.List; +import javax.annotation.Nullable; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import org.gbif.api.model.common.paging.Pageable; import org.gbif.vocabulary.model.Concept; import org.gbif.vocabulary.model.Definition; @@ -23,15 +27,9 @@ import org.gbif.vocabulary.model.search.ChildrenResult; import org.gbif.vocabulary.model.search.ConceptSearchParams; import org.gbif.vocabulary.model.search.KeyNameResult; +import org.gbif.vocabulary.persistence.dto.LookupDto; import org.gbif.vocabulary.persistence.dto.SuggestDto; -import java.util.List; - -import javax.annotation.Nullable; - -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - /** Mapper for {@link Concept}. */ @Mapper public interface ConceptMapper extends BaseMapper { @@ -197,4 +195,11 @@ List listHiddenLabelsLatestRelease( long countHiddenLabelsLatestRelease( @Param("entityKey") long entityKey, @Param("vocabName") String vocabularyName); + + List lookup(@Param("value") String value, @Param("vocabularyKey") long vocabularyKey); + + List lookupLatestRelease( + @Param("value") String value, + @Param("vocabularyKey") long vocabularyKey, + @Param("vocabName") String vocabularyName); } diff --git a/core/src/main/java/org/gbif/vocabulary/service/ConceptService.java b/core/src/main/java/org/gbif/vocabulary/service/ConceptService.java index 430d900f..3803a844 100644 --- a/core/src/main/java/org/gbif/vocabulary/service/ConceptService.java +++ b/core/src/main/java/org/gbif/vocabulary/service/ConceptService.java @@ -13,6 +13,11 @@ */ package org.gbif.vocabulary.service; +import java.util.List; +import javax.annotation.Nullable; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import org.gbif.api.model.common.paging.Pageable; import org.gbif.api.model.common.paging.PagingResponse; import org.gbif.vocabulary.model.Concept; @@ -23,15 +28,9 @@ import org.gbif.vocabulary.model.Tag; import org.gbif.vocabulary.model.search.ChildrenResult; import org.gbif.vocabulary.model.search.ConceptSearchParams; +import org.gbif.vocabulary.model.search.LookupResult; import org.gbif.vocabulary.model.search.SuggestResult; -import java.util.List; - -import javax.annotation.Nullable; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - /** Services for a {@link Concept}. */ public interface ConceptService extends BaseService { @@ -248,4 +247,26 @@ PagingResponse