diff src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java @ 54:a00efd5d9e77

new: adding delete saved table function
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 04 Feb 2016 11:30:46 +0100
parents 7c2e1b14b77d
children 95bf4ac726e6
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java	Mon Feb 01 15:49:48 2016 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java	Thu Feb 04 11:30:46 2016 +0100
@@ -1,5 +1,6 @@
 package de.mpiwg.gazetteer.utils;
 
+import java.io.IOException;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -296,6 +297,21 @@
 	}
 
 	
+	
+	
+	public void deleteLGFullTextSearchFile(LGFullTextSearchFile file) throws IOException{
+		//deleting file from DB: the record in table FullTextSearchFile
+		int modifiedFiles = DBService.deleteFullTextSearchFileFromDB(file.getId());
+		
+		// delete the files from file system (html in ftsearch-data/... and csv in LGMap/datasets/) 
+		FileManager.deleteFullTextSearchFileCsv(file);
+		FileManager.deleteFullTextSearchFileHtml(file);
+		
+		// delete file from cache
+		this.getFullTextSearchFileMap().remove(file.getKey());
+		logger.debug("deleteLGFullTextSearchFile");
+	}
+	
 	public LGFullTextSearchFile saveLGFullTextSearchFile(List<DBContents> list, Long userId, LGFullTextSearchFile searchFile) throws Exception {	
 		// save as csv and html file in filesystem, and records in db `FullTextSearchFile
 		// List<DBContents> list is the filteredList of searching result with isRemoved field