Class User

    • Field Detail

      • STATUS_ANONYMOUS

        public static final java.lang.Integer STATUS_ANONYMOUS
      • STATUS_ACTIVE

        public static final java.lang.Integer STATUS_ACTIVE
      • STATUS_REGISTERED

        public static final java.lang.Integer STATUS_REGISTERED
      • STATUS_LOCKED

        public static final java.lang.Integer STATUS_LOCKED
      • ID

        public static final Property<java.lang.Integer> ID
      • LOGIN

        public static final Property<java.lang.String> LOGIN
      • PASSWORD

        public static final Property<java.lang.String> PASSWORD
      • FIRST_NAME

        public static final Property<java.lang.String> FIRST_NAME
      • LAST_NAME

        public static final Property<java.lang.String> LAST_NAME
      • MAIL

        public static final Property<java.lang.String> MAIL
      • API_KEY

        public static final Property<java.lang.String> API_KEY
      • CREATED_ON

        public static final Property<java.util.Date> CREATED_ON
      • LAST_LOGIN_ON

        public static final Property<java.util.Date> LAST_LOGIN_ON
      • AUTH_SOURCE_ID

        public static final Property<java.lang.Integer> AUTH_SOURCE_ID
      • STATUS

        public static final Property<java.lang.Integer> STATUS
      • MAIL_NOTIFICATION

        public static final Property<java.lang.String> MAIL_NOTIFICATION
      • MUST_CHANGE_PASSWD

        public static final Property<java.lang.Boolean> MUST_CHANGE_PASSWD
      • GENERATE_PASSWORD

        public static final Property<java.lang.Boolean> GENERATE_PASSWORD
      • GROUPS

        public static final Property<java.util.Set<Group>> GROUPS
    • Constructor Detail

    • Method Detail

      • setId

        public User setId​(int id)
      • getId

        public java.lang.Integer getId()
        Specified by:
        getId in interface Identifiable
      • toString

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

        public java.lang.String getLogin()
      • setLogin

        public User setLogin​(java.lang.String login)
      • getFirstName

        public java.lang.String getFirstName()
      • setFirstName

        public User setFirstName​(java.lang.String firstName)
      • getLastName

        public java.lang.String getLastName()
      • setLastName

        public User setLastName​(java.lang.String lastName)
      • getMail

        public java.lang.String getMail()
        This field is empty when using issues.get(i).getAssignee().getMail()
      • setMail

        public User setMail​(java.lang.String mail)
      • getCreatedOn

        public java.util.Date getCreatedOn()
      • setCreatedOn

        public User setCreatedOn​(java.util.Date createdOn)
      • getLastLoginOn

        public java.util.Date getLastLoginOn()
      • setLastLoginOn

        public User setLastLoginOn​(java.util.Date lastLoginOn)
      • getApiKey

        public java.lang.String getApiKey()
      • setApiKey

        @Deprecated
        public User setApiKey​(java.lang.String apiKey)
        Deprecated.
        APIKey property is read-only. This setter is only for serialization JSon. The value you set using this method will be ignored by the server.
      • getAuthSourceId

        @Deprecated
        public java.lang.Integer getAuthSourceId()
        Deprecated.
        This value is not returned by redmine on existing users.
        Returns:
        - The Authentication Source ID, if you set it on your own.
      • setAuthSourceId

        public User setAuthSourceId​(java.lang.Integer authSource)
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

        public java.lang.String getFullName()
        Returns:
        `firstName` + space + `lastName` if `lastName` is not null. otherwise returns value of `firstName`
      • setFullName

        public User setFullName​(java.lang.String fullName)
        This is a BIG HACK just to workaround Redmine REST API limitation. see http://www.redmine.org/issues/7487
      • getPassword

        public java.lang.String getPassword()
      • setPassword

        public User setPassword​(java.lang.String password)
      • getCustomField

        public java.lang.String getCustomField​(java.lang.String fieldName)
        Returns:
        the value or NULL if the field is not found
      • getCustomFields

        public java.util.Collection<CustomField> getCustomFields()
        Returns:
        Custom Fields, NEVER NULL.
      • clearCustomFields

        public void clearCustomFields()
      • addCustomFields

        public User addCustomFields​(java.util.Collection<CustomField> customFields)
        NOTE: The custom field(s) must have correct database ID set to be saved to Redmine. This is Redmine REST API's limitation. ID can be seen in database or in Redmine administration when editing the custom field (number is part of the URL!).
      • addCustomField

        public User addCustomField​(CustomField customField)
        If there is a custom field with the same ID already present, the new field replaces the old one.
        Parameters:
        customField - the field to add.
      • getMemberships

        public java.util.Collection<Membership> getMemberships()
      • addMemberships

        public User addMemberships​(java.util.Collection<Membership> memberships)
      • getGroups

        public java.util.Collection<Group> getGroups()
      • addGroups

        public User addGroups​(java.util.Collection<Group> groups)
      • getStatus

        public java.lang.Integer getStatus()
        This field is visible to Admin only.

        Returns the user status. This number can theoretically be different for different Redmine versions, But the **current Redmine version in 2018** defines these numbers as:

        • 0: status anonymous
        • 1: status active
        • 2: status registered
        • 3: status locked

        see http://www.redmine.org/projects/redmine/repository/entry/trunk/app/models/principal.rb#L22-25

        Returns:
        possibly Redmine-version-specific number that represents user status (active/locked/etc)
        Since:
        Redmine REST API 2.4.0
      • setMailNotification

        public User setMailNotification​(java.lang.String mailNotification)
      • setMustChangePasswd

        public User setMustChangePasswd​(java.lang.Boolean mustChangePasswd)
      • setGeneratePassword

        public User setGeneratePassword​(java.lang.Boolean generatePassword)
      • addToGroup

        public void addToGroup​(int groupId)
                        throws RedmineException
        Adds this user (ID must be set!) to the given group.

        Note: "add to group" operation used to be safe (idempotent) for Redmine 2.6.x, but FAILS for Redmine 3.0.0 when executed twice on the same user. I submitted a bug: http://www.redmine.org/issues/19363 which was closed as "invalid"...

        Parameters:
        groupId - - id of the group to add to.
        Throws:
        RedmineException
        Since:
        Redmine 2.1