org.keycloak.models.jpa

## Class GroupAdapter

- java.lang.Object
- - org.keycloak.models.jpa.GroupAdapter

- All Implemented Interfaces:
    GroupModel, JpaModel<GroupEntity>, RoleMapperModel

      public class GroupAdapter
      extends Object
      implements GroupModel, JpaModel<GroupEntity>

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.persistence.EntityManager` | `em`
    `protected GroupEntity` | `group`
    `protected RealmModel` | `realm`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GroupAdapter(RealmModel realm, javax.persistence.EntityManager em, GroupEntity group)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChild(GroupModel subGroup)` Automatically calls setParent() on the subGroup
    `void` | `deleteRoleMapping(RoleModel role)`
    `boolean` | `equals(Object o)`
    `List<String>` | `getAttribute(String name)`
    `Map<String,List<String>>` | `getAttributes()`
    `Set<RoleModel>` | `getClientRoleMappings(ClientModel app)`
    `GroupEntity` | `getEntity()`
    `String` | `getFirstAttribute(String name)`
    `protected javax.persistence.TypedQuery<GroupRoleMappingEntity>` | `getGroupRoleMappingEntityTypedQuery(RoleModel role)`
    `String` | `getId()`
    `String` | `getName()`
    `GroupModel` | `getParent()`
    `String` | `getParentId()`
    `Set<RoleModel>` | `getRealmRoleMappings()`
    `Set<RoleModel>` | `getRoleMappings()`
    `Set<GroupModel>` | `getSubGroups()`
    `void` | `grantRole(RoleModel role)`
    `int` | `hashCode()`
    `boolean` | `hasRole(RoleModel role)`
    `void` | `removeAttribute(String name)`
    `void` | `removeChild(GroupModel subGroup)` Automatically calls setParent() on the subGroup
    `void` | `setAttribute(String name, List<String> values)`
    `void` | `setName(String name)`
    `void` | `setParent(GroupModel parent)` You must also call addChild on the parent group, addChild on RealmModel if there is no parent group
    `void` | `setSingleAttribute(String name, String value)` Set single value of specified attribute.
    `static GroupEntity` | `toEntity(GroupModel model, javax.persistence.EntityManager em)`

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

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

- - ### Field Detail

    - #### group

          protected GroupEntity group

    - #### em

          protected javax.persistence.EntityManager em

    - #### realm

          protected RealmModel realm

  - ### Constructor Detail

    - #### GroupAdapter

          public GroupAdapter(RealmModel realm,
                              javax.persistence.EntityManager em,
                              GroupEntity group)

  - ### Method Detail

    - #### getEntity

          public GroupEntity getEntity()

      Specified by:
        `getEntity` in interface `JpaModel<GroupEntity>`

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `GroupModel`

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `GroupModel`

    - #### setName

          public void setName(String name)

      Specified by:
        `setName` in interface `GroupModel`

    - #### getParent

          public GroupModel getParent()

      Specified by:
        `getParent` in interface `GroupModel`

    - #### getParentId

          public String getParentId()

      Specified by:
        `getParentId` in interface `GroupModel`

    - #### toEntity

          public static GroupEntity toEntity(GroupModel model,
                                             javax.persistence.EntityManager em)

    - #### setParent

          public void setParent(GroupModel parent)

      Description copied from interface: `GroupModel`
      You must also call addChild on the parent group, addChild on RealmModel if there is no parent group
      Specified by:
        `setParent` in interface `GroupModel`

    - #### addChild

          public void addChild(GroupModel subGroup)

      Description copied from interface: `GroupModel`
      Automatically calls setParent() on the subGroup
      Specified by:
        `addChild` in interface `GroupModel`

    - #### removeChild

          public void removeChild(GroupModel subGroup)

      Description copied from interface: `GroupModel`
      Automatically calls setParent() on the subGroup
      Specified by:
        `removeChild` in interface `GroupModel`

    - #### getSubGroups

          public Set<GroupModel> getSubGroups()

      Specified by:
        `getSubGroups` in interface `GroupModel`

    - #### setSingleAttribute

          public void setSingleAttribute(String name,
                                         String value)

      Description copied from interface: `GroupModel`
      Set single value of specified attribute. Remove all other existing values
      Specified by:
        `setSingleAttribute` in interface `GroupModel`

    - #### setAttribute

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

      Specified by:
        `setAttribute` in interface `GroupModel`

    - #### removeAttribute

          public void removeAttribute(String name)

      Specified by:
        `removeAttribute` in interface `GroupModel`

    - #### getFirstAttribute

          public String getFirstAttribute(String name)

      Specified by:
        `getFirstAttribute` in interface `GroupModel`
      Returns:
        null if there is not any value of specified attribute or first value otherwise. Don't throw exception if there are more values of the attribute

    - #### getAttribute

          public List<String> getAttribute(String name)

      Specified by:
        `getAttribute` in interface `GroupModel`
      Returns:
        list of all attribute values or empty list if there are not any values. Never return null

    - #### getAttributes

          public Map<String,List<String>> getAttributes()

      Specified by:
        `getAttributes` in interface `GroupModel`

    - #### hasRole

          public boolean hasRole(RoleModel role)

      Specified by:
        `hasRole` in interface `RoleMapperModel`

    - #### getGroupRoleMappingEntityTypedQuery

          protected javax.persistence.TypedQuery<GroupRoleMappingEntity> getGroupRoleMappingEntityTypedQuery(RoleModel role)

    - #### grantRole

          public void grantRole(RoleModel role)

      Specified by:
        `grantRole` in interface `RoleMapperModel`

    - #### getRealmRoleMappings

          public Set<RoleModel> getRealmRoleMappings()

      Specified by:
        `getRealmRoleMappings` in interface `RoleMapperModel`

    - #### getRoleMappings

          public Set<RoleModel> getRoleMappings()

      Specified by:
        `getRoleMappings` in interface `RoleMapperModel`

    - #### deleteRoleMapping

          public void deleteRoleMapping(RoleModel role)

      Specified by:
        `deleteRoleMapping` in interface `RoleMapperModel`

    - #### getClientRoleMappings

          public Set<RoleModel> getClientRoleMappings(ClientModel app)

      Specified by:
        `getClientRoleMappings` in interface `RoleMapperModel`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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