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

GlobalVersionedAuditedModel extends VersionedAuditedModel, then subclass

Parameter, ParameterCategory and Method from GlobalVersionedAuditedModel
parent 07dc110f
/**
* Copyright 2013 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package org.genesys2.server.model;
import javax.persistence.Lob;
import javax.persistence.MappedSuperclass;
/**
* This superclass adds a Resource Description Framework (RDF) Uniform Resource Identifier (URI)
* to records to link them with semantic web linked open (meta-)data
*
* @author Richard Bruskiewich
*
*/
@MappedSuperclass
public abstract class GlobalVersionedAuditedModel extends VersionedAuditedModel {
@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) ;
}
}
}
......@@ -30,14 +30,14 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.genesys2.server.model.AclAwareModel;
import org.genesys2.server.model.VersionedAuditedModel;
import org.genesys2.server.model.GlobalVersionedAuditedModel;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@Entity
@Table(name = "method")
public class Method extends VersionedAuditedModel implements AclAwareModel {
public class Method extends GlobalVersionedAuditedModel implements AclAwareModel {
/**
*
......
......@@ -30,7 +30,8 @@ import javax.persistence.Table;
import javax.persistence.Transient;
import org.genesys2.server.model.AclAwareModel;
import org.genesys2.server.model.VersionedAuditedModel;
import org.genesys2.server.model.GlobalVersionedAuditedModel;
import org.genesys2.server.model.impl.Crop;
import com.fasterxml.jackson.databind.JsonNode;
......@@ -38,7 +39,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Entity
@Table(name = "parameter")
public class Parameter extends VersionedAuditedModel implements AclAwareModel {
public class Parameter extends GlobalVersionedAuditedModel implements AclAwareModel {
private static final long serialVersionUID = -4831244149317371274L;
......
......@@ -24,13 +24,13 @@ import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Transient;
import org.genesys2.server.model.VersionedAuditedModel;
import org.genesys2.server.model.GlobalVersionedAuditedModel;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@Entity(name = "parametercategory")
public class ParameterCategory extends VersionedAuditedModel {
public class ParameterCategory extends GlobalVersionedAuditedModel {
@Column(length = 100)
private String name;
......
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