Class Actor

java.lang.Object
de.gustavblass.fsu.fmi.roombooking.model.actor.Actor
All Implemented Interfaces:
Identified, Serializable, Comparable<Actor>, org.springframework.security.core.CredentialsContainer, org.springframework.security.core.userdetails.UserDetails
Direct Known Subclasses:
LdapActor, LocalActor

@Entity public abstract class Actor extends Object implements Identified, Comparable<Actor>, org.springframework.security.core.userdetails.UserDetails, org.springframework.security.core.CredentialsContainer
A user of the Room-booking system. Can be an end-user, a faculty's administration employee or an IT administrator.
See Also:
  • Field Details

    • id

      @NonNull private @NonNull Long id
      Identifies this Actor uniquely.
    • role

      @NonNull private @NonNull ActorRole role
      Classification of this Actor. Every role implies certain privileges/authorities.
    • userName

      @NonNull private @NonNull String userName
      Human-friendly identifier. Used as a log-in credential.
    • name

      @NonNull private @NonNull String name
      The user's clear name, as stated on their university ID card or their government ID.
    • eMailAddress

      @NonNull private @NonNull String eMailAddress
      The e-mail address of the user. Can be used for e-mail notifications.
    • enabled

      private boolean enabled
      Whether the user has activated their account after self-registration.
    • locked

      private boolean locked
      Whether the faculty's administration has chosen to make the account temporarily unusable.
    • metadata

      private ActorMetadata metadata
      Additional information on the account of this Actor.
  • Constructor Details

    • Actor

      public Actor()
  • Method Details

    • getTypeCode

      @Contract(pure=true) @NonNull public abstract @NonNull String getTypeCode()
      Returns:
      Identifies the kind of Actor.
    • password

      @Contract(pure=true) @NonNull public abstract @NonNull Optional<String> password()
      A null-safe alternative to getPassword().
      Returns:
      The password, if present.
    • getPassword

      @Contract(pure=true) @Nullable public abstract @Nullable String getPassword()
      Specified by:
      getPassword in interface org.springframework.security.core.userdetails.UserDetails
    • compareTo

      @Contract(pure=true) public int compareTo(@NonNull @NonNull Actor other)

      Determines whether this Actor or a given one has the higher-priority role.

      • Negative: This Actor has a more privileged ActorRole than the given Actor.
      • Zero: Both Actors have the same role.
      • Positive: This Actor has a less privileged role than the given Actor.
      Specified by:
      compareTo in interface Comparable<Actor>
      Returns:
      Result of the actors' role comparison.
    • getAuthorities

      @Contract(pure=true) @NonNull public @NonNull Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
      Converts this Actor's role to a GrantedAuthority in a one-element List.
      Specified by:
      getAuthorities in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      The GrantedAuthority implied by the current ActorRole.
    • getUsername

      @Contract(pure=true) @NonNull public @NonNull String getUsername()
      Specified by:
      getUsername in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      The userName.
    • isEnabled

      @Contract(pure=true) public boolean isEnabled()
      Specified by:
      isEnabled in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      The enabled flag.
    • isAccountNonLocked

      @Contract(pure=true) public boolean isAccountNonLocked()
      Specified by:
      isAccountNonLocked in interface org.springframework.security.core.userdetails.UserDetails
      Returns:

      Opposite of

      invalid reference
      #isLocked()
      .
    • getMetadata

      @Contract(pure=true) @NonNull public @NonNull Optional<ActorMetadata> getMetadata()
      Returns:
      The metadata, if present.
    • setMetadata

      public void setMetadata(@NonNull @NonNull ActorMetadata metadata)
      Updates the metadata.
      Parameters:
      metadata - The new value for the metadata field.
    • resetMetadata

      public void resetMetadata()
      Sets the metadata to null.