access modifiers and constructors fix
This commit is contained in:
@ -8,6 +8,7 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import com.plannaplan.types.UserRoles;
|
||||
|
||||
//should setter be public?
|
||||
@Entity
|
||||
public class User {
|
||||
@ -24,6 +25,13 @@ public class User {
|
||||
public User() {
|
||||
}
|
||||
|
||||
public User(String name, String surname, String mail, UserRoles role) {
|
||||
this.name = name;
|
||||
this.surname = surname;
|
||||
this.email = mail;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import com.plannaplan.configutils.*;
|
||||
public class ConfiguratorService {
|
||||
|
||||
@Autowired
|
||||
FileToDatabaseMigrator migrator;
|
||||
private FileToDatabaseMigrator migrator;
|
||||
|
||||
public ConfiguratorService() {
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ public class UserService {
|
||||
super();
|
||||
}
|
||||
|
||||
// this code is more idiomatic to java using java 8 stream API
|
||||
public String login(String authority) throws UserNotFoundException {
|
||||
User user = this.repo.getByAuthority(authority.replace("\n", "").trim())
|
||||
.orElseThrow(() -> new UserNotFoundException("Can not find user with given authority"));
|
||||
@ -33,14 +32,12 @@ public class UserService {
|
||||
this.repo.save(user);
|
||||
}
|
||||
|
||||
// this code is more idiomatic to java
|
||||
public User getUserByEmail(String email) throws UserNotFoundException {
|
||||
return this.repo.getByAuthority(email.replace("\n", "").trim())
|
||||
.orElseThrow(() -> new UserNotFoundException("Cannot find user with given authority"));
|
||||
|
||||
}
|
||||
|
||||
// why is not throwing exception?
|
||||
public User getByToken(String token) {
|
||||
return this.repo.getByToken(token);
|
||||
}
|
||||
|
Reference in New Issue
Block a user