From 062b02da6c3b3ff3591be2641763133f0a6abf5a Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Wed, 9 Dec 2020 16:57:49 +0100 Subject: [PATCH] user docs corrected --- .../java/com/plannaplan/entities/User.java | 141 +++++++++--------- 1 file changed, 74 insertions(+), 67 deletions(-) diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/User.java b/buisnesslogic/src/main/java/com/plannaplan/entities/User.java index 9bf955d..0633dcc 100755 --- a/buisnesslogic/src/main/java/com/plannaplan/entities/User.java +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/User.java @@ -11,7 +11,8 @@ import javax.persistence.Id; import com.plannaplan.types.UserRoles; /** - * Entity of User grouping of state ssociated about id,name,surname,email,role,token,tokenCreatedDate + * Entity of User grouping of state ssociated about + * id,name,surname,email,role,token,tokenCreatedDate */ @Entity @@ -28,18 +29,16 @@ public class User { private UserRoles role; private String token; private Timestamp tokenUsageDate; - public User() { } - /* - * User - * - * @param name name given to the user + /** + * + * @param name name given to the user * @param surname surname given to the user - * @param email mail given to the user - * @param role role given to the user + * @param mail mail given to the user + * @param role */ public User(String name, String surname, String mail, UserRoles role) { this.name = name; @@ -48,136 +47,144 @@ public class User { this.role = role; } - /* - * User - * - * @param name name given to the user + /** + * + * @param name name given to the user * @param surname surname given to the user - * @param email mail given to the user - * @param usosId id in the USOS system - * @param role role given to the user + * @param mail mail given to the user + * @param usosId id in the USOS system + * @param role */ - public User(String name, String surname, String mail, String usosId, UserRoles role){ - this(name,surname,mail,role); - this.usosId = usosId; + public User(String name, String surname, String mail, String usosId, UserRoles role) { + this(name, surname, mail, role); + this.usosId = usosId; } - /* - * getusosId - * - * @return usosId + /** + * usos id getter + * + * @return usosid */ public String getUsosId() { return usosId; } - /* - * getEmail - * - * @return email + /** + * email getter + * + * @return mailof user */ public String getEmail() { return email; } - /* - * setEmail - * - * @param email set email to the user + /** + * email setter + * + * @param email user email */ public void setEmail(String email) { this.email = email; } - /* - * getTokenUsageDate - * - * @return tokenUsageDate + /** + * token usage getter + * + * @return Timestamp when token was used */ public Timestamp getTokenUsageDate() { return tokenUsageDate; } - /* - * getToken - * - * @return token + /** + * token getter + * + * @return user token */ public String getToken() { return token; } - /* - * setToken - * - * @param token set token to the entity + /** + * token seter. Sets token and automaticly set time when was set + * + * @param token token to set */ public void setToken(String token) { this.tokenUsageDate = new Timestamp(System.currentTimeMillis()); this.token = token; } - /* getName - * - * @return name + /** + * name setter + * + * @return String user name */ public String getName() { return name; } - /* getRole - * - * @return role + /** + * user rolse getter + * + * @return UserRoles of user */ public UserRoles getRole() { return role; } - /* setRole - * - * @param role set role to the entity + /** + * user role setter + * + * @param role to be set */ public void setRole(UserRoles role) { this.role = role; } - /* - * getSurname - * @return surname + /** + * surname getter + * + * @return string surname */ public String getSurname() { return surname; } - /* - * setSurname - * @param surname set surname into entity user + /** + * surname setter + * + * @param surname string to be set as surnames */ public void setSurname(String surname) { this.surname = surname; } - /* - * setName - * @param name set name into entity user + /** + * name stter + * + * @param name stirng to be set as name */ public void setName(String name) { this.name = name; } - /* - * getId - * @return id + /** + * id getter + * + * @return id in database */ public Long getId() { return this.id; } - /* - * isCredentialsNonExpired - * Returns TRUE if is Credentials Non Expired in the otherwise it returns false + /** + * it checks if given ammount of time passed since last token usage. If not + * retunr true and reset time otherwise return false and token won work anymore + * + * @return boolena if credentials (token) is expired or not */ - public boolean isCredentialsNonExpired() { + public boolean isCredentialsNonExpired() { final long diffInMilliseconds = Math .abs(this.tokenUsageDate.getTime() - new Timestamp(System.currentTimeMillis()).getTime()); final long minutes = TimeUnit.MILLISECONDS.toMinutes(diffInMilliseconds);