Package com.priint.pubserver.util
Class TableUtils
- java.lang.Object
-
- com.priint.pubserver.util.TableUtils
-
public final class TableUtils extends java.lang.ObjectUtility functions centered around finding information about tables given template or placeholder.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTableUtils.TablePlaceholderClass used as return type from some functions fromTableUtils.
It contains the original placeholder and most important information about the table.static classTableUtils.TableUtilsExceptionException thrown by thisTableUtils.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleandoesTemplateHaveTablePlaceholders(java.lang.String tenant, java.lang.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 java.util.Optional<Placeholder>getPlaceholder(int templateId, int placeholderId)Finds the placeholder that is described by thetemplateIdand theplaceholderIdand returns it.static java.util.List<Placeholder>getPlaceholders(int templateId)Returns list of all placeholders that are in the template described by thetemplateId.static java.util.Optional<java.lang.String>getPlaceholderUID(int templateId, int placeholderId)Finds the placeholder that is described by thetemplateIdand theplaceholderIdand 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 thetemplateIdand theplaceholderId.
Then looks for information about its table in thetenant, theprojectand 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 thetemplateId.
Then looks for information about their tables in thetenant, theproject.
-
-
-
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 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 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 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(java.lang.String tenant, java.lang.String project, int templateId) throws TableUtils.TableUtilsExceptionFinds 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 java.util.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 java.util.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 java.util.Optional<java.lang.String> getPlaceholderUID(int templateId, int placeholderId) throws TableUtils.TableUtilsExceptionFinds 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
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
-
-