Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemSempere committed Jan 3, 2024
1 parent dcc7be5 commit 57e54ca
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/fr/cirad/web/controller/rest/BrapiRestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,7 @@ static public class GermplasmSearchRequest {
}

@ApiOperation(authorizations = { @Authorization(value = "AuthorizationToken") }, value = "germplasmAttributes")
@RequestMapping(value = "/{database:.+}" + URL_BASE_PREFIX + "/"
+ URL_GERMPLASM_ATTRIBUTES, method = RequestMethod.GET, produces = "application/json")
@RequestMapping(value = "/{database:.+}" + URL_BASE_PREFIX + "/" + URL_GERMPLASM_ATTRIBUTES, method = RequestMethod.GET, produces = "application/json")
public Map<String, Object> germplasmAttributes(HttpServletRequest request, HttpServletResponse response,
@PathVariable String database, @PathVariable(name = "germplasmDbId") String germplasmDbId,
@RequestParam(required = false) Integer pageSize, @RequestParam(required = false) Integer page)
Expand All @@ -774,9 +773,7 @@ public Map<String, Object> germplasmAttributes(HttpServletRequest request, HttpS

Authentication authentication = tokenManager.getAuthenticationFromToken(token);
HashMap<String, Object> result = new HashMap<>();
Individual ind = MgdbDao.getInstance().loadIndividualsWithAllMetadata(database,
authentication == null ? "anonymousUser" : authentication.getName(), null, Arrays.asList(germplasmDbId))
.get(germplasmDbId);
Individual ind = MgdbDao.getInstance().loadIndividualsWithAllMetadata(database, authentication == null ? "anonymousUser" : authentication.getName(), null, Arrays.asList(germplasmDbId), null).get(germplasmDbId);
if (ind == null) {
build404Response(response);
return null;
Expand Down Expand Up @@ -923,7 +920,7 @@ public Map<String, Object> executeGermplasmSearch(HttpServletRequest request, Ht

Authentication auth = tokenManager.getAuthenticationFromToken(tokenManager.readToken(request));
String sCurrentUser = auth == null || "anonymousUser".equals(auth.getName()) ? "anonymousUser" : auth.getName();
for (Individual ind : MgdbDao.getInstance().loadIndividualsWithAllMetadata(database, sCurrentUser, null, indIDsForCurrentPage).values()) {
for (Individual ind : MgdbDao.getInstance().loadIndividualsWithAllMetadata(database, sCurrentUser, null, indIDsForCurrentPage, null).values()) {
Map<String, Object> germplasm = new TreeMap<>();
germplasm.put(BrapiService.BRAPI_FIELD_germplasmDbId, ind.getId());
germplasm.put("germplasmName", ind.getId());
Expand Down

0 comments on commit 57e54ca

Please sign in to comment.