org.keycloak.models.cache.infinispan.authorization

## Class PolicyAdapter

- java.lang.Object
- - org.keycloak.models.cache.infinispan.authorization.PolicyAdapter

- All Implemented Interfaces:
    CachedModel<Policy>, Policy

      public class PolicyAdapter
      extends Object
      implements Policy, CachedModel<Policy>

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<Policy>` | `associatedPolicies`
    `protected CachedPolicy` | `cached`
    `protected StoreFactoryCacheSession` | `cacheSession`
    `protected boolean` | `invalidated`
    `protected Set<Resource>` | `resources`
    `protected Set<Scope>` | `scopes`
    `protected Policy` | `updated`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PolicyAdapter(CachedPolicy cached, StoreFactoryCacheSession cacheSession)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAssociatedPolicy(Policy associatedPolicy)`
    `void` | `addResource(Resource resource)`
    `void` | `addScope(Scope scope)`
    `boolean` | `equals(Object o)`
    `Set<Policy>` | `getAssociatedPolicies()` Returns the `Policy` instances associated with this policy and used to evaluate authorization decisions when this policy applies.
    `long` | `getCacheTimestamp()` When was the model was loaded from database.
    `Map<String,String>` | `getConfig()` Returns a `Map` holding string-based key/value pairs representing any additional configuration for this policy.
    `DecisionStrategy` | `getDecisionStrategy()` Returns the `DecisionStrategy` for this policy.
    `Policy` | `getDelegateForUpdate()` Invalidates the cache for this model and returns a delegate that represents the actual data provider
    `String` | `getDescription()` Returns the description of this policy.
    `String` | `getId()` Returns the unique identifier for this instance.
    `Logic` | `getLogic()` Returns the `Logic` for this policy.
    `String` | `getName()` Returns the name of this policy.
    `String` | `getOwner()`
    `Set<Resource>` | `getResources()` Returns the `Resource` instances where this policy applies.
    `ResourceServer` | `getResourceServer()` Returns the `ResourceServer` where this policy belongs to.
    `Set<Scope>` | `getScopes()` Returns the `Scope` instances where this policy applies.
    `String` | `getType()` Returns the type of this policy.
    `int` | `hashCode()`
    `void` | `invalidate()` Invalidate the cache for this model
    `protected void` | `invalidateFlag()`
    `boolean` | `isFetched(String association)`
    `protected boolean` | `isUpdated()`
    `void` | `putConfig(String name, String value)`
    `void` | `removeAssociatedPolicy(Policy associatedPolicy)`
    `void` | `removeConfig(String name)`
    `void` | `removeResource(Resource resource)`
    `void` | `removeScope(Scope scope)`
    `void` | `setConfig(Map<String,String> config)` Sets a `Map` with string-based key/value pairs representing any additional configuration for this policy.
    `void` | `setDecisionStrategy(DecisionStrategy decisionStrategy)` Sets the {DecisionStrategy} for this policy.
    `void` | `setDescription(String description)` Sets the description for this policy.
    `void` | `setLogic(Logic logic)` Sets the {Logic} for this policy.
    `void` | `setName(String name)` Sets an unique name to this policy.
    `void` | `setOwner(String owner)`

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

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

- - ### Field Detail

    - #### cached

          protected final CachedPolicy cached

    - #### cacheSession

          protected final StoreFactoryCacheSession cacheSession

    - #### updated

          protected Policy updated

    - #### invalidated

          protected boolean invalidated

    - #### associatedPolicies

          protected Set<Policy> associatedPolicies

    - #### resources

          protected Set<Resource> resources

    - #### scopes

          protected Set<Scope> scopes

  - ### Constructor Detail

    - #### PolicyAdapter

          public PolicyAdapter(CachedPolicy cached,
                               StoreFactoryCacheSession cacheSession)

  - ### Method Detail

    - #### getDelegateForUpdate

          public Policy getDelegateForUpdate()

      Description copied from interface: `CachedModel`
      Invalidates the cache for this model and returns a delegate that represents the actual data provider
      Specified by:
        `getDelegateForUpdate` in interface `CachedModel<Policy>`
      Returns:

    - #### invalidateFlag

          protected void invalidateFlag()

    - #### invalidate

          public void invalidate()

      Description copied from interface: `CachedModel`
      Invalidate the cache for this model
      Specified by:
        `invalidate` in interface `CachedModel<Policy>`

    - #### getCacheTimestamp

          public long getCacheTimestamp()

      Description copied from interface: `CachedModel`
      When was the model was loaded from database.
      Specified by:
        `getCacheTimestamp` in interface `CachedModel<Policy>`
      Returns:

    - #### isUpdated

          protected boolean isUpdated()

    - #### getId

          public String getId()

      Description copied from interface: `Policy`
      Returns the unique identifier for this instance.
      Specified by:
        `getId` in interface `Policy`
      Returns:
        the unique identifier for this instance

    - #### getName

          public String getName()

      Description copied from interface: `Policy`
      Returns the name of this policy.
      Specified by:
        `getName` in interface `Policy`
      Returns:
        the name of this policy

    - #### setName

          public void setName(String name)

      Description copied from interface: `Policy`
      Sets an unique name to this policy.
      Specified by:
        `setName` in interface `Policy`
      Parameters:
        `name` - an unique name

    - #### getResourceServer

          public ResourceServer getResourceServer()

      Description copied from interface: `Policy`
      Returns the `ResourceServer` where this policy belongs to.
      Specified by:
        `getResourceServer` in interface `Policy`
      Returns:
        a resource server

    - #### getType

          public String getType()

      Description copied from interface: `Policy`
      Returns the type of this policy.
      Specified by:
        `getType` in interface `Policy`
      Returns:
        the type of this policy

    - #### getDecisionStrategy

          public DecisionStrategy getDecisionStrategy()

      Description copied from interface: `Policy`
      Returns the `DecisionStrategy` for this policy.
      Specified by:
        `getDecisionStrategy` in interface `Policy`
      Returns:
        the decision strategy defined for this policy

    - #### setDecisionStrategy

          public void setDecisionStrategy(DecisionStrategy decisionStrategy)

      Description copied from interface: `Policy`
      Sets the {DecisionStrategy} for this policy.
      Specified by:
        `setDecisionStrategy` in interface `Policy`

    - #### getLogic

          public Logic getLogic()

      Description copied from interface: `Policy`
      Returns the `Logic` for this policy.
      Specified by:
        `getLogic` in interface `Policy`
      Returns:
        the decision strategy defined for this policy

    - #### setLogic

          public void setLogic(Logic logic)

      Description copied from interface: `Policy`
      Sets the {Logic} for this policy.
      Specified by:
        `setLogic` in interface `Policy`

    - #### getConfig

          public Map<String,String> getConfig()

      Description copied from interface: `Policy`
      Returns a `Map` holding string-based key/value pairs representing any additional configuration for this policy.
      Specified by:
        `getConfig` in interface `Policy`
      Returns:
        a unmodifiable map with any additional configuration defined for this policy.

    - #### setConfig

          public void setConfig(Map<String,String> config)

      Description copied from interface: `Policy`
      Sets a `Map` with string-based key/value pairs representing any additional configuration for this policy.
      Specified by:
        `setConfig` in interface `Policy`

    - #### removeConfig

          public void removeConfig(String name)

      Specified by:
        `removeConfig` in interface `Policy`

    - #### putConfig

          public void putConfig(String name,
                                String value)

      Specified by:
        `putConfig` in interface `Policy`

    - #### getDescription

          public String getDescription()

      Description copied from interface: `Policy`
      Returns the description of this policy.
      Specified by:
        `getDescription` in interface `Policy`
      Returns:
        a description or null of there is no description

    - #### setDescription

          public void setDescription(String description)

      Description copied from interface: `Policy`
      Sets the description for this policy.
      Specified by:
        `setDescription` in interface `Policy`
      Parameters:
        `description` - a description

    - #### getAssociatedPolicies

          public Set<Policy> getAssociatedPolicies()

      Description copied from interface: `Policy`
      Returns the `Policy` instances associated with this policy and used to evaluate authorization decisions when this policy applies.
      Specified by:
        `getAssociatedPolicies` in interface `Policy`
      Returns:
        the associated policies or an empty set if no policy is associated with this policy

    - #### getResources

          public Set<Resource> getResources()

      Description copied from interface: `Policy`
      Returns the `Resource` instances where this policy applies.
      Specified by:
        `getResources` in interface `Policy`
      Returns:
        a set with all resource instances where this policy applies. Or an empty set if there is no resource associated with this policy

    - #### addScope

          public void addScope(Scope scope)

      Specified by:
        `addScope` in interface `Policy`

    - #### removeScope

          public void removeScope(Scope scope)

      Specified by:
        `removeScope` in interface `Policy`

    - #### addAssociatedPolicy

          public void addAssociatedPolicy(Policy associatedPolicy)

      Specified by:
        `addAssociatedPolicy` in interface `Policy`

    - #### removeAssociatedPolicy

          public void removeAssociatedPolicy(Policy associatedPolicy)

      Specified by:
        `removeAssociatedPolicy` in interface `Policy`

    - #### addResource

          public void addResource(Resource resource)

      Specified by:
        `addResource` in interface `Policy`

    - #### removeResource

          public void removeResource(Resource resource)

      Specified by:
        `removeResource` in interface `Policy`

    - #### isFetched

          public boolean isFetched(String association)

      Specified by:
        `isFetched` in interface `Policy`

    - #### getScopes

          public Set<Scope> getScopes()

      Description copied from interface: `Policy`
      Returns the `Scope` instances where this policy applies.
      Specified by:
        `getScopes` in interface `Policy`
      Returns:
        a set with all scope instances where this policy applies. Or an empty set if there is no scope associated with this policy

    - #### getOwner

          public String getOwner()

      Specified by:
        `getOwner` in interface `Policy`

    - #### setOwner

          public void setOwner(String owner)

      Specified by:
        `setOwner` in interface `Policy`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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