Commit 4afa17fa authored by Matija Obreza's avatar Matija Obreza
Browse files

Added AccessionIdentifier#species field

parent 1ea0ce1f
/*
* Copyright 2017 Global Crop Diversity Trust
* Copyright 2018 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.
......@@ -33,22 +33,26 @@ public class AccessionIdentifier implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The doi. */
@Column(name = "doi", length = 100)
/** The DOI. */
@Column(length = 100)
public String doi;
/** The inst code. */
@Column(name = "instCode", length = 10, nullable = false)
@Column(length = 10, nullable = false)
public String instCode;
/** The acce numb. */
@Column(name = "acceNumb", nullable = false, length = 50)
@Column(nullable = false, length = 50)
public String acceNumb;
/** The genus. */
@Column(name = "genus", nullable = false, length = 100)
@Column(nullable = false, length = 100)
public String genus;
/** The species. */
@Column(nullable = true, length = 100)
public String species;
/**
* Gets the doi.
*
......@@ -121,43 +125,55 @@ public class AccessionIdentifier implements Serializable {
this.genus = genus;
}
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
/**
* Gets the species.
*
* @return the species
*/
public String getSpecies() {
return species;
}
/**
* Sets the species.
*
* @param species the new species
*/
public void setSpecies(String species) {
this.species = species;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = (prime * result) + ((acceNumb == null) ? 0 : acceNumb.hashCode());
result = (prime * result) + ((doi == null) ? 0 : doi.hashCode());
result = (prime * result) + ((genus == null) ? 0 : genus.hashCode());
result = (prime * result) + ((instCode == null) ? 0 : instCode.hashCode());
int result = 1;
result = prime * result + ((acceNumb == null) ? 0 : acceNumb.hashCode());
result = prime * result + ((doi == null) ? 0 : doi.hashCode());
result = prime * result + ((genus == null) ? 0 : genus.hashCode());
result = prime * result + ((instCode == null) ? 0 : instCode.hashCode());
result = prime * result + ((species == null) ? 0 : species.hashCode());
return result;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
public boolean equals(Object obj) {
if (this == obj)
return true;
if (getClass() != obj.getClass())
if (obj == null)
return false;
final AccessionIdentifier other = (AccessionIdentifier) obj;
if (doi == null) {
if (other.doi != null)
return false;
} else if (doi.equals(other.doi))
if (getClass() != obj.getClass())
return false;
AccessionIdentifier other = (AccessionIdentifier) obj;
if (acceNumb == null) {
if (other.acceNumb != null)
return false;
} else if (!acceNumb.equals(other.acceNumb))
return false;
if (doi == null) {
if (other.doi != null)
return false;
} else if (!doi.equals(other.doi))
return false;
if (genus == null) {
if (other.genus != null)
return false;
......@@ -168,6 +184,11 @@ public class AccessionIdentifier implements Serializable {
return false;
} else if (!instCode.equals(other.instCode))
return false;
if (species == null) {
if (other.species != null)
return false;
} else if (!species.equals(other.species))
return false;
return true;
}
}
......@@ -42,6 +42,9 @@ public class AccessionIdentifierFilter {
/** The genus. */
public Set<String> genus;
/** The species. */
public Set<String> species;
/** The acce numb. */
public StringFilter acceNumb;
......@@ -64,6 +67,9 @@ public class AccessionIdentifierFilter {
if ((genus != null) && !genus.isEmpty()) {
and.and(identifier.genus.in(genus));
}
if ((species != null) && !species.isEmpty()) {
and.and(identifier.species.in(species));
}
if (acceNumb != null) {
and.and(acceNumb.buildQuery(identifier.acceNumb));
}
......
......@@ -3532,3 +3532,16 @@ databaseChangeLog:
onUpdate: NO ACTION
referencedColumnNames: id
referencedTableName: descriptor_list
- changeSet:
id: 1518021597000-1
author: mobreza
comment: Added AccessionIdentifier#species property
changes:
- addColumn:
columns:
- column:
name: species
type: VARCHAR(100)
tableName: dataset_accessions
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