public class IngestManager
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| static java.lang.String | AUTO_INGEST_TABLE_NAMEThe Constant AUTO_INGEST_TABLE_NAME. | 
| static java.lang.String | CLASSIFICATION_TABLE_NAMEThe Constant CLASSIFICATION_TABLE_NAME. | 
| static java.lang.String | DATA_TABLE_NAMEThe Constant DATA_TABLE_NAME. | 
| private java.lang.String | databaseThe database. | 
| protected org.apache.log4j.Logger | loggerThe logger. | 
| private static java.lang.String | PROP_FILEName of the properties file which must exist on the classpath. | 
| static java.lang.String | ROLE_COLUMNS_TABLE_NAMEThe Constant ROLE_COLUMNS_TABLE_NAME. | 
| static java.lang.String | ROLES_DATA_TABLE_NAMEThe Constant ROLES_DATA_TABLE_NAME. | 
| static java.lang.String | ROLES_TABLE_NAMEThe Constant ROLES_TABLE_NAME. | 
| private java.lang.String | uploadDirThe upload dir. | 
| Constructor and Description | 
|---|
| IngestManager()Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | createTables()Create tables for user and tables tracking.... | 
| java.lang.String | deleteAutoIngest(FlexAutoIngestRowObject autoIngest)Delete auto ingest in the database | 
| java.lang.String | deleteFile(java.lang.String filename)Delete a file in the upload directory | 
| java.lang.String | deleteIngestedData(java.lang.String tableName,
                  UserInfoObject user)Delete table from database | 
| java.lang.String | deleteTable(java.lang.String tableName)Delete table from database | 
| java.util.List<FlexAutoIngestRowObject> | getAutoIngests()Return list of cron jobs from the database | 
| java.lang.String | getClassification(java.lang.String tableName)Gets the classification String from the 'table'. | 
| java.util.ArrayList<java.lang.String> | getRoles(java.lang.String tableName)Returns list of roles specified | 
| java.util.ArrayList<java.lang.String> | getTableColumns(java.lang.String tableName)Returns list of columns in the table | 
| java.util.ArrayList<RoleInfoObject> | getTableRoleInfos(java.lang.String tableId)Returns list of role info objestcs for the table | 
| java.util.List<java.lang.String> | getTableRoles(java.lang.String tableId)Returns list of roles for the table | 
| java.lang.String | ingest(java.lang.String tableName,
      java.lang.String filename,
      boolean merge,
      java.lang.String classification,
      java.util.ArrayList<java.lang.String> roleColumns,
      UserInfoObject user,
      int published,
      java.util.ArrayList<RoleInfoObject> roles)Ingest file to the database | 
| IngestResult | ingestExcel(java.lang.String tableName,
           java.lang.String filename,
           boolean merge)Ingest Excel spreadsheet | 
| IngestResult | ingestFile(java.lang.String tableName,
          java.lang.String filename,
          boolean merge)Ingest file. | 
| IngestResult | ingestXML(java.lang.String tableName,
         java.lang.String filename,
         boolean merge)Ingest xml file. | 
| private boolean | isUserAdmin(UserInfoObject user)Check to see if user is admin | 
| java.util.ArrayList<java.lang.String> | listColumnHeaders(java.lang.String filename)Returns list of column headers for file specified | 
| java.util.ArrayList<java.lang.String> | listFiles()Return List of files at upload Directory | 
| java.util.List<TablesInfoObject> | listTables()Returns list of tables in the database | 
| static void | main(java.lang.String[] args)The main method. | 
| private java.lang.String | parseDate(java.util.Date date)Parses the date using "yyyy-MM-dd HH:mm:ss.S" | 
| java.lang.String | runAutoIngest(FlexAutoIngestRowObject autoIngest)Run auto ingest and update time | 
| java.lang.String | saveAutoIngest(FlexAutoIngestRowObject autoIngest)Save auto ingest in the database
  check table_info againt table name and id, return error if user id != owner id
  create new table_info record if no existing table name found
  delete existing classification and roles, update with new | 
| boolean | updateClassificationInfo(java.lang.String tableName,
                        java.lang.String classification)Update table info, find table by name and update ownerId and published | 
| boolean | updateIngestInfo(java.lang.String tableName,
                java.lang.String classification,
                java.util.ArrayList<java.lang.String> roleColumns,
                UserInfoObject user,
                int published,
                java.lang.String filename,
                java.util.ArrayList<RoleInfoObject> roles)Update table_data, table_roles, table_classification | 
| boolean | updateRoleColumnsInfo(java.lang.String tableName,
                     java.util.ArrayList<java.lang.String> roleColumns)Update role columns info, loop through the role columns list
 insert if data not exists, update if the data exists | 
| boolean | updateRolesInfo(java.lang.String tableName,
               java.util.ArrayList<RoleInfoObject> roles)Update table roles info, loop through the roles list
 insert if data not exists, update if the data exists | 
| boolean | updateTableInfo(java.lang.String tableName,
               int ownerId,
               long published,
               java.lang.String filename)Update table info, find table by name and update ownerId and published | 
| java.lang.String | validate(FlexAutoIngestRowObject ingestFile)Make sure the file actually exists in the specified location | 
| java.lang.String | validateUrl(java.lang.String url)Validate that the url is readable | 
private static final java.lang.String PROP_FILE
public static final java.lang.String AUTO_INGEST_TABLE_NAME
public static final java.lang.String DATA_TABLE_NAME
public static final java.lang.String ROLE_COLUMNS_TABLE_NAME
public static final java.lang.String CLASSIFICATION_TABLE_NAME
public static final java.lang.String ROLES_DATA_TABLE_NAME
public static final java.lang.String ROLES_TABLE_NAME
private java.lang.String uploadDir
private java.lang.String database
protected org.apache.log4j.Logger logger
public IngestManager()
public boolean createTables()
public java.lang.String ingest(java.lang.String tableName,
                      java.lang.String filename,
                      boolean merge,
                      java.lang.String classification,
                      java.util.ArrayList<java.lang.String> roleColumns,
                      UserInfoObject user,
                      int published,
                      java.util.ArrayList<RoleInfoObject> roles)
tableName - the table namefilename - the filenamemerge - the mergeclassification - the classificationroleColumns - the role columnsuser - the userpublished - the publishedroles - the rolespublic boolean updateIngestInfo(java.lang.String tableName,
                       java.lang.String classification,
                       java.util.ArrayList<java.lang.String> roleColumns,
                       UserInfoObject user,
                       int published,
                       java.lang.String filename,
                       java.util.ArrayList<RoleInfoObject> roles)
tableName - the table nameclassification - the classificationroleColumns - array of headers for row columnsuser - the userpublished - the published flagfilename - the filenameroles - the rolespublic boolean updateTableInfo(java.lang.String tableName,
                      int ownerId,
                      long published,
                      java.lang.String filename)
tableName - the table nameownerId - the owner id from the users tablepublished - the published flagfilename - the filenamepublic boolean updateClassificationInfo(java.lang.String tableName,
                               java.lang.String classification)
tableName - the table nameclassification - the classificationpublic boolean updateRoleColumnsInfo(java.lang.String tableName,
                            java.util.ArrayList<java.lang.String> roleColumns)
tableName - the table nameroleColumns - the array of role columnspublic boolean updateRolesInfo(java.lang.String tableName,
                      java.util.ArrayList<RoleInfoObject> roles)
tableName - the table nameroles - the rolespublic IngestResult ingestFile(java.lang.String tableName, java.lang.String filename, boolean merge)
tableName - the table namefilename - the filenamemerge - the merge flag. true = merge, false = replacepublic IngestResult ingestXML(java.lang.String tableName, java.lang.String filename, boolean merge)
tableName - the table namefilename - the filenamemerge - the merge flag. true = merge, false = replacepublic IngestResult ingestExcel(java.lang.String tableName, java.lang.String filename, boolean merge)
tableName - the table namefilename - the filenamemerge - the merge flag. true = merge, false = replacepublic java.lang.String deleteTable(java.lang.String tableName)
tableName - the table nameprivate boolean isUserAdmin(UserInfoObject user)
user - the userpublic java.lang.String deleteIngestedData(java.lang.String tableName,
                                  UserInfoObject user)
tableName - the table nameuser - the userpublic java.util.ArrayList<java.lang.String> listFiles()
public java.lang.String deleteFile(java.lang.String filename)
filename - the filename key for the directorypublic java.util.List<TablesInfoObject> listTables()
public java.util.ArrayList<java.lang.String> listColumnHeaders(java.lang.String filename)
filename - the filenamepublic java.util.List<FlexAutoIngestRowObject> getAutoIngests()
public java.lang.String saveAutoIngest(FlexAutoIngestRowObject autoIngest)
autoIngest - the auto ingestpublic java.lang.String deleteAutoIngest(FlexAutoIngestRowObject autoIngest)
autoIngest - the auto ingestpublic java.lang.String runAutoIngest(FlexAutoIngestRowObject autoIngest)
autoIngest - the auto ingest FlexAutoIngestRowObjectprivate java.lang.String parseDate(java.util.Date date)
date - the Date to formatpublic java.util.ArrayList<java.lang.String> getTableColumns(java.lang.String tableName)
tableName - the table namepublic java.util.List<java.lang.String> getTableRoles(java.lang.String tableId)
tableId - the table idpublic java.util.ArrayList<RoleInfoObject> getTableRoleInfos(java.lang.String tableId)
tableId - the table idpublic java.util.ArrayList<java.lang.String> getRoles(java.lang.String tableName)
tableName - the table namepublic java.lang.String getClassification(java.lang.String tableName)
tableName - the table namepublic java.lang.String validate(FlexAutoIngestRowObject ingestFile)
ingestFile - the FlexAutoIngestRowObject containing the location and file namepublic java.lang.String validateUrl(java.lang.String url)
url - the urlpublic static void main(java.lang.String[] args)
args - the arguments