Class TableUtils


  • public final class TableUtils
    extends java.lang.Object
    Utility functions centered around finding information about tables given template or placeholder.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean doesTemplateHaveTablePlaceholders​(java.lang.String tenant, java.lang.String project, int templateId)
      Finds all placeholders in all templates of the smart template described by the templateId and checks if it has any table placeholder.
      static java.util.Optional<Placeholder> getPlaceholder​(int templateId, int placeholderId)
      Finds the placeholder that is described by the templateId and the placeholderId and returns it.
      static java.util.List<Placeholder> getPlaceholders​(int templateId)
      Returns list of all placeholders that are in the template described by the templateId.
      static java.util.Optional<java.lang.String> getPlaceholderUID​(int templateId, int placeholderId)
      Finds the placeholder that is described by the templateId and the placeholderId and extracts the UID from it.
      static java.util.Optional<java.lang.String> getPlaceholderUID​(Placeholder placeholder)
      Extracts the UID from the given placeholder.
      static java.util.Optional<TableUtils.TablePlaceholder> getTablePlaceholderOfPlaceholder​(java.lang.String tenant, java.lang.String project, int templateId, int placeholderId)
      Finds the placeholder that is described by the templateId and the placeholderId.
      Then looks for information about its table in the tenant, the project and uses it to create tablePlaceholder.
      static java.util.List<TableUtils.TablePlaceholder> getTablePlaceholdersOfTemplate​(java.lang.String tenant, java.lang.String project, int templateId)
      Finds all placeholders in all templates of the smart template described by and the templateId.
      Then looks for information about their tables in the tenant, the project.
      • Methods inherited from class java.lang.Object

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

      • getTablePlaceholderOfPlaceholder

        public static java.util.Optional<TableUtils.TablePlaceholder> getTablePlaceholderOfPlaceholder​(java.lang.String tenant,
                                                                                                       java.lang.String project,
                                                                                                       int templateId,
                                                                                                       int placeholderId)
                                                                                                throws TableUtils.TableUtilsException
        Finds the placeholder that is described by the templateId and the placeholderId.
        Then looks for information about its table in the tenant, the project and uses it to create tablePlaceholder.
        Parameters:
        tenant -
        project -
        templateId -
        placeholderId -
        Returns:
        tablePlaceholder or Optional.empty if the placeholder was not found or it is not a table
        Throws:
        TableUtils.TableUtilsException
      • getTablePlaceholdersOfTemplate

        public static java.util.List<TableUtils.TablePlaceholder> getTablePlaceholdersOfTemplate​(java.lang.String tenant,
                                                                                                 java.lang.String project,
                                                                                                 int templateId)
                                                                                          throws TableUtils.TableUtilsException
        Finds all placeholders in all templates of the smart template described by and the templateId.
        Then looks for information about their tables in the tenant, the project.
        Parameters:
        tenant -
        project -
        templateId -
        Returns:
        tablePlaceholders - list of table placeholders for every placeholder that is a table
        Throws:
        TableUtils.TableUtilsException
      • doesTemplateHaveTablePlaceholders

        public static boolean doesTemplateHaveTablePlaceholders​(java.lang.String tenant,
                                                                java.lang.String project,
                                                                int templateId)
                                                         throws TableUtils.TableUtilsException
        Finds all placeholders in all templates of the smart template described by the templateId and checks if it has any table placeholder.
        Parameters:
        tenant -
        project -
        templateId -
        Returns:
        true if any of the placeholders in the template is a table
        Throws:
        TableUtils.TableUtilsException
      • getPlaceholder

        public static java.util.Optional<Placeholder> getPlaceholder​(int templateId,
                                                                     int placeholderId)
                                                              throws TableUtils.TableUtilsException
        Finds the placeholder that is described by the templateId and the placeholderId and returns it.
        Parameters:
        templateId -
        placeholderId -
        Returns:
        placeholder or Optional.empty if the placeholder was not found
        Throws:
        TableUtils.TableUtilsException
      • getPlaceholders

        public static java.util.List<Placeholder> getPlaceholders​(int templateId)
                                                           throws TableUtils.TableUtilsException
        Returns list of all placeholders that are in the template described by the templateId.
        Parameters:
        templateId -
        Returns:
        all placeholders from the template (if the template wasn't found, an empty list)
        Throws:
        TableUtils.TableUtilsException
      • getPlaceholderUID

        public static java.util.Optional<java.lang.String> getPlaceholderUID​(int templateId,
                                                                             int placeholderId)
                                                                      throws TableUtils.TableUtilsException
        Finds the placeholder that is described by the templateId and the placeholderId and extracts the UID from it.
        Parameters:
        templateId -
        placeholderId -
        Returns:
        placeholderUId or Optional.empty() if it was not found
        Throws:
        TableUtils.TableUtilsException
      • getPlaceholderUID

        public static java.util.Optional<java.lang.String> getPlaceholderUID​(Placeholder placeholder)
        Extracts the UID from the given placeholder.
        Parameters:
        placeholder -
        Returns:
        UID or Optional.empty() if it was not found