/** * Copyright 2014 David L. Whitehurst * * Licensed under the Apache License, Version 2.0 * (the "License"); You may not use this file except * in compliance with the License. You may obtain a * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the * License. * */ package org.musicrecital.service; import org.musicrecital.model.User; import javax.jws.WebService; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import java.util.List; /** * Web Service interface so hierarchy of Generic Manager isn't carried through. */ @WebService @Path("/users") public interface UserService { /** * Retrieves a user by userId. An exception is thrown if user not found * * @param userId the identifier for the user * @return User */ @GET @Path("{id}") User getUser(@PathParam("id") String userId); /** * Finds a user by their username. * * @param username the user's username used to login * @return User a populated user object */ User getUserByUsername(@PathParam("username") String username); /** * Retrieves a list of all users. * * @return List */ @GET List<User> getUsers(); /** * Saves a user's information * * @param user the user's information * @return updated user * @throws UserExistsException thrown when user already exists */ @POST User saveUser(User user) throws UserExistsException; /** * Removes a user from the database by their userId * * @param userId the user's id */ @DELETE void removeUser(String userId); }