Class User

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<User>

    public class User
    extends java.lang.Object
    implements java.lang.Comparable<User>, java.io.Serializable
    Container class for the user name and the permission type: READ_ONLY, WRITE, or ADMIN.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ADMIN
      Value corresponding to Administrative permission for a repository user.
      static java.lang.String ANONYMOUS_USERNAME
      Name associated with anonymous user
      static int READ_ONLY
      Value corresponding to Read-only permission for a repository user.
      static long serialVersionUID  
      static int WRITE
      Value corresponding to Write permission for a repository user.
    • Constructor Summary

      Constructors 
      Constructor Description
      User​(java.lang.String name, int permission)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(User other)  
      boolean equals​(java.lang.Object obj)  
      java.lang.String getName()
      Returns user id/name
      int getPermissionType()
      Returns the permission value assigned this user.
      int hashCode()  
      boolean hasWritePermission()
      Return true if this user has permission of WRITE or ADMIN.
      boolean isAdmin()
      Returns true if permission is ADMIN.
      boolean isReadOnly()
      Returns true if permission is READ_ONLY.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ANONYMOUS_USERNAME

        public static final java.lang.String ANONYMOUS_USERNAME
        Name associated with anonymous user
        See Also:
        Constant Field Values
      • READ_ONLY

        public static final int READ_ONLY
        Value corresponding to Read-only permission for a repository user.
        See Also:
        Constant Field Values
      • WRITE

        public static final int WRITE
        Value corresponding to Write permission for a repository user.
        See Also:
        Constant Field Values
      • ADMIN

        public static final int ADMIN
        Value corresponding to Administrative permission for a repository user.
        See Also:
        Constant Field Values
    • Constructor Detail

      • User

        public User​(java.lang.String name,
                    int permission)
        Constructor.
        Parameters:
        name - user id/name
        permission - permission value (READ_ONLY, WRITE or ADMIN)
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns user id/name
      • isReadOnly

        public boolean isReadOnly()
        Returns true if permission is READ_ONLY.
      • hasWritePermission

        public boolean hasWritePermission()
        Return true if this user has permission of WRITE or ADMIN.
      • isAdmin

        public boolean isAdmin()
        Returns true if permission is ADMIN.
      • getPermissionType

        public int getPermissionType()
        Returns the permission value assigned this user.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(User other)
        Specified by:
        compareTo in interface java.lang.Comparable<User>