Revision 769f9814

b/src/gr/ebs/gss/admin/client/AdminService.java
20 20

  
21 21
@RemoteServiceRelativePath("admin")
22 22
public interface AdminService extends RemoteService {
23
	List<UserDTO> getUsers() throws RpcException;
23
	List<UserDTO> getUsers() throws RpcException, ObjectNotFoundException;
24 24

  
25
	List<UserDTO> searchUsers(String query) throws RpcException;
25
	List<UserDTO> searchUsers(String query) throws RpcException, ObjectNotFoundException;
26 26

  
27 27
	StatsDTO getUserStatistics(Long userId) throws RpcException, ObjectNotFoundException;
28 28

  
b/src/gr/ebs/gss/server/admin/AdminServiceImpl.java
72 72
	}
73 73

  
74 74
	@Override
75
	public List<UserDTO> getUsers() throws RpcException {
75
	public List<UserDTO> getUsers() throws RpcException, ObjectNotFoundException {
76 76
		return getService().searchUsers("");
77 77
	}
78 78

  
......
95 95
	}
96 96

  
97 97
	@Override
98
	public List<UserDTO> searchUsers(String query) throws RpcException {
98
	public List<UserDTO> searchUsers(String query) throws RpcException, ObjectNotFoundException {
99 99
		return getService().searchUsers(query);
100 100
	}
101 101

  
b/src/gr/ebs/gss/server/ejb/AdminAPI.java
42 42
@Local
43 43
public interface AdminAPI {
44 44

  
45
	public List<UserDTO> searchUsers(String query);
45
	public List<UserDTO> searchUsers(String query) throws ObjectNotFoundException;
46 46

  
47 47
	public StatsDTO getUserStatistics(Long userId) throws ObjectNotFoundException;
48 48

  
b/src/gr/ebs/gss/server/ejb/AdminAPIBean.java
223 223
	}
224 224

  
225 225
	@Override
226
	public List<UserDTO> searchUsers(String query) {
226
	public List<UserDTO> searchUsers(String query) throws ObjectNotFoundException {
227 227
		List<User> users = dao.getUsersByUserNameOrEmailLike(query);
228 228
		List<UserDTO> result = new ArrayList<UserDTO>();
229 229
		for (User u : users){
230 230
			UserDTO tempDTO = u.getDTO();
231
			List<UserLogin> userLogins = dao.getLoginsForUser(u.getId());
231
			List<UserLogin> userLogins = api.getLastUserLogins(u.getId());
232 232
			tempDTO.setCurrentLoginDate(userLogins.get(0).getLoginDate());
233 233
			tempDTO.setLastLoginDate(userLogins.get(1).getLoginDate());	
234 234
			result.add(tempDTO);
......
241 241
		User u = dao.getUser(username);
242 242
		if(u!=null){
243 243
			UserDTO tempDTO = u.getDTO();
244
			List<UserLogin> userLogins = dao.getLoginsForUser(u.getId());
244
			List<UserLogin> userLogins = api.getLastUserLogins(u.getId());
245 245
			tempDTO.setCurrentLoginDate(userLogins.get(0).getLoginDate());
246
			tempDTO.setLastLoginDate(userLogins.get(1).getLoginDate());	
246
            tempDTO.setLastLoginDate(userLogins.get(1).getLoginDate());
247 247
			return tempDTO;
248 248
			
249 249
		}
b/src/gr/ebs/gss/server/ejb/ExternalAPI.java
1282 1282
	 * @return a list of last two user logins
1283 1283
	 * @throws ObjectNotFoundException 
1284 1284
	 */
1285
	public List<UserLogin> getUserLogins(Long userId) throws ObjectNotFoundException;
1285
	public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException;
1286 1286

  
1287 1287
	/**
1288 1288
	 * Posts the file specified by id to solr indexing server
b/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
2639 2639
	 * @throws ObjectNotFoundException 
2640 2640
	 */
2641 2641
	
2642
	public List<UserLogin> getUserLogins(Long userId) throws ObjectNotFoundException{
2642
	public List<UserLogin> getLastUserLogins(Long userId) throws ObjectNotFoundException{
2643 2643
		List<UserLogin> userLoginResults = new ArrayList<UserLogin>();		
2644 2644
		userLoginResults = dao.getLoginsForUser(userId);	
2645 2645
		if(userLoginResults.size() == 0)
b/src/gr/ebs/gss/server/rest/UserHandler.java
94 94
			String announcement = getConfiguration().getString("announcement");
95 95
			if (announcement != null && !announcement.isEmpty())
96 96
				json.put("announcement", announcement);
97
			List<UserLogin> userLogins = getService().getUserLogins(owner.getId());			
97
			List<UserLogin> userLogins = getService().getLastUserLogins(owner.getId());			
98 98
			UserLogin currentLogin = userLogins.get(0);
99 99
			Date currentLoginDate = currentLogin.getLoginDate();
100 100
			UserLogin lastLogin = userLogins.get(1);

Also available in: Unified diff