projects
/
pithos
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e08fd2f
)
Add helper methods for finding and updating users.
author
pastith
<devnull@localhost>
Tue, 14 Apr 2009 08:32:46 +0000
(08:32 +0000)
committer
pastith
<devnull@localhost>
Tue, 14 Apr 2009 08:32:46 +0000
(08:32 +0000)
gss/src/gr/ebs/gss/server/ejb/ExternalAPI.java
patch
|
blob
|
history
gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
patch
|
blob
|
history
gss/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
patch
|
blob
|
history
gss/src/gr/ebs/gss/server/ejb/GSSDAO.java
patch
|
blob
|
history
gss/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
patch
|
blob
|
history
diff --git
a/gss/src/gr/ebs/gss/server/ejb/ExternalAPI.java
b/gss/src/gr/ebs/gss/server/ejb/ExternalAPI.java
index
e3dfed6
..
69b4f99
100644
(file)
--- a/
gss/src/gr/ebs/gss/server/ejb/ExternalAPI.java
+++ b/
gss/src/gr/ebs/gss/server/ejb/ExternalAPI.java
@@
-1225,4
+1225,14
@@
public interface ExternalAPI {
*/
public FileBodyDTO getFileVersion(Long userId, Long fileId, int version) throws ObjectNotFoundException, InsufficientPermissionsException;
*/
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);
}
}
diff --git
a/gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
b/gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
index
f146109
..
bf4fe6f
100644
(file)
--- a/
gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
+++ b/
gss/src/gr/ebs/gss/server/ejb/ExternalAPIBean.java
@@
-1279,6
+1279,16
@@
public class ExternalAPIBean implements ExternalAPI, ExternalAPIRemote {
}
@Override
}
@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");
public User updateUser(String username, String name, String mail) throws ObjectNotFoundException {
if (username == null)
throw new ObjectNotFoundException("No username specified");
diff --git
a/gss/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
b/gss/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
index
e7ecd83
..
1dad1c9
100644
(file)
--- a/
gss/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
+++ b/
gss/src/gr/ebs/gss/server/ejb/ExternalAPIRemote.java
@@
-722,4
+722,15
@@
public interface ExternalAPIRemote {
* It is used by the Solr mbean to rebuild the index.
*/
public void rebuildSolrIndex();
* 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);
}
}
diff --git
a/gss/src/gr/ebs/gss/server/ejb/GSSDAO.java
b/gss/src/gr/ebs/gss/server/ejb/GSSDAO.java
index
ee7edbb
..
fff035a
100644
(file)
--- a/
gss/src/gr/ebs/gss/server/ejb/GSSDAO.java
+++ b/
gss/src/gr/ebs/gss/server/ejb/GSSDAO.java
@@
-218,6
+218,12
@@
public interface GSSDAO {
public User findUser(String username);
/**
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
* Returns a list of users matching specified username
*
* @param username the email of the User
diff --git
a/gss/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
b/gss/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
index
3a7cee3
..
4afa736
100644
(file)
--- a/
gss/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
+++ b/
gss/src/gr/ebs/gss/server/ejb/GSSDAOBean.java
@@
-326,18
+326,22
@@
public class GSSDAOBean implements GSSDAO {
return results.get(0);
}
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();
}
@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 " +
@Override
public List<Folder> getSharedRootFolders(Long userId) {
List<Folder> folders = manager.createQuery("select distinct f from Folder f " +
@@
-351,9
+355,6
@@
public class GSSDAOBean implements GSSDAO {
return result;
}
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 " +
@Override
public List<Folder> getFoldersPermittedForGroup(Long userId, Long groupId) {
return manager.createQuery("select distinct f from Folder f LEFT JOIN f.permissions p " +
@@
-361,9
+362,6
@@
public class GSSDAOBean implements GSSDAO {
setParameter("userId", userId).setParameter("groupId", groupId).getResultList();
}
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 " +
@Override
public List<User> getUsersSharingFoldersForUser(Long userId) {
return manager.createQuery("select distinct f.owner from Folder f " +
@@
-373,9
+371,6
@@
public class GSSDAOBean implements GSSDAO {
setParameter("userId", userId).getResultList();
}
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 " +
@Override
public List<User> getUsersSharingFilesForUser(Long userId) {
List<User> users = manager.createQuery("select distinct f.owner from FileHeader f " +