Commit 0af852b0 authored by Matija Obreza's avatar Matija Obreza

Added /c/ to list all crops and included CROPNAME in Excel MCPD export

parent 459a51bf
...@@ -55,6 +55,7 @@ All other fields are optional. ...@@ -55,6 +55,7 @@ All other fields are optional.
{ {
"instCode": "XYZ111", "instCode": "XYZ111",
"acceNumb": "M12345", "acceNumb": "M12345",
"cropName": "banana",
"genus": "Musa", "genus": "Musa",
"species": "acuminata", "species": "acuminata",
"spauthor": "Colla", "spauthor": "Colla",
......
...@@ -61,7 +61,7 @@ consistent manner. ...@@ -61,7 +61,7 @@ consistent manner.
are allowed: `subsp.` (for subspecies); `convar.` (for convariety); `var.` (for variety); `f.` (for form); `Group` (for 'cultivar group'). are allowed: `subsp.` (for subspecies); `convar.` (for convariety); `var.` (for variety); `f.` (for form); `Group` (for 'cultivar group').
|SUBTAUTHOR|Provide the subtaxon authority at the most detailed taxonomic level. |SUBTAUTHOR|Provide the subtaxon authority at the most detailed taxonomic level.
|CROPNAME|Common name of the crop. Example: `malting barley`, `macadamia`, `maize`. |<<mcpd-cropname,CROPNAME>>|Common name of the crop. Example: `malting barley`, `macadamia`, `maize`.
|ACCENAME|Either a registered or other designation given to the material received, other than the donor's |ACCENAME|Either a registered or other designation given to the material received, other than the donor's
accession number (DONORNUMB) or collecting number (COLLNUMB). First letter upper case. accession number (DONORNUMB) or collecting number (COLLNUMB). First letter upper case.
...@@ -155,6 +155,24 @@ use, the concatenation of INSTCODE, ACCENUMB, and GENUS as a globally unique ide ...@@ -155,6 +155,24 @@ use, the concatenation of INSTCODE, ACCENUMB, and GENUS as a globally unique ide
similar in most respects to the PUID whenever they exchange information on accessions with similar in most respects to the PUID whenever they exchange information on accessions with
third parties (e.g. `NOR017:NGB17773:ALLIUM`). third parties (e.g. `NOR017:NGB17773:ALLIUM`).
[[mcpd-cropname]]
==== Crop name
Genesys will read the CROPNAME as provided and attempt to link the name with an existing crop
record in Genesys. Genesys currently supports the following crop names:
apple, banana, barley, beans, breadfruit, cassava, chickpea, coconut, cowpea, eggplant, fababean,
fingermillet, grasspea, lentil, lettuce, maize, pearlmillet, pigeonpea, potato, rice, sorghum,
sunflower, sweetpotato, taro, tomato, wheat, yam
The up-to-date list of crops and their coded names is available at https://www.genesys-pgr.org/c/
As more data is uploaded to Genesys we will add aliases to crops, making sure that future uploads
properly link the accession with the specified crop.
You are encouraged to use the crop names listed above, but more importantly, let
helpdesk@genesys-pgr.org know if your crop is not yet listed.
[[mcpd-wiews]] [[mcpd-wiews]]
==== Institute codes in MCPD ==== Institute codes in MCPD
......
...@@ -98,12 +98,17 @@ public class CropServiceImpl implements CropService { ...@@ -98,12 +98,17 @@ public class CropServiceImpl implements CropService {
@Override @Override
public List<Crop> listCrops() { public List<Crop> listCrops() {
return cropRepository.findAll(); List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list
crops.stream().forEach(c -> { c.getOtherNames().size(); });
return crops;
} }
@Override @Override
public List<Crop> list(final Locale locale) { public List<Crop> list(final Locale locale) {
final List<Crop> crops = cropRepository.findAll(); final List<Crop> crops = cropRepository.findAll();
// Fetch otherNames list
crops.stream().forEach(c -> { c.getOtherNames().size(); });
Collections.sort(crops, new Comparator<Crop>() { Collections.sort(crops, new Comparator<Crop>() {
@Override @Override
public int compare(Crop o1, Crop o2) { public int compare(Crop o1, Crop o2) {
......
...@@ -27,8 +27,6 @@ import java.util.Date; ...@@ -27,8 +27,6 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.persistence.EntityManager;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
...@@ -53,7 +51,6 @@ import org.genesys2.server.model.genesys.PDCI; ...@@ -53,7 +51,6 @@ import org.genesys2.server.model.genesys.PDCI;
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.Country;
import org.genesys2.server.persistence.domain.GenesysLowlevelRepository; import org.genesys2.server.persistence.domain.GenesysLowlevelRepository;
import org.genesys2.server.persistence.domain.MethodRepository;
import org.genesys2.server.service.DownloadService; import org.genesys2.server.service.DownloadService;
import org.genesys2.server.service.GenesysService; import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GenesysService.AllStuff; import org.genesys2.server.service.GenesysService.AllStuff;
...@@ -71,9 +68,6 @@ public class DownloadServiceImpl implements DownloadService { ...@@ -71,9 +68,6 @@ public class DownloadServiceImpl implements DownloadService {
public static final Log LOG = LogFactory.getLog(DownloadServiceImpl.class); public static final Log LOG = LogFactory.getLog(DownloadServiceImpl.class);
@Autowired
private EntityManager entityManager;
@Autowired @Autowired
private GenesysService genesysService; private GenesysService genesysService;
...@@ -81,12 +75,6 @@ public class DownloadServiceImpl implements DownloadService { ...@@ -81,12 +75,6 @@ public class DownloadServiceImpl implements DownloadService {
@Qualifier("genesysLowlevelRepositoryCustomImpl") @Qualifier("genesysLowlevelRepositoryCustomImpl")
private GenesysLowlevelRepository genesysLowlevelRepository; private GenesysLowlevelRepository genesysLowlevelRepository;
@Autowired
private MethodRepository methodRepository;
@Autowired(required = false)
private PDCICalculator pdciCalculator;
@Value("${base.url}") @Value("${base.url}")
private String baseUrl; private String baseUrl;
...@@ -226,7 +214,8 @@ public class DownloadServiceImpl implements DownloadService { ...@@ -226,7 +214,8 @@ public class DownloadServiceImpl implements DownloadService {
createCell(row, 10, taxonomy.getSubtaxa()); createCell(row, 10, taxonomy.getSubtaxa());
createCell(row, 11, taxonomy.getSubtAuthor()); createCell(row, 11, taxonomy.getSubtAuthor());
} }
createCell(row, 12, accession.getCropName());
createCell(row, 14, accession.getAcquisitionDate()); createCell(row, 14, accession.getAcquisitionDate());
Country origin = accession.getCountryOfOrigin(); Country origin = accession.getCountryOfOrigin();
......
...@@ -18,7 +18,11 @@ package org.genesys2.server.servlet.controller; ...@@ -18,7 +18,11 @@ package org.genesys2.server.servlet.controller;
import org.genesys2.server.model.impl.Crop; import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.model.impl.CropTaxonomy; import org.genesys2.server.model.impl.CropTaxonomy;
import org.genesys2.server.service.*; import org.genesys2.server.service.ContentService;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.FilterConstants;
import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.TraitService;
import org.genesys2.server.service.impl.FilterHandler; import org.genesys2.server.service.impl.FilterHandler;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilter; import org.genesys2.server.service.impl.FilterHandler.AppliedFilter;
import org.genesys2.server.service.impl.FilterHandler.AppliedFilters; import org.genesys2.server.service.impl.FilterHandler.AppliedFilters;
...@@ -43,13 +47,20 @@ public class CropController extends BaseController { ...@@ -43,13 +47,20 @@ public class CropController extends BaseController {
@Autowired @Autowired
private ContentService contentService; private ContentService contentService;
@Autowired @Autowired
private GenesysService genesysService; private GenesysService genesysService;
@Autowired @Autowired
private TraitService traitService; private TraitService traitService;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index(ModelMap model) {
_logger.debug("Viewing all crops");
model.addAttribute("crops", cropService.list(getLocale()));
return "/crop/list";
}
@RequestMapping("/{shortName}") @RequestMapping("/{shortName}")
public String view(ModelMap model, @PathVariable(value = "shortName") String shortName) { public String view(ModelMap model, @PathVariable(value = "shortName") String shortName) {
_logger.debug("Viewing crop " + shortName); _logger.debug("Viewing crop " + shortName);
...@@ -67,10 +78,10 @@ public class CropController extends BaseController { ...@@ -67,10 +78,10 @@ public class CropController extends BaseController {
model.addAttribute("cropTaxonomies", cropService.getCropTaxonomies(crop, new PageRequest(0, 20, new Sort("taxonomy.genus", "taxonomy.species")))); model.addAttribute("cropTaxonomies", cropService.getCropTaxonomies(crop, new PageRequest(0, 20, new Sort("taxonomy.genus", "taxonomy.species"))));
model.addAttribute("blurp", contentService.getArticle(crop, "blurp", getLocale())); model.addAttribute("blurp", contentService.getArticle(crop, "blurp", getLocale()));
// model.addAttribute("statsGenus",
// model.addAttribute("statsGenus", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.TAXONOMY_GENUS, 5)); // elasticService.termStatisticsAuto(appliedFilters,
// FilterConstants.TAXONOMY_GENUS, 5));
return "/crop/index"; return "/crop/index";
} }
...@@ -138,7 +149,7 @@ public class CropController extends BaseController { ...@@ -138,7 +149,7 @@ public class CropController extends BaseController {
return "redirect:/explore"; return "redirect:/explore";
} }
@RequestMapping("/{shortName}/overview") @RequestMapping("/{shortName}/overview")
public String viewOverview(ModelMap model, @PathVariable(value = "shortName") String shortName) { public String viewOverview(ModelMap model, @PathVariable(value = "shortName") String shortName) {
_logger.warn("Viewing crop " + shortName); _logger.warn("Viewing crop " + shortName);
......
<!DOCTYPE html>
<%@include file="/WEB-INF/jsp/init.jsp"%>
<html>
<head>
<title><spring:message code="crop.croplist" /></title>
</head>
<body>
<h1>
<spring:message code="crop.croplist" />
</h1>
<ul class="funny-list">
<c:forEach items="${crops}" var="crop" varStatus="status">
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}">
<div class="row">
<div class="col-xs-4">
<a class="show pull-left" href="<c:url value="/c/${crop.shortName}" />"><c:out value="${crop.getName(pageContext.response.locale)}" /></a>
</div>
<div class="col-xs-8">
<span style="margin: 0 1em; white-space: nowrap;"><c:out value="${crop.shortName}" /></span>
<c:forEach items="${crop.otherNames}" var="otherName">
<span style="margin: 0 1em; white-space: nowrap;"><c:out value="${otherName}" /></span>
</c:forEach>
</div>
</div>
</li>
</c:forEach>
</ul>
</body>
</html>
\ No newline at end of file
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