org.keycloak.storage.adapter

## Class UpdateOnlyChangeUserModelDelegate

- java.lang.Object
- - org.keycloak.models.utils.UserModelDelegate
  - - org.keycloak.storage.adapter.UpdateOnlyChangeUserModelDelegate

- All Implemented Interfaces:
    RoleMapperModel, RoleMapperModel.Streams, UserModel, UserModel.Streams

      public class UpdateOnlyChangeUserModelDelegate
      extends UserModelDelegate

  This will perform update operation for particular attribute/property just if the existing value is not already same. In other words, just "real updates" will be passed to the delegate.
  Author:
    Marek Posolda

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.UserModel

      `UserModel.RequiredAction, UserModel.SearchableFields, UserModel.Streams, UserModel.UserRemovedEvent`

  - ### Field Summary

    - ### Fields inherited from class org.keycloak.models.utils.UserModelDelegate

      `delegate`

    - ### Fields inherited from interface org.keycloak.models.UserModel

      `COMPARE_BY_USERNAME, DISABLED_REASON, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UpdateOnlyChangeUserModelDelegate(UserModel delegate)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequiredAction(String action)`
    `void` | `addRequiredAction(UserModel.RequiredAction action)`
    `void` | `deleteRoleMapping(RoleModel role)` Removes the given role mapping from this object.
    `void` | `grantRole(RoleModel role)` Grants the given role to this object.
    `void` | `joinGroup(GroupModel group)`
    `void` | `leaveGroup(GroupModel group)`
    `void` | `removeAttribute(String name)`
    `void` | `removeRequiredAction(String action)`
    `void` | `removeRequiredAction(UserModel.RequiredAction action)`
    `void` | `setAttribute(String name, List<String> values)`
    `void` | `setCreatedTimestamp(Long timestamp)`
    `void` | `setEmail(String email)` Sets email for this user.
    `void` | `setEmailVerified(boolean verified)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setFederationLink(String link)`
    `void` | `setFirstName(String firstName)`
    `void` | `setLastName(String lastName)`
    `void` | `setServiceAccountClientLink(String clientInternalId)`
    `void` | `setSingleAttribute(String name, String value)` Set single value of specified attribute.
    `void` | `setUsername(String username)` Sets username for this user.

    - ### Methods inherited from class org.keycloak.models.utils.UserModelDelegate

      `equals, getAttributes, getAttributeStream, getClientRoleMappingsStream, getCreatedTimestamp, getDelegate, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroupsStream, getId, getLastName, getRealmRoleMappingsStream, getRequiredActionsStream, getRoleMappingsStream, getServiceAccountClientLink, getUsername, hashCode, hasRole, isEmailVerified, isEnabled, isMemberOf`

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

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

    - ### Methods inherited from interface org.keycloak.models.UserModel.Streams

      `getAttribute, getGroups, getRequiredActions`

    - ### Methods inherited from interface org.keycloak.models.UserModel

      `getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream`

    - ### Methods inherited from interface org.keycloak.models.RoleMapperModel.Streams

      `getClientRoleMappings, getRealmRoleMappings, getRoleMappings`

- - ### Constructor Detail

    - #### UpdateOnlyChangeUserModelDelegate

          public UpdateOnlyChangeUserModelDelegate(UserModel delegate)

  - ### Method Detail

    - #### setUsername

          public void setUsername(String username)

      Description copied from interface: `UserModel`
      Sets username for this user. No default method here to allow Abstract subclasses where the username is provided in a different manner
      Specified by:
        `setUsername` in interface `UserModel`
      Overrides:
        `setUsername` in class `UserModelDelegate`
      Parameters:
        `username` - username string

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Specified by:
        `setEnabled` in interface `UserModel`
      Overrides:
        `setEnabled` in class `UserModelDelegate`

    - #### setSingleAttribute

          public void setSingleAttribute(String name,
                                         String value)

      Description copied from interface: `UserModel`
      Set single value of specified attribute. Remove all other existing values of this attribute
      Specified by:
        `setSingleAttribute` in interface `UserModel`
      Overrides:
        `setSingleAttribute` in class `UserModelDelegate`

    - #### setAttribute

          public void setAttribute(String name,
                                   List<String> values)

      Specified by:
        `setAttribute` in interface `UserModel`
      Overrides:
        `setAttribute` in class `UserModelDelegate`

    - #### removeAttribute

          public void removeAttribute(String name)

      Specified by:
        `removeAttribute` in interface `UserModel`
      Overrides:
        `removeAttribute` in class `UserModelDelegate`

    - #### addRequiredAction

          public void addRequiredAction(String action)

      Specified by:
        `addRequiredAction` in interface `UserModel`
      Overrides:
        `addRequiredAction` in class `UserModelDelegate`

    - #### removeRequiredAction

          public void removeRequiredAction(String action)

      Specified by:
        `removeRequiredAction` in interface `UserModel`
      Overrides:
        `removeRequiredAction` in class `UserModelDelegate`

    - #### addRequiredAction

          public void addRequiredAction(UserModel.RequiredAction action)

      Specified by:
        `addRequiredAction` in interface `UserModel`
      Overrides:
        `addRequiredAction` in class `UserModelDelegate`

    - #### removeRequiredAction

          public void removeRequiredAction(UserModel.RequiredAction action)

      Specified by:
        `removeRequiredAction` in interface `UserModel`
      Overrides:
        `removeRequiredAction` in class `UserModelDelegate`

    - #### setFirstName

          public void setFirstName(String firstName)

      Specified by:
        `setFirstName` in interface `UserModel`
      Overrides:
        `setFirstName` in class `UserModelDelegate`

    - #### setLastName

          public void setLastName(String lastName)

      Specified by:
        `setLastName` in interface `UserModel`
      Overrides:
        `setLastName` in class `UserModelDelegate`

    - #### setEmail

          public void setEmail(String email)

      Description copied from interface: `UserModel`
      Sets email for this user.
      Specified by:
        `setEmail` in interface `UserModel`
      Overrides:
        `setEmail` in class `UserModelDelegate`
      Parameters:
        `email` - the email

    - #### setEmailVerified

          public void setEmailVerified(boolean verified)

      Specified by:
        `setEmailVerified` in interface `UserModel`
      Overrides:
        `setEmailVerified` in class `UserModelDelegate`

    - #### grantRole

          public void grantRole(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Grants the given role to this object.
      Specified by:
        `grantRole` in interface `RoleMapperModel`
      Overrides:
        `grantRole` in class `UserModelDelegate`

    - #### deleteRoleMapping

          public void deleteRoleMapping(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Removes the given role mapping from this object.
      Specified by:
        `deleteRoleMapping` in interface `RoleMapperModel`
      Overrides:
        `deleteRoleMapping` in class `UserModelDelegate`
      Parameters:
        `role` - Role to remove

    - #### setFederationLink

          public void setFederationLink(String link)

      Specified by:
        `setFederationLink` in interface `UserModel`
      Overrides:
        `setFederationLink` in class `UserModelDelegate`

    - #### setServiceAccountClientLink

          public void setServiceAccountClientLink(String clientInternalId)

      Specified by:
        `setServiceAccountClientLink` in interface `UserModel`
      Overrides:
        `setServiceAccountClientLink` in class `UserModelDelegate`

    - #### setCreatedTimestamp

          public void setCreatedTimestamp(Long timestamp)

      Specified by:
        `setCreatedTimestamp` in interface `UserModel`
      Overrides:
        `setCreatedTimestamp` in class `UserModelDelegate`

    - #### joinGroup

          public void joinGroup(GroupModel group)

      Specified by:
        `joinGroup` in interface `UserModel`
      Overrides:
        `joinGroup` in class `UserModelDelegate`

    - #### leaveGroup

          public void leaveGroup(GroupModel group)

      Specified by:
        `leaveGroup` in interface `UserModel`
      Overrides:
        `leaveGroup` in class `UserModelDelegate`

Copyright © 2021 JBoss by Red Hat. All rights reserved.