Commit 9a9f0cbc authored by Matija Obreza's avatar Matija Obreza
Browse files

Use Taxonomy2 instead of old Taxonomy

parent 3b99eddf
...@@ -23,7 +23,6 @@ import javax.persistence.Entity; ...@@ -23,7 +23,6 @@ import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.genesys2.server.lucene.genesys.AccessionBridge; import org.genesys2.server.lucene.genesys.AccessionBridge;
import org.genesys2.server.model.VersionedAuditedModel; import org.genesys2.server.model.VersionedAuditedModel;
...@@ -33,7 +32,10 @@ import org.hibernate.search.annotations.ClassBridge; ...@@ -33,7 +32,10 @@ import org.hibernate.search.annotations.ClassBridge;
import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.Indexed;
@Entity @Entity
@Table(name = "accession", uniqueConstraints = { @UniqueConstraint(columnNames = { "instCode", "acceNumb", "genus" }) }) @Table(name = "accession")
// TODO FIXME Reenable
// @Table(name = "accession", uniqueConstraints = {
// @UniqueConstraint(columnNames = { "instCode", "acceNumb", "taxGenus" }) })
@Indexed @Indexed
@ClassBridge(name = "body", impl = AccessionBridge.class) @ClassBridge(name = "body", impl = AccessionBridge.class)
public class Accession extends VersionedAuditedModel { public class Accession extends VersionedAuditedModel {
...@@ -54,11 +56,11 @@ public class Accession extends VersionedAuditedModel { ...@@ -54,11 +56,11 @@ public class Accession extends VersionedAuditedModel {
@ManyToOne(cascade = {}, optional = true) @ManyToOne(cascade = {}, optional = true)
@JoinColumn(name = "taxonomyId") @JoinColumn(name = "taxonomyId")
private Taxonomy taxonomy; private Taxonomy taxonomy1;
@ManyToOne(cascade = {}, optional = false) @ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "taxonomyId2") @JoinColumn(name = "taxonomyId2")
private Taxonomy2 taxonomy2; private Taxonomy2 taxonomy;
@Column(name = "acqSrc", length = 3) @Column(name = "acqSrc", length = 3)
private String acquisitionSource; private String acquisitionSource;
...@@ -136,13 +138,13 @@ public class Accession extends VersionedAuditedModel { ...@@ -136,13 +138,13 @@ public class Accession extends VersionedAuditedModel {
} }
public Taxonomy getTaxonomy1() { public Taxonomy getTaxonomy1() {
return this.taxonomy; return this.taxonomy1;
} }
public Taxonomy2 getTaxonomy() { public Taxonomy2 getTaxonomy() {
return this.taxonomy2; return this.taxonomy;
} }
public String getAcquisitionSource() { public String getAcquisitionSource() {
return this.acquisitionSource; return this.acquisitionSource;
} }
...@@ -231,7 +233,6 @@ public class Accession extends VersionedAuditedModel { ...@@ -231,7 +233,6 @@ public class Accession extends VersionedAuditedModel {
this.mlsStatus = mlsStatus; this.mlsStatus = mlsStatus;
} }
public long getTaxGenus() { public long getTaxGenus() {
return taxGenus; return taxGenus;
} }
...@@ -249,7 +250,11 @@ public class Accession extends VersionedAuditedModel { ...@@ -249,7 +250,11 @@ public class Accession extends VersionedAuditedModel {
} }
public void setTaxonomy(Taxonomy2 taxonomy2) { public void setTaxonomy(Taxonomy2 taxonomy2) {
this.taxonomy2 = taxonomy2; this.taxonomy = taxonomy2;
}
public void setTaxonomy1(Taxonomy taxonomy1) {
this.taxonomy1 = taxonomy1;
} }
@Override @Override
......
...@@ -38,8 +38,8 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> { ...@@ -38,8 +38,8 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query(countQuery = "select count(*) from accession a where a.institute = ?1") @Query(countQuery = "select count(*) from accession a where a.institute = ?1")
Page<Accession> findByInstitute(FaoInstitute institute, Pageable pageable); Page<Accession> findByInstitute(FaoInstitute institute, Pageable pageable);
@Query(countQuery = "select count(*) from accession a where a.genus = ?1") @Query(countQuery = "select count(*) from accession a where a.taxGenus = ?1")
Page<Accession> findByGenus(String genus, Pageable pageable); Page<Accession> findByTaxGenus(long taxonomyId, Pageable pageable);
List<Accession> findByInstitute(FaoInstitute institute); List<Accession> findByInstitute(FaoInstitute institute);
...@@ -53,8 +53,9 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> { ...@@ -53,8 +53,9 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
Page<Object[]> statisticsTaxonomyInInstitute(FaoInstitute institute, Pageable pageable); Page<Object[]> statisticsTaxonomyInInstitute(FaoInstitute institute, Pageable pageable);
// FIXME Slow query // FIXME Slow query
@Query(value = "select ct.crop, count(a) from Accession a inner join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1 group by ct.crop order by count(a) desc", countQuery = "select count(distinct ct.crop) from Accession a inner join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1") // FIXME TOOD taxonomy1!
Page<Object[]> statisticsCropInInstitute(FaoInstitute institute, Pageable pageable); // @Query(value = "select ct.crop, count(a) from Accession a inner join a.taxonomy1 t join t.cropTaxonomies ct where a.institute = ?1 group by ct.crop order by count(a) desc", countQuery = "select count(distinct ct.crop) from Accession a inner join a.taxonomy t join t.cropTaxonomies ct where a.institute = ?1")
// Page<Object[]> statisticsCropInInstitute(FaoInstitute institute, Pageable pageable);
@Query("select count(a) from Accession a where a.origin = ?1") @Query("select count(a) from Accession a where a.origin = ?1")
long countByOrigin(String isoCode3); long countByOrigin(String isoCode3);
...@@ -65,17 +66,17 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> { ...@@ -65,17 +66,17 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query("select a from Accession a where a.institute in ( ?1 )") @Query("select a from Accession a where a.institute in ( ?1 )")
Page<Accession> findByInstitute(List<FaoInstitute> institutes, Pageable pageable); Page<Accession> findByInstitute(List<FaoInstitute> institutes, Pageable pageable);
@Query("select a from Accession a where a.genus in ( ?1 )") // @Query("select a from Accession a where a.genus in ( ?1 )")
Page<Accession> findByGenus(List<String> genus, Pageable pageable); // Page<Accession> findByGenus(List<String> genus, Pageable pageable);
@Query("select a.institute, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.institute order by total desc") // @Query("select a.institute, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.institute order by total desc")
List<Object[]> statisticsInstitute(List<String> genus); // List<Object[]> statisticsInstitute(List<String> genus);
@Query("select a.origin, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.origin order by total desc") // @Query("select a.origin, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.origin order by total desc")
List<Object[]> statisticsOrigin(List<String> genus); // List<Object[]> statisticsOrigin(List<String> genus);
@Query("select a.taxonomy, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.taxonomy order by total desc") // @Query("select a.taxonomy, count(a.id) as total from Accession a where a.genus in ( ?1 ) group by a.taxonomy order by total desc")
List<Object[]> statisticsTaxonomy(List<String> genus); // List<Object[]> statisticsTaxonomy(List<String> genus);
// List<Accession> findByOrigin(String origin); // List<Accession> findByOrigin(String origin);
...@@ -96,9 +97,10 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> { ...@@ -96,9 +97,10 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query("select a from Accession a where a.taxonomy in ( ?1 )") @Query("select a from Accession a where a.taxonomy in ( ?1 )")
Page<Accession> findByTaxonomy(Collection<Taxonomy> taxonomies, Pageable pageable); Page<Accession> findByTaxonomy(Collection<Taxonomy> taxonomies, Pageable pageable);
Accession findByInstituteCodeAndAccessionName(String instCode, String acceNumb); Accession findByInstituteCodeAndAccessionName(String instCode, String accessionName);
Accession findByInstituteCodeAndAccessionNameAndGenus(String holdingInstitute, String accessionName, String genus); @Query("select a from Accession a inner join a.taxonomy t where a.instituteCode=?1 and a.accessionName=?2 and t.genus=?3")
Accession findOne(String holdingInstitute, String accessionName, String genus);
@Query("select count(a.id) from Accession a where a.id in ( ?1 ) and a.availability = true") @Query("select count(a.id) from Accession a where a.id in ( ?1 ) and a.availability = true")
long countAvailable(Set<Long> accessionIds); long countAvailable(Set<Long> accessionIds);
......
...@@ -101,7 +101,7 @@ public interface GenesysService { ...@@ -101,7 +101,7 @@ public interface GenesysService {
Page<Object[]> statisticsTaxonomyByInstitute(FaoInstitute faoInstitute, Pageable pageable); Page<Object[]> statisticsTaxonomyByInstitute(FaoInstitute faoInstitute, Pageable pageable);
Page<Object[]> statisticsCropByInstitute(FaoInstitute faoInstitute, Pageable pageable); // Page<Object[]> statisticsCropByInstitute(FaoInstitute faoInstitute, Pageable pageable);
Page<Accession> listAccessionsByInstituteAndTaxonomy(FaoInstitute institute, Taxonomy taxonomy, Pageable pageable); Page<Accession> listAccessionsByInstituteAndTaxonomy(FaoInstitute institute, Taxonomy taxonomy, Pageable pageable);
......
...@@ -84,6 +84,7 @@ import org.genesys2.server.service.AclService; ...@@ -84,6 +84,7 @@ import org.genesys2.server.service.AclService;
import org.genesys2.server.service.DatasetService; import org.genesys2.server.service.DatasetService;
import org.genesys2.server.service.GenesysService; import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.HtmlSanitizer; import org.genesys2.server.service.HtmlSanitizer;
import org.genesys2.server.service.TaxonomyService;
import org.genesys2.server.service.TraitService; import org.genesys2.server.service.TraitService;
import org.genesys2.spring.SecurityContextUtil; import org.genesys2.spring.SecurityContextUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -130,6 +131,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -130,6 +131,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
private MetadataMethodRepository metadataMethodRepository; private MetadataMethodRepository metadataMethodRepository;
@Autowired @Autowired
private TraitValueRepository traitValueRepository; private TraitValueRepository traitValueRepository;
@Autowired
private TaxonomyService taxonomyService;
@Autowired @Autowired
private CropTaxonomyRepository cropTaxonomyRepository; private CropTaxonomyRepository cropTaxonomyRepository;
...@@ -168,7 +171,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -168,7 +171,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public long countAll() { public long countAll() {
return accessionRepository.count(); return accessionRepository.count();
} }
@Override @Override
public long countByInstitute(FaoInstitute institute) { public long countByInstitute(FaoInstitute institute) {
return accessionRepository.countByInstitute(institute); return accessionRepository.countByInstitute(institute);
...@@ -206,7 +209,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -206,7 +209,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public List<Accession> listAccessions(List<? extends AccessionIdentifier3> accns) { public List<Accession> listAccessions(List<? extends AccessionIdentifier3> accns) {
List<Accession> result = new ArrayList<Accession>(accns.size()); List<Accession> result = new ArrayList<Accession>(accns.size());
for (AccessionIdentifier3 aid3 : accns) { for (AccessionIdentifier3 aid3 : accns) {
Accession accn = accessionRepository.findByInstituteCodeAndAccessionNameAndGenus(aid3.getHoldingInstitute(), aid3.getAccessionName(), Accession accn = accessionRepository.findOne(aid3.getHoldingInstitute(), aid3.getAccessionName(),
aid3.getGenus()); aid3.getGenus());
// Including null's // Including null's
result.add(accn); result.add(accn);
...@@ -222,9 +225,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -222,9 +225,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Override @Override
public Accession getAccession(AccessionIdentifier3 aid3) { public Accession getAccession(AccessionIdentifier3 aid3) {
return accessionRepository.findByInstituteCodeAndAccessionNameAndGenus(aid3.getHoldingInstitute(), aid3.getAccessionName(), aid3.getGenus()); return accessionRepository.findOne(aid3.getHoldingInstitute(), aid3.getAccessionName(), aid3.getGenus());
} }
@Override @Override
public Accession getAccession(String instCode, String acceNumb) { public Accession getAccession(String instCode, String acceNumb) {
...@@ -233,7 +235,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -233,7 +235,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Override @Override
public Accession getAccession(String instCode, String acceNumb, String genus) { public Accession getAccession(String instCode, String acceNumb, String genus) {
return accessionRepository.findByInstituteCodeAndAccessionNameAndGenus(instCode, acceNumb, genus); return accessionRepository.findOne(instCode, acceNumb, genus);
} }
@Override @Override
...@@ -364,11 +366,6 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -364,11 +366,6 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
return accessionRepository.statisticsTaxonomyInInstitute(institute, pageable); return accessionRepository.statisticsTaxonomyInInstitute(institute, pageable);
} }
@Override
public Page<Object[]> statisticsCropByInstitute(FaoInstitute institute, Pageable pageable) {
return accessionRepository.statisticsCropInInstitute(institute, pageable);
}
@Override @Override
public Page<Accession> listAccessionsByInstituteAndTaxonomy(FaoInstitute institute, Taxonomy taxonomy, Pageable pageable) { public Page<Accession> listAccessionsByInstituteAndTaxonomy(FaoInstitute institute, Taxonomy taxonomy, Pageable pageable) {
return accessionRepository.findByInstituteAndTaxonomy(institute, taxonomy, pageable); return accessionRepository.findByInstituteAndTaxonomy(institute, taxonomy, pageable);
...@@ -381,7 +378,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -381,7 +378,8 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Override @Override
public Page<Accession> listAccessionsByGenus(String genus, Pageable pageable) { public Page<Accession> listAccessionsByGenus(String genus, Pageable pageable) {
return accessionRepository.findByGenus(genus, pageable); long taxGenusId = taxonomyService.getTaxonomy2Id(genus);
return accessionRepository.findByTaxGenus(taxGenusId, pageable);
} }
@Override @Override
...@@ -416,7 +414,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -416,7 +414,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public List<Parameter> listTraits() { public List<Parameter> listTraits() {
return parameterRepository.findAll(new Sort(new Order(Direction.ASC, "id"))); return parameterRepository.findAll(new Sort(new Order(Direction.ASC, "id")));
} }
@Override @Override
public Page<Parameter> listTraits(Pageable pageable) { public Page<Parameter> listTraits(Pageable pageable) {
return parameterRepository.findAll(pageable); return parameterRepository.findAll(pageable);
...@@ -446,7 +444,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -446,7 +444,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
public List<Method> listMethods() { public List<Method> listMethods() {
return methodRepository.findAll(new Sort(new Order(Direction.ASC, "id"))); return methodRepository.findAll(new Sort(new Order(Direction.ASC, "id")));
} }
@Override @Override
public Page<Method> listMethods(Pageable pageable) { public Page<Method> listMethods(Pageable pageable) {
return methodRepository.findAll(pageable); return methodRepository.findAll(pageable);
...@@ -532,7 +530,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -532,7 +530,7 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
svalbardRepository.deleteForAccessions(accessionIds); svalbardRepository.deleteForAccessions(accessionIds);
accessionRepository.delete(toDelete); accessionRepository.delete(toDelete);
updateAccessionCount(institute); updateAccessionCount(institute);
} }
} }
...@@ -616,11 +614,11 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -616,11 +614,11 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@Override @Override
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = false) @Transactional(readOnly = false)
public ParameterCategory addCategory(String name, String i18n) { public ParameterCategory addCategory(String name, String i18n) {
ParameterCategory category = new ParameterCategory(); ParameterCategory category = new ParameterCategory();
category.setName(name); category.setName(name);
category.setNameL(i18n); category.setNameL(i18n);
parameterCategoryRepository.save(category); parameterCategoryRepository.save(category);
return category; return category;
} }
...@@ -628,33 +626,27 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -628,33 +626,27 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public ParameterCategory getCategory(String name) { public ParameterCategory getCategory(String name) {
ParameterCategory category = ParameterCategory category = parameterCategoryRepository.findByName(name);
parameterCategoryRepository.findByName(name);
return category; return category;
} }
@Override @Override
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = false) @Transactional(readOnly = false)
public Parameter addParameter( public Parameter addParameter(String rdfUri, Crop crop, String category, String title, String i18n) {
String rdfUri,
Crop crop, String category,
String title, String i18n
) {
Parameter parameter = new Parameter(); Parameter parameter = new Parameter();
parameter.setRdfUri(StringUtils.defaultIfBlank(rdfUri, null)); parameter.setRdfUri(StringUtils.defaultIfBlank(rdfUri, null));
parameter.setCrop(crop); parameter.setCrop(crop);
// In an ideal world, we should search for category by URI, not name... // In an ideal world, we should search for category by URI, not name...
ParameterCategory parameterCategory = ParameterCategory parameterCategory = parameterCategoryRepository.findByName(category);
parameterCategoryRepository.findByName(category);
parameter.setCategory(parameterCategory); parameter.setCategory(parameterCategory);
parameter.setTitle(title); parameter.setTitle(title);
parameter.setI18n(StringUtils.defaultIfBlank(i18n, null)); parameter.setI18n(StringUtils.defaultIfBlank(i18n, null));
parameterRepository.save(parameter); parameterRepository.save(parameter);
return parameter; return parameter;
...@@ -664,12 +656,17 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -664,12 +656,17 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Parameter getParameter(String rdfUri) { public Parameter getParameter(String rdfUri) {
if(rdfUri == null || rdfUri.isEmpty() ) if (rdfUri == null || rdfUri.isEmpty())
return null ; return null;
Parameter parameter = Parameter parameter = parameterRepository.findByRdfUri(rdfUri); // assumes
parameterRepository.findByRdfUri(rdfUri) ; // assumes that crop x title is unique(?) // that
// crop
// x
// title
// is
// unique(?)
return parameter; return parameter;
} }
...@@ -677,21 +674,22 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -677,21 +674,22 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Parameter getParameter(Crop crop, String title) { public Parameter getParameter(Crop crop, String title) {
Parameter parameter = Parameter parameter = parameterRepository.findByCropAndTitle(crop, title); // assumes
parameterRepository.findByCropAndTitle(crop, title) ; // assumes that crop x title is unique(?) // that
// crop
// x
// title
// is
// unique(?)
return parameter; return parameter;
} }
@Override @Override
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = false) @Transactional(readOnly = false)
public Method addMethod( public Method addMethod(String rdfUri, String description, String i18n, String unit, String fieldName, int fieldType, Integer fieldSize, String options,
String rdfUri, String description, String i18n, String unit, String range, Parameter parameter) {
String fieldName, int fieldType, Integer fieldSize,
String options, String range,
Parameter parameter
) {
Method method = new Method(); Method method = new Method();
method.setRdfUri(StringUtils.defaultIfBlank(rdfUri, null)); method.setRdfUri(StringUtils.defaultIfBlank(rdfUri, null));
...@@ -700,12 +698,12 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -700,12 +698,12 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
method.setUnit(StringUtils.defaultIfBlank(StringUtils.trimToNull(unit), null)); method.setUnit(StringUtils.defaultIfBlank(StringUtils.trimToNull(unit), null));
method.setFieldName(StringUtils.trimToNull(fieldName)); method.setFieldName(StringUtils.trimToNull(fieldName));
method.setFieldType(fieldType); method.setFieldType(fieldType);
if (fieldType == 0) { if (fieldType == 0) {
// Will throw NPE if not provided! // Will throw NPE if not provided!
method.setFieldSize(fieldSize.toString()); method.setFieldSize(fieldSize.toString());
} }
method.setOptions(StringUtils.defaultIfBlank(StringUtils.trimToNull(options), null)); method.setOptions(StringUtils.defaultIfBlank(StringUtils.trimToNull(options), null));
method.setRange(StringUtils.defaultIfBlank(StringUtils.trimToNull(range), null)); method.setRange(StringUtils.defaultIfBlank(StringUtils.trimToNull(range), null));
method.setParameter(parameter); method.setParameter(parameter);
...@@ -722,26 +720,23 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset ...@@ -722,26 +720,23 @@ public class GenesysServiceImpl implements GenesysService, TraitService, Dataset
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Method getMethod(String rdfUri) { public Method getMethod(String rdfUri) {
if(rdfUri == null || rdfUri.isEmpty() ) if (rdfUri == null || rdfUri.isEmpty())
return null ; return null;
Method method = Method method = methodRepository.findByRdfUri(rdfUri);
methodRepository.findByRdfUri(rdfUri) ;
return method; return method;
} }
@Override @Override
public Method getMethod(String description, Parameter parameter) { public Method getMethod(String description, Parameter parameter) {
if(description == null || description.isEmpty() ) if (description == null || description.isEmpty())
return null ; return null;
Method method = Method method = methodRepository.findByMethodAndParameter(description, parameter);
methodRepository.findByMethodAndParameter(description,parameter) ;
return method; return method;
} }
......
...@@ -100,6 +100,7 @@ public class WiewsController extends BaseController { ...@@ -100,6 +100,7 @@ public class WiewsController extends BaseController {
// model.addAttribute("statisticsCrop", // model.addAttribute("statisticsCrop",
// genesysService.statisticsCropByInstitute(faoInstitute, new // genesysService.statisticsCropByInstitute(faoInstitute, new
// PageRequest(0, 30))); // PageRequest(0, 30)));
model.addAttribute("statisticsGenus", genesysService.statisticsGenusByInstitute(faoInstitute, new PageRequest(0, 30))); model.addAttribute("statisticsGenus", genesysService.statisticsGenusByInstitute(faoInstitute, new PageRequest(0, 30)));
model.addAttribute("statisticsTaxonomy", genesysService.statisticsTaxonomyByInstitute(faoInstitute, new PageRequest(0, 30))); model.addAttribute("statisticsTaxonomy", genesysService.statisticsTaxonomyByInstitute(faoInstitute, new PageRequest(0, 30)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment