Class TableUtils

java.lang.Object
com.priint.pubserver.util.TableUtils

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

    • getTablePlaceholderOfPlaceholder

      public static Optional<TableUtils.TablePlaceholder> getTablePlaceholderOfPlaceholder(String tenant, 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 List<TableUtils.TablePlaceholder> getTablePlaceholdersOfTemplate(String tenant, 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(String tenant, 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 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 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 Optional<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 Optional<String> getPlaceholderUID(Placeholder placeholder)
      Extracts the UID from the given placeholder.
      Parameters:
      placeholder -
      Returns:
      UID or Optional.empty() if it was not found