*/
public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
+ /**
+ * Search the system for a user with the specified email address.
+ * If no such user is found, the method returns null.
+ */
+ public User findUserByEmail(String email);
+
+ /**
+ * Update the user with the values from the supplied object.
+ */
+ public void updateUser(User user);
}
}
@Override
+ public User findUserByEmail(String email) {
+ return dao.findUserByEmail(email);
+ }
+
+ @Override
+ public void updateUser(User user) {
+ dao.update(user);
+ }
+
+ @Override
public User updateUser(String username, String name, String mail) throws ObjectNotFoundException {
if (username == null)
throw new ObjectNotFoundException("No username specified");
* It is used by the Solr mbean to rebuild the index.
*/
public void rebuildSolrIndex();
+
+ /**
+ * Search the system for a user with the specified email address.
+ * If no such user is found, the method returns null.
+ */
+ public User findUserByEmail(String email);
+
+ /**
+ * Update the user with the values from the supplied object.
+ */
+ public void updateUser(User user);
}
public User findUser(String username);
/**
+ * Search the system for a user with the specified email address.
+ * If no such user is found, the method returns null.
+ */
+ public User findUserByEmail(String email);
+
+ /**
* Returns a list of users matching specified username
*
* @param username the email of the User
return results.get(0);
}
- /* (non-Javadoc)
- * @see gr.ebs.gss.server.ejb.GSSDAO#getUsersByUserNameLike(java.lang.String)
- */
+ @Override
+ public User findUserByEmail(String email) {
+ if (email == null)
+ return null;
+ List<User> results = manager.createQuery("select u from User u where u.email=:email").
+ setParameter("email", email).getResultList();
+ if (results.isEmpty()) return null;
+ return results.get(0);
+ }
+
@Override
public List<User> getUsersByUserNameLike(String username) {
return manager.createQuery("select u from User u where u.username like :username").
setParameter("username", username+"%").getResultList();
}
- /* (non-Javadoc)
- * @see gr.ebs.gss.server.ejb.GSSDAO#getSharedRootFolders(java.lang.Long)
- */
@Override
public List<Folder> getSharedRootFolders(Long userId) {
List<Folder> folders = manager.createQuery("select distinct f from Folder f " +
return result;
}
- /* (non-Javadoc)
- * @see gr.ebs.gss.server.ejb.GSSDAO#getFoldersPermittedForGroup(java.lang.Long, java.lang.Long)
- */
@Override
public List<Folder> getFoldersPermittedForGroup(Long userId, Long groupId) {
return manager.createQuery("select distinct f from Folder f LEFT JOIN f.permissions p " +
setParameter("userId", userId).setParameter("groupId", groupId).getResultList();
}
- /* (non-Javadoc)
- * @see gr.ebs.gss.server.ejb.GSSDAO#getUsersSharingFilesForUser(java.lang.Long)
- */
@Override
public List<User> getUsersSharingFoldersForUser(Long userId) {
return manager.createQuery("select distinct f.owner from Folder f " +
setParameter("userId", userId).getResultList();
}
- /* (non-Javadoc)
- * @see gr.ebs.gss.server.ejb.GSSDAO#getUsersSharingFilesForUser(java.lang.Long)
- */
@Override
public List<User> getUsersSharingFilesForUser(Long userId) {
List<User> users = manager.createQuery("select distinct f.owner from FileHeader f " +