Commit da15c170 authored by Matija Obreza's avatar Matija Obreza

Added EURISCO descriptor ACCEURL: URL linking to additional data about the...

Added EURISCO descriptor ACCEURL: URL linking to additional data about the accession either in the holding genebank or from another source.
parent ce973bc7
......@@ -88,6 +88,9 @@ public class AccessionDetails {
@Field(index = FieldIndex.not_analyzed, type = FieldType.String)
private String bredCode;
@Field(index = FieldIndex.not_analyzed, type = FieldType.String)
private String acceUrl;
public static AccessionDetails from(AccessionData accession) {
AccessionDetails ad = new AccessionDetails();
ad.version = accession.getVersion();
......@@ -108,6 +111,7 @@ public class AccessionDetails {
ad.sampStat = accession.getSampleStatus();
ad.storage = MCPDUtil.toIntegers(accession.getStorage());
ad.taxonomy = Taxonomy.from(accession.getTaxonomy());
ad.acceUrl = accession.getAcceUrl();
if (ad.taxonomy == null) {
LOG.warn("Go check " + ad.id);
......@@ -344,11 +348,11 @@ public class AccessionDetails {
public String getBredCode() {
return bredCode;
}
public void setBredCode(String bredCode) {
this.bredCode = bredCode;
}
public String getPedigree() {
return pedigree;
}
......@@ -435,4 +439,12 @@ public class AccessionDetails {
institute.setNetworks(networks);
}
public String getAcceUrl() {
return this.acceUrl;
}
public void setAcceUrl(String acceUrl) {
this.acceUrl = acceUrl;
}
}
......@@ -130,6 +130,9 @@ public abstract class AccessionData implements IdUUID, Serializable {
@Column(name = "storage", length = 64, nullable = true)
private String storage;
@Column(name = "acceurl", length = 300, nullable = true)
private String acceUrl;
/**
* Update MCPD {@link #storage}
*/
......@@ -358,4 +361,12 @@ public abstract class AccessionData implements IdUUID, Serializable {
public String toString() {
return MessageFormat.format("Accession id={0,number,##########} UUID={1}", accessionId.getId(), getUuid());
}
public String getAcceUrl() {
return this.acceUrl;
}
public void setAcceUrl(String acceUrl) {
this.acceUrl = acceUrl;
}
}
......@@ -76,6 +76,8 @@ public class AccessionJson {
private Remark[] remarks;
@JsonProperty(value = Accession.HISTORIC)
private boolean historic;
@JsonProperty(value = Accession.ACCEURL)
private String acceUrl;
public long getVersion() {
return version;
......@@ -292,4 +294,12 @@ public class AccessionJson {
public boolean getHistoric() {
return this.historic;
}
public String getAcceUrl() {
return acceUrl;
}
public void setAcceUrl(String acceUrl) {
this.acceUrl = acceUrl;
}
}
......@@ -177,6 +177,12 @@ public interface Api1Constants {
*/
public static final String OTHERNUMB = "otherNumb";
/**
* URL linking to additional data about the accession either in the
* holding genebank or from another source.
*/
public static final String ACCEURL = "acceUrl";
}
public static interface Collecting {
......
......@@ -320,6 +320,19 @@ public class BatchRESTServiceImpl implements BatchRESTService {
updated = true;
}
}
value = accnJson.get(Api1Constants.Accession.ACCEURL);
if (value != null) {
if (!value.isNull() && !value.isTextual()) {
throw new RESTApiDataTypeException("If provided, 'acceUrl' must be a String");
}
final String acceUrl = value.isNull() ? null : value.textValue();
if (!areEqual(acceUrl, accession.getAcceUrl())) {
accession.setAcceUrl(acceUrl);
updated = true;
}
}
if (accnJson.has(Api1Constants.Accession.COLL)) {
final ObjectNode collecting = (ObjectNode) accnJson.get(Api1Constants.Accession.COLL);
......
......@@ -263,7 +263,7 @@ public class DownloadServiceImpl implements DownloadService {
}
if (accession.getUuid() != null) {
XSSFHyperlink hypr=(XSSFHyperlink) sheet.getWorkbook().getCreationHelper().createHyperlink(Hyperlink.LINK_URL);
XSSFHyperlink hypr = (XSSFHyperlink) sheet.getWorkbook().getCreationHelper().createHyperlink(Hyperlink.LINK_URL);
hypr.setAddress("http://purl.org/germplasm/id/" + accession.getUuid());
Cell cell = createCell(row, 37, accession.getUuid().toString());
cell.setHyperlink(hypr);
......@@ -272,6 +272,13 @@ public class DownloadServiceImpl implements DownloadService {
createCell(row, 38, accession.getHistoric());
}
if (accession.getAcceUrl() != null) {
XSSFHyperlink hypr = (XSSFHyperlink) sheet.getWorkbook().getCreationHelper().createHyperlink(Hyperlink.LINK_URL);
hypr.setAddress(accession.getAcceUrl());
Cell cell = createCell(row, 39, accession.getAcceUrl());
cell.setHyperlink(hypr);
}
if (remarks != null && remarks.size() > 0) {
String r = "";
for (AccessionRemark remark : remarks) {
......@@ -284,7 +291,7 @@ public class DownloadServiceImpl implements DownloadService {
}
}
createCell(row, 39, r);
createCell(row, 40, r);
}
}
......@@ -311,7 +318,7 @@ public class DownloadServiceImpl implements DownloadService {
c.setCellValue(value);
return c;
}
private String addName(String otherNames, String name, String usedBy) {
if (StringUtils.isBlank(name)) {
return otherNames;
......
......@@ -627,7 +627,8 @@ accession.pdci.about-link=Read about Passport Data Completeness Index
accession.pdci.independent-items=Independent of the population type
accession.pdci.dependent-items=Depending on the population type
accession.donorNumb = WIEWS code of donor institute
accession.donorNumb=Donor institute code
accession.acqDate=Acquisition date
accession.svalbard-data.url=Svalbard database URL
accession.svalbard-data.url-title=Deposit information in SGSV database
......
......@@ -227,6 +227,15 @@
</div>
</div>
<div class="row">
<div class="col-xs-4">
<spring:message code="accession.acqDate" />
</div>
<div class="col-xs-8">
<c:out value="${accession.acquisitionDate}" />
</div>
</div>
<div class="row">
<div class="col-xs-4">
<spring:message code="accession.availability" />
......@@ -314,6 +323,18 @@
</div>
</c:if>
<c:if test="${accession.acceUrl ne null}">
<div class="row">
<div class="col-xs-4">
<spring:message code="accession.acceUrl" />
</div>
<div class="col-xs-8">
<a target="_blank" href="<c:out value="${accession.acceUrl}" />"><c:out value="${accession.acceUrl}" /></a>
</div>
</div>
</c:if>
<c:if test="${accessionCollect ne null}">
<h4>
<spring:message code="accession.collecting" />
......
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