public class ContractsParser
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| private java.sql.Connection | _dbConnectionThe _db connection. | 
| protected org.apache.log4j.Logger | _loggerThe _logger. | 
| static java.util.Map<java.lang.String,java.lang.String> | columnMapThe Constant columnMap. | 
| private java.lang.String | databaseThe database. | 
| private java.lang.String | driverThe driver. | 
| private java.lang.String | hostThe host. | 
| static java.util.List<java.lang.String> | NULLABLE_COLUMNSThe Constant NULLABLE_COLUMNS. | 
| static java.util.Map<java.lang.String,java.lang.String> | OBLIGATIONS_COLUMN_MAPThe Constant OBLIGATIONS_COLUMN_MAP. | 
| static java.lang.String | OBLIGATIONS_TABLE_NAMEThe Constant OBLIGATIONS_TABLE_NAME. | 
| private java.lang.String[] | obligationsBlackListThe obligations black list. | 
| private java.lang.String[] | obligationsWhiteListThe obligations white list. | 
| private java.lang.String[] | obligationsWhiteListColumnNamesThe obligations white list column names. | 
| static java.util.Map<java.lang.String,java.lang.String> | OUTLAYS_COLUMN_MAPThe Constant OUTLAYS_COLUMN_MAP. | 
| static java.lang.String | OUTLAYS_TABLE_NAMEThe Constant OUTLAYS_TABLE_NAME. | 
| private java.lang.String[] | outlaysBlackListThe outlays black list. | 
| private java.lang.String[] | outlaysWhiteListThe outlays white list. | 
| private java.lang.String[] | outlaysWhiteListColumnNamesThe outlays white list column names. | 
| private java.lang.String | passwordThe password. | 
| private static java.lang.String | PROP_FILEThe Constant PROP_FILE. | 
| private java.lang.String | userThe user. | 
| Constructor and Description | 
|---|
| ContractsParser()Instantiates a new contracts parser. | 
| Modifier and Type | Method and Description | 
|---|---|
| private java.lang.String[] | buildFindSql(java.lang.String[] whiteList,
            java.util.Map columnsMap)build a list of sqls to used for finding duplicates in the table. | 
| private java.lang.Boolean | checkForFields(java.util.Map row,
              java.util.Map columnsMap)check row against the columnMap
 1. | 
| private void | closeDBConnection()Close db connection. | 
| private java.lang.Boolean | findDuplicateRow(java.util.Map row,
                java.lang.String tableName,
                java.lang.String[] columnNames,
                java.lang.String[] columnValues)look for duplicate row in the database table. | 
| private java.sql.Connection | getDBConnection()Gets the DB connection. | 
| private int | getSqlType(java.lang.String columnName)Budget Center = budget_center java.sql.Types.VARCHAR
 Sub-Budget Center = sub_budget_center java.sql.Types.VARCHAR
 Executing Budget Center = executing_budget_center java.sql.Types.VARCHAR
 Appropriation Year = appropriation_year java.sql.Types.DECIMAL
 Appropriation = appropriation java.sql.Types.VARCHAR
 Requisition ID = requisition_id java.sql.Types.VARCHAR
 PO Reference = po_reference java.sql.Types.VARCHAR
 ACR = acr java.sql.Types.VARCHAR
 Obligation Date = obligation_date java.sql.Types.DATE
 Obligated Amount = obligated_amount java.sql.Types.DECIMAL
 Expensed Amount = expensed_amount java.sql.Types.DECIMAL
 Expensed Date = expensed_date java.sql.Types.DATE
 Voucher ID = voucher_id java.sql.Types.VARCHAR | 
| private void | initDBConnection()Inits the database connection. | 
| static void | main(java.lang.String[] args)The main method. | 
| java.lang.String | parseCognosXLSXFile(java.lang.String filename)main interface to the client
 parses XLSX file and stores in the database. | 
| private java.util.ArrayList | parseCOGNOSXLSXFile(java.lang.String filename)parses XLXS file and stores key/value pair in ArrayList. | 
| static void | printMap(java.util.Map mp)util function to print key/value pairs in the mao. | 
| private java.lang.String | saveCOGNOSData(java.lang.String tableName,
              java.util.ArrayList data,
              java.lang.String[] whiteListColumnNames,
              java.lang.String[] whiteList,
              java.util.Map columnsMap)Saves COGNOS data into database table using whitelists 1000 at a time using batch function. | 
| private java.lang.String | saveDataToTable(java.util.ArrayList dataToSave,
               java.lang.String tableName,
               java.util.Map columnsMap)save data to table using columnsMap and batching 1000 at a time. | 
| private void | setVarchar(java.sql.PreparedStatement stmt,
          int col,
          java.lang.String var,
          int type)set type of column specified in the parameter. | 
protected org.apache.log4j.Logger _logger
private static final java.lang.String PROP_FILE
public static final java.lang.String OBLIGATIONS_TABLE_NAME
public static final java.lang.String OUTLAYS_TABLE_NAME
public static final java.util.Map<java.lang.String,java.lang.String> columnMap
public static final java.util.Map<java.lang.String,java.lang.String> OBLIGATIONS_COLUMN_MAP
public static final java.util.Map<java.lang.String,java.lang.String> OUTLAYS_COLUMN_MAP
public static final java.util.List<java.lang.String> NULLABLE_COLUMNS
private java.lang.String[] obligationsWhiteList
private java.lang.String[] obligationsWhiteListColumnNames
private java.lang.String[] obligationsBlackList
private java.lang.String[] outlaysWhiteList
private java.lang.String[] outlaysWhiteListColumnNames
private java.lang.String[] outlaysBlackList
private java.sql.Connection _dbConnection
private java.lang.String host
private java.lang.String database
private java.lang.String driver
private java.lang.String user
private java.lang.String password
private void initDBConnection()
                       throws java.sql.SQLException
java.sql.SQLException - the SQL exceptionprivate java.lang.String[] buildFindSql(java.lang.String[] whiteList,
                              java.util.Map columnsMap)
whiteList - the white listcolumnsMap - the columns mapprivate java.sql.Connection getDBConnection()
                                     throws java.sql.SQLException
java.sql.SQLException - the SQL exceptionprivate void closeDBConnection()
                        throws java.sql.SQLException
java.sql.SQLException - the SQL exceptionpublic java.lang.String parseCognosXLSXFile(java.lang.String filename)
filename - the filenameprivate java.lang.Boolean checkForFields(java.util.Map row,
                               java.util.Map columnsMap)
row - the rowcolumnsMap - the columns mapprivate java.lang.String saveCOGNOSData(java.lang.String tableName,
                              java.util.ArrayList data,
                              java.lang.String[] whiteListColumnNames,
                              java.lang.String[] whiteList,
                              java.util.Map columnsMap)
tableName - the table namedata - the datawhiteListColumnNames - the white list column nameswhiteList - the white listcolumnsMap - the columns mapprivate java.lang.String saveDataToTable(java.util.ArrayList dataToSave,
                               java.lang.String tableName,
                               java.util.Map columnsMap)
dataToSave - the data to savetableName - the table namecolumnsMap - the columns mappublic static void printMap(java.util.Map mp)
mp - the mpprivate java.util.ArrayList parseCOGNOSXLSXFile(java.lang.String filename)
filename - the filenameprivate int getSqlType(java.lang.String columnName)
columnName - the column nameprivate java.lang.Boolean findDuplicateRow(java.util.Map row,
                                 java.lang.String tableName,
                                 java.lang.String[] columnNames,
                                 java.lang.String[] columnValues)
row - the rowtableName - the table namecolumnNames - the column namescolumnValues - the column valuesprivate void setVarchar(java.sql.PreparedStatement stmt,
              int col,
              java.lang.String var,
              int type)
                 throws java.sql.SQLException
stmt - the stmtcol - the colvar - the vartype - the typejava.sql.SQLException - the SQL exceptionpublic static void main(java.lang.String[] args)
args - the arguments