Class ResourceTypeHelper


  • public class ResourceTypeHelper
    extends java.lang.Object
    This is to assist the UI with type-ahead on the ResourceTypes/ResourceSegments
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ResourceTypeHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getResourceID​(java.net.URL url)
      Parsing the ResourceID out of the URL.
      static java.lang.String getResourceType​(java.net.URL url)
      Parsing the ResourceType out of the URL.
      static java.lang.String[] getResourceTypes()
      Used by the InputFieldHint annotation for type-ahead.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResourceTypeHelper

        protected ResourceTypeHelper()
    • Method Detail

      • getResourceTypes

        public static java.lang.String[] getResourceTypes()
        Used by the InputFieldHint annotation for type-ahead.
      • getResourceType

        public static java.lang.String getResourceType​(java.net.URL url)
        Parsing the ResourceType out of the URL.

        Odd number of uri fragments, it's the last one, even number of uri fragments it's the penultimate one.

        • https://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs/ -> docs
        • https://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs/MyName -> docs

        Parameters:
        url - the URL endpoint
        Returns:
        the ResourceType
        See Also:
        CosmosAuthorizationHeaderFromUrl
      • getResourceID

        public static java.lang.String getResourceID​(java.net.URL url)
        Parsing the ResourceID out of the URL.

        odd number of uri fragments, then it's everything but the last one; even number of uri fragments it's all of them.

        • https://azuredb.microsoft.com/dbs/tempdb/colls -> dbs/tempdb
        • https://azuredb.microsoft.com/dbs/tempdb/colls/tempcoll/docs/MyName -> dbs/tempdb/colls/tempcoll/docs/MyName

        Parameters:
        url - the URL endpoint
        Returns:
        the ResourceID.
        See Also:
        CosmosAuthorizationHeaderFromUrl