Commit 84d358fc authored by Matija Obreza's avatar Matija Obreza
Browse files

Use MCPD#cropName instead of taxonomy to determine crop of accession

parent af504f12
CREATE TABLE `cropname` (
`cropId` bigint(20) NOT NULL,
`otherName` varchar(255) NOT NULL,
UNIQUE KEY `UK_o6svkv9o98t67jnnxv7i0d4a7` (`otherName`),
KEY `FK_tb67bwitjd2dlmmfbxqsfcjmq` (`cropId`),
CONSTRAINT `FK_tb67bwitjd2dlmmfbxqsfcjmq` FOREIGN KEY (`cropId`) REFERENCES `crop` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table accession add `cropName` varchar(50) DEFAULT NULL,
add `cropId` bigint(20) DEFAULT NULL,
add CONSTRAINT `FK_826wi40aq5ucsmeki61dnr9pt` FOREIGN KEY (`cropId`) REFERENCES `crop` (`id`);
alter table accessionhistoric add `cropName` varchar(50) DEFAULT NULL,
add `cropId` bigint(20) DEFAULT NULL,
add CONSTRAINT `FK_tb12h2n6q2ck6wvpp2l73up2a` FOREIGN KEY (`cropId`) REFERENCES `crop` (`id`);
update accession a inner join croptaxonomy ct on ct.taxonomyId=a.taxonomyId2 inner join crop c on c.id=ct.cropId set a.cropName=c.shortName, a.cropId=c.id;
update accessionhistoric a inner join croptaxonomy ct on ct.taxonomyId=a.taxonomyId2 inner join crop c on c.id=ct.cropId set a.cropName=c.shortName, a.cropId=c.id;
...@@ -153,6 +153,18 @@ public class AccessionDetails { ...@@ -153,6 +153,18 @@ public class AccessionDetails {
} }
} }
/**
* Single crop
*
* @param shortName
*/
public void crops(String cropName) {
if (StringUtils.isBlank(cropName))
return;
this.crops = new ArrayList<String>();
this.crops.add(cropName);
}
public void crops(List<Crop> crops) { public void crops(List<Crop> crops) {
if (crops == null || crops.isEmpty()) if (crops == null || crops.isEmpty())
return; return;
...@@ -473,4 +485,5 @@ public class AccessionDetails { ...@@ -473,4 +485,5 @@ public class AccessionDetails {
public void setLists(Set<String> lists) { public void setLists(Set<String> lists) {
this.lists = lists; this.lists = lists;
} }
} }
...@@ -26,6 +26,7 @@ import java.util.UUID; ...@@ -26,6 +26,7 @@ import java.util.UUID;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
...@@ -39,6 +40,7 @@ import javax.persistence.Version; ...@@ -39,6 +40,7 @@ import javax.persistence.Version;
import org.genesys2.server.model.IdUUID; import org.genesys2.server.model.IdUUID;
import org.genesys2.server.model.impl.Country; import org.genesys2.server.model.impl.Country;
import org.genesys2.server.model.impl.Crop;
import org.genesys2.server.model.impl.FaoInstitute; import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.util.MCPDUtil; import org.genesys2.util.MCPDUtil;
import org.genesys2.util.NumberUtils; import org.genesys2.util.NumberUtils;
...@@ -92,6 +94,13 @@ public abstract class AccessionData implements IdUUID, Serializable { ...@@ -92,6 +94,13 @@ public abstract class AccessionData implements IdUUID, Serializable {
@Column(name = "seqNo", nullable = false) @Column(name = "seqNo", nullable = false)
private float seqNo = 0; private float seqNo = 0;
@Column(name = "cropName", nullable = true, length = 50)
private String cropName;
@ManyToOne(cascade = {}, optional = true, fetch = FetchType.LAZY)
@JoinColumn(name = "cropId")
private Crop crop;
// @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) // @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@ManyToOne(cascade = {}, optional = false) @ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "taxonomyId2") @JoinColumn(name = "taxonomyId2")
...@@ -153,7 +162,7 @@ public abstract class AccessionData implements IdUUID, Serializable { ...@@ -153,7 +162,7 @@ public abstract class AccessionData implements IdUUID, Serializable {
this.instituteCode = getInstitute().getCode(); this.instituteCode = getInstitute().getCode();
this.storage = MCPDUtil.toMcpdArray(getStoRage()); this.storage = MCPDUtil.toMcpdArray(getStoRage());
// Update the ACCENUMB number // Update the ACCENUMB number
this.seqNo = NumberUtils.numericValue(this.accessionName); this.seqNo = NumberUtils.numericValue(this.accessionName);
} }
...@@ -388,4 +397,20 @@ public abstract class AccessionData implements IdUUID, Serializable { ...@@ -388,4 +397,20 @@ public abstract class AccessionData implements IdUUID, Serializable {
public void setSeqNo(float acceNumbNumb) { public void setSeqNo(float acceNumbNumb) {
this.seqNo = acceNumbNumb; this.seqNo = acceNumbNumb;
} }
public String getCropName() {
return cropName;
}
public void setCropName(String cropName) {
this.cropName = cropName;
}
public Crop getCrop() {
return crop;
}
public void setCrop(Crop crop) {
this.crop = crop;
}
} }
...@@ -24,12 +24,18 @@ import java.util.List; ...@@ -24,12 +24,18 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import javax.persistence.CollectionTable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
...@@ -56,6 +62,12 @@ public class Crop extends GlobalVersionedAuditedModel implements AclAwareModel { ...@@ -56,6 +62,12 @@ public class Crop extends GlobalVersionedAuditedModel implements AclAwareModel {
@Column(nullable = false, length = 50, unique = true) @Column(nullable = false, length = 50, unique = true)
private String shortName; private String shortName;
@Column(name = "otherName", nullable = false)
@ElementCollection(fetch = FetchType.LAZY)
@CollectionTable(name = "cropname", joinColumns = @JoinColumn(name = "cropId", referencedColumnName = "id"), uniqueConstraints = { @UniqueConstraint(columnNames = "otherName") })
@OrderBy("otherName")
private List<String> otherNames;
@Column(nullable = false, length = 200) @Column(nullable = false, length = 200)
private String name; private String name;
...@@ -219,4 +231,11 @@ public class Crop extends GlobalVersionedAuditedModel implements AclAwareModel { ...@@ -219,4 +231,11 @@ public class Crop extends GlobalVersionedAuditedModel implements AclAwareModel {
return buildVernacularMap("description"); return buildVernacularMap("description");
} }
public List<String> getOtherNames() {
return otherNames;
}
public void setOtherNames(List<String> otherNames) {
this.otherNames = otherNames;
}
} }
...@@ -186,8 +186,13 @@ public interface Api1Constants { ...@@ -186,8 +186,13 @@ public interface Api1Constants {
*/ */
public static final String ACCEURL = "acceUrl"; public static final String ACCEURL = "acceUrl";
/**
* Gene bank provided MCPD#CROPNAME
*/
public static final String CROPNAME = "cropName";
} }
public static interface Institute { public static interface Institute {
/** /**
* Corresponds to INSTCODE * Corresponds to INSTCODE
...@@ -197,9 +202,9 @@ public interface Api1Constants { ...@@ -197,9 +202,9 @@ public interface Api1Constants {
public static final String INSTCODE_COUNTRY = "country.iso3"; public static final String INSTCODE_COUNTRY = "country.iso3";
} }
public static interface Taxonomy { public static interface Taxonomy {
public static final String SCIENTIFIC_NAME = "sciName"; public static final String SCIENTIFIC_NAME = "sciName";
/** /**
......
...@@ -19,6 +19,7 @@ package org.genesys2.server.persistence.domain; ...@@ -19,6 +19,7 @@ package org.genesys2.server.persistence.domain;
import java.util.List; import java.util.List;
import org.genesys2.server.model.impl.Crop; import org.genesys2.server.model.impl.Crop;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
public interface CropRepository extends JpaRepository<Crop, Long> { public interface CropRepository extends JpaRepository<Crop, Long> {
...@@ -26,4 +27,7 @@ public interface CropRepository extends JpaRepository<Crop, Long> { ...@@ -26,4 +27,7 @@ public interface CropRepository extends JpaRepository<Crop, Long> {
Crop findByShortName(String shortName); Crop findByShortName(String shortName);
List<Crop> findByShortName(List<String> cropNames); List<Crop> findByShortName(List<String> cropNames);
@Query("select c from Crop c where ?1 member of c.otherNames")
Crop findByOtherNames(String cropName);
} }
...@@ -45,6 +45,7 @@ import org.genesys2.server.model.impl.FaoInstitute; ...@@ -45,6 +45,7 @@ import org.genesys2.server.model.impl.FaoInstitute;
import org.genesys2.server.model.json.Api1Constants; import org.genesys2.server.model.json.Api1Constants;
import org.genesys2.server.persistence.domain.AccessionCustomRepository; import org.genesys2.server.persistence.domain.AccessionCustomRepository;
import org.genesys2.server.service.BatchRESTService; import org.genesys2.server.service.BatchRESTService;
import org.genesys2.server.service.CropService;
import org.genesys2.server.service.GenesysService; import org.genesys2.server.service.GenesysService;
import org.genesys2.server.service.GeoService; import org.genesys2.server.service.GeoService;
import org.genesys2.server.service.InstituteService; import org.genesys2.server.service.InstituteService;
...@@ -78,6 +79,9 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -78,6 +79,9 @@ public class BatchRESTServiceImpl implements BatchRESTService {
@Autowired @Autowired
TaxonomyService taxonomyService; TaxonomyService taxonomyService;
@Autowired
CropService cropService;
@Autowired @Autowired
OrganizationService organizationService; OrganizationService organizationService;
...@@ -195,10 +199,10 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -195,10 +199,10 @@ public class BatchRESTServiceImpl implements BatchRESTService {
throw new RESTApiException("Accession does not belong to instCode=" + institute.getCode() + " acn=" + dataJson); throw new RESTApiException("Accession does not belong to instCode=" + institute.getCode() + " acn=" + dataJson);
} }
Accession accession = loaded.stream() Accession accession = loaded
.filter(a -> useUniqueAcceNumbs ? (a.getAccessionName().equalsIgnoreCase(dataJson.acceNumb)) .stream()
: (a.getAccessionName().equalsIgnoreCase(dataJson.acceNumb) && a.getTaxonomy().getGenus().equalsIgnoreCase(dataJson.genus))) .filter(a -> useUniqueAcceNumbs ? (a.getAccessionName().equalsIgnoreCase(dataJson.acceNumb)) : (a.getAccessionName().equalsIgnoreCase(
.findFirst().orElse(null); dataJson.acceNumb) && a.getTaxonomy().getGenus().equalsIgnoreCase(dataJson.genus))).findFirst().orElse(null);
boolean updated = false; boolean updated = false;
...@@ -237,6 +241,7 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -237,6 +241,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
updated |= updateTaxonomy(accession, accnJson); updated |= updateTaxonomy(accession, accnJson);
} }
updated |= updateCrop(accession, accnJson.get(Api1Constants.Accession.CROPNAME));
updated |= updateAcceNumb(accession, accnJson.get(Api1Constants.Accession.ACCENUMB_NEW)); updated |= updateAcceNumb(accession, accnJson.get(Api1Constants.Accession.ACCENUMB_NEW));
updated |= updateOrgCty(accession, accnJson.get(Api1Constants.Accession.ORIGCTY)); updated |= updateOrgCty(accession, accnJson.get(Api1Constants.Accession.ORIGCTY));
updated |= updateUuid(accession, accnJson.get(Api1Constants.Accession.UUID)); updated |= updateUuid(accession, accnJson.get(Api1Constants.Accession.UUID));
...@@ -520,24 +525,24 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -520,24 +525,24 @@ public class BatchRESTServiceImpl implements BatchRESTService {
List<Accession> savedData = genesysService.saveAccessions(institute, toSave); List<Accession> savedData = genesysService.saveAccessions(institute, toSave);
// Iterate savedData to extract UUIDs // Iterate savedData to extract UUIDs
upsertResponses.stream().forEach(response -> { upsertResponses.stream().forEach(
Accession accession = savedData.stream() response -> {
.filter(a -> useUniqueAcceNumbs ? (a.getAccessionName() Accession accession = savedData
.equalsIgnoreCase(response.getAcceNumb())) .stream()
: (a.getAccessionName().equalsIgnoreCase(response.getAcceNumb()) .filter(a -> useUniqueAcceNumbs ? (a.getAccessionName().equalsIgnoreCase(response.getAcceNumb())) : (a.getAccessionName()
&& a.getTaxonomy().getGenus().equalsIgnoreCase(response.getGenus()))) .equalsIgnoreCase(response.getAcceNumb()) && a.getTaxonomy().getGenus().equalsIgnoreCase(response.getGenus())))
.findFirst().orElse(null); .findFirst().orElse(null);
UpsertResult result = response.getResult(); UpsertResult result = response.getResult();
if (accession != null) { if (accession != null) {
if (result.getUuid() == null) { if (result.getUuid() == null) {
result.setAction(UpsertResult.Type.INSERT); result.setAction(UpsertResult.Type.INSERT);
} else { } else {
result.setAction(UpsertResult.Type.UPDATE); result.setAction(UpsertResult.Type.UPDATE);
} }
result.setUUID(accession.getUuid()); result.setUUID(accession.getUuid());
} }
}); });
} }
if (toSaveColl.size() > 0) { if (toSaveColl.size() > 0) {
...@@ -584,6 +589,30 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -584,6 +589,30 @@ public class BatchRESTServiceImpl implements BatchRESTService {
return upsertResponses; return upsertResponses;
} }
private boolean updateCrop(Accession accession, JsonNode value) throws RESTApiDataTypeException {
if (value != null) {
if (!value.isTextual()) {
throw new RESTApiDataTypeException("cropName must be a String");
}
if (value.isNull()) {
if (!StringUtils.equals(null, accession.getCropName())) {
accession.setCropName(null);
accession.setCrop(null);
return true;
}
}
final String cropName = value.textValue().trim();
if (!StringUtils.equals(cropName, accession.getCropName())) {
accession.setCropName(cropName);
accession.setCrop(cropService.getCrop(cropName));
return true;
}
}
return false;
}
private boolean updateStorage(AccessionData accession, ObjectNode accnJson) throws RESTApiDataTypeException { private boolean updateStorage(AccessionData accession, ObjectNode accnJson) throws RESTApiDataTypeException {
boolean updated = false; boolean updated = false;
...@@ -1043,7 +1072,7 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -1043,7 +1072,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#institute, 'DELETE') or hasPermission(#institute, 'MANAGE')") @PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#institute, 'DELETE') or hasPermission(#institute, 'MANAGE')")
public List<AccessionOpResponse> deleteAccessions(FaoInstitute institute, List<AccessionHeaderJson> batch) throws RESTApiException { public List<AccessionOpResponse> deleteAccessions(FaoInstitute institute, List<AccessionHeaderJson> batch) throws RESTApiException {
LOG.info("Batch deleting " + batch.size() + " entries for " + institute); LOG.info("Batch deleting " + batch.size() + " entries for " + institute);
final List<AccessionOpResponse> upsertResponses = new ArrayList<AccessionOpResponse>(); final List<AccessionOpResponse> upsertResponses = new ArrayList<AccessionOpResponse>();
...@@ -1077,12 +1106,12 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -1077,12 +1106,12 @@ public class BatchRESTServiceImpl implements BatchRESTService {
if (accession != null) { if (accession != null) {
toDelete.add(accession); toDelete.add(accession);
upsertResult=new UpsertResult(UpsertResult.Type.DELETE); upsertResult = new UpsertResult(UpsertResult.Type.DELETE);
upsertResult.setUUID(accession.getUuid()); upsertResult.setUUID(accession.getUuid());
} else { } else {
upsertResult=new UpsertResult(UpsertResult.Type.NOOP); upsertResult = new UpsertResult(UpsertResult.Type.NOOP);
} }
upsertResponse.setResult(upsertResult); upsertResponse.setResult(upsertResult);
} }
......
...@@ -72,7 +72,12 @@ public class CropServiceImpl implements CropService { ...@@ -72,7 +72,12 @@ public class CropServiceImpl implements CropService {
@Override @Override
public Crop getCrop(String shortName) { public Crop getCrop(String shortName) {
return cropRepository.findByShortName(shortName); Crop crop = cropRepository.findByShortName(shortName);
if (crop == null) {
// Find crop by alias
crop = cropRepository.findByOtherNames(shortName);
}
return crop;
} }
@PreAuthorize("hasRole('ADMINISTRATOR')") @PreAuthorize("hasRole('ADMINISTRATOR')")
......
...@@ -110,17 +110,16 @@ public class DirectMysqlQuery { ...@@ -110,17 +110,16 @@ public class DirectMysqlQuery {
innerJoin("accelist", "al", "al.id=ali.listid"); innerJoin("accelist", "al", "al.id=ali.listid");
} }
if (filters.hasFilter(FilterConstants.CROPS) || filters.hasFilter(FilterConstants.TAXONOMY_GENUS) || filters.hasFilter(FilterConstants.TAXONOMY_SPECIES) if (filters.hasFilter(FilterConstants.TAXONOMY_GENUS) || filters.hasFilter(FilterConstants.TAXONOMY_SPECIES)
|| filters.hasFilter(FilterConstants.TAXONOMY_SUBTAXA) || filters.hasFilter(FilterConstants.TAXONOMY_SCINAME)) { || filters.hasFilter(FilterConstants.TAXONOMY_SUBTAXA) || filters.hasFilter(FilterConstants.TAXONOMY_SCINAME)) {
innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2"); innerJoin("taxonomy2", "t", "t.id=a.taxonomyId2");
if (filters.hasFilter(FilterConstants.CROPS)) {
innerJoin("croptaxonomy", "ct", "ct.taxonomyId=t.id");
innerJoin("crop", null, "crop.id=ct.cropId");
}
} }
if (filters.hasFilter(FilterConstants.CROPS)) {
innerJoin("crop", null, "crop.id=a.cropId");
}
// if (filters.hasFilter(FilterConstants.ORGCTY_ISO3)) { // if (filters.hasFilter(FilterConstants.ORGCTY_ISO3)) {
// innerJoin("country", "cty", "cty.id=a.orgCtyId"); // innerJoin("country", "cty", "cty.id=a.orgCtyId");
// } // }
......
...@@ -363,6 +363,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -363,6 +363,8 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
accession.getStoRage().size(); accession.getStoRage().size();
if (accession.getCountryOfOrigin() != null) if (accession.getCountryOfOrigin() != null)
accession.getCountryOfOrigin().getId(); accession.getCountryOfOrigin().getId();
if (accession.getCrop() != null)
accession.getCrop().getId();
} }
return accession; return accession;
} }
...@@ -394,7 +396,11 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -394,7 +396,11 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
ad.remarks(all.remarks); ad.remarks(all.remarks);
// ad.traits(listMethods(accession), // ad.traits(listMethods(accession),
// getAccessionTraitValues(accession)); // getAccessionTraitValues(accession));
ad.crops(cropService.getCrops(all.accession.getTaxonomy())); if (all.accession.getCrop() != null) {
ad.crops(all.accession.getCrop().getShortName());
} else {
ad.crops(cropService.getCrops(all.accession.getTaxonomy()));
}
return ad; return ad;
} }
...@@ -1105,8 +1111,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -1105,8 +1111,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
zos.putNextEntry(metaEntry); zos.putNextEntry(metaEntry);
final BufferedWriter osw = new BufferedWriter(new OutputStreamWriter(zos)); final BufferedWriter osw = new BufferedWriter(new OutputStreamWriter(zos));
osw.write("<?xml version='1.0' encoding='utf-8'?>\n"); osw.write("<?xml version='1.0' encoding='utf-8'?>\n");
osw.write( osw.write("<archive xmlns=\"http://rs.tdwg.org/dwc/text/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://rs.tdwg.org/dwc/text/ http://rs.tdwg.org/dwc/text/tdwg_dwc_text.xsd\">\n");
"<archive xmlns=\"http://rs.tdwg.org/dwc/text/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://rs.tdwg.org/dwc/text/ http://rs.tdwg.org/dwc/text/tdwg_dwc_text.xsd\">\n");
osw.write("<core encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n"); osw.write("<core encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n");
osw.write("\t<files><location>core.csv</location></files>\n"); osw.write("\t<files><location>core.csv</location></files>\n");
osw.write("\t<id index=\"0\" />\n"); osw.write("\t<id index=\"0\" />\n");
...@@ -1373,8 +1378,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -1373,8 +1378,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
zos.putNextEntry(metaEntry); zos.putNextEntry(metaEntry);
final BufferedWriter osw = new BufferedWriter(new OutputStreamWriter(zos)); final BufferedWriter osw = new BufferedWriter(new OutputStreamWriter(zos));
osw.write("<?xml version='1.0' encoding='utf-8'?>\n"); osw.write("<?xml version='1.0' encoding='utf-8'?>\n");
osw.write( osw.write("<archive xmlns=\"http://rs.tdwg.org/dwc/text/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://rs.tdwg.org/dwc/text/ http://rs.tdwg.org/dwc/text/tdwg_dwc_text.xsd\">\n");
"<archive xmlns=\"http://rs.tdwg.org/dwc/text/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://rs.tdwg.org/dwc/text/ http://rs.tdwg.org/dwc/text/tdwg_dwc_text.xsd\">\n");
osw.write("<core encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n"); osw.write("<core encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n");
osw.write("\t<files><location>core.csv</location></files>\n"); osw.write("\t<files><location>core.csv</location></files>\n");
osw.write("\t<id index=\"0\" />\n"); osw.write("\t<id index=\"0\" />\n");
...@@ -1386,8 +1390,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService { ...@@ -1386,8 +1390,7 @@ public class GenesysServiceImpl implements GenesysService, DatasetService {
for (int i = 0; i < metadataMethods.size(); i++) { for (int i = 0; i < metadataMethods.size(); i++) {
final Method method = metadataMethods.get(i); final Method method = metadataMethods.get(i);
osw.write( osw.write("<extension encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n");
"<extension encoding=\"UTF-8\" fieldsTerminatedBy=\",\" linesTerminatedBy=\"\\n\" fieldsEnclosedBy=\"&quot;\" ignoreHeaderLines=\"0\">\n");
osw.write("\t<files><location>"); osw.write("\t<files><location>");
osw.write(method.getFieldName().toLowerCase()); osw.write(method.getFieldName().toLowerCase());
osw.write(".csv</location></files>\n"); osw.write(".csv</location></files>\n");
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package org.genesys2.server.servlet.controller; package org.genesys2.server.servlet.controller;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
...@@ -24,6 +25,7 @@ import org.genesys2.server.model.genesys.Accession; ...@@ -24,6 +25,7 @@ import org.genesys2.server.model.genesys.Accession;
import org.genesys2.server.model.genesys.AccessionGeo; import org.genesys2.server.model.genesys.AccessionGeo;
import org.genesys2.server.model.genesys.PDCI; import