Class Vote3Resource

java.lang.Object
org.ctan.site.resources.catalogue.Vote3Resource

@Path("/3.0") @Produces({"application/json","application/xml"}) public class Vote3Resource extends Object
The class Vote3Resource contains the controller for the vote resource.
  • Constructor Details

    • Vote3Resource

      public Vote3Resource(@NonNull @NonNull VoteStore voteStore, @NonNull @NonNull PkgStore pkgStore, @NonNull @NonNull UserStore userStore)
      This is the constructor for Vote3Resource.
      Parameters:
      voteStore - the vote store
      pkgStore - the package store
      userStore - the user store
  • Method Details

    • deleteVote

      @DELETE @Path("/vote") @PermitAll @UnitOfWork("siteDb") public boolean deleteVote(String pkg, String account)
      The method deleteVote provides means to delete a vote.
      Parameters:
      pkg - the name of the package
      account - the account name
      Returns:
      true iff the deletion was successful
    • listVotesByPkg

      @GET @Path("/votes/{pkg}") @PermitAll @UnitOfWork("siteDb") public Vote3Resource.VoteSummaryTo listVotesByPkg(@PathParam("pkg") String pkgKey, @DefaultValue("0") @QueryParam("page") long page, @DefaultValue("16") @QueryParam("size") long size)
      The method listVotesByPkg provides means to retrieve a list of votes for a package.
      Parameters:
      pkgKey - the package name
      page - the page
      size - the page size
      Returns:
      a list of matching author summaries
    • vote

      @POST @Path("/vote") @PermitAll @UnitOfWork("siteDb") public Vote3Resource.VoteTo vote(String pkg, int rating, int expertise, String comment, String account)
      The method vote provides means to update a vote.
      Parameters:
      pkg - the package name
      rating - the rating in the range [1, 5]
      expertise - the expertise in the range [0, 4]
      comment - the comment
      account - the account name of the user
      Returns:
      the updated vote record