This commit is contained in:
@@ -8,11 +8,17 @@ import org.yacos.core.exceptions.PKAlreadyUsedException;
|
||||
|
||||
@Remote
|
||||
public interface IUserManager {
|
||||
|
||||
//crud methode
|
||||
public Collection<User> getUsers();
|
||||
public void addUser(User user) throws PKAlreadyUsedException;
|
||||
public User addUser(String login, String password, String firstName,
|
||||
String lastName, String organization, String email) throws PKAlreadyUsedException;
|
||||
public void removeUser(User user);
|
||||
public User getUser(String login);
|
||||
public void UpdateUser(User user);
|
||||
public Boolean exists(User user);
|
||||
public Boolean exists(String login);
|
||||
|
||||
//role methode
|
||||
public Collection<Role> getRoles();
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class Role {
|
||||
AUTHOR,CHAIRMAN,PCMEMBER,REFEREE
|
||||
}
|
||||
|
||||
@Id
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private RoleType type;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.yacos.core.users;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.Role.RoleType;
|
||||
|
||||
public class RolePK implements Serializable{
|
||||
|
||||
@@ -11,8 +12,18 @@ public class RolePK implements Serializable{
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private RoleType type;
|
||||
private User user;
|
||||
private Conference conference;
|
||||
|
||||
|
||||
|
||||
public RoleType getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(RoleType type) {
|
||||
this.type = type;
|
||||
}
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@@ -32,13 +32,15 @@ public class UserManagerBean implements IUserManager{
|
||||
* throw PKAlreadyUsedException if login exist in the DB
|
||||
* @param user
|
||||
*/
|
||||
public void addUser(User user) throws PKAlreadyUsedException{
|
||||
if (!this.exists(user)){
|
||||
public User addUser(String login, String password, String firstName,
|
||||
String lastName, String organization, String email) throws PKAlreadyUsedException{
|
||||
|
||||
if (!this.exists(login)){
|
||||
User user = new User(login, password, firstName, lastName, organization, email);
|
||||
em.persist(user);
|
||||
return user;
|
||||
}
|
||||
else{
|
||||
throw new PKAlreadyUsedException();
|
||||
}
|
||||
else{ throw new PKAlreadyUsedException(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,9 +60,13 @@ public class UserManagerBean implements IUserManager{
|
||||
em.merge(user);
|
||||
}
|
||||
|
||||
public Boolean exists(User user){
|
||||
return (this.getUser(user.getLogin())!= null);
|
||||
public Boolean exists(String login){
|
||||
return (this.getUser(login)!= null);
|
||||
}
|
||||
|
||||
public Collection<Role> getRoles() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user