use of uk.ac.ebi.spot.goci.model.EnsemblReleaseJson in project goci by EBISPOT.
the class EnsemblRelease method getReleaseVersion.
/**
* Getter for the release version
*
* @return the numeric release version
*/
public int getReleaseVersion() throws EnsemblRestIOException {
RestTemplate restTemplate = new RestTemplate();
String url = getServer() + getEndpoint();
int currentEnsemblRelease = 0;
try {
EnsemblReleaseJson ensemblReleaseJson = restTemplate.getForObject(url, EnsemblReleaseJson.class);
getLog().info("Querying " + url);
int[] releases = ensemblReleaseJson.getReleases();
if (releases != null) {
if (releases.length == 1) {
currentEnsemblRelease = releases[0];
} else {
throw new EnsemblRestIOException("Unable to determine Ensembl release");
}
} else {
throw new EnsemblRestIOException("No Ensembl release information returned from API");
}
} catch (Exception e) {
throw new EnsemblRestIOException("Problem querying Ensembl API for release");
}
return currentEnsemblRelease;
}
Aggregations