Class CrudUser3Resource

java.lang.Object
org.ctan.site.resources.admin.CrudUser3Resource

@Path("/3.0/admin") @Produces("application/json") @RolesAllowed("ADMIN") public class CrudUser3Resource extends Object
The class CrudUser3Resource contains the CRUD controller for the user resource.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CrudUser3Resource(@NonNull UserStore store)
    This is the constructor for the class CrudUser3Resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(@NonNull User user)
    The method create provides an end-point to create a user.
    get(@NonNull Long id)
    The method get provides means to retrieve a user.
    get(@NonNull String account)
    The method get provides means to retrieve a user.
    list(String q, int page, int size, String orderBy, boolean asc)
    The method list provides means to retrieve a page of users.
    boolean
    remove(@NonNull Long id)
    The method remove provides an end-point to remove a user.
    boolean
    remove(@NonNull String account)
    The method remove provides an end-point to remove a user.
    boolean
    set(@NonNull String account, @NonNull Map<String,String> map)
    The method set provides means to set a single attribute of a user.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CrudUser3Resource

      public CrudUser3Resource(@NonNull @NonNull UserStore store)
      This is the constructor for the class CrudUser3Resource.
      Parameters:
      store - the underlying store
  • Method Details

    • create

      @POST @Path("/user") @UnitOfWork("siteDb") public User create(@NonNull @NonNull User user)
      The method create provides an end-point to create a user.
      Parameters:
      user - the user object to store
      Returns:
      the updated entity
    • get

      @GET @Path("/user/id/{id}") @UnitOfWork("siteDb") public User get(@NonNull @PathParam("id") @NonNull Long id)
      The method get provides means to retrieve a user.
      Parameters:
      id - the id
      Returns:
      true iff the user exists
    • get

      @GET @Path("/user/{account}") @UnitOfWork("siteDb") public User get(@NonNull @PathParam("account") @NonNull String account)
      The method get provides means to retrieve a user.
      Parameters:
      account - the account
      Returns:
      true iff the user exists
    • list

      @GET @Path("/users") @UnitOfWork("siteDb") public GeneralPage list(@QueryParam("q") String q, @QueryParam("page") @DefaultValue("1") int page, @QueryParam("size") @DefaultValue("256") int size, @QueryParam("order") String orderBy, @QueryParam("asc") boolean asc)
      The method list provides means to retrieve a page of users.
      Parameters:
      q - the name pattern
      page - the page
      size - the page size
      orderBy - the order
      asc - the indicator for ascending
      Returns:
      the page for the user or null
    • remove

      @DELETE @Path("/user/id/{id}") @UnitOfWork("siteDb") public boolean remove(@NonNull @PathParam("id") @NonNull Long id)
      The method remove provides an end-point to remove a user.
      Parameters:
      id - the id
      Returns:
      true iff the user has existed
    • remove

      @DELETE @Path("/user/{account}") @UnitOfWork("siteDb") public boolean remove(@NonNull @PathParam("account") @NonNull String account)
      The method remove provides an end-point to remove a user.
      Parameters:
      account - the account
      Returns:
      true iff the user has existed
    • set

      @PUT @Path("/user/{account}") @UnitOfWork("siteDb") public boolean set(@NonNull @PathParam("account") @NonNull String account, @NonNull @NonNull Map<String,String> map)
      The method set provides means to set a single attribute of a user.
      Parameters:
      account - the account
      map - the mapping containing key and value
      Returns:
      true iff the setting has succeeded