system
Class Bol

java.lang.Object
  extended by system.Bol

public class Bol
extends java.lang.Object

This class is the data storage and processing power of the entire API.


Nested Class Summary
static class Bol.IOType
          The Input/Output types for text file loading/saving
 
Field Summary
private  java.util.ArrayList<java.lang.String> catalogs
           
private  java.util.ArrayList<java.lang.Object> columnClassTypes
           
private  java.util.ArrayList<java.lang.Object> columnNames
           
private static char COMMA
           
private  java.util.List<java.util.List<java.lang.Object>> data
           
private static java.lang.String[] dataTypes
           
private static java.lang.String DEFAULT_COLUMN_NAME
           
private static java.util.ArrayList<java.lang.Exception> errors
           
private static java.lang.String NEW_LINE
           
(package private) static java.lang.String SPACE
           
private  java.util.ArrayList<java.lang.String> tables
           
 
Constructor Summary
Bol()
           
 
Method Summary
(package private)  void changeDataType(java.lang.Object newDataType, int position)
          Changes the classes based on the users choice of dataType.
(package private)  void clearData()
          Removes the data and columnNames from the current BOL Object.
(package private)  void deleteColumn(int col)
          Deletes a column at the position selected.
(package private)  void deleteRow(int row)
          Deletes a record at the position selected.
(package private)  java.util.ArrayList<java.lang.String> getCatalogs()
          Gets the catalogs.
(package private)  java.util.ArrayList<java.lang.Object> getClasses()
          Gets the data classes of the Bol2.
 java.util.ArrayList<java.lang.Object> getColumnNames()
          Returns the current BOL's columnNames arraylist.
(package private)  boolean getConnection(java.lang.String url, int vendor, java.lang.String user, java.lang.String password)
          Sends through the various parameters needed for the connection.
(package private)  java.util.List<java.util.List<java.lang.Object>> getData()
          Returns the current BOL's data arraylist.
 java.util.ArrayList<java.lang.Object> getDataType()
          Checks the data type of the data and returns it.
(package private)  boolean getDataTypeSingle(java.lang.Object value, int position)
          Get the data type of the string and checks whether it matches the previously set data type.
(package private) static java.lang.String getErrors()
          Gets the errors from the error list.
(package private)  java.util.ArrayList<java.lang.String> getTables(java.lang.String catalog)
          Gets the databases tables.
(package private)  java.lang.String[] getVendors()
          Gets the vendors of supplying DBMS.
(package private)  void insertColumn(int pos)
          Inserts a new column at the position selected.
(package private)  void insertRow(int pos)
          Inserts a new record at the position selected.
(package private)  void modifyCell(int row, int column, java.lang.Object newContent)
          Sets the data in an individual record and field.
(package private)  void modifyColumnName(int column, java.lang.Object newText)
          Changes the column name.
(package private)  boolean populate(java.lang.String fileName, Bol.IOType type)
          Populates the data arraylist.
(package private)  boolean saveData(Bol.IOType type, java.lang.String fileName)
          Saves the data as a text document.
(package private)  boolean sendDataToDBMS(java.lang.String database, java.lang.String tableName)
          Gets the database name and table name.
 void setData(java.util.List<java.util.List<java.lang.Object>> data)
          Sets the current BOL's data arraylist.
 void setDefaultColumnNames()
          Sets the default column names if the column names are blank.
(package private)  java.util.ArrayList<java.lang.String> writeDataTypes(int colNumber)
          Gets the list of available data types for a column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPACE

static final java.lang.String SPACE
See Also:
Constant Field Values

NEW_LINE

private static final java.lang.String NEW_LINE
See Also:
Constant Field Values

DEFAULT_COLUMN_NAME

private static final java.lang.String DEFAULT_COLUMN_NAME
See Also:
Constant Field Values

dataTypes

private static final java.lang.String[] dataTypes

errors

private static java.util.ArrayList<java.lang.Exception> errors

COMMA

private static final char COMMA
See Also:
Constant Field Values

columnNames

private java.util.ArrayList<java.lang.Object> columnNames

data

private java.util.List<java.util.List<java.lang.Object>> data

columnClassTypes

private java.util.ArrayList<java.lang.Object> columnClassTypes

tables

private java.util.ArrayList<java.lang.String> tables

catalogs

private java.util.ArrayList<java.lang.String> catalogs
Constructor Detail

Bol

public Bol()
Method Detail

clearData

void clearData()
Removes the data and columnNames from the current BOL Object.


getData

java.util.List<java.util.List<java.lang.Object>> getData()
Returns the current BOL's data arraylist.

Returns:
the data arraylist.

setData

public void setData(java.util.List<java.util.List<java.lang.Object>> data)
Sets the current BOL's data arraylist.

Parameters:
data - - the data to be added to this BOL's data arraylist.

getColumnNames

public java.util.ArrayList<java.lang.Object> getColumnNames()
Returns the current BOL's columnNames arraylist.

Returns:
the columnNames arraylist.

populate

boolean populate(java.lang.String fileName,
                 Bol.IOType type)
Populates the data arraylist.

Parameters:
fileName - - the name of the file to be opened and the data copied into the API.
type - - the users selected file type enum.
Returns:
the success of the populate data arraylist.

saveData

boolean saveData(Bol.IOType type,
                 java.lang.String fileName)
Saves the data as a text document.

Parameters:
type - the users selected file type enum to save as.
fileName - the name of the file to be saved.
Returns:
the success of the save data method call.

setDefaultColumnNames

public void setDefaultColumnNames()
Sets the default column names if the column names are blank.


getDataType

public java.util.ArrayList<java.lang.Object> getDataType()
Checks the data type of the data and returns it.

Returns:
the array list of the data type of the data.

getDataTypeSingle

boolean getDataTypeSingle(java.lang.Object value,
                          int position)
Get the data type of the string and checks whether it matches the previously set data type.

Parameters:
value - - string sent from user to change for validation check.
position - - position of the data in the arraylist
Returns:
the success of the validation, whether it is acceptable in the data type slot.

getVendors

java.lang.String[] getVendors()
Gets the vendors of supplying DBMS.

Returns:
the string array of vendors on the machine.

getConnection

boolean getConnection(java.lang.String url,
                      int vendor,
                      java.lang.String user,
                      java.lang.String password)
Sends through the various parameters needed for the connection.

Parameters:
url - the url of the connection stream.
vendor - the vendor of the conection stream.
user - the username of the conection stream.
password - the password of the conection stream.
Returns:
whether the connection was successful.

getTables

java.util.ArrayList<java.lang.String> getTables(java.lang.String catalog)
Gets the databases tables.

Parameters:
catalog - the catalogs to get the tables.
Returns:
the arraylist of tables.

getCatalogs

java.util.ArrayList<java.lang.String> getCatalogs()
Gets the catalogs.

Returns:
the catalogs arraylist from the Bol2.

sendDataToDBMS

boolean sendDataToDBMS(java.lang.String database,
                       java.lang.String tableName)
Gets the database name and table name.

Parameters:
database - the database name.
tableName - the database table.
Returns:
whether the data was sent successfully.

getClasses

java.util.ArrayList<java.lang.Object> getClasses()
Gets the data classes of the Bol2.

Returns:
the arraylist of the classes.

modifyColumnName

void modifyColumnName(int column,
                      java.lang.Object newText)
Changes the column name.

Parameters:
column - the column to have the new name changed.
newText - the new name of the column.

deleteRow

void deleteRow(int row)
Deletes a record at the position selected.

Parameters:
row - the position of the new record.

insertRow

void insertRow(int pos)
Inserts a new record at the position selected.

Parameters:
pos - the position of the new record.

deleteColumn

void deleteColumn(int col)
Deletes a column at the position selected.

Parameters:
col - the position of the new column.

insertColumn

void insertColumn(int pos)
Inserts a new column at the position selected.

Parameters:
pos - the position of the new column.

modifyCell

void modifyCell(int row,
                int column,
                java.lang.Object newContent)
Sets the data in an individual record and field.

Parameters:
row - - the record to be modified.
column - - the field to be modified.
newContent - - the new data to be modified.

writeDataTypes

java.util.ArrayList<java.lang.String> writeDataTypes(int colNumber)
Gets the list of available data types for a column.

Parameters:
colNumber - position the column's position in the list.
Returns:
the arraylist of available data types for the column.

changeDataType

void changeDataType(java.lang.Object newDataType,
                    int position)
Changes the classes based on the users choice of dataType.

Parameters:
newDataType - - the new data type of the field.
position - - the position of the data type in the data type array.

getErrors

static java.lang.String getErrors()
Gets the errors from the error list.

Returns:
the error that was generated.