Class UserServiceImpl

  • All Implemented Interfaces:
    UserService

    @Transactional
    @Service("userService")
    public class UserServiceImpl
    extends java.lang.Object
    implements UserService
    Implements UserService interface
    • Constructor Summary

      Constructors 
      Constructor Description
      UserServiceImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(long id)
      Deletes the user record based off the provided primary key
      void deleteAll()
      Deletes all records and their associated records from the database
      java.util.List<User> findAll()
      Returns a list of all the users
      java.util.List<User> findAllByLastName​(java.lang.String lastname)
      A list of users whose last name contains the given substring
      User findByEmail​(java.lang.String email)
      Returns the user with the given email address
      User findById​(long id)
      Returns the user with the given primary key
      User findByUsername​(java.lang.String username)
      Returns the user with the given username
      java.util.List<User> findUsernamesContaining​(java.lang.String username)
      A list of users whose username contains the given substring
      User save​(User user)
      Given a complete user object, saves that user object in the database If a primary key is provided, the record is completely replaced If no primary key is provided, one is automatically generated and the record is added to the database
      User update​(User user, long id)
      Updates the provided fields in the user record referenced by the primary key
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UserServiceImpl

        public UserServiceImpl()
    • Method Detail

      • findAll

        public java.util.List<User> findAll()
        Description copied from interface: UserService
        Returns a list of all the users
        Specified by:
        findAll in interface UserService
        Returns:
        List of users
      • findById

        public User findById​(long id)
        Description copied from interface: UserService
        Returns the user with the given primary key
        Specified by:
        findById in interface UserService
        Parameters:
        id - The primary key (long) of the user you seek
        Returns:
        User object with the given primary key or throws an exception if not found
      • findByUsername

        public User findByUsername​(java.lang.String username)
        Description copied from interface: UserService
        Returns the user with the given username
        Specified by:
        findByUsername in interface UserService
        Parameters:
        username - The username (String) of the user you seek
        Returns:
        User object with given username or throws an exception if not found
      • findByEmail

        public User findByEmail​(java.lang.String email)
        Description copied from interface: UserService
        Returns the user with the given email address
        Specified by:
        findByEmail in interface UserService
        Parameters:
        email - The email (String) of the user you seek
        Returns:
        User object with the given email or throws an exception if not found
      • findUsernamesContaining

        public java.util.List<User> findUsernamesContaining​(java.lang.String username)
        Description copied from interface: UserService
        A list of users whose username contains the given substring
        Specified by:
        findUsernamesContaining in interface UserService
        Parameters:
        username - The substring (String) containing the username
        Returns:
        List of users whose username contains the given substring
      • findAllByLastName

        public java.util.List<User> findAllByLastName​(java.lang.String lastname)
        Description copied from interface: UserService
        A list of users whose last name contains the given substring
        Specified by:
        findAllByLastName in interface UserService
        Parameters:
        lastname - The substring (String) containing the last name
        Returns:
        List of users whose last name contains the given substring
      • save

        public User save​(User user)
        Description copied from interface: UserService
        Given a complete user object, saves that user object in the database If a primary key is provided, the record is completely replaced If no primary key is provided, one is automatically generated and the record is added to the database
        Specified by:
        save in interface UserService
        Parameters:
        user - The user object (User) to be saved
        Returns:
        The saved user object including any automatically generated fields
      • update

        public User update​(User user,
                           long id)
        Description copied from interface: UserService
        Updates the provided fields in the user record referenced by the primary key
        Specified by:
        update in interface UserService
        Parameters:
        user - Only the user fields to be updated
        id - The primary key (long) of the user to be updated
        Returns:
        Update user object
      • delete

        public void delete​(long id)
        Description copied from interface: UserService
        Deletes the user record based off the provided primary key
        Specified by:
        delete in interface UserService
        Parameters:
        id - The primary key (long) of the user to be deleted
      • deleteAll

        public void deleteAll()
        Description copied from interface: UserService
        Deletes all records and their associated records from the database
        Specified by:
        deleteAll in interface UserService