Commit b26d0a06 authored by Matija Obreza's avatar Matija Obreza
Browse files

Entity cleanup

parent 068020fe
...@@ -39,7 +39,7 @@ import org.genesys2.server.model.impl.FaoInstitute; ...@@ -39,7 +39,7 @@ import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.util.MCPDUtil; import org.genesys2.util.MCPDUtil;
@Entity @Entity
@Table(name = "accession", uniqueConstraints = { @UniqueConstraint(name="UQ_accession_genus_inst", columnNames = { "instituteId", "taxGenus", "acceNumb" }) }) @Table(name = "accession", uniqueConstraints = { @UniqueConstraint(name = "UQ_accession_genus_inst", columnNames = { "instituteId", "taxGenus", "acceNumb" }) })
public class Accession extends VersionedAuditedModel { public class Accession extends VersionedAuditedModel {
private static final long serialVersionUID = -7630113633534038876L; private static final long serialVersionUID = -7630113633534038876L;
...@@ -49,22 +49,22 @@ public class Accession extends VersionedAuditedModel { ...@@ -49,22 +49,22 @@ public class Accession extends VersionedAuditedModel {
@Column(name = "instCode", length = 10, nullable = false) @Column(name = "instCode", length = 10, nullable = false)
private String instituteCode; private String instituteCode;
@ManyToOne(cascade = {}, optional = true) @ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "instituteId") @JoinColumn(name = "instituteId")
private FaoInstitute institute; private FaoInstitute institute;
@Column(name = "acceNumb", nullable = false, length = 128) @Column(name = "acceNumb", nullable = false, length = 128)
private String accessionName; private String accessionName;
// @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) // @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@ManyToOne(cascade = {}, optional = true) @ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "taxonomyId2") @JoinColumn(name = "taxonomyId2")
private Taxonomy2 taxonomy; private Taxonomy2 taxonomy;
@Column(name = "acqSrc", length = 3) @Column(name = "acqSrc", length = 3)
private String acquisitionSource; private String acquisitionSource;
@Column(name = "acqDate", length = 8) @Column(name = "acqDate", length = 12)
private String acquisitionDate; private String acquisitionDate;
@Column(name = "orgCty", length = 3) @Column(name = "orgCty", length = 3)
...@@ -74,7 +74,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -74,7 +74,7 @@ public class Accession extends VersionedAuditedModel {
@JoinColumn(name = "orgCtyId", nullable = true) @JoinColumn(name = "orgCtyId", nullable = true)
private Country countryOfOrigin; private Country countryOfOrigin;
@Column(name = "duplSite", length = 32) @Column(name = "duplSite", length = 64)
private String duplSite; private String duplSite;
@Column(name = "sampStat", length = 3) @Column(name = "sampStat", length = 3)
...@@ -101,7 +101,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -101,7 +101,7 @@ public class Accession extends VersionedAuditedModel {
@OrderBy("storage") @OrderBy("storage")
private List<Integer> stoRage = new ArrayList<Integer>(); private List<Integer> stoRage = new ArrayList<Integer>();
@Column(name = "storage", length = 50, nullable = true) @Column(name = "storage", length = 64, nullable = true)
private String storage; private String storage;
public Accession() { public Accession() {
...@@ -113,6 +113,9 @@ public class Accession extends VersionedAuditedModel { ...@@ -113,6 +113,9 @@ public class Accession extends VersionedAuditedModel {
@PrePersist @PrePersist
@PreUpdate @PreUpdate
private void prePersist() { private void prePersist() {
this.origin = getCountryOfOrigin().getCode3();
this.taxGenus = getTaxonomy().getTaxGenus();
this.instituteCode = getInstitute().getCode();
this.storage = MCPDUtil.toMcpdArray(this.stoRage); this.storage = MCPDUtil.toMcpdArray(this.stoRage);
} }
...@@ -136,7 +139,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -136,7 +139,7 @@ public class Accession extends VersionedAuditedModel {
return instituteCode; return instituteCode;
} }
public void setInstituteCode(final String instituteCode) { protected void setInstituteCode(final String instituteCode) {
this.instituteCode = instituteCode; this.instituteCode = instituteCode;
} }
...@@ -172,7 +175,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -172,7 +175,7 @@ public class Accession extends VersionedAuditedModel {
return this.origin; return this.origin;
} }
public void setOrigin(final String origin) { protected void setOrigin(final String origin) {
this.origin = origin; this.origin = origin;
} }
...@@ -236,7 +239,7 @@ public class Accession extends VersionedAuditedModel { ...@@ -236,7 +239,7 @@ public class Accession extends VersionedAuditedModel {
return taxGenus; return taxGenus;
} }
public void setTaxGenus(long taxGenus) { protected void setTaxGenus(long taxGenus) {
this.taxGenus = taxGenus; this.taxGenus = taxGenus;
} }
......
...@@ -22,6 +22,7 @@ import java.util.Set; ...@@ -22,6 +22,7 @@ import java.util.Set;
import org.genesys2.server.model.genesys.Accession; import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.Taxonomy2; import org.genesys2.server.model.genesys.Taxonomy2;
import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.FaoInstitute; import org.genesys2.server.model.impl.FaoInstitute;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -50,40 +51,15 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> { ...@@ -50,40 +51,15 @@ public interface AccessionRepository extends JpaRepository<Accession, Long> {
@Query(value = "select t.taxSpecies, count(a) from Accession a inner join a.taxonomy t where a.institute = ?1 group by t.taxSpecies order by count(a) desc", countQuery = "select count(distinct a.taxonomy.taxSpecies) from Accession a where a.institute = ?1") @Query(value = "select t.taxSpecies, count(a) from Accession a inner join a.taxonomy t where a.institute = ?1 group by t.taxSpecies order by count(a) desc", countQuery = "select count(distinct a.taxonomy.taxSpecies) from Accession a where a.institute = ?1")
Page<Object[]> statisticsSpeciesInInstitute(FaoInstitute institute, Pageable pageable); Page<Object[]> statisticsSpeciesInInstitute(FaoInstitute institute, Pageable pageable);
// FIXME Slow query @Query("select count(a) from Accession a where a.countryOfOrigin = ?1")
// FIXME TOOD taxonomy1! long countByOrigin(Country country);
// @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.institute.country = ?1")
long countByOrigin(String isoCode3); long countByLocation(Country country);
@Query("select count(a) from Accession a inner join a.institute i inner join i.country c where c.code3 = ?1")
long countByLocation(String isoCode3);
@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 )")
// 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")
// 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")
// 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")
// List<Object[]> statisticsTaxonomy(List<String> genus);
// List<Accession> findByOrigin(String origin);
Page<Accession> findByOrigin(String isoCode3, Pageable pageable);
List<Accession> findByInstituteAndAccessionName(FaoInstitute faoInstitute, String accessionName); List<Accession> findByInstituteAndAccessionName(FaoInstitute faoInstitute, String accessionName);
@Query("from Accession a where a.id in ( ?1 )") @Query("from Accession a where a.id in ( ?1 )")
......
...@@ -51,13 +51,9 @@ public interface GenesysService { ...@@ -51,13 +51,9 @@ public interface GenesysService {
long countByInstitute(FaoInstitute institute); long countByInstitute(FaoInstitute institute);
long countByOrigin(String isoCode3); long countByOrigin(Country country);
long countByLocation(String isoCode3); long countByLocation(Country country);
Page<Accession> listAccessionsByOrigin(Country country, Pageable pageable);
Page<Accession> listAccessionsByInstitute(FaoInstitute faoInstitute, Pageable pageable);
Accession getAccession(long accessionId); Accession getAccession(long accessionId);
......
...@@ -134,7 +134,6 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -134,7 +134,6 @@ public class BatchRESTServiceImpl implements BatchRESTService {
LOG.warn("New accession " + dataJson); LOG.warn("New accession " + dataJson);
accession = new Accession(); accession = new Accession();
accession.setInstituteCode(dataJson.instCode);
accession.setInstitute(institute); accession.setInstitute(institute);
accession.setAccessionName(dataJson.acceNumb); accession.setAccessionName(dataJson.acceNumb);
...@@ -602,7 +601,6 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -602,7 +601,6 @@ public class BatchRESTServiceImpl implements BatchRESTService {
throw new RESTApiValueException("No country with ISO3 code: " + orgCty); throw new RESTApiValueException("No country with ISO3 code: " + orgCty);
} }
} }
accession.setOrigin(orgCty);
accession.setCountryOfOrigin(country); accession.setCountryOfOrigin(country);
return true; return true;
} }
...@@ -659,7 +657,6 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -659,7 +657,6 @@ public class BatchRESTServiceImpl implements BatchRESTService {
if (!ensuredTaxonomy.sameAs(taxonomy)) { if (!ensuredTaxonomy.sameAs(taxonomy)) {
accession.setTaxonomy(ensuredTaxonomy); accession.setTaxonomy(ensuredTaxonomy);
accession.setTaxGenus(ensuredTaxonomy.getTaxGenus());
updated = true; updated = true;
} }
......
...@@ -99,16 +99,32 @@ public class DirectMysqlQuery { ...@@ -99,16 +99,32 @@ public class DirectMysqlQuery {
protected DirectMysqlQuery join(AppliedFilters filters) { protected DirectMysqlQuery join(AppliedFilters filters) {
if (hasFilter(filters, FilterConstants.CROPS) || hasFilter(filters, FilterConstants.TAXONOMY_GENUS) if (hasFilter(filters, FilterConstants.CROPS) || hasFilter(filters, FilterConstants.TAXONOMY_GENUS)
|| hasFilter(filters, FilterConstants.TAXONOMY_SPECIES) || hasFilter(filters, FilterConstants.TAXONOMY_SCINAME)) { || hasFilter(filters, FilterConstants.TAXONOMY_SPECIES) || hasFilter(filters, FilterConstants.TAXONOMY_SCINAME)) {
innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2"); innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2");
if (hasFilter(filters, FilterConstants.CROPS)) { if (hasFilter(filters, FilterConstants.CROPS)) {
innerJoin("croptaxonomy", "ct", "ct.taxonomyId=t.id"); innerJoin("croptaxonomy", "ct", "ct.taxonomyId=t.id");
innerJoin("crop", null, "crop.id=ct.cropId"); innerJoin("crop", null, "crop.id=ct.cropId");
} }
} }
if (hasFilter(filters, FilterConstants.INSTITUTE_NETWORK)) {
// if (hasFilter(filters, FilterConstants.ORGCTY_ISO3)) {
// innerJoin("country", "cty", "cty.id=a.orgCtyId");
// }
if (hasFilter(filters, FilterConstants.INSTCODE) || hasFilter(filters, FilterConstants.INSTITUTE_COUNTRY_ISO3)
|| hasFilter(filters, FilterConstants.INSTITUTE_NETWORK)) {
innerJoin("faoinstitute", "fao", "fao.id=a.instituteId"); innerJoin("faoinstitute", "fao", "fao.id=a.instituteId");
innerJoin("organizationinstitute", "oi", "oi.instituteId=fao.id");
innerJoin("organization", "org", "org.id=oi.organizationId"); if (hasFilter(filters, FilterConstants.INSTITUTE_COUNTRY_ISO3)) {
innerJoin("country", "faocty", "faocty.id=fao.countryId");
}
if (hasFilter(filters, FilterConstants.INSTITUTE_NETWORK)) {
innerJoin("organizationinstitute", "oi", "oi.instituteId=fao.id");
innerJoin("organization", "org", "org.id=oi.organizationId");
}
} }
if (hasFilter(filters, FilterConstants.GEO_LATITUDE) || hasFilter(filters, FilterConstants.GEO_LONGITUDE) if (hasFilter(filters, FilterConstants.GEO_LATITUDE) || hasFilter(filters, FilterConstants.GEO_LONGITUDE)
...@@ -146,6 +162,7 @@ public class DirectMysqlQuery { ...@@ -146,6 +162,7 @@ public class DirectMysqlQuery {
createQuery(whereBuffer, "a.acceNumb", filters.get(FilterConstants.ACCENUMB), params); createQuery(whereBuffer, "a.acceNumb", filters.get(FilterConstants.ACCENUMB), params);
createQuery(whereBuffer, "a.orgCty", filters.get(FilterConstants.ORGCTY_ISO3), params); createQuery(whereBuffer, "a.orgCty", filters.get(FilterConstants.ORGCTY_ISO3), params);
createQuery(whereBuffer, "a.instCode", filters.get(FilterConstants.INSTCODE), params); createQuery(whereBuffer, "a.instCode", filters.get(FilterConstants.INSTCODE), params);
createQuery(whereBuffer, "faocty.code3", filters.get(FilterConstants.INSTITUTE_COUNTRY_ISO3), params);
createQuery(whereBuffer, "a.inSGSV", filters.get(FilterConstants.SGSV), params); createQuery(whereBuffer, "a.inSGSV", filters.get(FilterConstants.SGSV), params);
createQuery(whereBuffer, "a.mlsStat", filters.get(FilterConstants.MLSSTATUS), params); createQuery(whereBuffer, "a.mlsStat", filters.get(FilterConstants.MLSSTATUS), params);
createQuery(whereBuffer, "a.inTrust", filters.get(FilterConstants.ART15), params); createQuery(whereBuffer, "a.inTrust", filters.get(FilterConstants.ART15), params);
......
...@@ -178,23 +178,13 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -178,23 +178,13 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
} }
@Override @Override
public long countByOrigin(String isoCode3) { public long countByOrigin(Country country) {
return accessionRepository.countByOrigin(isoCode3); return accessionRepository.countByOrigin(country);
} }
@Override @Override
public long countByLocation(String isoCode3) { public long countByLocation(Country country) {
return accessionRepository.countByLocation(isoCode3); return accessionRepository.countByLocation(country);
}
@Override
public Page<Accession> listAccessionsByOrigin(Country country, Pageable pageable) {
return accessionRepository.findByOrigin(country.getCode3(), pageable);
}
@Override
public Page<Accession> listAccessionsByInstitute(FaoInstitute faoInstitute, Pageable pageable) {
return accessionRepository.findByInstitute(faoInstitute, pageable);
} }
@Override @Override
......
...@@ -85,8 +85,8 @@ public class CountryController extends BaseController { ...@@ -85,8 +85,8 @@ public class CountryController extends BaseController {
// Active ones // Active ones
model.addAttribute("genesysInstitutes", instituteService.listByCountryActive(country)); model.addAttribute("genesysInstitutes", instituteService.listByCountryActive(country));
model.addAttribute("countByOrigin", genesysService.countByOrigin(country.getCode3())); model.addAttribute("countByOrigin", genesysService.countByOrigin(country));
model.addAttribute("countByLocation", genesysService.countByLocation(country.getCode3())); model.addAttribute("countByLocation", genesysService.countByLocation(country));
return "/country/details"; return "/country/details";
} }
......
...@@ -25,7 +25,7 @@ db.url=jdbc:mysql://localhost/genesys20141230?useUnicode=true&characterEncoding= ...@@ -25,7 +25,7 @@ db.url=jdbc:mysql://localhost/genesys20141230?useUnicode=true&characterEncoding=
db.driverClassName=com.mysql.jdbc.Driver db.driverClassName=com.mysql.jdbc.Driver
db.username=root db.username=root
db.password= db.password=
db.showSql=true db.showSql=false
db.hbm2ddl=false db.hbm2ddl=false
c3p0.acquireIncrement=1 c3p0.acquireIncrement=1
......
...@@ -48,7 +48,6 @@ public class AccessionStorageTest { ...@@ -48,7 +48,6 @@ public class AccessionStorageTest {
@Test @Test
public void nullStorage() { public void nullStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-1"); a.setAccessionName("A-1");
genesysService.saveAccession(a); genesysService.saveAccession(a);
} }
...@@ -56,7 +55,6 @@ public class AccessionStorageTest { ...@@ -56,7 +55,6 @@ public class AccessionStorageTest {
@Test @Test
public void blankStorage() { public void blankStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-" + System.currentTimeMillis()); a.setAccessionName("A-" + System.currentTimeMillis());
List<Integer> stoRage = new ArrayList<Integer>(); List<Integer> stoRage = new ArrayList<Integer>();
a.setStoRage(stoRage); a.setStoRage(stoRage);
...@@ -72,7 +70,6 @@ public class AccessionStorageTest { ...@@ -72,7 +70,6 @@ public class AccessionStorageTest {
@Test @Test
public void oneStorage() { public void oneStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-" + System.currentTimeMillis()); a.setAccessionName("A-" + System.currentTimeMillis());
List<Integer> stoRage = new ArrayList<Integer>(); List<Integer> stoRage = new ArrayList<Integer>();
stoRage.add(1); stoRage.add(1);
...@@ -89,7 +86,6 @@ public class AccessionStorageTest { ...@@ -89,7 +86,6 @@ public class AccessionStorageTest {
@Test @Test
public void twoStorage() { public void twoStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-" + System.currentTimeMillis()); a.setAccessionName("A-" + System.currentTimeMillis());
List<Integer> stoRage = new ArrayList<Integer>(); List<Integer> stoRage = new ArrayList<Integer>();
stoRage.add(1); stoRage.add(1);
...@@ -107,7 +103,6 @@ public class AccessionStorageTest { ...@@ -107,7 +103,6 @@ public class AccessionStorageTest {
@Test @Test
public void clearStorage() { public void clearStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-" + System.currentTimeMillis()); a.setAccessionName("A-" + System.currentTimeMillis());
List<Integer> stoRage = new ArrayList<Integer>(); List<Integer> stoRage = new ArrayList<Integer>();
stoRage.add(1); stoRage.add(1);
...@@ -134,7 +129,6 @@ public class AccessionStorageTest { ...@@ -134,7 +129,6 @@ public class AccessionStorageTest {
@Test @Test
public void updateStorage() { public void updateStorage() {
Accession a = new Accession(); Accession a = new Accession();
a.setInstituteCode("INS000");
a.setAccessionName("A-" + System.currentTimeMillis()); a.setAccessionName("A-" + System.currentTimeMillis());
List<Integer> stoRage = new ArrayList<Integer>(); List<Integer> stoRage = new ArrayList<Integer>();
stoRage.add(1); stoRage.add(1);
......
...@@ -205,7 +205,6 @@ public class ElasticUpdaterTest { ...@@ -205,7 +205,6 @@ public class ElasticUpdaterTest {
public void testAspect() throws InterruptedException { public void testAspect() throws InterruptedException {
Accession a = new Accession(); Accession a = new Accession();
a.setAccessionName("A-1"); a.setAccessionName("A-1");
a.setInstituteCode("INS000");
genesysService.saveAccession(a); genesysService.saveAccession(a);
LOG.info("Accession saved"); LOG.info("Accession saved");
Thread.sleep(1000); Thread.sleep(1000);
...@@ -218,7 +217,6 @@ public class ElasticUpdaterTest { ...@@ -218,7 +217,6 @@ public class ElasticUpdaterTest {
Accession accn; Accession accn;
a.add(accn = new Accession()); a.add(accn = new Accession());
accn.setAccessionName("A-" + i); accn.setAccessionName("A-" + i);
accn.setInstituteCode("INS000");
} }
genesysService.saveAccessions(a); genesysService.saveAccessions(a);
LOG.info("Accessions saved"); LOG.info("Accessions saved");
......
...@@ -210,7 +210,6 @@ public class SGSVUpdateTest { ...@@ -210,7 +210,6 @@ public class SGSVUpdateTest {
final Accession a = new Accession(); final Accession a = new Accession();
a.setInstitute(institute); a.setInstitute(institute);
a.setInstituteCode(institute.getCode());
a.setAccessionName(acceNumb); a.setAccessionName(acceNumb);
a.setTaxonomy(taxonomyService.ensureTaxonomy2(genus, species, null, null, null)); a.setTaxonomy(taxonomyService.ensureTaxonomy2(genus, species, null, null, null));
......
...@@ -16,8 +16,13 @@ ...@@ -16,8 +16,13 @@
package org.genesys2.server.test; package org.genesys2.server.test;
import static org.junit.Assert.*; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.*; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -69,7 +74,6 @@ import org.springframework.cache.support.NoOpCacheManager; ...@@ -69,7 +74,6 @@ import org.springframework.cache.support.NoOpCacheManager;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...@@ -201,9 +205,6 @@ public class BatchRESTServiceTest { ...@@ -201,9 +205,6 @@ public class BatchRESTServiceTest {
System.err.println("Tearing down"); System.err.println("Tearing down");
for (final String instCode : new String[] { "INS002", "INS001" }) { for (final String instCode : new String[] { "INS002", "INS001" }) {
final FaoInstitute institute = instituteService.getInstitute(instCode); final FaoInstitute institute = instituteService.getInstitute(instCode);
System.err.println("Deleting accessions for " + institute);
genesysService.removeAccessions(institute, genesysService.listAccessionsByInstitute(institute, new PageRequest(0, Integer.MAX_VALUE)).getContent());
System.err.println("Deleting " + institute);
instituteService.delete(institute.getCode()); instituteService.delete(institute.getCode());
} }
......
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