Author: amarkhel
Date: 2009-05-07 08:01:57 -0400 (Thu, 07 May 2009)
New Revision: 14057
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/domain/User.java
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/IUserAction.java
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/UserAction.java
Log:
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/domain/User.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/domain/User.java 2009-05-07
11:25:08 UTC (rev 14056)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/domain/User.java 2009-05-07
12:01:57 UTC (rev 14057)
@@ -74,6 +74,10 @@
query = "select u from User u where u.login = :login"
),
@NamedQuery(
+ name = "email-exist",
+ query = "select u from User u where u.email = :email"
+ ),
+ @NamedQuery(
name = "user-user",
query = "select u from User u where u.login = :login"
)
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java 2009-05-07
11:25:08 UTC (rev 14056)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/Constants.java 2009-05-07
12:01:57 UTC (rev 14057)
@@ -84,10 +84,13 @@
public static final String UPLOAD_FOLDER_PATH_ERROR = "Cannot bound image folder
path";
public static final String INVALID_LOGIN_OR_PASSWORD = "Invalid login or
password";
public static final String USER_WITH_THIS_LOGIN_ALREADY_EXIST = "User with this
login already exist";
+ public static final String USER_WITH_THIS_EMAIL_ALREADY_EXIST = "E-mail is not
unique";
public static final String CONFIRM_PASSWORD_NOT_EQUALS_PASSWORD = "Confirm
Password not equals password";
public static final String HAVENT_ACCESS = "You have no rights to view this
album";
public static final String FILE_PROCESSING_ERROR = "Error processing occured during
upload";
public static final String FILE_SAVE_ERROR = "Error occured during saving image to
disk";
+ public static final String REGISTRATION_ERROR = "Error while registration
process";
+ public static final String LOGIN_ERROR = "Login error";
//Outcomes
public static final String LOGOUT_OUTCOME = "logout";
@@ -105,11 +108,12 @@
//ID's
public static final String REGISTER_LOGIN_NAME_ID = "mainform:loginName";
public static final String REGISTER_CONFIRM_PASSWORD_ID =
"mainform:confirmPassword";
+ public static final String REGISTER_EMAIL_ID = "mainform:email";
public static final String SHELF_ID = "shelf";
//Roles
public static final String ADMIN_ROLE = "admin";
- public static final String GUEST_ROLE = "guest";
+ //public static final String GUEST_ROLE = "guest";
//misc
public static final String AVATAR_JPG = "avatar.jpg";
@@ -172,6 +176,9 @@
public static final String SEARCH_NO_WHERE_OPTIONS_ERROR = "You must specify where
search execute";
public static final String USER_COMMENTS_QUERY = "user-comments";
public static final String AUTHOR_PARAMETER = "author";
+ public static final String EMAIL_EXIST_QUERY = "email-exist";
+ public static final String EMAIL_PARAMETER = "email";
+
private Constants(){
}
}
\ No newline at end of file
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/IUserAction.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/IUserAction.java 2009-05-07
11:25:08 UTC (rev 14056)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/IUserAction.java 2009-05-07
12:01:57 UTC (rev 14057)
@@ -36,4 +36,5 @@
public void register(User user) throws PhotoAlbumException;
public boolean isUserExist(String login) ;
public User updateUser() throws PhotoAlbumException;
+ public boolean isEmailExist(String email);
}
\ No newline at end of file
Modified:
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/UserAction.java
===================================================================
---
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/UserAction.java 2009-05-07
11:25:08 UTC (rev 14056)
+++
trunk/examples/photoalbum/source/ejb/src/main/java/org/richfaces/photoalbum/service/UserAction.java 2009-05-07
12:01:57 UTC (rev 14057)
@@ -97,4 +97,14 @@
.setParameter(Constants.LOGIN_PARAMETER, login)
.getResultList().size() != 0;
}
+
+ /**
+ * Check if user with specified email already exist
+ * @return is user with specified email already exist
+ */
+ public boolean isEmailExist(String email){
+ return em.createNamedQuery(Constants.EMAIL_EXIST_QUERY)
+ .setParameter(Constants.EMAIL_PARAMETER, email)
+ .getResultList().size() != 0;
+ }
}
\ No newline at end of file
Show replies by date