Package org.forgerock.opendj.rest2ldap
Class Resource
java.lang.Object
org.forgerock.opendj.rest2ldap.Resource
Defines the characteristics of a resource, including its properties, inheritance, and sub-resources.
In particular, a resource defines how LDAP entries map to JSON. To that end, it describes:
- a "schema" of the JSON object it represents, including inheritance and its properties
- a mapping to the equivalent LDAP objectClasses
- a mapping of the JSON properties to the LDAP attribute names in the objectClass, and a set of constraints for each properties that must match the LDAP schema
- CREST sub paths that are accessible under this resource, and which resources they represent. These are specified as sub-resources.
-
Method Summary
Modifier and TypeMethodDescriptionallowedAuxiliaryTypes
(String... resourceIds) Specifies the resource IDs of any auxiliary resources which are allowed to be combined, or "mixed in", with this resource.allowedAuxiliaryTypes
(Collection<String> resourceIds) Specifies the resource IDs of any auxiliary resources which are allowed to be combined, or "mixed in", with this resource.void
description
(LocalizableMessage description) Sets the description of this resource.boolean
Returnstrue
if the provided parameter is aResource
having the same resource ID as this resource.excludedDefaultUserAttributes
(String... attributeNames) Specifies zero or more user attributes which will be excluded from the default user attribute mappings when enabled usingincludeAllUserAttributesByDefault(boolean)
.excludedDefaultUserAttributes
(Collection<String> attributeNames) Specifies zero or more user attributes which will be excluded from the default user attribute mappings when enabled usingincludeAllUserAttributesByDefault(boolean)
.int
hashCode()
includeAllUserAttributesByDefault
(boolean include) Specifies whether all LDAP user attributes should be mapped by default using the default schema based mapping rules.isAbstract
(boolean isAbstract) Specifies whether this resource is an abstract type and therefore cannot be created.objectClass
(String objectClass) Specifies an LDAP object class which is to be associated with this resource.objectClasses
(String... objectClasses) Specifies LDAP object classes which are to be associated with this resource.property
(String name, PropertyMapper mapper) Specifies a mapping for a property contained in this JSON resource.subResource
(SubResource subResource) Specifies a parent-child relationship with another resource.subResources
(SubResource... subResources) Specifies a parent-child relationship with zero or more resources.Specifies the resource ID of the resource which is a super-type of this resource.supportedAction
(Action action) Registers an action which should be supported by this resource.supportedActions
(Action... actions) Registers zero or more actions which should be supported by this resource.toString()
Returns the resource ID of this resource.
-
Method Details
-
description
Sets the description of this resource.- Parameters:
description
- the description of this resource
-
toString
Returns the resource ID of this resource. -
equals
Returnstrue
if the provided parameter is aResource
having the same resource ID as this resource. -
hashCode
public int hashCode() -
superType
Specifies the resource ID of the resource which is a super-type of this resource. This resource will inherit the properties and sub-resources of the super-type, and may optionally override them.- Parameters:
resourceId
- The resource ID of the resource which is a super-type of this resource, ornull
if there is no super-type.- Returns:
- A reference to this object.
-
allowedAuxiliaryTypes
Specifies the resource IDs of any auxiliary resources which are allowed to be combined, or "mixed in", with this resource. This mechanism is equivalent to multiple inheritance and is implemented in LDAP through the use of auxiliary object classes. Auxiliary resource types can be added to and removed from resources after creation using update and patch operations. The properties of an auxiliary resource will be merged with the properties of the resource and the auxiliary resource ID will be listed in the auxiliary resource type property.- Parameters:
resourceIds
- The resource IDs of the auxiliary resources which may be combined with this resource.- Returns:
- A reference to this object.
-
allowedAuxiliaryTypes
Specifies the resource IDs of any auxiliary resources which are allowed to be combined, or "mixed in", with this resource. This mechanism is equivalent to multiple inheritance and is implemented in LDAP through the use of auxiliary object classes. Auxiliary resource types can be added to and removed from resources after creation using update and patch operations. The properties of an auxiliary resource will be merged with the properties of the resource and the auxiliary resource ID will be listed in the auxiliary resource type property.- Parameters:
resourceIds
- The resource IDs of the auxiliary resources which may be combined with this resource.- Returns:
- A reference to this object.
-
isAbstract
Specifies whether this resource is an abstract type and therefore cannot be created. Only non-abstract sub-types can be created.- Parameters:
isAbstract
-true
if this resource is abstract.- Returns:
- A reference to this object.
-
property
Specifies a mapping for a property contained in this JSON resource. Properties are inherited and sub-types may override them. Properties are optional: a resource that does not have any properties cannot be created, read, or modified, and may only be used for accessing sub-resources. These resources usually represent API "endpoints".- Parameters:
name
- The name of the JSON property to be mapped.mapper
- The property mapper responsible for mapping the JSON property to LDAP attribute(s).- Returns:
- A reference to this object.
-
includeAllUserAttributesByDefault
Specifies whether all LDAP user attributes should be mapped by default using the default schema based mapping rules. Individual attributes can be excluded usingexcludedDefaultUserAttributes(java.lang.String...)
in order to prevent attributes with explicit mappings being mapped twice.- Parameters:
include
-true
if all LDAP user attributes be mapped by default.- Returns:
- A reference to this object.
-
excludedDefaultUserAttributes
Specifies zero or more user attributes which will be excluded from the default user attribute mappings when enabled usingincludeAllUserAttributesByDefault(boolean)
. Attributes which have explicit mappings should be excluded in order to prevent duplication.- Parameters:
attributeNames
- The list of attributes to be excluded.- Returns:
- A reference to this object.
-
excludedDefaultUserAttributes
Specifies zero or more user attributes which will be excluded from the default user attribute mappings when enabled usingincludeAllUserAttributesByDefault(boolean)
. Attributes which have explicit mappings should be excluded in order to prevent duplication.- Parameters:
attributeNames
- The list of attributes to be excluded.- Returns:
- A reference to this object.
-
objectClass
Specifies an LDAP object class which is to be associated with this resource. Multiple object classes may be specified. The object classes are used for determining the type of resource being accessed during all requests other than create. Object classes are inherited by sub-types and must be defined for any resources that are non-abstract and which can be created.- Parameters:
objectClass
- An LDAP object class associated with this resource's LDAP representation.- Returns:
- A reference to this object.
-
objectClasses
Specifies LDAP object classes which are to be associated with this resource. Multiple object classes may be specified. The object classes are used for determining the type of resource being accessed during all requests other than create. Object classes are inherited by sub-types and must be defined for any resources that are non-abstract and which can be created.- Parameters:
objectClasses
- The LDAP object classes associated with this resource's LDAP representation.- Returns:
- A reference to this object.
-
supportedAction
Registers an action which should be supported by this resource. By default, no actions are supported.- Parameters:
action
- The action supported by this resource.- Returns:
- A reference to this object.
-
supportedActions
Registers zero or more actions which should be supported by this resource. By default, no actions are supported.- Parameters:
actions
- The actions supported by this resource.- Returns:
- A reference to this object.
-
subResource
Specifies a parent-child relationship with another resource. Sub-resources are inherited by sub-types and may be overridden.- Parameters:
subResource
- The sub-resource definition.- Returns:
- A reference to this object.
-
subResources
Specifies a parent-child relationship with zero or more resources. Sub-resources are inherited by sub-types and may be overridden.- Parameters:
subResources
- The sub-resource definitions.- Returns:
- A reference to this object.
-