Class InMemoryUserService

java.lang.Object
org.apache.directory.scim.example.quarkus.service.InMemoryUserService
All Implemented Interfaces:
Repository<ScimUser>

@Named @ApplicationScoped public class InMemoryUserService extends Object implements Repository<ScimUser>
Creates a singleton (effectively) Repository with a memory-based persistence layer.
Author:
Chris Harm <crh5255@psu.edu>
  • Constructor Details

    • InMemoryUserService

      @Inject public InMemoryUserService(SchemaRegistry schemaRegistry, PatchHandler patchHandler)
    • InMemoryUserService

      protected InMemoryUserService()
  • Method Details

    • init

      @PostConstruct public void init()
    • getResourceClass

      public Class<ScimUser> getResourceClass()
      Description copied from interface: Repository
      Returns the type of ScimResource this repository manages.
      Specified by:
      getResourceClass in interface Repository<ScimUser>
      Returns:
      The type of resource this repository manages.
    • create

      public ScimUser create(ScimUser resource) throws UnableToCreateResourceException
      Description copied from interface: Repository
      Allows the SCIM server's REST implementation to create a resource via a POST to a valid end-point.
      Specified by:
      create in interface Repository<ScimUser>
      Parameters:
      resource - The ScimResource to create and persist.
      Returns:
      The newly created ScimResource.
      Throws:
      UnableToCreateResourceException
      See Also:
    • update

      public ScimUser update(String id, String version, ScimUser resource, Set<AttributeReference> includedAttributeReferences, Set<AttributeReference> excludedAttributeReferences) throws ResourceException
      Description copied from interface: Repository
      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.
      Specified by:
      update in interface Repository<ScimUser>
      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
      includedAttributeReferences - optional set of attributes to include from ScimResource, may be used to optimize queries.
      excludedAttributeReferences - 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

      public ScimUser patch(String id, String version, List<PatchOperation> patchOperations, Set<AttributeReference> includedAttributeReferences, Set<AttributeReference> excludedAttributeReferences) throws ResourceException
      Description copied from interface: Repository
      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.
      Specified by:
      patch in interface Repository<ScimUser>
      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.
      includedAttributeReferences - optional set of attributes to include from ScimResource, may be used to optimize queries.
      excludedAttributeReferences - 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

      public ScimUser get(String id)
      Description copied from interface: Repository
      Retrieves the ScimResource associated with the provided identifier.
      Specified by:
      get in interface Repository<ScimUser>
      Parameters:
      id - The identifier of the target ScimResource.
      Returns:
      The requested ScimResource.
      See Also:
    • delete

      public void delete(String id)
      Description copied from interface: Repository
      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.
      Specified by:
      delete in interface Repository<ScimUser>
      Parameters:
      id - The ScimResource's identifier.
      See Also:
    • find

      public FilterResponse<ScimUser> find(Filter filter, PageRequest pageRequest, SortRequest sortRequest)
      Description copied from interface: Repository
      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.
      Specified by:
      find in interface Repository<ScimUser>
      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.
      See Also:
    • getExtensionList

      public List<Class<? extends ScimExtension>> getExtensionList()
      Description copied from interface: Repository
      Returns a list of the SCIM Extensions that this repository considers to be associated with the ScimResource of type T.
      Specified by:
      getExtensionList in interface Repository<ScimUser>
      Returns:
      A list of ScimExtension classes.
      See Also: