Class ResourceHandler<T extends ResourceNode>
- java.lang.Object
-
- de.captaingoldfish.scim.sdk.server.endpoints.ResourceHandler<T>
-
- Direct Known Subclasses:
ResourceTypeHandler,SchemaHandler,ServiceProviderHandler
public abstract class ResourceHandler<T extends ResourceNode> extends Object
author Pascal Knueppel
created at: 07.10.2019 - 23:17
this abstract class is the base for the developer to implement
-
-
Constructor Summary
Constructors Constructor Description ResourceHandler()default constructor that resolves the generic type for this class
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract TcreateResource(T resource, Authorization authorization)permanently create a resourceabstract voiddeleteResource(String id, Authorization authorization)permanently deletes the resource with the given idabstract TgetResource(String id, Authorization authorization)extract a resource by its idabstract PartialListResponse<T>listResources(long startIndex, int count, FilterNode filter, SchemaAttribute sortBy, SortOrder sortOrder, List<SchemaAttribute> attributes, List<SchemaAttribute> excludedAttributes, Authorization authorization)queries several resources based on the following valuesabstract TupdateResource(T resourceToUpdate, Authorization authorization)should update an existing resource with the given one.
-
-
-
Method Detail
-
createResource
public abstract T createResource(T resource, Authorization authorization)
permanently create a resource- Parameters:
resource- the resource to storeauthorization- should return the roles of an user and may contain arbitrary data needed in the handler implementation- Returns:
- the stored resource with additional meta information as id, created, lastModified timestamps etc.
-
getResource
public abstract T getResource(String id, Authorization authorization)
extract a resource by its id- Parameters:
id- the id of the resource to returnauthorization- should return the roles of an user and may contain arbitrary data needed in the handler implementation- Returns:
- the found resource
-
listResources
public abstract PartialListResponse<T> listResources(long startIndex, int count, FilterNode filter, SchemaAttribute sortBy, SortOrder sortOrder, List<SchemaAttribute> attributes, List<SchemaAttribute> excludedAttributes, Authorization authorization)
queries several resources based on the following values- Parameters:
startIndex- the start index that has a minimum value of 1. So the given startIndex here will never be lower than 1count- the number of entries that should be returned to the client. The minimum value of this value is 0.filter- the parsed filter expression if the client has given a filtersortBy- the attribute value that should be used for sortingsortOrder- the sort orderattributes- the attributes that should be returned to the client. If the client send this parameter the evaluation of these parameters might help to improve database performance by omitting unnecessary table joinsexcludedAttributes- the attributes that should NOT be returned to the client. If the client send this parameter the evaluation of these parameters might help to improve database performance by omitting unnecessary table joinsauthorization- should return the roles of an user and may contain arbitrary data needed in the handler implementation- Returns:
- a list of several resources and a total results value. You may choose to leave the totalResults value blank but this might lead to erroneous results on the client side
-
updateResource
public abstract T updateResource(T resourceToUpdate, Authorization authorization)
should update an existing resource with the given one. Simply use the id of the given resource and override the existing one with the given one. Be careful there have been no checks in advance for you if the resource to update does exist. This has to be done manually.
NOTE:
this method is also called by patch. But in the case of patch the check if the resource does exist will have been executed and the given resource is the already updated resource.- Parameters:
resourceToUpdate- the resource that should override an existing oneauthorization- should return the roles of an user and may contain arbitrary data needed in the handler implementation- Returns:
- the updated resource with the values changed and a new lastModified value
-
deleteResource
public abstract void deleteResource(String id, Authorization authorization)
permanently deletes the resource with the given id- Parameters:
id- the id of the resource to deleteauthorization- should return the roles of an user and may contain arbitrary data needed in the handler implementation
-
-