Class MapPolicyStore

    • Method Detail

      • create

        public Policy create​(ResourceServer resourceServer,
                             AbstractPolicyRepresentation representation)
        Description copied from interface: PolicyStore
        Creates a new Policy instance. The new instance is not necessarily persisted though, which may require a call to the {#save} method to actually make it persistent.
        Specified by:
        create in interface PolicyStore
        Parameters:
        resourceServer - the resource server to which this policy belongs. Cannot be null.
        representation - the policy representation
        Returns:
        a new instance of Policy
      • delete

        public void delete​(RealmModel realm,
                           String id)
        Description copied from interface: PolicyStore
        Deletes a policy from the underlying persistence mechanism.
        Specified by:
        delete in interface PolicyStore
        Parameters:
        realm - the realm that the removed policy belongs to. Cannot be null
        id - the id of the policy to delete
      • findById

        public Policy findById​(RealmModel realm,
                               ResourceServer resourceServer,
                               String id)
        Description copied from interface: PolicyStore
        Returns a Policy with the given id
        Specified by:
        findById in interface PolicyStore
        Parameters:
        realm - the realm. Cannot be null.
        resourceServer - the resource server. Ignored if null.
        id - the identifier of the policy
        Returns:
        a policy with the given identifier.
      • findByName

        public Policy findByName​(ResourceServer resourceServer,
                                 String name)
        Description copied from interface: PolicyStore
        Returns a Policy with the given name
        Specified by:
        findByName in interface PolicyStore
        Parameters:
        resourceServer - the resource server. Cannot be null
        name - the name of the policy
        Returns:
        a policy with the given name or null if no such policy exists.
      • find

        public List<Policy> find​(RealmModel realm,
                                 ResourceServer resourceServer,
                                 Map<Policy.FilterOption,​String[]> attributes,
                                 Integer firstResult,
                                 Integer maxResults)
        Description copied from interface: PolicyStore
        Returns a list of Policy associated with a ResourceServer with the given resourceServerId.
        Specified by:
        find in interface PolicyStore
        Parameters:
        realm - the realm. Cannot be null.
        resourceServer - the identifier of a resource server. Ignored if null.
        attributes - a map holding the attributes that will be used as a filter; possible filter options are given by Policy.FilterOption
        firstResult - first result to return. Ignored if negative or null.
        maxResults - maximum number of results to return. Ignored if negative or null.
        Returns:
        a list of policies that belong to the given resource server
      • findByResource

        public void findByResource​(ResourceServer resourceServer,
                                   Resource resource,
                                   Consumer<Policy> consumer)
        Description copied from interface: PolicyStore
        Searches for all policies associated with the Resource and passes the result to the consumer
        Specified by:
        findByResource in interface PolicyStore
        Parameters:
        resourceServer - the resourceServer. Cannot be null.
        resource - the resource. Cannot be null.
        consumer - consumer of policies resulted from the search
      • findByResourceType

        public void findByResourceType​(ResourceServer resourceServer,
                                       String type,
                                       Consumer<Policy> policyConsumer)
        Description copied from interface: PolicyStore
        Searches for policies associated with a ResourceServer and passes the result to the consumer
        Specified by:
        findByResourceType in interface PolicyStore
        Parameters:
        resourceServer - the resourceServer. Cannot be null.
        type - the type of a resource
        policyConsumer - consumer of policies resulted from the search
      • findByScopes

        public List<Policy> findByScopes​(ResourceServer resourceServer,
                                         List<Scope> scopes)
        Description copied from interface: PolicyStore
        Returns a list of Policy associated with a Scope within the given scope.
        Specified by:
        findByScopes in interface PolicyStore
        Parameters:
        resourceServer - the resource server. Cannot be null.
        scopes - the scopes
        Returns:
        a list of policies associated with the given scopes
      • findByType

        public List<Policy> findByType​(ResourceServer resourceServer,
                                       String type)
        Description copied from interface: PolicyStore
        Returns a list of Policy with the given type.
        Specified by:
        findByType in interface PolicyStore
        Parameters:
        resourceServer - the resource server id. Cannot be null.
        type - the type of the policy
        Returns:
        a list of policies with the given type
      • findDependentPolicies

        public List<Policy> findDependentPolicies​(ResourceServer resourceServer,
                                                  String id)
        Description copied from interface: PolicyStore
        Returns a list of Policy that depends on another policy with the given id.
        Specified by:
        findDependentPolicies in interface PolicyStore
        Parameters:
        resourceServer - the resource server
        id - the id of the policy to query its dependents
        Returns:
        a list of policies that depends on the a policy with the given identifier
      • preRemove

        public void preRemove​(RealmModel realm)