user docs corrected
This commit is contained in:
parent
0cee454356
commit
062b02da6c
@ -11,7 +11,8 @@ import javax.persistence.Id;
|
|||||||
import com.plannaplan.types.UserRoles;
|
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
|
@Entity
|
||||||
@ -28,18 +29,16 @@ public class User {
|
|||||||
private UserRoles role;
|
private UserRoles role;
|
||||||
private String token;
|
private String token;
|
||||||
private Timestamp tokenUsageDate;
|
private Timestamp tokenUsageDate;
|
||||||
|
|
||||||
|
|
||||||
public User() {
|
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 surname surname given to the user
|
||||||
* @param email mail given to the user
|
* @param mail mail given to the user
|
||||||
* @param role role given to the user
|
* @param role
|
||||||
*/
|
*/
|
||||||
public User(String name, String surname, String mail, UserRoles role) {
|
public User(String name, String surname, String mail, UserRoles role) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -48,136 +47,144 @@ public class User {
|
|||||||
this.role = role;
|
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 surname surname given to the user
|
||||||
* @param email mail given to the user
|
* @param mail mail given to the user
|
||||||
* @param usosId id in the USOS system
|
* @param usosId id in the USOS system
|
||||||
* @param role role given to the user
|
* @param role
|
||||||
*/
|
*/
|
||||||
public User(String name, String surname, String mail, String usosId, UserRoles role){
|
public User(String name, String surname, String mail, String usosId, UserRoles role) {
|
||||||
this(name,surname,mail,role);
|
this(name, surname, mail, role);
|
||||||
this.usosId = usosId;
|
this.usosId = usosId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getusosId
|
* usos id getter
|
||||||
*
|
*
|
||||||
* @return usosId
|
* @return usosid
|
||||||
*/
|
*/
|
||||||
public String getUsosId() {
|
public String getUsosId() {
|
||||||
return usosId;
|
return usosId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getEmail
|
* email getter
|
||||||
*
|
*
|
||||||
* @return email
|
* @return mailof user
|
||||||
*/
|
*/
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* setEmail
|
* email setter
|
||||||
*
|
*
|
||||||
* @param email set email to the user
|
* @param email user email
|
||||||
*/
|
*/
|
||||||
public void setEmail(String email) {
|
public void setEmail(String email) {
|
||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getTokenUsageDate
|
* token usage getter
|
||||||
*
|
*
|
||||||
* @return tokenUsageDate
|
* @return Timestamp when token was used
|
||||||
*/
|
*/
|
||||||
public Timestamp getTokenUsageDate() {
|
public Timestamp getTokenUsageDate() {
|
||||||
return tokenUsageDate;
|
return tokenUsageDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getToken
|
* token getter
|
||||||
*
|
*
|
||||||
* @return token
|
* @return user token
|
||||||
*/
|
*/
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* setToken
|
* token seter. Sets token and automaticly set time when was set
|
||||||
*
|
*
|
||||||
* @param token set token to the entity
|
* @param token token to set
|
||||||
*/
|
*/
|
||||||
public void setToken(String token) {
|
public void setToken(String token) {
|
||||||
this.tokenUsageDate = new Timestamp(System.currentTimeMillis());
|
this.tokenUsageDate = new Timestamp(System.currentTimeMillis());
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getName
|
/**
|
||||||
*
|
* name setter
|
||||||
* @return name
|
*
|
||||||
|
* @return String user name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getRole
|
/**
|
||||||
*
|
* user rolse getter
|
||||||
* @return role
|
*
|
||||||
|
* @return UserRoles of user
|
||||||
*/
|
*/
|
||||||
public UserRoles getRole() {
|
public UserRoles getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setRole
|
/**
|
||||||
*
|
* user role setter
|
||||||
* @param role set role to the entity
|
*
|
||||||
|
* @param role to be set
|
||||||
*/
|
*/
|
||||||
public void setRole(UserRoles role) {
|
public void setRole(UserRoles role) {
|
||||||
this.role = role;
|
this.role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getSurname
|
* surname getter
|
||||||
* @return surname
|
*
|
||||||
|
* @return string surname
|
||||||
*/
|
*/
|
||||||
public String getSurname() {
|
public String getSurname() {
|
||||||
return surname;
|
return surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* setSurname
|
* surname setter
|
||||||
* @param surname set surname into entity user
|
*
|
||||||
|
* @param surname string to be set as surnames
|
||||||
*/
|
*/
|
||||||
public void setSurname(String surname) {
|
public void setSurname(String surname) {
|
||||||
this.surname = surname;
|
this.surname = surname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* setName
|
* name stter
|
||||||
* @param name set name into entity user
|
*
|
||||||
|
* @param name stirng to be set as name
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* getId
|
* id getter
|
||||||
* @return id
|
*
|
||||||
|
* @return id in database
|
||||||
*/
|
*/
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* isCredentialsNonExpired
|
* it checks if given ammount of time passed since last token usage. If not
|
||||||
* Returns TRUE if is Credentials Non Expired in the otherwise it returns false
|
* 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
|
final long diffInMilliseconds = Math
|
||||||
.abs(this.tokenUsageDate.getTime() - new Timestamp(System.currentTimeMillis()).getTime());
|
.abs(this.tokenUsageDate.getTime() - new Timestamp(System.currentTimeMillis()).getTime());
|
||||||
final long minutes = TimeUnit.MILLISECONDS.toMinutes(diffInMilliseconds);
|
final long minutes = TimeUnit.MILLISECONDS.toMinutes(diffInMilliseconds);
|
||||||
|
Loading…
Reference in New Issue
Block a user