Interface HApiUtil
-
@ProviderType public interface HApiUtil
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOLLECTION_RESOURCE_TYPEstatic StringCOLLECTION_RESOURCE_TYPE_DESCstatic StringDEFAULT_COLLECTION_RESOURCE_TYPEstatic booleanDEFAULT_ENABLEDstatic StringDEFAULT_RESOURCE_TYPEstatic StringDEFAULT_SEARCH_PATHstatic StringDEFAULT_SERVER_URLstatic StringENABLEDstatic StringENABLED_DESCstatic StringEXTERNAL_URLstatic StringEXTERNAL_URL_DESCstatic StringRESOURCE_TYPEstatic StringRESOURCE_TYPE_DESCstatic StringSEARCH_PATHSstatic StringSEARCH_PATHS_DESC
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description HApiTypesCollectioncollectionFromPath(ResourceResolver resolver, String collectionPath)Get aHApiTypesCollectionobject from a path String.HApiTypesCollectioncollectionFromResource(ResourceResolver resolver, Resource collectionResource)Get aHApiTypesCollectionobject from aResource.HApiTypefromNode(ResourceResolver resolver, Node typeNode)Deprecated.HApiTypefromPath(ResourceResolver resolver, String type)Get a HApi type object from a type identifier.HApiTypefromResource(ResourceResolver resolver, Resource typeResource)Get a HApi type object from theResource.MicrodataAttributeHelpergetHelper(ResourceResolver resolver, String type)Get a new instance of AttributeHelper for the type identified by 'type'ResourcegetTypeCollectionResource(ResourceResolver resolver, String collection)Get a HApi type collection Resource from a collection identifier.NodegetTypeNode(ResourceResolver resolver, String type)Deprecated.ResourcegetTypeResource(ResourceResolver resolver, String type)Get a HApi type Resource from a type identifier.
-
-
-
Field Detail
-
DEFAULT_RESOURCE_TYPE
static final String DEFAULT_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
RESOURCE_TYPE
static final String RESOURCE_TYPE
- See Also:
- Constant Field Values
-
RESOURCE_TYPE_DESC
static final String RESOURCE_TYPE_DESC
- See Also:
- Constant Field Values
-
DEFAULT_COLLECTION_RESOURCE_TYPE
static final String DEFAULT_COLLECTION_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
COLLECTION_RESOURCE_TYPE
static final String COLLECTION_RESOURCE_TYPE
- See Also:
- Constant Field Values
-
COLLECTION_RESOURCE_TYPE_DESC
static final String COLLECTION_RESOURCE_TYPE_DESC
- See Also:
- Constant Field Values
-
DEFAULT_SEARCH_PATH
static final String DEFAULT_SEARCH_PATH
- See Also:
- Constant Field Values
-
SEARCH_PATHS
static final String SEARCH_PATHS
- See Also:
- Constant Field Values
-
SEARCH_PATHS_DESC
static final String SEARCH_PATHS_DESC
- See Also:
- Constant Field Values
-
DEFAULT_SERVER_URL
static final String DEFAULT_SERVER_URL
- See Also:
- Constant Field Values
-
EXTERNAL_URL
static final String EXTERNAL_URL
- See Also:
- Constant Field Values
-
EXTERNAL_URL_DESC
static final String EXTERNAL_URL_DESC
- See Also:
- Constant Field Values
-
DEFAULT_ENABLED
static final boolean DEFAULT_ENABLED
- See Also:
- Constant Field Values
-
ENABLED
static final String ENABLED
- See Also:
- Constant Field Values
-
ENABLED_DESC
static final String ENABLED_DESC
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTypeNode
@Deprecated Node getTypeNode(ResourceResolver resolver, 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, 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, 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, String type) throws RepositoryException
Get a HApi type object from a type identifier.
The type identifier is resolved to a
Nodeand thenfromNode(org.apache.sling.api.resource.ResourceResolver, javax.jcr.Node)is called.For restrictions on the
NodeseegetTypeNode(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:HApiTypesCollectionobject 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_TYPEproperty- Parameters:
resolver- The resource resolvercollectionResource- The sling Resource of the HApi type collection- Returns:
- The HApiTypesCollection
- Throws:
RepositoryException
-
collectionFromPath
HApiTypesCollection collectionFromPath(ResourceResolver resolver, String collectionPath) throws RepositoryException
Get a
HApiTypesCollectionobject 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, 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
-
-