public final class EtlUtils
extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
EtlUtils.HowToSearch
The Enum HowToSearch.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
LAST_ETL_EXCEPTION
The Constant LAST_ETL_EXCEPTION.
|
| Constructor and Description |
|---|
EtlUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Variable |
addVar(ListHashMap<String,Variable> vars,
String name,
String defValue,
boolean replace)
Creates a new variable and adds it to the given map.
|
static boolean |
checkCondition(EtlConfig config,
String name,
Scenario scenario,
ConditionalExecution conditionalExecution)
Checks condition.
|
static boolean |
checkCondition(EtlConfig config,
String name,
Scenario scenario,
ConditionalExecution conditionalExecution,
DataSet dataSet)
Checks condition.
|
static Block |
getBlockByName(Scenario scenario,
String name,
EtlUtils.HowToSearch howToSearch)
Find block by name.
|
static String |
getDbId(Alias alias,
String delim)
Gets the database id by parsing url.
|
static String |
getFileName(String fileName)
Gets the file name.
|
static String |
getPatternName(String name)
Gets the pattern name.
|
static String |
getScenarioFileName(String folder,
String fileName)
Gets the scenario file name.
|
static String |
getScenarioName(String name)
Gets the scenario name.
|
static String |
getSqlFileName(String name,
int index)
Gets the sql file name.
|
static String |
getVarValue(ListHashMap<String,Variable> vars,
String name,
String defValue)
Gets the variable value.
|
static String |
insert2Update(String sql,
String keyField)
Converts "insert" sql to "update".
|
static boolean |
isExtract(int action)
Checks if extract needs to be performed during execution of the etl
scenario.
|
static boolean |
isExtractLoad(int action)
Checks if extract and load needs to be performed during execution of the
etl scenario.
|
static boolean |
isLoad(int action)
Checks if load needs to be performed during execution of the etl
scenario.
|
static String |
mergeSqlWithVars(CacheProvider<String,Object> cacheProvider,
String sql,
String using,
ListHashMap<String,Variable> variables,
Map<String,Object> bindVars)
Merges sql with variables.
|
static String |
mergeSqlWithVars(String sql,
ListHashMap<String,Variable> vars,
Driver driver)
Merges sql with variables.
|
static String |
mergeStringWithParams(String input,
String[] params)
Merges string with parameters.
|
static Point |
parseException(Throwable exception,
String code,
String errorLinePattern)
Parses exception.
|
static void |
substituteVars(ListHashMap<String,Variable> variables)
Substitute variable values in {} brackets.
|
static String |
varValue2ColumnValue(String value)
Remove single quotes from the string.
|
public static final String LAST_ETL_EXCEPTION
public static Variable addVar(ListHashMap<String,Variable> vars, String name, String defValue, boolean replace)
vars - the map of variablesname - the namedefValue - the default valuereplace - the "replace" flag. If true will replace existing variable
with the same name.public static boolean checkCondition(EtlConfig config, String name, Scenario scenario, ConditionalExecution conditionalExecution) throws Exception
config - the configname - the namescenario - the scenarioconditionalExecution - the instance of the conditional execution class. Usually it is
either Source, Destination or ScenarioException - in case of any errorpublic static boolean checkCondition(EtlConfig config, String name, Scenario scenario, ConditionalExecution conditionalExecution, DataSet dataSet) throws Exception
config - the configname - the namescenario - the scenarioconditionalExecution - the instance of the conditional execution class. Usually it is
either Source, Destination or ScenariodataSet - the data setException - in case of any errorpublic static Block getBlockByName(Scenario scenario, String name, EtlUtils.HowToSearch howToSearch)
scenario - the scenarioname - the namehowToSearch - the how to searchpublic static String getDbId(Alias alias, String delim)
alias - the aliasdelim - the delimiterpublic static String getFileName(String fileName)
fileName - the file namepublic static String getPatternName(String name)
name - the namepublic static String getScenarioFileName(String folder,
String fileName)
folder - the folderfileName - the file namepublic static String getScenarioName(String name)
a/b/c.txt --> c a.txt --> a a/b/c --> c a/b/c/ --> ""
name - the namepublic static String getSqlFileName(String name,
int index)
name - the nameindex - the index of the filepublic static String getVarValue(ListHashMap<String,Variable> vars, String name, String defValue)
vars - the variablesname - the variable namedefValue - the default valuepublic static String insert2Update(String sql,
String keyField)
sql - the sqlkeyField - the key field(s)public static boolean isExtract(int action)
action - The action associated with the scenario.public static boolean isExtractLoad(int action)
action - The action associated with the scenario.public static boolean isLoad(int action)
action - The action associated with the scenario.public static String varValue2ColumnValue(String value)
value - the valuepublic static String mergeSqlWithVars(CacheProvider<String,Object> cacheProvider, String sql, String using, ListHashMap<String,Variable> variables, Map<String,Object> bindVars)
cacheProvider - the cache providersql - the sqlusing - the comma delimited string with the names of bind variables.variables - the variablesbindVars - the bind variablespublic static String mergeSqlWithVars(String sql,
ListHashMap<String,Variable> vars,
Driver driver)
sql - the sqlvars - the variablesdriver - the driverpublic static String mergeStringWithParams(String input,
String[] params)
input - the inputparams - the parameterspublic static Point parseException(Throwable exception,
String code,
String errorLinePattern)
exception - the exceptioncode - the sqlerrorLinePattern - the error line patternpublic static void substituteVars(ListHashMap<String,Variable> variables)
variables - the variablesCopyright © 2010-2020 Toolsverse. All Rights Reserved.