Interface HApiUtil


@ProviderType public interface HApiUtil
  • Field Details

  • Method Details

    • 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 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 object
      type - 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 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 object
      type - 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 object
      collection - 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 Node and then fromNode(org.apache.sling.api.resource.ResourceResolver, javax.jcr.Node) is called.

      For restrictions on the Node see getTypeNode(org.apache.sling.api.resource.ResourceResolver, String)

      Parameters:
      resolver - The sling resource resolver object
      type - 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 Node.

      The Node has the following properties:
      • 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 resolver
      typeNode - 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 Resource.

      The Resource has the following properties:
      • 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 resolver
      typeResource - The sling Resource of the HApi type
      Returns:
      The HApiType
      Throws:
      RepositoryException
    • collectionFromResource

      HApiTypesCollection collectionFromResource(ResourceResolver resolver, Resource collectionResource) throws RepositoryException

      Get a HApiTypesCollection object from a Resource.

      The Resource has the following properties:
      • 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 resolver
      collectionResource - The sling Resource of the HApi type collection
      Returns:
      The HApiTypesCollection
      Throws:
      RepositoryException
    • collectionFromPath

      HApiTypesCollection collectionFromPath(ResourceResolver resolver, String collectionPath) throws RepositoryException

      Get a HApiTypesCollection object from a path String.

      Parameters:
      resolver - The resource resolver
      collectionPath - The sling resource path of the HApi type collection
      Returns:
      The HApiTypesCollection
      Throws:
      RepositoryException
    • getHelper

      Get a new instance of AttributeHelper for the type identified by 'type'
      Parameters:
      resolver -
      type - See getTypeNode(org.apache.sling.api.resource.ResourceResolver, String) for the format of the type identifier
      Returns:
      Throws:
      RepositoryException