Class ScimRequestBuilder

  • All Implemented Interfaces:
    AutoCloseable

    public class ScimRequestBuilder
    extends Object
    implements AutoCloseable
    author Pascal Knueppel
    created at: 07.12.2019 - 23:08

    this class can be used to build any type of request for SCIM
    • Constructor Detail

    • Method Detail

      • loadServiceProviderConfiguration

        public ServiceProvider loadServiceProviderConfiguration()
        tries to load the service provider configuration from the SCIM provider, but it will not cause any aborts if loading of the configuration does fail
      • create

        public <T extends ResourceNodeCreateBuilder<T> create​(Class<T> type,
                                                                String endpoint)
        builds a create builder class based on the given type
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a create-request builder for the given resource type
      • create

        public <T extends ResourceNodeCreateBuilder<T> create​(String fullyQualifiedUrl,
                                                                Class<T> type)
        builds a create builder class based on the given type
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a create-request builder for the given resource type
      • get

        public <T extends ResourceNodeGetBuilder<T> get​(Class<T> type,
                                                          String endpoint,
                                                          String resourceId)
        builds a get builder class based on the given type
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        resourceId - the id of the resource that should be returned (may be null if the endpoint path already contains the id)
        Returns:
        a get-request builder for the given resource type
      • get

        public <T extends ResourceNodeGetBuilder<T> get​(Class<T> type,
                                                          String endpoint)
        builds a get builder that is used to access a singleton resource from the provider
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a get-request builder for the given resource type
      • get

        public <T extends ResourceNodeGetBuilder<T> get​(String fullyQualifiedUrl,
                                                          Class<T> type)
        builds a get builder class based on the given type
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a get-request builder for the given resource type
      • delete

        public <T extends ResourceNodeDeleteBuilder<T> delete​(Class<T> type,
                                                                String endpoint,
                                                                String resourceId)
        builds a delete builder class based on the given type
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        resourceId - the id of the resource that should be returned (may be null if the endpoint path already contains the id)
        Returns:
        a delete-request builder for the given resource type
      • delete

        public <T extends ResourceNodeDeleteBuilder<T> delete​(Class<T> type,
                                                                String endpoint)
        builds a delete builder class based on the given type used to delete a singleton entry at the provider
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a delete-request builder for the given resource type
      • delete

        public <T extends ResourceNodeDeleteBuilder<T> delete​(String fullyQualifiedUrl,
                                                                Class<T> type)
        builds a delete builder class based on the given type
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a delete-request builder for the given resource type
      • update

        public <T extends ResourceNodeUpdateBuilder<T> update​(Class<T> type,
                                                                String endpoint,
                                                                String resourceId)
        builds an update builder class based on the given type
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        resourceId - the id of the resource that should be returned (may be null if the endpoint path already contains the id)
        Returns:
        a update-request builder for the given resource type
      • update

        public <T extends ResourceNodeUpdateBuilder<T> update​(Class<T> type,
                                                                String endpoint)
        builds an update builder class used to update a singleton entry at the provider
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a update-request builder for the given resource type
      • update

        public <T extends ResourceNodeUpdateBuilder<T> update​(String fullyQualifiedUrl,
                                                                Class<T> type)
        builds an update builder class based on the given type
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a update-request builder for the given resource type
      • list

        public <T extends ResourceNodeListBuilder<T> list​(Class<T> type,
                                                            String endpoint)
        builds an update builder class based on the given type
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a update-request builder for the given resource type
      • list

        public <T extends ResourceNodeListBuilder<T> list​(String fullyQualifiedUrl,
                                                            Class<T> type)
        builds an update builder class based on the given type
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a update-request builder for the given resource type
      • bulk

        public BulkBuilder bulk()
        builds an bulk request builder
        Returns:
        a bulk-request builder
      • bulk

        public BulkBuilder bulk​(String fullyQualifiedUrl)
        builds an bulk request builder
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        Returns:
        a bulk-request builder
      • patch

        public <T extends ResourceNodePatchBuilder<T> patch​(Class<T> type,
                                                              String endpoint,
                                                              String resourceId)
        builds a patch request builder
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        resourceId - the id of the resource that should be returned (may be null if the endpoint path already contains the id)
        Returns:
        a patch-request builder
      • patch

        public <T extends ResourceNodePatchBuilder<T> patch​(Class<T> type,
                                                              String endpoint)
        builds a patch request builder used to patch a singleton entry at the provider
        Parameters:
        type - the type that should be created
        endpoint - the endpoint path to the resource e.g. "/Users" or "/Groups"
        Returns:
        a patch-request builder
      • patch

        public <T extends ResourceNodePatchBuilder<T> patch​(String fullyQualifiedUrl,
                                                              Class<T> type)
        builds a patch request builder
        Parameters:
        fullyQualifiedUrl - if the builder should not build the url on the baseUrl but use another fully qualified url
        type - the type that should be created
        Returns:
        a patch-request builder
      • close

        public void close()
        closes the underlying apache http client. If the http client is closed this request builder is still usable. The next request will simply be executed with a new http client instance
        Specified by:
        close in interface AutoCloseable
      • getScimClientConfig

        public ScimClientConfig getScimClientConfig()
        the configuration for the client that should be used
      • getScimHttpClient

        protected ScimHttpClient getScimHttpClient()
        a convenience implementation that wraps the apache http client
      • getServiceProvider

        public ServiceProvider getServiceProvider()
        the service provider configuration from the SCIM provider application
      • setServiceProvider

        public void setServiceProvider​(ServiceProvider serviceProvider)
        the service provider configuration from the SCIM provider application