// input = website // path: /service/visits/website/{website}?sortBy=[visit_asc, visit_desc, date_asc, date_desc] @GET @Path("/website/{website_name}") public Visits getVisitsByWebsite( @PathParam("website_name") String name, @DefaultValue("visit_desc") @QueryParam("sortBy") String sortBy) { // TODO: We might want to avoid these if statements LOL SortBy type = SortBy.VISIT_DESC; if (sortBy.equals("visit_asc")) { type = SortBy.VISIT_ASC; } else if (sortBy.equals("visit_desc")) { type = SortBy.VISIT_DESC; } else if (sortBy.equals("date_asc")) { type = SortBy.DATE_ASC; } else if (sortBy.equals("date_desc")) { type = SortBy.DATE_DESC; } return VisitsDAO.getVisitsByWebsite(name, type); }
// path: /service/visits/ @GET public Visits getAllVisit() { return VisitsDAO.getAllWebsiteVisits(); }