View Javadoc

1   package org.appfuse.webapp.server.services;
2   
3   import java.util.List;
4   
5   import javax.ws.rs.DELETE;
6   import javax.ws.rs.GET;
7   import javax.ws.rs.POST;
8   import javax.ws.rs.Path;
9   import javax.ws.rs.PathParam;
10  
11  import org.appfuse.model.User;
12  import org.appfuse.service.UserExistsException;
13  import org.springframework.security.access.prepost.PreAuthorize;
14  
15  @Path("/usersService")
16  public interface UserRequestService {
17  
18      /**
19       * 
20       * @return
21       */
22      @GET
23      @Path("currentUser")
24      User getCurrentUser();
25  
26      /**
27       * 
28       * @return
29       */
30      @GET
31      @Path("signUp")
32      User signUp();
33  
34      /**
35       * 
36       * @param user
37       * @return
38       * @throws Exception
39       */
40      @POST
41      @Path("signUp")
42      User signUp(User user) throws Exception;
43  
44      /**
45       * 
46       * @return
47       */
48      @GET
49      @Path("editProfile")
50      @PreAuthorize("isAuthenticated()")
51      User editProfile();
52  
53      /**
54       * 
55       * @param user
56       * @return
57       * @throws Exception
58       */
59      @POST
60      @Path("editProfile")
61      @PreAuthorize("isAuthenticated()")
62      User editProfile(User user) throws Exception;
63  
64      /**
65       * 
66       * @param userId
67       * @return
68       */
69      @GET
70      @Path("user/{id}")
71      @PreAuthorize("hasRole('ROLE_ADMIN')")
72      User getUser(@PathParam("id") Long userId);
73  
74      /**
75       * 
76       * @param user
77       * @return
78       * @throws Exception
79       */
80      @POST
81      @Path("saveUser")
82      @PreAuthorize("hasRole('ROLE_ADMIN')")
83      User saveUser(User user) throws Exception;
84  
85      /**
86       * 
87       * @param searchCriteria
88       * @return
89       */
90      @POST
91      @Path("countUsers")
92      @PreAuthorize("hasRole('ROLE_ADMIN')")
93      long countUsers(UsersSearchCriteria searchCriteria);
94  
95      /**
96       * 
97       * @param searchCriteria
98       * @param firstResult
99       * @param maxResults
100      * @return
101      */
102     @POST
103     @Path("searchUsers")
104     @PreAuthorize("hasRole('ROLE_ADMIN')")
105     List<User> searchUsers(UsersSearchCriteria searchCriteria, int firstResult, int maxResults);
106 
107     /**
108      * 
109      * @param searchCriteria
110      * @param firstResult
111      * @param maxResults
112      * @param sortProperty
113      * @param ascending
114      * @return
115      */
116     @POST
117     @Path("searchUsers")
118     @PreAuthorize("hasRole('ROLE_ADMIN')")
119     List<User> searchUsers(UsersSearchCriteria searchCriteria, int firstResult, int maxResults, String sortProperty, boolean ascending);
120 
121     /**
122      * 
123      * @param user
124      */
125     @DELETE
126     @Path("removeUser/{id}")
127     @PreAuthorize("hasRole('ROLE_ADMIN')")
128     void removeUser(@PathParam("id") Long userId);
129 
130     /**
131      * 
132      * @param username
133      * @return
134      */
135     @POST
136     @Path("passwordHint")
137     String sendPasswordHint(String username);
138 
139     /**
140      * 
141      * @param username
142      * @return
143      */
144     @POST
145     @Path("/requestRecoveryToken")
146     String requestRecoveryToken(String username);
147 
148     @POST
149     @Path("/updatePassword/{username}")
150     User updatePassword(@PathParam("username") String username, String token, String currentPassword, String password) throws UserExistsException;
151 
152     /**
153      * 
154      * @return
155      */
156     @GET
157     @Path("activeUsers")
158     @PreAuthorize("hasRole('ROLE_ADMIN')")
159     List<User> getActiveUsers();
160 
161     @GET
162     @Path("/logout")
163     boolean logout();
164 
165 }