Interface HApiUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final booleanstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptioncollectionFromPath(ResourceResolver resolver, String collectionPath) Get aHApiTypesCollectionobject from a path String.collectionFromResource(ResourceResolver resolver, Resource collectionResource) Get aHApiTypesCollectionobject from aResource.fromNode(ResourceResolver resolver, Node typeNode) Deprecated.fromPath(ResourceResolver resolver, String type) Get a HApi type object from a type identifier.fromResource(ResourceResolver resolver, Resource typeResource) Get a HApi type object from theResource.getHelper(ResourceResolver resolver, String type) Get a new instance of AttributeHelper for the type identified by 'type'getTypeCollectionResource(ResourceResolver resolver, String collection) Get a HApi type collection Resource from a collection identifier.getTypeNode(ResourceResolver resolver, String type) Deprecated.getTypeResource(ResourceResolver resolver, String type) Get a HApi type Resource from a type identifier.
-
Field Details
-
DEFAULT_RESOURCE_TYPE
- See Also:
-
RESOURCE_TYPE
- See Also:
-
RESOURCE_TYPE_DESC
- See Also:
-
DEFAULT_COLLECTION_RESOURCE_TYPE
- See Also:
-
COLLECTION_RESOURCE_TYPE
- See Also:
-
COLLECTION_RESOURCE_TYPE_DESC
- See Also:
-
DEFAULT_SEARCH_PATH
- See Also:
-
SEARCH_PATHS
- See Also:
-
SEARCH_PATHS_DESC
- See Also:
-
DEFAULT_SERVER_URL
- See Also:
-
EXTERNAL_URL
- See Also:
-
EXTERNAL_URL_DESC
- See Also:
-
DEFAULT_ENABLED
static final boolean DEFAULT_ENABLED- See Also:
-
ENABLED
- See Also:
-
ENABLED_DESC
- See Also:
-
-
Method Details
-
getTypeNode
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 config and the sling:resourceType should be set to the value defined by the 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
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 config and the sling:resourceType should be set to the value defined by the 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 config and the sling:resourceType should be set to the value defined by the 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
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.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
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.- 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
-