forked from Archives/Athou_commafeed
deduplicate method names across all the api (swagger requires unique api operations)
This commit is contained in:
@@ -62,7 +62,8 @@ public class AdminREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Save or update a user", notes = "Save or update a user. If the id is not specified, a new user will be created")
|
||||
@Timed
|
||||
public Response save(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user, @ApiParam(required = true) UserModel userModel) {
|
||||
public Response adminSaveUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||
@ApiParam(required = true) UserModel userModel) {
|
||||
Preconditions.checkNotNull(userModel);
|
||||
Preconditions.checkNotNull(userModel.getName());
|
||||
|
||||
@@ -117,7 +118,7 @@ public class AdminREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Get user information", notes = "Get user information", response = UserModel.class)
|
||||
@Timed
|
||||
public Response getUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||
public Response adminGetUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||
@ApiParam(value = "user id", required = true) @PathParam("id") Long id) {
|
||||
Preconditions.checkNotNull(id);
|
||||
User u = userDAO.findById(id);
|
||||
@@ -135,7 +136,7 @@ public class AdminREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Get all users", notes = "Get all users", response = UserModel.class, responseContainer = "List")
|
||||
@Timed
|
||||
public Response getUsers(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||
public Response adminGetUsers(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||
Map<Long, UserModel> users = new HashMap<>();
|
||||
for (UserRole role : userRoleDAO.findAll()) {
|
||||
User u = role.getUser();
|
||||
@@ -163,7 +164,8 @@ public class AdminREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Delete a user", notes = "Delete a user, and all his subscriptions")
|
||||
@Timed
|
||||
public Response delete(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user, @ApiParam(required = true) IDRequest req) {
|
||||
public Response adminDeleteUser(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user,
|
||||
@ApiParam(required = true) IDRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
|
||||
@@ -183,7 +185,7 @@ public class AdminREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Retrieve application settings", notes = "Retrieve application settings", response = ApplicationSettings.class)
|
||||
@Timed
|
||||
public Response getSettings(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||
public Response getApplicationSettings(@ApiParam(hidden = true) @SecurityCheck(Role.ADMIN) User user) {
|
||||
return Response.ok(config.getApplicationSettings()).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ public class CategoryREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Collapse a category", notes = "Save collapsed or expanded status for a category")
|
||||
@Timed
|
||||
public Response collapse(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) CollapseRequest req) {
|
||||
public Response collapseCategory(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) CollapseRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
|
||||
@@ -422,9 +422,9 @@ public class CategoryREST {
|
||||
@GET
|
||||
@Path("/get")
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Get feed categories", notes = "Get all categories and subscriptions of the user", response = Category.class)
|
||||
@ApiOperation(value = "Get root category", notes = "Get all categories and subscriptions of the user", response = Category.class)
|
||||
@Timed
|
||||
public Response getSubscriptions(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
public Response getRootCategory(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
Category root = cache.getUserRootCategory(user);
|
||||
if (root == null) {
|
||||
log.debug("tree cache miss for {}", user.getId());
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EntryREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
||||
@Timed
|
||||
public Response markFeedEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response markEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "Mark Request", required = true) MarkRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
@@ -61,13 +61,13 @@ public class EntryREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Mark multiple feed entries", notes = "Mark feed entries as read/unread")
|
||||
@Timed
|
||||
public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response markEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "Multiple Mark Request", required = true) MultipleMarkRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getRequests());
|
||||
|
||||
for (MarkRequest r : req.getRequests()) {
|
||||
markFeedEntry(user, r);
|
||||
markEntry(user, r);
|
||||
}
|
||||
|
||||
return Response.ok().build();
|
||||
@@ -78,7 +78,7 @@ public class EntryREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
||||
@Timed
|
||||
public Response starFeedEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response starEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "Star Request", required = true) StarRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
@@ -104,7 +104,7 @@ public class EntryREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
|
||||
@Timed
|
||||
public Response tagFeedEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response tagEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "Tag Request", required = true) TagRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getEntryId());
|
||||
|
||||
@@ -331,9 +331,9 @@ public class FeedREST {
|
||||
@GET
|
||||
@Path("/get/{id}")
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "", notes = "")
|
||||
@ApiOperation(value = "get feed", response = Subscription.class)
|
||||
@Timed
|
||||
public Response get(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response getFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "user id", required = true) @PathParam("id") Long id) {
|
||||
|
||||
Preconditions.checkNotNull(id);
|
||||
@@ -350,7 +350,7 @@ public class FeedREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Fetch a feed's icon", notes = "Fetch a feed's icon")
|
||||
@Timed
|
||||
public Response getFavicon(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response getFeedFavicon(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "subscription id", required = true) @PathParam("id") Long id) {
|
||||
|
||||
Preconditions.checkNotNull(id);
|
||||
@@ -409,7 +409,7 @@ public class FeedREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Subscribe to a feed", notes = "Subscribe to a feed")
|
||||
@Timed
|
||||
public Response subscribe(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response subscribeFromUrl(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "feed url", required = true) @QueryParam("url") String url) {
|
||||
|
||||
try {
|
||||
@@ -455,7 +455,7 @@ public class FeedREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Modify a subscription", notes = "Modify a feed subscription")
|
||||
@Timed
|
||||
public Response modify(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response modifyFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "subscription id", required = true) FeedModificationRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getId());
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ServerREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Get server infos", notes = "Get server infos", response = ServerInfo.class)
|
||||
@Timed
|
||||
public Response get() {
|
||||
public Response getServerInfos() {
|
||||
ServerInfo infos = new ServerInfo();
|
||||
infos.setAnnouncement(config.getApplicationSettings().getAnnouncement());
|
||||
infos.setVersion(config.getVersion());
|
||||
@@ -61,7 +61,7 @@ public class ServerREST {
|
||||
@ApiOperation(value = "proxy image")
|
||||
@Produces("image/png")
|
||||
@Timed
|
||||
public Response get(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
public Response getProxiedImage(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(value = "image url", required = true) @QueryParam("u") String url) {
|
||||
if (!config.getApplicationSettings().getImageProxyEnabled()) {
|
||||
return Response.status(Status.FORBIDDEN).build();
|
||||
|
||||
@@ -83,7 +83,7 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Retrieve user settings", notes = "Retrieve user settings", response = Settings.class)
|
||||
@Timed
|
||||
public Response getSettings(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
public Response getUserSettings(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
Settings s = new Settings();
|
||||
UserSettings settings = userSettingsDAO.findByUser(user);
|
||||
if (settings != null) {
|
||||
@@ -138,7 +138,7 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Save user settings", notes = "Save user settings")
|
||||
@Timed
|
||||
public Response saveSettings(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) Settings settings) {
|
||||
public Response saveUserSettings(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) Settings settings) {
|
||||
Preconditions.checkNotNull(settings);
|
||||
|
||||
UserSettings s = userSettingsDAO.findByUser(user);
|
||||
@@ -177,7 +177,7 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Retrieve user's profile", response = UserModel.class)
|
||||
@Timed
|
||||
public Response get(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
public Response getUserProfile(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
UserModel userModel = new UserModel();
|
||||
userModel.setId(user.getId());
|
||||
userModel.setName(user.getName());
|
||||
@@ -197,7 +197,8 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Save user's profile")
|
||||
@Timed
|
||||
public Response save(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) ProfileModificationRequest request) {
|
||||
public Response saveUserProfile(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||
@ApiParam(required = true) ProfileModificationRequest request) {
|
||||
Preconditions.checkArgument(StringUtils.isBlank(request.getPassword()) || request.getPassword().length() >= 6);
|
||||
if (StringUtils.isNotBlank(request.getEmail())) {
|
||||
User u = userDAO.findByEmail(request.getEmail());
|
||||
@@ -226,7 +227,7 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Register a new account")
|
||||
@Timed
|
||||
public Response register(@Valid @ApiParam(required = true) RegistrationRequest req,
|
||||
public Response registerUser(@Valid @ApiParam(required = true) RegistrationRequest req,
|
||||
@Context @ApiParam(hidden = true) SessionHelper sessionHelper) {
|
||||
try {
|
||||
User registeredUser = userService.register(req.getName(), req.getPassword(), req.getEmail(), Arrays.asList(Role.USER));
|
||||
@@ -332,7 +333,7 @@ public class UserREST {
|
||||
@UnitOfWork
|
||||
@ApiOperation(value = "Delete the user account")
|
||||
@Timed
|
||||
public Response delete(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
public Response deleteUser(@ApiParam(hidden = true) @SecurityCheck User user) {
|
||||
if (CommaFeedApplication.USERNAME_ADMIN.equals(user.getName()) || CommaFeedApplication.USERNAME_DEMO.equals(user.getName())) {
|
||||
return Response.status(Status.FORBIDDEN).build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user