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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
The classVoteSummaryTo
contains the transport object for the vote resource in the summary list.protected static class
The classVoteTo
contains the transport object for the vote. -
Constructor Summary
ConstructorsConstructorDescriptionVote3Resource
(@NonNull VoteStore voteStore, @NonNull PkgStore pkgStore, @NonNull UserStore userStore) This is the constructor forVote3Resource
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
deleteVote
(String pkg, String account) The methoddeleteVote
provides means to delete a vote.listVotesByPkg
(String pkgKey, long page, long size) The methodlistVotesByPkg
provides means to retrieve a list of votes for a package.The methodvote
provides means to update a vote.
-
Constructor Details
-
Method Details
-
deleteVote
@DELETE @Path("/vote") @PermitAll @UnitOfWork("siteDb") public boolean deleteVote(String pkg, String account) The methoddeleteVote
provides means to delete a vote.- Parameters:
pkg
- the name of the packageaccount
- 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 methodlistVotesByPkg
provides means to retrieve a list of votes for a package.- Parameters:
pkgKey
- the package namepage
- the pagesize
- 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 methodvote
provides means to update a vote.- Parameters:
pkg
- the package namerating
- the rating in the range [1, 5]expertise
- the expertise in the range [0, 4]comment
- the commentaccount
- the account name of the user- Returns:
- the updated vote record
-