Package com.priint.pubserver.util
Class TableUtils
java.lang.Object
com.priint.pubserver.util.TableUtils
Utility functions centered around finding information about tables given template or placeholder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass used as return type from some functions fromTableUtils.
It contains the original placeholder and most important information about the table.static final classException thrown by thisTableUtils. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandoesTemplateHaveTablePlaceholders(String tenant, String project, int templateId) Finds all placeholders in all templates of the smart template described by thetemplateIdand checks if it has any table placeholder.static Optional<Placeholder>getPlaceholder(int templateId, int placeholderId) Finds the placeholder that is described by thetemplateIdand theplaceholderIdand returns it.static List<Placeholder>getPlaceholders(int templateId) Returns list of all placeholders that are in the template described by thetemplateId.getPlaceholderUID(int templateId, int placeholderId) Finds the placeholder that is described by thetemplateIdand theplaceholderIdand extracts the UID from it.getPlaceholderUID(Placeholder placeholder) Extracts the UID from the given placeholder.static Optional<TableUtils.TablePlaceholder>getTablePlaceholderOfPlaceholder(String tenant, String project, int templateId, int placeholderId) Finds the placeholder that is described by thetemplateIdand theplaceholderId.
Then looks for information about its table in thetenant, theprojectand uses it to create tablePlaceholder.static List<TableUtils.TablePlaceholder>getTablePlaceholdersOfTemplate(String tenant, String project, int templateId) Finds all placeholders in all templates of the smart template described by and thetemplateId.
Then looks for information about their tables in thetenant, theproject.
-
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 thetemplateIdand theplaceholderId.
Then looks for information about its table in thetenant, theprojectand uses it to create tablePlaceholder.- Parameters:
tenant-project-templateId-placeholderId-- Returns:
- tablePlaceholder or
Optional.emptyif 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 thetemplateId.
Then looks for information about their tables in thetenant, theproject.- 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 thetemplateIdand checks if it has any table placeholder.- Parameters:
tenant-project-templateId-- Returns:
trueif 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 thetemplateIdand theplaceholderIdand returns it.- Parameters:
templateId-placeholderId-- Returns:
- placeholder or
Optional.emptyif 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 thetemplateId.- 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 thetemplateIdand theplaceholderIdand extracts the UID from it.- Parameters:
templateId-placeholderId-- Returns:
- placeholderUId or
Optional.empty()if it was not found - Throws:
TableUtils.TableUtilsException
-
getPlaceholderUID
Extracts the UID from the given placeholder.- Parameters:
placeholder-- Returns:
- UID or
Optional.empty()if it was not found
-