Genesys Backend issueshttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues2018-09-19T13:57:17+02:00https://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/330ApiInfoController v12018-09-19T13:57:17+02:00Matija ObrezaApiInfoController v1Implement a new `ApiInfoController` **v1** at `public static final String CONTROLLER_URL = ApiBaseController.APIv1_BASE + "/info";` in the **server.api.v1** package.
Copy info method from existing ApiInfoController (from Catalog)
## Ex...Implement a new `ApiInfoController` **v1** at `public static final String CONTROLLER_URL = ApiBaseController.APIv1_BASE + "/info";` in the **server.api.v1** package.
Copy info method from existing ApiInfoController (from Catalog)
## Extra data
Add additional properties to the returned object:
- `String[] cdnServers` loaded from `application.properties` (see genesys-pgr/genesys-server/issues/328)
- `long accessionCount` number of all accessions from `accessionService.count()`
- `long datasetCount` number of published datasets
- `long subsetCount` number of published subsets
- `long instituteCount` number of institutes with accessions in Genesys
- `long descriptorCount` number of published descriptors
- `long partnerCount` number of Partners
## Implementation
Please implement these "count" methods when they are missing and use this template (when possible):
```java
@Override
public long countAccessions(AccessionFilter filter) {
long total = elasticsearchService.count(Accession.class, filter);
if (total < 10000) {
// If total is below 10K, use actual count
total = accessionRepository.count(filter.buildQuery());
}
return total;
}
```
## Extras
Also expose:
- `captchaSiteKey` as `captchaSiteKey`
- `google.analytics.account` as `googleAnalyticsId`
- `itpgrfa.glis.basepath` as `glisUrl`
2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/328Accession API v1: Geo info2018-09-16T12:41:20+02:00Matija ObrezaAccession API v1: Geo infoAdd endpoint to AccessionController **v1** API `/acn/geo` as `geoInfo(String filterCode, AccessionFilter filter)` that returns
```json
{
"bounds": [
[-4.8587000, 39.8772333],
[-6.4917667, 39.0945000]
],
"accessionCount": 1...Add endpoint to AccessionController **v1** API `/acn/geo` as `geoInfo(String filterCode, AccessionFilter filter)` that returns
```json
{
"bounds": [
[-4.8587000, 39.8772333],
[-6.4917667, 39.0945000]
],
"accessionCount": 123123,
"tileServers": [ "cdn1.sandbox.genesys-pgr.org", "cdn2.sandbox.genesys-pgr.org" ]
}
```
## Bounds
Add `getBounds(AccessionFilter filter)` to **AccessionServiceImpl**.
See https://leafletjs.com/reference-1.3.4.html#latlngbounds
It should select `min(latitude), max(longitude), max(latitude), min(longitude) from accession.accessionId.geo` and return:
```js
[
[ min(latitude), max(longitude) ],
[ max(latitude), min(longitude) ]
]
```
## Accession count
Add `public long count(AccessionFilter filter)` to **AccessionServiceImpl**:
```java
@Override
public Page<Accession> list(AccessionFilter filter) {
long total = elasticsearchService.count(Accession.class, filter);
if (total < 10000) {
// If total is below 10K, use actual count
total = accessionRepository.count(filter.buildQuery());
}
return total;
}
```
## Tile servers
Tileservers info is the `cdn.servers` setting from `application.properties` and it's accessible at:
```java
@Value("${cdn.servers}")
private String[] cdnServers;
```2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/318Include inherited permissions2018-09-13T14:41:35+02:00Matija ObrezaInclude inherited permissionsIn Permissions API v1, add a static private class `_AclObjectIdentity` extending AclObjectIdentity with
```java
public List<AclEntry> inherited;
```
In method `lazyLoadForJson`, return `_AclObjectIdentity` and fill the `inherited` lis...In Permissions API v1, add a static private class `_AclObjectIdentity` extending AclObjectIdentity with
```java
public List<AclEntry> inherited;
```
In method `lazyLoadForJson`, return `_AclObjectIdentity` and fill the `inherited` list recursively with ACL entries for all `parentObjects`:
```java
private void inhertied(AclObjectIdentity objectIdentity, List<AclEntry> aclEntries, Set<AclObjectIdentity> handled) {
if (objectIdentity == null || handled.contains(objectIdentity)) {
return aclEntries;
}
aclEntries.addAll(objectIdentity.getAclEntries());
handled.add(objectIdentity);
if (objectIdentity.getParentObject() != null) {
inherited(objectIdentity.getParentObject(), aclEntries, handled);
}
}
```
Also add `objectIdentity.inherited.forEach(entry -> entry.getAclSid().getId());`.2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/316Export: Descriptor data as Excel2018-09-13T14:41:38+02:00Matija ObrezaExport: Descriptor data as ExcelExtend DescriptorController API v0 with a method that returns filtered results in Excel format using the format of the existing sheet for descriptors of the standard Catalog Excel template.
```java
@PostMapping(value = "/export", produ...Extend DescriptorController API v0 with a method that returns filtered results in Excel format using the format of the existing sheet for descriptors of the standard Catalog Excel template.
```java
@PostMapping(value = "/export", produces = { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" } )
public void exportDescriptors(
@RequestParam(name = "f", required = false) String filterCode,
@RequestBody(required = false) DescriptorFilter filter, HttpServletResponse response) throws IOException {
if (filterCode != null) {
filter = shortFilterService.filterByCode(filterCode, DescriptorFilter.class);
} else {
filterCode = shortFilterService.getCode(filter);
}
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.addHeader("Content-Disposition", String.format("attachment; filename=\"genesys-descriptors-" + filterCode + ".xlsx\""));
response.flushBuffer();
// Write XLSX to the stream.
final OutputStream outputStream = response.getOutputStream();
try {
descriptorService.exportDescriptors(filter, outputStream);
response.flushBuffer();
} catch (EOFException e) {
LOG.warn("Download was aborted", e);
}
}
```
The export should include the `UUID` and `version` as the first two columns of the updated Excel sheet.2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/314Accesssion API v1: details2018-09-11T14:21:39+02:00Matija ObrezaAccesssion API v1: detailsAccession API v1 `/{uuid}` or `/{doi}` return accession information.
Add new endpoints `/details/{uuid}` and `/details/{doi}` that return the following JSON:
```json
{
"details": accession,
"pdci": acession.accessionId.pdci,
"datase...Accession API v1 `/{uuid}` or `/{doi}` return accession information.
Add new endpoints `/details/{uuid}` and `/details/{doi}` that return the following JSON:
```json
{
"details": accession,
"pdci": acession.accessionId.pdci,
"datasets": ...,
"subsets": ...
}
```
- `datasets`: includes List of basic information of Datasets where accession is described (use JsonView.Minimal)
- `subsets`: includes List of basic infomration of Subsets where accession is included (use JsonView.Minimal)
Some service methods may not yet be available (check with @mborodenko).2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/300InstituteFilter: accessions2018-08-22T14:37:57+02:00Matija ObrezaInstituteFilter: accessionsExtend `InstituteFilter` with:
```
public Boolean accessions;
```
If the `accessions` value is not `null`:
```java
if (accessions != null) {
if (accessions == true)
and.and(institute.accessionCount.gt(0));
else
and.and(insti...Extend `InstituteFilter` with:
```
public Boolean accessions;
```
If the `accessions` value is not `null`:
```java
if (accessions != null) {
if (accessions == true)
and.and(institute.accessionCount.gt(0));
else
and.and(institute.accessionCount.eq(0));
}
```2.4Alexander PrendetskiyAlexander Prendetskiyhttps://gitlab.croptrust.org/genesys-pgr/genesys-server/-/issues/294InstituteController v12018-08-04T12:33:53+02:00Matija ObrezaInstituteController v1Add a new API controller `v1.InstituteController` with these methods:
## `/details`
Loads basic `FaoInstitute` data and if not `null` it adds:
- ES termStatistics on `crop.shortName`, `cropName`, `taxonomy.genus`, `taxonomy.genusSpeci...Add a new API controller `v1.InstituteController` with these methods:
## `/details`
Loads basic `FaoInstitute` data and if not `null` it adds:
- ES termStatistics on `crop.shortName`, `cropName`, `taxonomy.genus`, `taxonomy.genusSpecies`
- PDCI statistics for the institute
- Last updates of passport data for the institute
```java
@GetMapping("/{wiewsCode}")
public InstituteDetails details(...) {
InstituteDetails details = new InstituteDetails();
details.stats = elasticsearchService....
details.blurb = ...
...
return details;
}
// New class
public static class InsituteDetails {
public FaoInstitute institute;
public Article blurb;
public ? lastUpdates;
public ? stats; // for term statistics
}
}
```
Using InstituteDetails class will also help with API docs generation.2.4Alexander PrendetskiyAlexander Prendetskiy