Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
Java Client API
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Genesys PGR
Java Client API
Commits
3e680a2b
Commit
3e680a2b
authored
Apr 08, 2019
by
Maxym Borodenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added taxonomy constants, fixed auth endpoint name
parent
01239534
Pipeline
#9585
passed with stage
in 29 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
226 additions
and
144 deletions
+226
-144
src/main/java/org/genesys2/client/oauth/GenesysClient.java
src/main/java/org/genesys2/client/oauth/GenesysClient.java
+2
-2
src/main/java/org/genesys2/client/oauth/api/accession/AccessionJson.java
...rg/genesys2/client/oauth/api/accession/AccessionJson.java
+23
-110
src/main/java/org/genesys2/client/oauth/api/accession/Api1Constants.java
...rg/genesys2/client/oauth/api/accession/Api1Constants.java
+41
-20
src/main/java/org/genesys2/client/oauth/api/accession/TaxonomyJson.java
...org/genesys2/client/oauth/api/accession/TaxonomyJson.java
+157
-0
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
+1
-1
src/test/java/org/geneys2/client/oauth/MockGenesysServer.java
...test/java/org/geneys2/client/oauth/MockGenesysServer.java
+2
-11
No files found.
src/main/java/org/genesys2/client/oauth/GenesysClient.java
View file @
3e680a2b
...
...
@@ -401,7 +401,7 @@ public class GenesysClient {
public
String
updateAccession
(
String
instituteCode
,
String
data
)
throws
InterruptedException
,
GenesysApiException
{
for
(
int
retry
=
0
;
retry
<
5
;
retry
++)
{
try
{
return
query
(
Verb
.
P
U
T
,
"/acn/"
+
instituteCode
+
"/upsert"
,
null
,
data
);
return
query
(
Verb
.
P
OS
T
,
"/acn/"
+
instituteCode
+
"/upsert"
,
null
,
data
);
}
catch
(
final
PleaseRetryException
e
)
{
final
long
sleepTime
=
(
long
)
(
Math
.
pow
(
2
,
retry
)
*
100
+
Math
.
pow
(
2
,
retry
)
*
2500
*
Math
.
random
());
LOG
.
warn
(
"Retrying PUT after {} ms."
,
sleepTime
);
...
...
@@ -511,7 +511,7 @@ public class GenesysClient {
* @throws GenesysApiException the Genesys API exception
*/
public
String
me
()
throws
OAuthAuthenticationException
,
PleaseRetryException
,
GenesysApiException
{
return
query
(
"/me"
);
return
query
(
"/me
/profile
"
);
}
/**
...
...
src/main/java/org/genesys2/client/oauth/api/accession/AccessionJson.java
View file @
3e680a2b
...
...
@@ -51,26 +51,6 @@ public class AccessionJson {
@JsonProperty
(
value
=
Accession
.
GENUS
)
private
String
genus
;
/** The new genus. */
@JsonProperty
(
value
=
Accession
.
GENUS_NEW
)
private
String
newGenus
;
/** The species. */
@JsonProperty
(
value
=
Accession
.
SPECIES
)
private
String
species
;
/** The spauthor. */
@JsonProperty
(
value
=
Accession
.
SPAUTHOR
)
private
String
spauthor
;
/** The subtaxa. */
@JsonProperty
(
value
=
Accession
.
SUBTAXA
)
private
String
subtaxa
;
/** The subtauthor. */
@JsonProperty
(
value
=
Accession
.
SUBTAUTHOR
)
private
String
subtauthor
;
/** The uuid. */
@JsonProperty
(
value
=
Accession
.
UUID
)
private
String
uuid
;
...
...
@@ -139,6 +119,10 @@ public class AccessionJson {
@JsonProperty
(
value
=
Accession
.
GEO
)
private
GeoJson
geo
;
/** The taxonomy. */
@JsonProperty
(
value
=
Accession
.
TAXONOMY
)
private
TaxonomyJson
taxonomy
;
/** The remarks. */
@JsonProperty
(
value
=
Accession
.
REMARKS
)
private
Remark
[]
remarks
;
...
...
@@ -166,6 +150,7 @@ public class AccessionJson {
public
AccessionJson
()
{
this
.
geo
=
new
GeoJson
();
this
.
coll
=
new
CollectingJson
();
this
.
taxonomy
=
new
TaxonomyJson
();
}
/**
...
...
@@ -284,96 +269,6 @@ public class AccessionJson {
this
.
genus
=
genus
;
}
/**
* Gets the new genus.
*
* @return the new genus
*/
public
String
getNewGenus
()
{
return
newGenus
;
}
/**
* Sets the new genus.
*
* @param newGenus the new new genus
*/
public
void
setNewGenus
(
final
String
newGenus
)
{
this
.
newGenus
=
newGenus
;
}
/**
* Gets the species.
*
* @return the species
*/
public
String
getSpecies
()
{
return
species
;
}
/**
* Sets the species.
*
* @param species the new species
*/
public
void
setSpecies
(
final
String
species
)
{
this
.
species
=
species
;
}
/**
* Gets the spauthor.
*
* @return the spauthor
*/
public
String
getSpauthor
()
{
return
spauthor
;
}
/**
* Sets the spauthor.
*
* @param spauthor the new spauthor
*/
public
void
setSpauthor
(
final
String
spauthor
)
{
this
.
spauthor
=
spauthor
;
}
/**
* Gets the subtaxa.
*
* @return the subtaxa
*/
public
String
getSubtaxa
()
{
return
subtaxa
;
}
/**
* Sets the subtaxa.
*
* @param subtaxa the new subtaxa
*/
public
void
setSubtaxa
(
final
String
subtaxa
)
{
this
.
subtaxa
=
subtaxa
;
}
/**
* Gets the subtauthor.
*
* @return the subtauthor
*/
public
String
getSubtauthor
()
{
return
subtauthor
;
}
/**
* Sets the subtauthor.
*
* @param subtauthor the new subtauthor
*/
public
void
setSubtauthor
(
final
String
subtauthor
)
{
this
.
subtauthor
=
subtauthor
;
}
/**
* Gets the uuid.
*
...
...
@@ -662,6 +557,24 @@ public class AccessionJson {
this
.
geo
=
geo
;
}
/**
* Gets the taxonomy.
*
* @return the taxonomy
*/
public
TaxonomyJson
getTaxonomy
()
{
return
taxonomy
;
}
/**
* Sets the taxonomy.
*
* @param taxonomy the new taxonomy
*/
public
void
setTaxonomy
(
final
TaxonomyJson
taxonomy
)
{
this
.
taxonomy
=
taxonomy
;
}
/**
* Gets the remarks.
*
...
...
src/main/java/org/genesys2/client/oauth/api/accession/Api1Constants.java
View file @
3e680a2b
...
...
@@ -55,26 +55,6 @@ public interface Api1Constants {
*/
public
static
final
String
GENUS
=
"genus"
;
/**
* May be used to assign a different genus.
*/
public
static
final
String
GENUS_NEW
=
"newGenus"
;
/**
* Specific epithet portion of the scientific name, in latin, in lowercase letters.
* Following abbreviation is allowed: ‘sp.’
*/
public
static
final
String
SPECIES
=
"species"
;
/** Corresponds to MCPD SPAUTHOR. */
public
static
final
String
SPAUTHOR
=
"spauthor"
;
/** Corresponds to MCPD SUBTAXA. */
public
static
final
String
SUBTAXA
=
"subtaxa"
;
/** Corresponds to MCPD SUBTAUTHOR. */
public
static
final
String
SUBTAUTHOR
=
"subtauthor"
;
/**
* Universally Unique IDentifier for the accession, assigned by the first holding institute
* and immutable when accession is duplicated in another institute.
...
...
@@ -154,6 +134,9 @@ public interface Api1Constants {
/** Object containing georeference data. */
public
static
final
String
GEO
=
"geo"
;
/** Object containing taxonomy data. */
public
static
final
String
TAXONOMY
=
"taxonomy"
;
/** MCPD Remarks. */
public
static
final
String
REMARKS
=
"remarks"
;
...
...
@@ -235,4 +218,42 @@ public interface Api1Constants {
/** Corresponds to GEOREFMETH. */
public
static
final
String
GEOREFMETH
=
"georefMeth"
;
}
/**
* The Interface Taxonomy.
*/
public
static
interface
Taxonomy
{
/**
* Reported genus of accession.
*/
public
static
final
String
GENUS
=
"genus"
;
/**
* May be used to assign a different genus.
*/
public
static
final
String
GENUS_NEW
=
"newGenus"
;
/**
* Specific epithet portion of the scientific name, in latin, in
* lowercase letters. Following abbreviation is allowed: ‘sp.’
*/
public
static
final
String
SPECIES
=
"species"
;
/**
* Corresponds to MCPD SPAUTHOR
*/
public
static
final
String
SPAUTHOR
=
"spAuthor"
;
/**
* Corresponds to MCPD SUBTAXA
*/
public
static
final
String
SUBTAXA
=
"subtaxa"
;
/**
* Corresponds to MCPD SUBTAUTHOR
*/
public
static
final
String
SUBTAUTHOR
=
"subtAuthor"
;
}
}
src/main/java/org/genesys2/client/oauth/api/accession/TaxonomyJson.java
0 → 100644
View file @
3e680a2b
/*
* Copyright 2019 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.client.oauth.api.accession
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
/**
* The Class TaxonomyJson.
*/
public
class
TaxonomyJson
{
/** The genus. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
GENUS
)
private
String
genus
;
/** The new genus. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
GENUS_NEW
)
private
String
newGenus
;
/** The spAuthor. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
SPAUTHOR
)
private
String
spAuthor
;
/** The species. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
SPECIES
)
private
String
species
;
/** The subtAuthor. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
SUBTAUTHOR
)
private
String
subtAuthor
;
/** The subtaxa. */
@JsonProperty
(
value
=
Api1Constants
.
Taxonomy
.
SUBTAXA
)
private
String
subtaxa
;
/**
* Gets the genus.
*
* @return the genus
*/
public
String
getGenus
()
{
return
genus
;
}
/**
* Sets the genus.
*
* @param genus the new genus
*/
public
void
setGenus
(
final
String
genus
)
{
this
.
genus
=
genus
;
}
/**
* Gets the new genus.
*
* @return the new genus
*/
public
String
getNewGenus
()
{
return
newGenus
;
}
/**
* Sets the new genus.
*
* @param newGenus the new new genus
*/
public
void
setNewGenus
(
final
String
newGenus
)
{
this
.
newGenus
=
newGenus
;
}
/**
* Gets the spAuthor.
*
* @return the spAuthor
*/
public
String
getSpAuthor
()
{
return
spAuthor
;
}
/**
* Sets the spAuthor.
*
* @param spAuthor the new spAuthor
*/
public
void
setSpAuthor
(
final
String
spAuthor
)
{
this
.
spAuthor
=
spAuthor
;
}
/**
* Gets the species.
*
* @return the species
*/
public
String
getSpecies
()
{
return
species
;
}
/**
* Sets the species.
*
* @param species the new species
*/
public
void
setSpecies
(
final
String
species
)
{
this
.
species
=
species
;
}
/**
* Gets the subtAuthor.
*
* @return the subtAuthor
*/
public
String
getSubtAuthor
()
{
return
subtAuthor
;
}
/**
* Sets the subtAuthor.
*
* @param subtAuthor the new subtAuthor
*/
public
void
setSubtAuthor
(
final
String
subtAuthor
)
{
this
.
subtAuthor
=
subtAuthor
;
}
/**
* Gets the subtaxa.
*
* @return the subtaxa
*/
public
String
getSubtaxa
()
{
return
subtaxa
;
}
/**
* Sets the subtaxa.
*
* @param subtaxa the new subtaxa
*/
public
void
setSubtaxa
(
final
String
subtaxa
)
{
this
.
subtaxa
=
subtaxa
;
}
}
src/test/java/org/geneys2/client/oauth/AccessionApiTest.java
View file @
3e680a2b
...
...
@@ -171,7 +171,7 @@ public class AccessionApiTest {
assertThat
(
"Expected matching INSTCODE"
,
aj1
.
getInstituteCode
(),
is
(
instituteCode
));
assertThat
(
"Expected ACCENUMB starting with"
,
aj1
.
getAccessionNumber
(),
CoreMatchers
.
startsWith
(
"ACC-"
));
assertThat
(
"Expected GENUS=Genus"
,
aj1
.
getGenus
(),
is
(
"Genus"
));
assertThat
(
"Expected SPECIES=null"
,
aj1
.
getSpecies
(),
nullValue
());
assertThat
(
"Expected SPECIES=null"
,
aj1
.
get
Taxonomy
().
get
Species
(),
nullValue
());
}
}
...
...
src/test/java/org/geneys2/client/oauth/MockGenesysServer.java
View file @
3e680a2b
...
...
@@ -188,17 +188,8 @@ public class MockGenesysServer {
if
(
aj
.
getSampStat
()
!=
null
)
{
existing
.
setSampStat
(
aj
.
getSampStat
());
}
if
(
aj
.
getSpecies
()
!=
null
)
{
existing
.
setSpecies
(
aj
.
getSpecies
());
}
if
(
aj
.
getSpauthor
()
!=
null
)
{
existing
.
setSpauthor
(
aj
.
getSpauthor
());
}
if
(
aj
.
getSubtaxa
()
!=
null
)
{
existing
.
setSubtaxa
(
aj
.
getSubtaxa
());
}
if
(
aj
.
getSubtauthor
()
!=
null
)
{
existing
.
setSubtauthor
(
aj
.
getSubtauthor
());
if
(
aj
.
getTaxonomy
()
!=
null
)
{
}
if
(
aj
.
getUuid
()
!=
null
)
{
if
(
existing
.
getUuid
()
==
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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