@Override @GET @Path("interactionsByIds/{codeset}/{drugs}") @Produces("application/json") public DrugInteraction[] findInteractionsByIds(CodeSet requestedCodeset, Long[] drugs) { log.info( "findInteractionsByIds(" + requestedCodeset + ", " + (drugs != null ? drugs.length : 0) + ")"); return InteractionLookup.findInteractionsFromDrugs(requestedCodeset, Arrays.asList(drugs)) .toArray(new DrugInteraction[0]); }
@Override @GET @Path("interactions/{codeset}/{drugs}") @Produces("application/json") public DrugInteraction[] findInteractions(CodeSet requestedCodeset, Drug[] drugs) { log.info( "findInteractions(" + requestedCodeset + ", " + (drugs != null ? drugs.length : 0) + ")"); // Extract all ids from drugs List<Long> drugIds = new ArrayList<Long>(); for (Drug drug : drugs) { log.info("Adding drug id " + drug.getDrugId() + " to stack"); drugIds.add(drug.getDrugId()); } return InteractionLookup.findInteractionsFromDrugs(requestedCodeset, drugIds) .toArray(new DrugInteraction[0]); }