Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
068020fe
Commit
068020fe
authored
Dec 30, 2014
by
Matija Obreza
Browse files
Bring back Accession#taxGenus
parent
74ad400e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/model/genesys/Accession.java
View file @
068020fe
...
...
@@ -31,6 +31,7 @@ import javax.persistence.OrderBy;
import
javax.persistence.PrePersist
;
import
javax.persistence.PreUpdate
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
org.genesys2.server.model.VersionedAuditedModel
;
import
org.genesys2.server.model.impl.Country
;
...
...
@@ -38,10 +39,7 @@ import org.genesys2.server.model.impl.FaoInstitute;
import
org.genesys2.util.MCPDUtil
;
@Entity
@Table
(
name
=
"accession"
)
// TODO FIXME Reenable
// @Table(name = "accession", uniqueConstraints = {
// @UniqueConstraint(columnNames = { "instCode", "acceNumb", "taxGenus" }) })
@Table
(
name
=
"accession"
,
uniqueConstraints
=
{
@UniqueConstraint
(
name
=
"UQ_accession_genus_inst"
,
columnNames
=
{
"instituteId"
,
"taxGenus"
,
"acceNumb"
})
})
public
class
Accession
extends
VersionedAuditedModel
{
private
static
final
long
serialVersionUID
=
-
7630113633534038876L
;
...
...
@@ -94,6 +92,9 @@ public class Accession extends VersionedAuditedModel {
@Column
(
name
=
"mlsStat"
)
private
Boolean
mlsStatus
;
@Column
(
name
=
"taxGenus"
,
nullable
=
false
)
private
long
taxGenus
;
@Column
(
name
=
"storage"
,
nullable
=
false
)
@ElementCollection
(
fetch
=
FetchType
.
LAZY
)
@CollectionTable
(
name
=
"accessionstorage"
,
joinColumns
=
@JoinColumn
(
name
=
"accessionId"
))
...
...
@@ -231,6 +232,14 @@ public class Accession extends VersionedAuditedModel {
this
.
mlsStatus
=
mlsStatus
;
}
public
long
getTaxGenus
()
{
return
taxGenus
;
}
public
void
setTaxGenus
(
long
taxGenus
)
{
this
.
taxGenus
=
taxGenus
;
}
public
void
setTaxonomy
(
Taxonomy2
taxonomy2
)
{
this
.
taxonomy
=
taxonomy2
;
}
...
...
@@ -261,6 +270,6 @@ public class Accession extends VersionedAuditedModel {
@Override
public
String
toString
()
{
return
MessageFormat
.
format
(
"Accession id={0,number,#} A={3} inst={1} genus={2}"
,
id
,
instituteCode
,
"N/A"
,
accessionName
);
return
MessageFormat
.
format
(
"Accession id={0,number,#} A={3} inst={1} genus={2}"
,
id
,
instituteCode
,
taxGenus
,
accessionName
);
}
}
src/main/java/org/genesys2/server/service/impl/BatchRESTServiceImpl.java
View file @
068020fe
...
...
@@ -659,6 +659,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
if
(!
ensuredTaxonomy
.
sameAs
(
taxonomy
))
{
accession
.
setTaxonomy
(
ensuredTaxonomy
);
accession
.
setTaxGenus
(
ensuredTaxonomy
.
getTaxGenus
());
updated
=
true
;
}
...
...
src/test/java/org/genesys2/server/test/BatchRESTServiceTest.java
View file @
068020fe
...
...
@@ -240,6 +240,7 @@ public class BatchRESTServiceTest {
assertTrue
(
accession
.
getTaxonomy
()
!=
null
);
final
Taxonomy2
tax
=
accession
.
getTaxonomy
();
System
.
err
.
println
(
tax
);
System
.
err
.
println
(
accession
.
getTaxGenus
());
// Modify taxonomy
json
.
put
(
"genus"
,
"Hordeum"
);
...
...
@@ -257,6 +258,7 @@ public class BatchRESTServiceTest {
final
Taxonomy2
tax2
=
accession
.
getTaxonomy
();
System
.
err
.
println
(
tax2
);
assertFalse
(
tax2
.
getId
().
equals
(
tax
.
getId
()));
System
.
err
.
println
(
accession
.
getTaxGenus
());
// test nothing
try
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment