diff --git a/src/main/java/fr/cirad/web/controller/gigwa/GigwaRestController.java b/src/main/java/fr/cirad/web/controller/gigwa/GigwaRestController.java index 5915384e..306633b8 100644 --- a/src/main/java/fr/cirad/web/controller/gigwa/GigwaRestController.java +++ b/src/main/java/fr/cirad/web/controller/gigwa/GigwaRestController.java @@ -260,11 +260,11 @@ public class GigwaRestController extends ControllerInterface { static public final String VARIANTS_BY_IDS = "/variants/byIds"; static public final String VARIANTS_LOOKUP = "/variants/lookup"; static public final String GENES_LOOKUP = "/genes/lookup"; - static public final String GALAXY_HISTORY_PUSH = "/pushToGalaxyHistory"; + static public final String GALAXY_HISTORY_PUSH = "/pushToGalaxyHistory"; static public final String DISTINCT_INDIVIDUAL_METADATA = "/distinctIndividualMetadata"; static public final String FILTER_INDIVIDUAL_METADATA = "/filterIndividualsFromMetadata"; static public final String INSTANCE_CONTENT_SUMMARY = "/instanceContentSummary"; - static final public String snpclustEditionURL = "/snpclustEditionURL"; + static final public String snpclustEditionURL = "/snpclustEditionURL"; /** * get a unique processID @@ -1630,7 +1630,7 @@ public void run() { if (brapiUrlList.size() > 0) { // we've got BrAPI endpoints to pull metadata from storeSessionAttributes(session); // in case external source info was just added - HashMap> brapiUrlToIndividualsMap = new HashMap<>(); + HashMap /*individual*/>> brapiUrlToIndividualsMap = new HashMap<>(); if (metadataType.equals("individual")) { Collection individuals = MgdbDao.getInstance().loadIndividualsWithAllMetadata(sModule, sFinalUsername, null, null, null).values(); for (Individual individual : individuals) @@ -1648,13 +1648,16 @@ public void run() { if (brapiUrlToIndividualsMap.get(endPointUrl) == null) brapiUrlToIndividualsMap.put(endPointUrl, new HashMap<>()); - HashMap individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl); + HashMap> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl); if (individualsCurrentEndpointHasDataFor == null) { individualsCurrentEndpointHasDataFor = new HashMap<>(); brapiUrlToIndividualsMap.put(endPointUrl, individualsCurrentEndpointHasDataFor); } - individualsCurrentEndpointHasDataFor.put(extRefIdValue, individual.getId()); + if (individualsCurrentEndpointHasDataFor.get(extRefIdValue) == null) { + individualsCurrentEndpointHasDataFor.put(extRefIdValue, new HashSet<>()); + } + individualsCurrentEndpointHasDataFor.get(extRefIdValue).add(individual.getId()); } } else { @@ -1674,13 +1677,16 @@ public void run() { if (brapiUrlToIndividualsMap.get(endPointUrl) == null) brapiUrlToIndividualsMap.put(endPointUrl, new HashMap<>()); - HashMap individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl); + HashMap> individualsCurrentEndpointHasDataFor = brapiUrlToIndividualsMap.get(endPointUrl); if (individualsCurrentEndpointHasDataFor == null) { individualsCurrentEndpointHasDataFor = new HashMap<>(); brapiUrlToIndividualsMap.put(endPointUrl, individualsCurrentEndpointHasDataFor); } - individualsCurrentEndpointHasDataFor.put(extRefIdValue, sample.getSampleName()); + if (individualsCurrentEndpointHasDataFor.get(extRefIdValue) == null) { + individualsCurrentEndpointHasDataFor.put(extRefIdValue, new HashSet<>()); + } + individualsCurrentEndpointHasDataFor.get(extRefIdValue).add(sample.getSampleName()); } } @@ -2568,7 +2574,7 @@ public List searchableVariantsLookup( return null; } - + @ApiIgnore @RequestMapping(value = BASE_URL + DISTINCT_INDIVIDUAL_METADATA + "/{module}", method = RequestMethod.POST, produces = "application/json") public LinkedHashMap> distinctIndividualMetadata(HttpServletRequest request, HttpServletResponse response, @PathVariable String module, @RequestParam(required = false) final Integer projID, @RequestBody HashMap reqBody) throws IOException { @@ -2584,7 +2590,7 @@ public Collection filterIndividualMetadata(HttpServletRequest reques String sUserName = auth != null && auth.getAuthorities().contains(new SimpleGrantedAuthority(IRoleDefinition.ROLE_ADMIN)) ? null : AbstractTokenManager.getUserNameFromAuthentication(auth); return MgdbDao.getInstance().loadIndividualsWithAllMetadata(module, sUserName, Arrays.asList(projID), null, filters).values(); } - + @ApiOperation(authorizations = { @Authorization(value = "AuthorizationToken") }, value = GENES_LOOKUP , notes = "Get genes names ") @ApiResponses(value = { @ApiResponse(code = 200, message = "Success", response = List.class), @ApiResponse(code = 400, message = "wrong parameters"), @@ -2652,6 +2658,6 @@ public List searchableGenesLookup( i++; } - return resultObjects; + return resultObjects; } }