Commit a31bacfc authored by Jean-Baptiste Nizet's avatar Jean-Baptiste Nizet
Browse files

feat: start removing some demo code

parent a3050d84
......@@ -76,15 +76,17 @@ public class GermplasmController {
@GetMapping("/{germplasmId}")
public ModelAndView get(@PathVariable("germplasmId") String germplasmId) {
// GermplasmVO germplasm = germplasmRepository.getById(germplasmId);
// TODO replace this block by the above commented one
GermplasmVO germplasm = createGermplasm();
GermplasmVO germplasm = germplasmRepository.getById(germplasmId);
if (germplasm == null) {
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);
}
......@@ -132,17 +134,19 @@ public class GermplasmController {
}
private ModelAndView toModelAndView(GermplasmVO germplasm) {
// List<BrapiGermplasmAttributeValue> attributes = getAttributes(germplasm);
// PedigreeVO pedigree = getPedigree(germplasm);
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<BrapiGermplasmAttributeValue> attributes = Arrays.asList(
createAttribute()
);
PedigreeVO pedigree = createPedigree();
List<XRefDocumentVO> crossReferences = Arrays.asList(
createXref("foobar"),
createXref("bazbing")
......@@ -224,7 +228,7 @@ public class GermplasmController {
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"));
......
......@@ -50,6 +50,11 @@ public class SiteController {
public ModelAndView get(@PathVariable("siteId") String siteId) {
LocationVO site = locationRepository.getById(siteId);
if (site == null) {
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(
......@@ -57,13 +62,6 @@ public class SiteController {
createXref("bazbing")
);
// LocationVO site = createSite();
if (site == null) {
throw new NotFoundException("Site with ID " + siteId + " not found");
}
return new ModelAndView("site",
"model",
new SiteModel(
......@@ -93,24 +91,6 @@ public class SiteController {
return ResponseEntity.ok().contentType(MediaType.TEXT_PLAIN).body(body);
}
private LocationVO createSite() {
LocationVO site = new LocationVO();
site.setLocationName("France");
site.setSourceUri("https://urgi.versailles.inrae.fr/gnpis");
site.setUri("Test URI");
site.setUrl("https://google.com");
site.setLatitude(45.65);
site.setLongitude(1.34);
BrapiAdditionalInfo additionalInfo = new BrapiAdditionalInfo();
additionalInfo.addProperty("Slope", 4.32);
additionalInfo.addProperty("Distance to city", "3 km");
additionalInfo.addProperty("foo", "bar");
additionalInfo.addProperty("baz", "zing");
additionalInfo.addProperty("blob", null);
site.setAdditionalInfo(additionalInfo);
return site;
}
private XRefDocumentVO createXref(String name) {
XRefDocumentVO xref = new XRefDocumentVO();
xref.setName(name);
......
......@@ -75,6 +75,10 @@ public class StudyController {
public ModelAndView get(@PathVariable("studyId") String studyId) {
StudyDetailVO study = studyRepository.getById(studyId);
if (study == null) {
throw new NotFoundException("Study with ID " + studyId + " not found");
}
// TODO uncomment this
// List<XRefDocumentVO> crossReferences = xRefDocumentRepository.find(
// XRefDocumentSearchCriteria.forXRefId(study.getStudyDbId()));
......@@ -83,19 +87,11 @@ public class StudyController {
createXref("bazbing")
);
if (study == null) {
throw new NotFoundException("Study with ID " + studyId + " not found");
}
List<GermplasmVO> germplasms = getGermplasms(study);
List<ObservationVariableVO> variables = getVariables(study);
List<TrialVO> trials = getTrials(study);
LocationVO location = getLocation(study);
// TODO remove this
location.setLatitude(34.0);
location.setLongitude(14.0);
return new ModelAndView("study",
"model",
new StudyModel(
......
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