public class UpgradeUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
UpgradeUtils.ColumnMetaDataExtractor<T> |
Constructor and Description |
---|
UpgradeUtils(OfBizDelegator delegator) |
Modifier and Type | Method and Description |
---|---|
void |
clearColumn(String tableName,
String column) |
static void |
doColumnsOrTablesExist(List<TableColumnCheckResult> tableColumnCheckResults) |
static <T> Optional<T> |
getColumnInfo(String tableName,
String columnName,
UpgradeUtils.ColumnMetaDataExtractor<T> valueExtractor)
Returns the exact column name according to the database.
|
static String |
getColumnType(String tableName,
String columnName)
Returns the type of the column according to the database.
|
static String |
getExactColumnName(String tableName,
String columnName)
Returns the exact column name according to the database.
|
static String |
getExactTableName(String entityName) |
static int |
getJIRABuildVersionNumber()
This will return the current build version of JIRA present in the database.
|
static boolean |
tableExists(String tableName)
This method is used to verify if a named table exists or not within the database.
|
void |
transformTableColumn(String tableName,
String sourceColumn,
String targetColumn,
org.apache.commons.collections.Transformer transformer)
Transform a column in a table into another column on that same table.
|
public UpgradeUtils(OfBizDelegator delegator)
public void transformTableColumn(String tableName, String sourceColumn, String targetColumn, org.apache.commons.collections.Transformer transformer)
tableName
- name of table @NonnullsourceColumn
- name of source column @NonnulltargetColumn
- name of target columns @Nonnulltransformer
- the transformer used to transform the columnpublic static boolean tableExists(String tableName) throws DataAccessException
tableName
- is the name of the table to look for.DataAccessException
- If there is an error getting a DB connection, or getting the DB meta data@Nullable public static String getExactColumnName(String tableName, String columnName)
tableName
- Table namecolumnName
- Column name@Nullable public static String getColumnType(String tableName, String columnName)
VARCHAR
for a VARCHAR(255)
.tableName
- Table namecolumnName
- Column namenull
if it does not exist@Nonnull public static <T> Optional<T> getColumnInfo(String tableName, String columnName, UpgradeUtils.ColumnMetaDataExtractor<T> valueExtractor)
tableName
- Table namecolumnName
- Column namevalueExtractor
- a function that will obtain the desired information for the column from its metadataempty()
if the column was not foundpublic static int getJIRABuildVersionNumber()
public static void doColumnsOrTablesExist(List<TableColumnCheckResult> tableColumnCheckResults)
Copyright © 2002-2022 Atlassian. All Rights Reserved.