Class ResourceTypeFactory
java.lang.Object
de.captaingoldfish.scim.sdk.server.schemas.ResourceTypeFactory
author Pascal Knueppel
created at: 03.10.2019 - 23:11
this class is used to register and get resource types. With this utility class the SCIM endpoints can be extended by additional resource types, resource schemata and resource extensions
created at: 03.10.2019 - 23:11
this class is used to register and get resource types. With this utility class the SCIM endpoints can be extended by additional resource types, resource schemata and resource extensions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetResourceType(String endpoint) tries to get a resource type by the endpoint path under which it is accessiblegetResourceTypeByName(String name) gets a resource type by its name valueprotected Map<String,ResourceType> the resource type registry.
The key will be the uri to the resource schema that represents the resource type.this instance is hold in order for unit tests to be able to write tests without polluting the whole application context which might lead to unpredictable unit test errorsprotected booleanisResourceRegistered(String resourceName) checks if a resource type with the given name does existregisterResourceType(ResourceHandler resourceHandler, com.fasterxml.jackson.databind.JsonNode resourceType, com.fasterxml.jackson.databind.JsonNode resourceSchema, com.fasterxml.jackson.databind.JsonNode... resourceSchemaExtensions) this method will register a new resource typevoidregisterResourceType(ResourceHandler resourceHandler, String id, String name, String description, String schema, String endpoint, com.fasterxml.jackson.databind.JsonNode resourceSchema, com.fasterxml.jackson.databind.JsonNode... resourceSchemaExtensions) builds a json resource type object and callsregisterResourceType(ResourceHandler, JsonNode, JsonNode, JsonNode...)
-
Constructor Details
-
ResourceTypeFactory
public ResourceTypeFactory()will register the default resource types
-
-
Method Details
-
registerResourceType
public ResourceType registerResourceType(ResourceHandler resourceHandler, com.fasterxml.jackson.databind.JsonNode resourceType, com.fasterxml.jackson.databind.JsonNode resourceSchema, com.fasterxml.jackson.databind.JsonNode... resourceSchemaExtensions) this method will register a new resource type- Parameters:
resourceType- the resource type as json documentresourceSchema- the resource schema definition as json object this object will additionally be registered within theSchemaFactory. This is the resource that is referenced under the "schema" attribute within theresourceTypedocumentresourceSchemaExtensions- the extensions that will be appended to theresourceSchemadefinition
-
registerResourceType
public void registerResourceType(ResourceHandler resourceHandler, String id, String name, String description, String schema, String endpoint, com.fasterxml.jackson.databind.JsonNode resourceSchema, com.fasterxml.jackson.databind.JsonNode... resourceSchemaExtensions) builds a json resource type object and callsregisterResourceType(ResourceHandler, JsonNode, JsonNode, JsonNode...)- Parameters:
id- the id of the resource typename- the name of the resource typedescription- the description of the resource typeschema- the resource type schema that describes this resource typeendpoint- the endpoint under which this resource should be reachableresourceSchema- the resource schema definition as json object these object will also be registeredresourceSchemaExtensions- the extensions that will be appended to theresourceSchemadefinition
-
getResourceType
tries to get a resource type by the endpoint path under which it is accessible- Parameters:
endpoint- the endpoint of the resource type
-
isResourceRegistered
checks if a resource type with the given name does exist- Parameters:
resourceName- the name of the resource- Returns:
- true if a resource type with the given name was already registered, false else
-
getResourceTypeByName
gets a resource type by its name value- Parameters:
name- the name value of the given resource type- Returns:
- the resource type or an empty if no resource type with the given name exists
-
getAllResourceTypes
- Returns:
- returns all registered resource types
-
getResourceTypes
the resource type registry.
The key will be the uri to the resource schema that represents the resource type. Like this the resource type can be easier found if a request comes in -
getSchemaFactory
this instance is hold in order for unit tests to be able to write tests without polluting the whole application context which might lead to unpredictable unit test errors
-