TaxonomyService.java
/*
* Copyright 2020 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.server.service;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.genesys.server.model.genesys.Taxonomy2;
import org.genesys.server.model.grin.TaxonomySpecies;
import org.genesys.server.service.filter.TaxonomyExtraFilter;
import org.genesys.server.service.filter.TaxonomyFilter;
import org.genesys.server.service.filter.TaxonomySpeciesFilter;
import org.genesys.server.exception.SearchException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
public interface TaxonomyService {
List<String> autocompleteGenus(String term);
List<String> autocompleteSpecies(String term, List<String> genus);
List<String> autocompleteTaxonomy(String term);
List<String> autocompleteSubtaxa(String term, List<String> genus, List<String> species);
long getTaxonomy2Id(String genus);
long getTaxonomy2Id(String genus, String species);
long countTaxonomy2();
Taxonomy2 get(Long id);
Taxonomy2 get(String genus);
List<Taxonomy2> list(TaxonomyFilter filter);
Page<Taxonomy2Info> list(TaxonomyExtraFilter filter, Pageable page);
Page<TaxonomySpecies> listSpecies(TaxonomySpeciesFilter filter, Pageable page) throws SearchException;
Taxonomy2 setGrinSpecies(long taxonomy2Id, Long customGrinSpeciesId);
List<String> getAllGenera();
Taxonomy2 get(String genus, String species);
Taxonomy2 find(String genus, String species, String spAuthor, String subtaxa, String subtAuthor);
Taxonomy2 internalEnsure(String genus, String species, String spAuthor, String subtaxa, String subtAuthor) throws InterruptedException;
List<Long> findByGenus(List<String> genus);
void cleanupTaxonomies();
Taxonomy2 ensureTaxonomy(Taxonomy2 source);
List<Long> findTaxonomy2GenusId(List<String> genera);
List<Long> findTaxonomy2SpeciesId(List<String> speciesNames);
List<Long> findGrinGenusId(List<String> genera);
List<Long> findGrinSpeciesId(List<String> speciesNames);
public static class Taxonomy2Info implements Serializable {
private static final long serialVersionUID = 2114693656081783236L;
@JsonUnwrapped
public Taxonomy2 taxonomy;
public Long accessionCount;
public static Taxonomy2Info from(Taxonomy2 taxonomy, Long accessionCount) {
Taxonomy2Info taxonomy2Info = new Taxonomy2Info();
taxonomy2Info.taxonomy = taxonomy;
taxonomy2Info.accessionCount = accessionCount;
return taxonomy2Info;
}
}
List<Long> findTaxonomy2ByGrinGenus(List<String> genus);
List<Long> findTaxonomy2ByCurrentGrinGenus(List<String> genus);
List<Long> findTaxonomy2ByGrinSpecies(List<String> genusSpecies);
List<Long> findTaxonomy2ByCurrentGrinSpecies(List<String> genusSpecies);
List<Long> findTaxonomy2ByGrinNames(List<String> names);
List<Long> findTaxonomy2ByCurrentGrinNames(List<String> names);
List<Long> listTaxonomy2ByGrinId(Collection<Long> grinId);
List<Long> listTaxonomy2ByCurrentGrinId(Collection<Long> grinId);
/** Populate blank Taxonomy2.family using GRIN species.genus.family.name */
void updateFamilyNames();
}