Commit 95bb54d6 authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet Committed by Exbrayat Cédric
Browse files

fix: remove demo code

parent 3b112aee
package fr.inra.urgi.faidare.web.germplasm;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
......@@ -11,24 +10,14 @@ import java.util.stream.Collectors;
import fr.inra.urgi.faidare.api.NotFoundException;
import fr.inra.urgi.faidare.config.FaidareProperties;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiGermplasmAttributeValue;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiSibling;
import fr.inra.urgi.faidare.domain.criteria.GermplasmAttributeCriteria;
import fr.inra.urgi.faidare.domain.criteria.GermplasmGETSearchCriteria;
import fr.inra.urgi.faidare.domain.data.germplasm.CollPopVO;
import fr.inra.urgi.faidare.domain.data.germplasm.DonorVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GenealogyVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmAttributeValueVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmInstituteVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmMcpdVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmSitemapVO;
import fr.inra.urgi.faidare.domain.data.germplasm.GermplasmVO;
import fr.inra.urgi.faidare.domain.data.germplasm.InstituteVO;
import fr.inra.urgi.faidare.domain.data.germplasm.PedigreeVO;
import fr.inra.urgi.faidare.domain.data.germplasm.PhotoVO;
import fr.inra.urgi.faidare.domain.data.germplasm.PuiNameValueVO;
import fr.inra.urgi.faidare.domain.data.germplasm.SiblingVO;
import fr.inra.urgi.faidare.domain.data.germplasm.SiteVO;
import fr.inra.urgi.faidare.domain.data.germplasm.TaxonSourceVO;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentSearchCriteria;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentVO;
import fr.inra.urgi.faidare.repository.es.GermplasmAttributeRepository;
import fr.inra.urgi.faidare.repository.es.GermplasmRepository;
......@@ -82,11 +71,6 @@ public class GermplasmController {
throw new NotFoundException("Germplasm with ID " + germplasmId + " not found");
}
// TODO remove this, which is used to display all the sections on a specific germplasm
if (germplasm.getGermplasmDbId().equals("dXJuOlZJQi9nZXJtcGxhc20vWmVhX1ZJQl9SSUwxOFJJTDJ3YXlfX185Ng==")) {
germplasm = createGermplasm();
}
return toModelAndView(germplasm);
}
......@@ -137,19 +121,8 @@ public class GermplasmController {
List<BrapiGermplasmAttributeValue> attributes = getAttributes(germplasm);
PedigreeVO pedigree = getPedigree(germplasm);
// TODO remove this
if (germplasm.getGermplasmDbId().equals("dXJuOlZJQi9nZXJtcGxhc20vWmVhX1ZJQl9SSUwxOFJJTDJ3YXlfX185Ng==")) {
attributes = Arrays.asList(createAttribute());
pedigree = createPedigree();
}
// List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
// XRefDocumentSearchCriteria.forXRefId(germplasm.getGermplasmDbId())
// );
// TODO replace this block by the above commented one
List<XRefDocumentVO> crossReferences = Arrays.asList(
createXref("foobar"),
createXref("bazbing")
List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
XRefDocumentSearchCriteria.forXRefId(germplasm.getGermplasmDbId())
);
sortDonors(germplasm);
......@@ -219,243 +192,6 @@ public class GermplasmController {
return germplasmRepository.findPedigree(germplasm.getGermplasmDbId());
}
private BrapiGermplasmAttributeValue createAttribute() {
GermplasmAttributeValueVO result = new GermplasmAttributeValueVO();
result.setAttributeName("A1");
result.setValue("V1");
return result;
}
private GermplasmVO createGermplasm() {
GermplasmVO result = new GermplasmVO();
result.setGermplasmDbId("dXJuOlZJQi9nZXJtcGxhc20vWmVhX1ZJQl9SSUwxOFJJTDJ3YXlfX185Ng==");
result.setGermplasmName("BLE BARBU DU ROUSSILLON");
result.setAccessionNumber("1408");
result.setSynonyms(Arrays.asList("BLE DU ROUSSILLON", "FRA051:1699", "ROUSSILLON"));
PhotoVO photo = new PhotoVO();
photo.setPhotoName("Blé du roussillon");
photo.setCopyright("INRA, Emmanuelle BOULAT/Lionel BARDY 2012");
photo.setThumbnailFile("https://urgi.versailles.inrae.fr/files/siregal/images/accession/CEREALS/thumbnails/thumb_1408_R09_S.jpg");
photo.setFile("https://urgi.versailles.inrae.fr/files/siregal/images/accession/CEREALS/1408_R09_S.jpg");
result.setPhoto(photo);
InstituteVO holdingGenBank = new InstituteVO();
holdingGenBank.setLogo("https://urgi.versailles.inra.fr/files/siregal/images/grc/inra_brc_en.png");
holdingGenBank.setInstituteName("INRA BRC");
holdingGenBank.setWebSite("http://google.fr");
result.setHoldingGenbank(holdingGenBank);
result.setBiologicalStatusOfAccessionCode("Traditional cultivar/landrace ");
result.setPedigree("LV");
SiteVO originSite = new SiteVO();
originSite.setSiteId("1234");
originSite.setSiteName("Le Moulon");
originSite.setSiteType("Origin site");
originSite.setLatitude(47.0F);
originSite.setLongitude(12.0F);
result.setOriginSite(originSite);
List<SiteVO> evaluationSites = new ArrayList<>();
for (int i = 0; i < 5; i++) {
SiteVO evaluationSite = new SiteVO();
evaluationSite.setSiteId(Integer.toString(12347 + i));
evaluationSite.setSiteType("Evaluation site");
evaluationSite.setSiteName("Site " + i);
evaluationSite.setLatitude(46.0F + i);
evaluationSite.setLongitude(13.0F + i);
evaluationSites.add(evaluationSite);
}
result.setEvaluationSites(evaluationSites);
result.setGenus("Genus 1");
result.setSpecies("Species 1");
result.setSpeciesAuthority("Species Auth");
result.setSourceUri("https://urgi.versailles.inrae.fr/gnpis");
result.setSubtaxa("Subtaxa 1");
result.setGenusSpeciesSubtaxa("Triticum aestivum subsp. aestivum");
result.setSubtaxaAuthority("INRAE");
result.setTaxonIds(Arrays.asList(createTaxonId(), createTaxonId()));
result.setTaxonComment("C'est bon le blé");
result.setTaxonCommonNames(Arrays.asList("Blé tendre", "Bread wheat", "Soft wheat"));
result.setTaxonSynonyms(Arrays.asList("Blé tendre1", "Bread wheat1", "Soft wheat1"));
InstituteVO holdingInstitute = new InstituteVO();
holdingInstitute.setInstituteName("GDEC - UMR Génétique, Diversité et Ecophysiologie des Céréales");
holdingInstitute.setLogo("https://urgi.versailles.inra.fr/files/siregal/images/grc/inra_brc_en.png");
holdingInstitute.setWebSite("https://google.fr/q=qsdqsdqsdslqlsdnqlsdqlsdlqskdlqdqlsdqsdqsdqd");
holdingInstitute.setInstituteCode("GDEC");
holdingInstitute.setInstituteType("Type1");
holdingInstitute.setAcronym("G.D.E.C");
holdingInstitute.setAddress("Lyon");
holdingInstitute.setOrganisation("SAS");
result.setHoldingInstitute(holdingInstitute);
result.setPresenceStatus("Maintained");
GermplasmInstituteVO collector = new GermplasmInstituteVO();
collector.setMaterialType("Fork");
collector.setCollectors("Joe, Jack, William, Averell");
InstituteVO collectingInstitute = new InstituteVO();
collectingInstitute.setInstituteName("Ninja Squad");
collector.setInstitute(collectingInstitute);
collector.setAccessionNumber("567");
result.setCollector(collector);
SiteVO collectingSite = new SiteVO();
collectingSite.setSiteId("1235");
collectingSite.setSiteName("St Just");
collectingSite.setSiteType("Collecting site");
collectingSite.setLatitude(48.0F);
collectingSite.setLongitude(13.0F);
result.setCollectingSite(collectingSite);
result.setAcquisitionDate("In the summer");
GermplasmInstituteVO breeder = new GermplasmInstituteVO();
InstituteVO breedingInstitute = new InstituteVO();
breedingInstitute.setInstituteName("Microsoft");
breeder.setInstitute(breedingInstitute);
breeder.setAccessionCreationDate(2015);
breeder.setAccessionNumber("678");
breeder.setRegistrationYear(2016);
breeder.setDeregistrationYear(2019);
result.setBreeder(breeder);
result.setDonors(Arrays.asList(
createDonor()
));
result.setDistributors(Arrays.asList(
createDistributor()
));
result.setChildren(Arrays.asList(createChild(), createChild()));
result.setGermplasmPUI("germplasmPUI");
result.setPopulation(Arrays.asList(createPopulation1(), createPopulation2(), createPopulation3()));
result.setCollection(Arrays.asList(createCollection()));
result.setPanel(Arrays.asList(createPanel()));
return result;
}
private DonorVO createDonor() {
DonorVO result = new DonorVO();
result.setDonorGermplasmPUI("PUI1");
result.setDonationDate(2017);
result.setDonorAccessionNumber("3456");
result.setDonorInstituteCode("GD46U");
InstituteVO institute = new InstituteVO();
institute.setInstituteName("Hello");
result.setDonorInstitute(institute);
return result;
}
private GermplasmInstituteVO createDistributor() {
GermplasmInstituteVO result = new GermplasmInstituteVO();
InstituteVO institute = new InstituteVO();
institute.setInstituteName("Microsoft");
result.setInstitute(institute);
result.setAccessionNumber("678");
result.setDistributionStatus("OK");
return result;
}
private PedigreeVO createPedigree() {
PedigreeVO result = new PedigreeVO();
result.setPedigree("Pedigree 1");
result.setParent1DbId("12345");
result.setParent1Name("Parent 1");
result.setParent1Type("P1");
result.setParent2DbId("12346");
result.setParent2Name("Parent 2");
result.setParent2Type("P2");
result.setCrossingPlan("crossing plan 1");
result.setCrossingYear("2012");
result.setSiblings(Arrays.asList(createBrapiSibling()));
return result;
}
private BrapiSibling createBrapiSibling() {
SiblingVO sibling = new SiblingVO();
sibling.setGermplasmDbId("5678");
sibling.setDefaultDisplayName("Sibling 5678");
return sibling;
}
private GenealogyVO createChild() {
GenealogyVO result = new GenealogyVO();
result.setFirstParentName("CP1");
result.setSecondParentName("CP2");
result.setSibblings(Arrays.asList(createPuiNameValueVO(), createPuiNameValueVO()));
return result;
}
private PuiNameValueVO createPuiNameValueVO() {
PuiNameValueVO result = new PuiNameValueVO();
result.setName("Child 1");
result.setPui("pui1");
return result;
}
private CollPopVO createPopulation1() {
CollPopVO result = new CollPopVO();
result.setName("Population 1");
result.setType("Pop Type 1");
result.setGermplasmCount(3);
result.setGermplasmRef(createPuiNameValueVO());
return result;
}
private CollPopVO createPopulation2() {
CollPopVO result = new CollPopVO();
result.setName("Population 2");
result.setGermplasmCount(3);
PuiNameValueVO puiNameValueVO = createPuiNameValueVO();
puiNameValueVO.setPui("germplasmPUI");
result.setGermplasmRef(puiNameValueVO);
return result;
}
private CollPopVO createPopulation3() {
CollPopVO result = new CollPopVO();
result.setName("Population 3");
result.setGermplasmCount(5);
return result;
}
private CollPopVO createCollection() {
CollPopVO result = new CollPopVO();
result.setName("Collection 1");
result.setGermplasmCount(7);
return result;
}
private CollPopVO createPanel() {
CollPopVO result = new CollPopVO();
result.setName("The_panel_1");
result.setGermplasmCount(2);
return result;
}
private TaxonSourceVO createTaxonId() {
TaxonSourceVO result = new TaxonSourceVO();
result.setTaxonId("taxon1");
result.setSourceName("ThePlantList");
return result;
}
private XRefDocumentVO createXref(String name) {
XRefDocumentVO xref = new XRefDocumentVO();
xref.setName(name);
xref.setDescription("A very large description for the xref " + name + " which has way more than 120 characters bla bla bla bla bla bla bla bla bla bla bla bla");
xref.setDatabaseName("db_" + name);
xref.setUrl("https://google.com");
xref.setEntryType("type " + name);
return xref;
}
private List<GermplasmExportableField> getFieldsToExport(GermplasmExportCommand command) {
List<GermplasmExportableField> fields = command.getFields();
if (fields.isEmpty()) {
......
package fr.inra.urgi.faidare.web.site;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import fr.inra.urgi.faidare.api.NotFoundException;
import fr.inra.urgi.faidare.config.FaidareProperties;
import fr.inra.urgi.faidare.domain.brapi.v1.data.BrapiAdditionalInfo;
import fr.inra.urgi.faidare.domain.data.LocationSitemapVO;
import fr.inra.urgi.faidare.domain.data.LocationVO;
import fr.inra.urgi.faidare.domain.xref.XRefDocumentSearchCriteria;
......@@ -54,12 +50,8 @@ public class SiteController {
throw new NotFoundException("Site with ID " + siteId + " not found");
}
// TODO uncomment this and remove the hard-coded xrefs
// List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
// XRefDocumentSearchCriteria.forXRefId(site.getLocationDbId()));
List<XRefDocumentVO> crossReferences = Arrays.asList(
createXref("foobar"),
createXref("bazbing")
List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
XRefDocumentSearchCriteria.forXRefId(site.getLocationDbId())
);
return new ModelAndView("site",
......@@ -90,14 +82,4 @@ public class SiteController {
};
return ResponseEntity.ok().contentType(MediaType.TEXT_PLAIN).body(body);
}
private XRefDocumentVO createXref(String name) {
XRefDocumentVO xref = new XRefDocumentVO();
xref.setName(name);
xref.setDescription("A very large description for the xref " + name + " which has way more than 120 characters bla bla bla bla bla bla bla bla bla bla bla bla");
xref.setDatabaseName("db_" + name);
xref.setUrl("https://google.com");
xref.setEntryType("type " + name);
return xref;
}
}
package fr.inra.urgi.faidare.web.study;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
......@@ -79,12 +78,8 @@ public class StudyController {
throw new NotFoundException("Study with ID " + studyId + " not found");
}
// TODO uncomment this
// List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
// XRefDocumentSearchCriteria.forXRefId(study.getStudyDbId()));
List<XRefDocumentVO> crossReferences = Arrays.asList(
createXref("foobar"),
createXref("bazbing")
List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
XRefDocumentSearchCriteria.forXRefId(study.getStudyDbId())
);
List<GermplasmVO> germplasms = getGermplasms(study);
......@@ -166,14 +161,4 @@ public class StudyController {
}
private XRefDocumentVO createXref(String name) {
XRefDocumentVO xref = new XRefDocumentVO();
xref.setName(name);
xref.setDescription("A very large description for the xref " + name + " which has way more than 120 characters bla bla bla bla bla bla bla bla bla bla bla bla");
xref.setDatabaseName("db_" + name);
xref.setUrl("https://google.com");
xref.setEntryType("type " + name);
return xref;
}
}
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