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 getter
`java.lang.Long` | `getId()` | id getter
`java.lang.String` | `getName()` | name setter
`java.lang.Integer` | `getRanking()` | Ranking points are [100;500].
`java.lang.String` | `getRefreshToken()` |
`UserRoles` | `getRole()` | user rolse getter
`java.util.Set<Groups>` | `getStudentRegisteredGrups()` |
`java.lang.String` | `getSurname()` | surname getter
`java.lang.String` | `getToken()` | token getter
`java.sql.Timestamp` | `getTokenUsageDate()` | token usage getter
`java.lang.String` | `getUsosId()` | usos id getter
`boolean` | `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 setter
`void` | `setName​(java.lang.String name)` | name stter
`void` | `setRanking​(java.lang.Integer ranking)` | Ranking points setter.
`void` | `setRole​(UserRoles role)` | user role setter
`void` | `setSurname​(java.lang.String surname)` | surname setter
`void` | `setToken​(java.lang.String token)` | token seter.
`void` | `updateWithUsosData​(UserApiResponse usosData)` | updates user entity with data got by UsosApiService::getUserData

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 user
  `surname` - surname given to the user
  `mail` - mail given to the user
  `role` - 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 user
  `surname` - surname given to the user
  `mail` - mail given to the user
  `usosId` - id in the USOS system
  `role` - 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 user
  `surname` - surname given to the user
  `mail` - mail given to the user
  `usosId` - id in the USOS system
  `role` - user's role
  `ranking` - ranking points [100;500]. It's calculated by gradesAvg*100*studiesYear

## Method Details

### getStudentRegisteredGrups

public java.util.Set<Groups> getStudentRegisteredGrups()

### removeGroup

public void removeGroup​(java.lang.Long id)

### claimGroup

public void claimGroup​(Groups group)

### 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

public UserRoles getRole()
user rolse getter

Returns:
  UserRoles of user

### setRole

public void setRole​(UserRoles role)
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

public void updateWithUsosData​(UserApiResponse usosData)
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