Interface Repository<T extends ScimResource>

Type Parameters:
T - a SCIM ResourceType that extends ScimResource
All Known Implementing Classes:
InMemoryGroupService, InMemoryGroupService, InMemoryGroupService, InMemoryGroupService, InMemoryUserService, InMemoryUserService, InMemoryUserService, InMemoryUserService

public interface Repository<T extends ScimResource>
Defines the interface between the SCIM protocol implementation and the Repository implementation for type T.
Author:
Chris Harm <crh5255@psu.edu>
  • Method Summary

    Modifier and Type
    Method
    Description
    create(T resource)
    Allows the SCIM server's REST implementation to create a resource via a POST to a valid end-point.
    void
    Deletes the ScimResource with the provided identifier (if it exists).
    find(Filter filter, PageRequest pageRequest, SortRequest sortRequest)
    Finds and retrieves all ScimResource objects known to the persistence layer that match the criteria specified by the passed Filter.
    get(String id)
    Retrieves the ScimResource associated with the provided identifier.
    default List<Class<? extends ScimExtension>>
    Returns a list of the SCIM Extensions that this repository considers to be associated with the ScimResource of type T.
    Returns the type of ScimResource this repository manages.
    patch(String id, String version, List<PatchOperation> patchOperations, Set<AttributeReference> includedAttributes, Set<AttributeReference> excludedAttributes)
    Allows the SCIM server's REST implementation to update and existing resource via a PATCH to a valid end-point.
    update(String id, String version, T resource, Set<AttributeReference> includedAttributes, Set<AttributeReference> excludedAttributes)
    Allows the SCIM server's REST implementation to update and existing resource via a PUT to a valid end-point.
  • Method Details

    • getResourceClass

      Class<T> getResourceClass()
      Returns the type of ScimResource this repository manages.
      Returns:
      The type of resource this repository manages.
    • create

      T create(T resource) throws ResourceException
      Allows the SCIM server's REST implementation to create a resource via a POST to a valid end-point.
      Parameters:
      resource - The ScimResource to create and persist.
      Returns:
      The newly created ScimResource.
      Throws:
      ResourceException - When the ScimResource cannot be created.
    • update

      T update(String id, String version, T resource, Set<AttributeReference> includedAttributes, Set<AttributeReference> excludedAttributes) throws ResourceException
      Allows the SCIM server's REST implementation to update and existing resource via a PUT to a valid end-point.
      SCIM Implementation NOTE: SCIM supports versioning of resources via HTTP ETags, if the (optional) version parameter is present, (and supported by the server), it can be used as a mechanism for caching and to ensure clients do not inadvertently overwrite other changes.
      Parameters:
      id - the identifier of the ScimResource to update and persist.
      version - an optional version (usually used as an ETag) that can be used to optimize update requests, may be compared against, the current ScimResource.meta.version.
      resource - an updated resource to persist
      includedAttributes - optional set of attributes to include from ScimResource, may be used to optimize queries.
      excludedAttributes - optional set of attributes to exclude from ScimResource, may be used to optimize queries.
      Returns:
      The newly updated ScimResource.
      Throws:
      ResourceException - When the ScimResource cannot be updated.
    • patch

      T patch(String id, String version, List<PatchOperation> patchOperations, Set<AttributeReference> includedAttributes, Set<AttributeReference> excludedAttributes) throws ResourceException
      Allows the SCIM server's REST implementation to update and existing resource via a PATCH to a valid end-point.
      SCIM Implementation NOTE: SCIM supports versioning of resources via HTTP ETags, if the (optional) version parameter is present, (and supported by the server), it can be used as a mechanism for caching and to ensure clients do not inadvertently overwrite other changes.
      Parameters:
      id - the identifier of the ScimResource to update and persist.
      version - an optional version (usually used as an ETag) that can be used to optimize update requests, may be compared against, the current ScimResource.meta.version.
      patchOperations - a list of patch operations to apply to an existing resource.
      includedAttributes - optional set of attributes to include from ScimResource, may be used to optimize queries.
      excludedAttributes - optional set of attributes to exclude from ScimResource, may be used to optimize queries.
      Returns:
      The newly updated ScimResource.
      Throws:
      ResourceException - When the ScimResource cannot be updated.
    • get

      T get(String id) throws ResourceException
      Retrieves the ScimResource associated with the provided identifier.
      Parameters:
      id - The identifier of the target ScimResource.
      Returns:
      The requested ScimResource.
      Throws:
      ResourceException - When the ScimResource cannot be retrieved.
    • find

      FilterResponse<T> find(Filter filter, PageRequest pageRequest, SortRequest sortRequest) throws ResourceException
      Finds and retrieves all ScimResource objects known to the persistence layer that match the criteria specified by the passed Filter. The results may be truncated by the scope specified by the passed PageRequest and the order of the returned resources may be controlled by the passed SortRequest.
      Parameters:
      filter - The filter that determines the ScimResources that will be part of the ResultList
      pageRequest - For paged requests, this object specifies the start index and number of ScimResources that should be returned.
      sortRequest - Specifies which fields the returned ScimResources should be sorted by and whether the sort order is ascending or descending.
      Returns:
      A list of the ScimResources that pass the filter criteria, truncated to match the requested "page" and sorted according to the provided requirements.
      Throws:
      ResourceException - If one or more ScimResources cannot be retrieved.
    • delete

      void delete(String id) throws ResourceException
      Deletes the ScimResource with the provided identifier (if it exists). This interface makes no distinction between hard and soft deletes but rather leaves that to the designer of the persistence layer.
      Parameters:
      id - The ScimResource's identifier.
      Throws:
      ResourceException - When the specified ScimResource cannot be deleted.
    • getExtensionList

      default List<Class<? extends ScimExtension>> getExtensionList() throws InvalidRepositoryException
      Returns a list of the SCIM Extensions that this repository considers to be associated with the ScimResource of type T.
      Returns:
      A list of ScimExtension classes.
      Throws:
      InvalidRepositoryException - If the repository cannot return the appropriate list.