Interface HApiUtil
-
@ProviderType public interface HApiUtil
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COLLECTION_RESOURCE_TYPE
static java.lang.String
COLLECTION_RESOURCE_TYPE_DESC
static java.lang.String
DEFAULT_COLLECTION_RESOURCE_TYPE
static boolean
DEFAULT_ENABLED
static java.lang.String
DEFAULT_RESOURCE_TYPE
static java.lang.String
DEFAULT_SEARCH_PATH
static java.lang.String
DEFAULT_SERVER_URL
static java.lang.String
ENABLED
static java.lang.String
ENABLED_DESC
static java.lang.String
EXTERNAL_URL
static java.lang.String
EXTERNAL_URL_DESC
static java.lang.String
RESOURCE_TYPE
static java.lang.String
RESOURCE_TYPE_DESC
static java.lang.String
SEARCH_PATHS
static java.lang.String
SEARCH_PATHS_DESC
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description HApiTypesCollection
collectionFromPath(ResourceResolver resolver, java.lang.String collectionPath)
Get aHApiTypesCollection
object from a path String.HApiTypesCollection
collectionFromResource(ResourceResolver resolver, Resource collectionResource)
Get aHApiTypesCollection
object from aResource
.HApiType
fromNode(ResourceResolver resolver, Node typeNode)
Deprecated.HApiType
fromPath(ResourceResolver resolver, java.lang.String type)
Get a HApi type object from a type identifier.HApiType
fromResource(ResourceResolver resolver, Resource typeResource)
Get a HApi type object from theResource
.MicrodataAttributeHelper
getHelper(ResourceResolver resolver, java.lang.String type)
Get a new instance of AttributeHelper for the type identified by 'type'Resource
getTypeCollectionResource(ResourceResolver resolver, java.lang.String collection)
Get a HApi type collection Resource from a collection identifier.Node
getTypeNode(ResourceResolver resolver, java.lang.String type)
Deprecated.Resource
getTypeResource(ResourceResolver resolver, java.lang.String type)
Get a HApi type Resource from a type identifier.
-
-
-
Field Detail
-
DEFAULT_RESOURCE_TYPE
static final java.lang.String DEFAULT_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
RESOURCE_TYPE
static final java.lang.String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
RESOURCE_TYPE_DESC
static final java.lang.String RESOURCE_TYPE_DESC
- See Also:
- Constant Field Values
-
DEFAULT_COLLECTION_RESOURCE_TYPE
static final java.lang.String DEFAULT_COLLECTION_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
COLLECTION_RESOURCE_TYPE
static final java.lang.String COLLECTION_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
COLLECTION_RESOURCE_TYPE_DESC
static final java.lang.String COLLECTION_RESOURCE_TYPE_DESC
- See Also:
- Constant Field Values
-
DEFAULT_SEARCH_PATH
static final java.lang.String DEFAULT_SEARCH_PATH
- See Also:
- Constant Field Values
-
SEARCH_PATHS
static final java.lang.String SEARCH_PATHS
- See Also:
- Constant Field Values
-
SEARCH_PATHS_DESC
static final java.lang.String SEARCH_PATHS_DESC
- See Also:
- Constant Field Values
-
DEFAULT_SERVER_URL
static final java.lang.String DEFAULT_SERVER_URL
- See Also:
- Constant Field Values
-
EXTERNAL_URL
static final java.lang.String EXTERNAL_URL
- See Also:
- Constant Field Values
-
EXTERNAL_URL_DESC
static final java.lang.String EXTERNAL_URL_DESC
- See Also:
- Constant Field Values
-
DEFAULT_ENABLED
static final boolean DEFAULT_ENABLED
- See Also:
- Constant Field Values
-
ENABLED
static final java.lang.String ENABLED
- See Also:
- Constant Field Values
-
ENABLED_DESC
static final java.lang.String ENABLED_DESC
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeNode
@Deprecated Node getTypeNode(ResourceResolver resolver, java.lang.String type) throws RepositoryException
Deprecated.Get a HApi type jcr node from a type identifier.
The JCR node must be [nt:unstructured], a descendant of any of the HAPi search path defined by the {@see HAPI_PATHS} config and the sling:resourceType should be set to the value defined by the {@see HAPI_RESOURCE_TYPE} config
The first result is returned
- Parameters:
resolver
- The sling resource resolver objecttype
- The type identifier, which is either in the form of a jcr path, same as the path for . If the path cannot be resolved, type is treated like a fully qualified domain name, which has to match the "fqdn" property on the JCR node which represents the type.- Returns:
- The first node that matches that type or null if none is found.
- Throws:
RepositoryException
-
getTypeResource
Resource getTypeResource(ResourceResolver resolver, java.lang.String type) throws RepositoryException
Get a HApi type Resource from a type identifier.
The Resource must be [nt:unstructured], a descendant of any of the HAPi search path defined by the {@see HAPI_PATHS} config and the sling:resourceType should be set to the value defined by the {@see HapiUtil#RESOURCE_TYPE} config
The first result is returned
- Parameters:
resolver
- The sling resource resolver objecttype
- The type identifier, which is either in the form of a jcr path, same as the path for . If the path cannot be resolved, type is treated like a fully qualified domain name, which has to match the "fqdn" property on the Resource which represents the type.- Returns:
- The first Resource that matches that type or null if none is found.
- Throws:
RepositoryException
-
getTypeCollectionResource
Resource getTypeCollectionResource(ResourceResolver resolver, java.lang.String collection) throws RepositoryException
Get a HApi type collection Resource from a collection identifier.
The Resource must be [nt:unstructured], a descendant of any of the HAPi search path defined by the {@see HAPI_PATHS} config and the sling:resourceType should be set to the value defined by the {@see HapiUtil#COLLECTION_RESOURCE_TYPE} config
The first result is returned
- Parameters:
resolver
- The sling resource resolver objectcollection
- The collection identifier, which is either in the form of a jcr path, same as the path for . If the path cannot be resolved, collection is treated like a fully qualified domain name, which has to match the "fqdn" property on the Resource which represents the type.- Returns:
- The first Resource that matches that collection or null if none is found.
- Throws:
RepositoryException
-
fromPath
HApiType fromPath(ResourceResolver resolver, java.lang.String type) throws RepositoryException
Get a HApi type object from a type identifier.
The type identifier is resolved to a
Node
and thenfromNode(org.apache.sling.api.resource.ResourceResolver, javax.jcr.Node)
is called.For restrictions on the
Node
seegetTypeNode(org.apache.sling.api.resource.ResourceResolver, String)
- Parameters:
resolver
- The sling resource resolver objecttype
- The type identifier, which is either in the form of a jcr path, same as the path for. If the path cannot be resolved, type is treated like a fully qualified domain name, which has to match the "fqdn" property on the JCR node which represents the type.- Returns:
- The HApiType resolved from the type identifier
- Throws:
RepositoryException
-
fromNode
@Deprecated HApiType fromNode(ResourceResolver resolver, Node typeNode) throws RepositoryException
Deprecated.Get a HApi type object from the
The Node has the following properties:Node
.- name: A 'Name' of the type (mandatory)
- description: A 'String' with the description text for this type (mandatory)
- fqdn: A 'String' with the fully qualified domain name; A namespace like a java package (mandatory)
- extends: A type identifier (either a path or a fqdn); (optional). This defines the parent type of this type
- parameter: A multivalue property to define a list of java-like generic types that can be used as types for properties; (optional)
The properties of this type are defined as children nodes.
The name of property node defines the name of the property for this type.
The children property nodes have the following properties:- type: The type identifier (mandatory). Can be of type 'Name' or 'Path'
See
getTypeNode(org.apache.sling.api.resource.ResourceResolver, String)
for the format of this value - description: A 'String' with the description for this property (mandatory)
- multiple: A 'Boolean' that defines whether this property can exist multiple times on an object of this type (optional)
- Parameters:
resolver
- The resource resolvertypeNode
- The jcr node of the HApi type- Returns:
- The HApiType
- Throws:
RepositoryException
-
fromResource
HApiType fromResource(ResourceResolver resolver, Resource typeResource) throws RepositoryException
Get a HApi type object from the
The Resource has the following properties:Resource
.- name: A 'Name' of the type (mandatory)
- description: A 'String' with the description text for this type (mandatory)
- fqdn: A 'String' with the fully qualified domain name; A namespace like a java package (mandatory)
- extends: A type identifier (either a path or a fqdn); (optional). This defines the parent type of this type
- parameter: A multivalue property to define a list of java-like generic types that can be used as types for properties; (optional)
The properties of this type are defined as children resources.
The name of property resource defines the name of the property for this type.
The children property nodes have the following properties:- type: The type identifier (mandatory). Can be of type 'Name' or 'Path'
See
getTypeNode(org.apache.sling.api.resource.ResourceResolver, String)
for the format of this value - description: A 'String' with the description for this property (mandatory)
- multiple: A 'Boolean' that defines whether this property can exist multiple times on an object of this type (optional)
- Parameters:
resolver
- The resource resolvertypeResource
- The sling Resource of the HApi type- Returns:
- The HApiType
- Throws:
RepositoryException
-
collectionFromResource
HApiTypesCollection collectionFromResource(ResourceResolver resolver, Resource collectionResource) throws RepositoryException
Get a
The Resource has the following properties:HApiTypesCollection
object from aResource
.- name: A 'Name' of the type collection (mandatory)
- description: A 'String' with the description text for this type collection (mandatory)
- fqdn: A 'String' with the fully qualified domain name; A namespace like a java package (mandatory)
The types collection will be populated with direct child Resources of the {{collectionResource}}, which have the resourceType equal to the value of the
RESOURCE_TYPE
property- Parameters:
resolver
- The resource resolvercollectionResource
- The sling Resource of the HApi type collection- Returns:
- The HApiTypesCollection
- Throws:
RepositoryException
-
collectionFromPath
HApiTypesCollection collectionFromPath(ResourceResolver resolver, java.lang.String collectionPath) throws RepositoryException
Get a
HApiTypesCollection
object from a path String.{@see HApiUtil#collectionFromResource}
- Parameters:
resolver
- The resource resolvercollectionPath
- The sling resource path of the HApi type collection- Returns:
- The HApiTypesCollection
- Throws:
RepositoryException
-
getHelper
MicrodataAttributeHelper getHelper(ResourceResolver resolver, java.lang.String type) throws RepositoryException
Get a new instance of AttributeHelper for the type identified by 'type'- Parameters:
resolver
-type
- SeegetTypeNode(org.apache.sling.api.resource.ResourceResolver, String)
for the format of the type identifier- Returns:
- Throws:
RepositoryException
-
-