Class ResourceTypeFactory
- java.lang.Object
-
- de.captaingoldfish.scim.sdk.server.schemas.ResourceTypeFactory
-
public final class ResourceTypeFactory extends Object
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
-
-
Constructor Summary
Constructors Constructor Description ResourceTypeFactory()will register the default resource types
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<ResourceType>getAllResourceTypes()ResourceTypegetResourceType(String endpoint)tries to get a resource type by the endpoint path under which it is accessibleOptional<ResourceType>getResourceTypeByName(String name)gets a resource type by its name valueprotected booleanisResourceRegistered(String resourceName)checks if a resource type with the given name does existResourceTyperegisterResourceType(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...)
-
-
-
Method Detail
-
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
public ResourceType getResourceType(String endpoint)
tries to get a resource type by the endpoint path under which it is accessible- Parameters:
endpoint- the endpoint of the resource type
-
isResourceRegistered
protected boolean isResourceRegistered(String resourceName)
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
public Optional<ResourceType> getResourceTypeByName(String name)
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
public Collection<ResourceType> getAllResourceTypes()
- Returns:
- returns all registered resource types
-
-