Package com.plannaplan.entities
Class User
java.lang.Object
com.plannaplan.entities.User
@Entity
public class User
extends java.lang.Object
Entity of User grouping of state ssociated about
id,name,surname,email,role,token,tokenCreatedDate
-
Constructor Summary
Constructors Constructor Description User()
User(java.lang.String name, java.lang.String surname, java.lang.String mail, UserRoles role)
User(java.lang.String name, java.lang.String surname, java.lang.String mail, java.lang.String usosId, UserRoles role)
User(java.lang.String name, java.lang.String surname, java.lang.String mail, java.lang.String usosId, UserRoles role, java.lang.Integer ranking)
-
Method Summary
Modifier and Type Method Description void
claimGroup(Groups group)
java.lang.String
getEmail()
email getterjava.lang.Long
getId()
id getterjava.lang.String
getName()
name setterjava.lang.Integer
getRanking()
Ranking points are [100;500].java.lang.String
getRefreshToken()
UserRoles
getRole()
user rolse getterjava.util.Set<Groups>
getStudentRegisteredGrups()
java.lang.String
getSurname()
surname getterjava.lang.String
getToken()
token getterjava.sql.Timestamp
getTokenUsageDate()
token usage getterjava.lang.String
getUsosId()
usos id getterboolean
isCredentialsNonExpired()
it checks if given ammount of time passed since last token usage.void
removeGroup(java.lang.Long id)
void
setEmail(java.lang.String email)
email settervoid
setName(java.lang.String name)
name sttervoid
setRanking(java.lang.Integer ranking)
Ranking points setter.void
setRole(UserRoles role)
user role settervoid
setSurname(java.lang.String surname)
surname settervoid
setToken(java.lang.String token)
token seter.void
updateWithUsosData(UserApiResponse usosData)
updates user entity with data got by UsosApiService::getUserData
-
Constructor Details
-
User
public User() -
User
public User(java.lang.String name, java.lang.String surname, java.lang.String mail, UserRoles role)- Parameters:
name
- name given to the usersurname
- surname given to the usermail
- mail given to the userrole
- user's role
-
User
public User(java.lang.String name, java.lang.String surname, java.lang.String mail, java.lang.String usosId, UserRoles role)- Parameters:
name
- name given to the usersurname
- surname given to the usermail
- mail given to the userusosId
- id in the USOS systemrole
- user's role
-
User
public User(java.lang.String name, java.lang.String surname, java.lang.String mail, java.lang.String usosId, UserRoles role, java.lang.Integer ranking)- Parameters:
name
- name given to the usersurname
- surname given to the usermail
- mail given to the userusosId
- id in the USOS systemrole
- user's roleranking
- ranking points [100;500]. It's calculated by gradesAvg*100*studiesYear
-
-
Method Details
-
getStudentRegisteredGrups
-
removeGroup
public void removeGroup(java.lang.Long id) -
claimGroup
-
getUsosId
public java.lang.String getUsosId()usos id getter- Returns:
- usosid
-
getEmail
public java.lang.String getEmail()email getter- Returns:
- mailof user
-
setEmail
public void setEmail(java.lang.String email)email setter- Parameters:
email
- user email
-
getTokenUsageDate
public java.sql.Timestamp getTokenUsageDate()token usage getter- Returns:
- Timestamp when token was used
-
getToken
public java.lang.String getToken()token getter- Returns:
- user token
-
getRefreshToken
public java.lang.String getRefreshToken()- Returns:
- token needed to call refresh token after it expired
-
setToken
public void setToken(java.lang.String token)token seter. Sets token and automaticly set time when was set- Parameters:
token
- token to set
-
getName
public java.lang.String getName()name setter- Returns:
- String user name
-
getRole
user rolse getter- Returns:
- UserRoles of user
-
setRole
user role setter- Parameters:
role
- to be set
-
getSurname
public java.lang.String getSurname()surname getter- Returns:
- string surname
-
setSurname
public void setSurname(java.lang.String surname)surname setter- Parameters:
surname
- string to be set as surnames
-
setName
public void setName(java.lang.String name)name stter- Parameters:
name
- stirng to be set as name
-
getId
public java.lang.Long getId()id getter- Returns:
- id in database
-
getRanking
public java.lang.Integer getRanking()Ranking points are [100;500]. It's calculated by gradesAvg*100*studiesYear- Returns:
- ranking points [100;500]
-
setRanking
public void setRanking(java.lang.Integer ranking)Ranking points setter. Ranking points are [100;500]. It's calculated by gradesAvg*100*studiesYear- Parameters:
ranking
- ranking points [100;500]
-
updateWithUsosData
updates user entity with data got by UsosApiService::getUserData- Parameters:
usosData
- UserApiResponse model with needed data
-
isCredentialsNonExpired
public boolean isCredentialsNonExpired()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- Returns:
- boolena if credentials (token) is expired or not
-