diff --git a/pom.xml b/pom.xml
index 763b26ef6502178d4f9f43db827c201f6b75e267..47d84ecc59cb5a7a195673b7f076fe49f9041f4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -497,6 +497,12 @@
spring-data-jpa
1.4.4.RELEASE
+
+ org.jamel.dbf
+ dbf-reader
+ 0.1.0
+ test
+
diff --git a/src/main/java/org/genesys2/server/model/VersionedModel.java b/src/main/java/org/genesys2/server/model/VersionedModel.java
new file mode 100644
index 0000000000000000000000000000000000000000..338cbe98a82f91671cfcf34174a5f1864eee8b98
--- /dev/null
+++ b/src/main/java/org/genesys2/server/model/VersionedModel.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2014 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.MappedSuperclass;
+import javax.persistence.Version;
+
+@MappedSuperclass
+public abstract class VersionedModel extends BusinessModel {
+ private static final long serialVersionUID = 8415401512360230669L;
+
+ @Version
+ private long version = 0;
+
+ public long getVersion() {
+ return version;
+ }
+
+ public void setVersion(long version) {
+ this.version = version;
+ }
+}
diff --git a/src/main/java/org/genesys2/server/model/impl/GrinTaxonomy.java b/src/main/java/org/genesys2/server/model/impl/GrinTaxonomy.java
new file mode 100644
index 0000000000000000000000000000000000000000..dbf409c5071339461bfe8b4b84e4ed2186773872
--- /dev/null
+++ b/src/main/java/org/genesys2/server/model/impl/GrinTaxonomy.java
@@ -0,0 +1,268 @@
+/**
+ * Copyright 2014 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.impl;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.genesys2.server.model.VersionedModel;
+
+/**
+ * GRIN taxonomy based on "species 2.dbf" from
+ * http://www.ars-grin.gov/misc/tax/species.zip
+ *
+ * @author matijaobreza
+ */
+@Entity
+public class GrinTaxonomy extends VersionedModel {
+
+ @Column(unique = true, nullable = false)
+ private Long taxno;
+
+ @Column(nullable = true)
+ private Long validTaxNo;
+
+ @Column(length = 30)
+ private String genus;
+ private Character sHybrid;
+ @Column(length = 30)
+ private String species;
+ @Column(length = 100)
+ private String sAuthor;
+ private Character sSpHybrid;
+
+ @Column(length = 30)
+ private String subSp;
+ @Column(length = 100)
+ private String subSpAuthor;
+ private Character varHybrid;
+ @Column(length = 30)
+ private String var;
+ @Column(length = 100)
+ private String varAuthor;
+ private Character svHybrid;
+ @Column(length = 30)
+ private String subVar;
+ @Column(length = 100)
+ private String svAuthor;
+ private Character fHybrid;
+ @Column(length = 30)
+ private String forma;
+ @Column(length = 100)
+ private String fAuthor;
+
+ @Column(length = 240)
+ private String protologue;
+ @Column(length = 254)
+ private String taxcmt;
+
+ @Temporal(TemporalType.DATE)
+ private Date createdDate;
+ @Temporal(TemporalType.DATE)
+ private Date modifiedDate;
+ @Temporal(TemporalType.DATE)
+ private Date verifiedDate;
+
+ public Long getTaxno() {
+ return taxno;
+ }
+
+ public void setTaxno(Long taxno) {
+ this.taxno = taxno;
+ }
+
+ public Long getValidTaxNo() {
+ return validTaxNo;
+ }
+
+ public void setValidTaxNo(Long validTaxNo) {
+ this.validTaxNo = validTaxNo;
+ }
+
+ public String getGenus() {
+ return genus;
+ }
+
+ public void setGenus(String genus) {
+ this.genus = genus;
+ }
+
+ public Character getsHybrid() {
+ return sHybrid;
+ }
+
+ public void setsHybrid(Character sHybrid) {
+ this.sHybrid = sHybrid;
+ }
+
+ public String getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+
+ public String getsAuthor() {
+ return sAuthor;
+ }
+
+ public void setsAuthor(String sAuthor) {
+ this.sAuthor = sAuthor;
+ }
+
+ public Character getsSpHybrid() {
+ return sSpHybrid;
+ }
+
+ public void setsSpHybrid(Character sSpHybrid) {
+ this.sSpHybrid = sSpHybrid;
+ }
+
+ public String getSubSp() {
+ return subSp;
+ }
+
+ public void setSubSp(String subSp) {
+ this.subSp = subSp;
+ }
+
+ public String getSubSpAuthor() {
+ return subSpAuthor;
+ }
+
+ public void setSubSpAuthor(String subSpAuthor) {
+ this.subSpAuthor = subSpAuthor;
+ }
+
+ public Character getVarHybrid() {
+ return varHybrid;
+ }
+
+ public void setVarHybrid(Character varHybrid) {
+ this.varHybrid = varHybrid;
+ }
+
+ public String getVar() {
+ return var;
+ }
+
+ public void setVar(String var) {
+ this.var = var;
+ }
+
+ public String getVarAuthor() {
+ return varAuthor;
+ }
+
+ public void setVarAuthor(String varAuthor) {
+ this.varAuthor = varAuthor;
+ }
+
+ public Character getSvHybrid() {
+ return svHybrid;
+ }
+
+ public void setSvHybrid(Character svHybrid) {
+ this.svHybrid = svHybrid;
+ }
+
+ public String getSubVar() {
+ return subVar;
+ }
+
+ public void setSubVar(String subVar) {
+ this.subVar = subVar;
+ }
+
+ public String getSvAuthor() {
+ return svAuthor;
+ }
+
+ public void setSvAuthor(String svAuthor) {
+ this.svAuthor = svAuthor;
+ }
+
+ public Character getfHybrid() {
+ return fHybrid;
+ }
+
+ public void setfHybrid(Character fHybrid) {
+ this.fHybrid = fHybrid;
+ }
+
+ public String getForma() {
+ return forma;
+ }
+
+ public void setForma(String forma) {
+ this.forma = forma;
+ }
+
+ public String getfAuthor() {
+ return fAuthor;
+ }
+
+ public void setfAuthor(String fAuthor) {
+ this.fAuthor = fAuthor;
+ }
+
+ public String getProtologue() {
+ return protologue;
+ }
+
+ public void setProtologue(String protologue) {
+ this.protologue = protologue;
+ }
+
+ public String getTaxcmt() {
+ return taxcmt;
+ }
+
+ public void setTaxcmt(String taxcmt) {
+ this.taxcmt = taxcmt;
+ }
+
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ }
+
+ public Date getModifiedDate() {
+ return modifiedDate;
+ }
+
+ public void setModifiedDate(Date modifiedDate) {
+ this.modifiedDate = modifiedDate;
+ }
+
+ public Date getVerifiedDate() {
+ return verifiedDate;
+ }
+
+ public void setVerifiedDate(Date verifiedDate) {
+ this.verifiedDate = verifiedDate;
+ }
+
+}
diff --git a/src/test/java/org/genesys2/server/test/GRINTaxonomyTest.java b/src/test/java/org/genesys2/server/test/GRINTaxonomyTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..780f28f565e001d0abf531e06b50bd3128c9762b
--- /dev/null
+++ b/src/test/java/org/genesys2/server/test/GRINTaxonomyTest.java
@@ -0,0 +1,177 @@
+/**
+ * Copyright 2014 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.test;
+
+import java.io.File;
+import java.util.Date;
+
+import org.jamel.dbf.processor.DbfProcessor;
+import org.jamel.dbf.processor.DbfRowProcessor;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Value;
+
+/**
+ * Test DBF reader of GRIN Taxonomy data from http://www.ars-grin.gov/misc/tax/
+ *
+ * @author matijaobreza
+ */
+@Ignore
+public class GRINTaxonomyTest {
+
+ @Value("${download.files.dir}")
+ private String filesDir = "./data";
+
+ // @Test
+ public void dbInfoTest() {
+ String dbfInfo = DbfProcessor.readDbfInfo(new File("genusno.dbf"));
+ System.out.println(dbfInfo);
+ }
+
+ /**
+ * Common names
+ */
+ // @Test
+ public void testCommon() {
+ File dbf = new File("common.dbf");
+ String dbfInfo = DbfProcessor.readDbfInfo(dbf);
+ System.out.println(dbfInfo);
+
+ DbfProcessor.processDbf(dbf, new DbfRowProcessor() {
+ @Override
+ public void processRow(Object[] row) {
+ System.out.print(new String((byte[]) row[0]).trim());
+ System.out.print(", ");
+ System.out.print(((Number) row[1]).longValue());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[2]).trim());
+ System.out.println();
+ }
+ });
+ }
+
+ @Test
+ public void testSpecies() {
+ File dbf = new File(filesDir, "species 2.dbf");
+ String dbfInfo = DbfProcessor.readDbfInfo(dbf);
+ System.out.println(dbfInfo);
+
+ DbfProcessor.processDbf(dbf, new DbfRowProcessor() {
+ @Override
+ public void processRow(Object[] row) {
+ // if (! "Zea".equals(new String((byte[]) row[3]).trim())) {
+ // return;
+ // }
+ // if ("".equals(new String((byte[]) row[4]).trim()) ||
+ // "".equals(new String((byte[]) row[8]).trim()) ) {
+ // return;
+ // }
+ System.out.print(((Number) row[0]).longValue());
+ System.out.print(", ");
+ System.out.print(((Number) row[1]).longValue());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[3]).trim());
+ System.out.print(", 4=");
+ System.out.print(new String((byte[]) row[4]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[5]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[6]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[7]).trim());
+ System.out.print(", SUB >> ");
+ System.out.print(new String((byte[]) row[8]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[9]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[10]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[11]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[12]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[13]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[14]).trim());
+ System.out.print(", ");
+
+ System.out.print(new String((byte[]) row[15]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[16]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[17]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[18]).trim());
+ System.out.print(", ");
+
+ System.out.print(new String((byte[]) row[20]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[21]).trim());
+ System.out.print(", ");
+
+ System.out.print((Date) row[24]);
+ System.out.print(", ");
+ System.out.print((Date) row[25]);
+ System.out.println();
+ }
+ });
+ }
+
+ // @Test
+ public void testGenusno() {
+ File dbf = new File("genusno.dbf");
+ String dbfInfo = DbfProcessor.readDbfInfo(dbf);
+ System.out.println(dbfInfo);
+
+ DbfProcessor.processDbf(dbf, new DbfRowProcessor() {
+ @Override
+ public void processRow(Object[] row) {
+ System.out.print(new String((byte[]) row[0]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[1]).trim());
+ System.out.print(", ");
+ System.out.print(((Number) row[2]).longValue());
+ System.out.print(", ");
+ System.out.print(((Number) row[3]).longValue());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[4]).trim());
+ System.out.println();
+ }
+ });
+ }
+
+ // @Test
+ public void testTaxonno() {
+ File dbf = new File("taxonno.dbf");
+ String dbfInfo = DbfProcessor.readDbfInfo(dbf);
+ System.out.println(dbfInfo);
+
+ DbfProcessor.processDbf(dbf, new DbfRowProcessor() {
+ @Override
+ public void processRow(Object[] row) {
+ System.out.print(new String((byte[]) row[0]).trim());
+ System.out.print(", ");
+ System.out.print(new String((byte[]) row[1]).trim());
+ System.out.print(", ");
+ System.out.print(((Number) row[2]).longValue());
+ System.out.print(", ");
+ System.out.print(((Number) row[3]).longValue());
+ System.out.println();
+ }
+ });
+ }
+}