Commit f6daa885 authored by Richard Bruskiewich's avatar Richard Bruskiewich Committed by Matija Obreza
Browse files

Promoted the rdfURI and associated methods up to the VersionedAuditedModel...

Promoted the rdfURI and associated methods up to the VersionedAuditedModel abstract class, for reuse across several classes.
parent 67b68674
......@@ -16,6 +16,7 @@
package org.genesys2.server.model;
import javax.persistence.Lob;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
......@@ -33,4 +34,37 @@ public abstract class VersionedAuditedModel extends AuditedModel {
public void setVersion(long version) {
this.version = version;
}
// Resource Description Framework (RDF) Uniform Resource Identifier (URI)
// to link records with semantic web linked open (meta-)data
@Lob
private String rdfUri;
public String getRdfUri() {
return this.rdfUri;
}
public void setRdfUri(final String rdfUri) {
this.rdfUri = rdfUri;
}
public String getRdfUriId()
{
if(this.rdfUri == null)
return "" ;
else {
// first, check for hash URIs
String[] hashpart = rdfUri.split("#") ;
if(hashpart.length>1)
// assumed well-formed URI.. tail part is the RDF ID
return hashpart[1] ;
else
// not a hash uri... hmmm...
// since this should be a term URI,
// then take the tail part of the path as the RDF ID
return rdfUri.substring(rdfUri.lastIndexOf('/')+1) ;
}
}
}
......@@ -48,11 +48,6 @@ public class Method extends VersionedAuditedModel implements AclAwareModel {
@Column(length = 36, unique = true, nullable = false)
private String uuid;
// Resource Description Framework (RDF) Uniform Resource Identifier (URI)
// to link method records with semantic web linked open (meta-)data
@Lob
private String rdfUri;
@Column(nullable = false)
@Lob
private String method;
......@@ -92,14 +87,6 @@ public class Method extends VersionedAuditedModel implements AclAwareModel {
}
}
public String getRdfUri() {
return this.rdfUri;
}
public void setRdfUri(final String rdfUri) {
this.rdfUri = rdfUri;
}
public String getMethod() {
return this.method;
}
......
......@@ -46,11 +46,6 @@ public class Parameter extends VersionedAuditedModel implements AclAwareModel {
@Column(length = 36, unique = true, nullable = false)
private String uuid;
// Resource Description Framework (RDF) Uniform Resource Identifier (URI)
// to link method records with semantic web linked open (meta-)data
@Lob
private String rdfUri;
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "cropId")
private Crop crop;
......@@ -78,33 +73,6 @@ public class Parameter extends VersionedAuditedModel implements AclAwareModel {
}
}
public String getRdfUri() {
return this.rdfUri;
}
public String getRdfUriId()
{
if(this.rdfUri == null)
return "" ;
else {
// first, check for hash URIs
String[] hashpart = rdfUri.split("#") ;
if(hashpart.length>1)
// assumed well-formed URI.. tail part is the RDF ID
return hashpart[1] ;
else
// not a hash uri... hmmm...
// since this should be a term URI,
// then take the tail part of the path as the RDF ID
return rdfUri.substring(rdfUri.lastIndexOf('/')+1) ;
}
}
public void setRdfUri(final String rdfUri) {
this.rdfUri = rdfUri;
}
public Crop getCrop() {
return this.crop;
}
......@@ -128,7 +96,7 @@ public class Parameter extends VersionedAuditedModel implements AclAwareModel {
public void setTitle(final String title) {
this.title = title;
}
public String getTitle(Locale locale) {
return getTitleLocal(locale);
}
......@@ -142,9 +110,12 @@ public class Parameter extends VersionedAuditedModel implements AclAwareModel {
e.printStackTrace();
}
}
return this.titleJ != null && this.titleJ.has(locale.getLanguage()) ? this.titleJ.get(locale.getLanguage()).textValue() : this.title;
return this.titleJ != null &&
this.titleJ.has(locale.getLanguage())
? this.titleJ.get(locale.getLanguage()).textValue()
: this.title;
}
public void setI18n(String i18n) {
this.i18n = i18n;
}
......
......@@ -28,6 +28,7 @@
<td><spring:message code="ce.method" /></td>
<td><spring:message code="unit-of-measure" /></td>
<td><spring:message code="method.fieldName" /></td>
</tr>
</thead>
<tbody>
<c:forEach items="${traitMethods}" var="method">
......
......@@ -14,10 +14,26 @@
<spring:message code="filter.crop" />: <b><a href="<c:url value="/c/${trait.crop.shortName}/descriptors" />">${trait.crop.getName(pageContext.response.locale)}</a></b>
</div>
<table>
<thead>
<tr>
<td><spring:message code="ce.trait" /></td>
<td><spring:message code="ce.method" /></td>
<td><spring:message code="ce.sameAs" /></td>
<td><spring:message code="method.fieldName" /></td>
<td><spring:message code="unit-of-measure" /></td>
</tr>
</thead>
<tbody>
<tr>
<td><a href="<c:url value="/descriptors/${trait.id}" />"><c:out value="${method.parameter.getTitle(pageContext.response.locale)}" /></a></td>
<td><a href="<c:url value="/descriptors/${trait.id}/${method.id}" />"><c:out value="${method.getMethod(pageContext.response.locale)}" /></a></td>
<td>
<c:if test="${method.rdfUri ne null}">
<a href="<c:url value="${method.rdfUri}" />">
<c:out value="${method.getRdfUriId()}" />
</a>
</c:if>
</td>
<td><c:out value="${method.fieldName}" /></td>
<td><c:out value="${method.unit}" /></td>
</tr>
......
Supports Markdown
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