|
@@ -0,0 +1,50 @@
|
|
|
|
+package es.uv.garcosda.services;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Arrays;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import es.uv.garcosda.domain.User;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class UserService {
|
|
|
|
+
|
|
|
|
+ private List<User> users;
|
|
|
|
+
|
|
|
|
+ public UserService() {
|
|
|
|
+ users = new ArrayList<User>(
|
|
|
|
+ Arrays.asList(new User("Quintina.Ardra@yopmail.com","Quintina","Ardra"),
|
|
|
|
+ new User("Sybille.Land@yopmail.com","Sybille","Land"),
|
|
|
|
+ new User("Kimmy.Elisha@yopmail.com","Kimmy","Elisha"),
|
|
|
|
+ new User("Jeanna.McGrody@yopmail.com","Jeanna","McGrody"),
|
|
|
|
+ new User("Lelah.Haymes@yopmail.com","Lelah","Haymes"),
|
|
|
|
+ new User("Edith.Milson@yopmail.com","Edith","Milson"),
|
|
|
|
+ new User("Minne.Eugenia@yopmail.com","Minne","Eugenia"),
|
|
|
|
+ new User("Abbie.Brittani@yopmail.com","Abbie","Brittani"),
|
|
|
|
+ new User("Brianna.Tacye@yopmail.com","Brianna","Tacye"),
|
|
|
|
+ new User("Gabi.Clarissa@yopmail.com","Gabi","Clarissa"),
|
|
|
|
+ new User("Aili.Evvie@yopmail.com","Aili","Evvie"),
|
|
|
|
+ new User("Jillayne.Plato@yopmail.com","Jillayne","Plato"),
|
|
|
|
+ new User("Allis.Daniele@yopmail.com","Allis","Daniele"),
|
|
|
|
+ new User("Sam.Guildroy@yopmail.com","Sam","Guildroy"),
|
|
|
|
+ new User("Sam.Argus@yopmail.com","Sam","Argus"),
|
|
|
|
+ new User("Lorne.Kirbee@yopmail.com","Lorne","Kirbee"),
|
|
|
|
+ new User("Brianna.Georgy@yopmail.com","Brianna","Georgy"),
|
|
|
|
+ new User("Tarra.Gino@yopmail.com","Tarra","Gino"),
|
|
|
|
+ new User("Elvira.Thornburg@yopmail.com","Elvira","Thornburg"),
|
|
|
|
+ new User("Paola.Alice@yopmail.com","Paola","Alice")
|
|
|
|
+ ));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public User findByEmail(String email) {
|
|
|
|
+ List<User> ps = this.users.stream().filter(x -> x.getEmail().toLowerCase().equals(email.toLowerCase())).collect(Collectors.toList());
|
|
|
|
+ if(ps.size() > 0) {
|
|
|
|
+ return ps.get(0);
|
|
|
|
+ }
|
|
|
|
+ return new User();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|