changeset 63:fc5116de601f

config to SBB server
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 25 Jul 2016 11:14:59 +0200
parents 824b808a7481
children 4c8fed0d71cc
files src/main/java/de/mpiwg/gazetteer/rest/DownloadFullTextSearchCsvFile.java src/main/java/de/mpiwg/gazetteer/utils/DBService.java src/main/java/de/mpiwg/web/branch/SortBranchByBookId.java src/main/java/de/mpiwg/web/jsp/HomePage.java src/main/java/de/mpiwg/web/jsp/JSPProxy.java src/main/resources/config.properties src/main/webapp/pages/home.jsp
diffstat 7 files changed, 66 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/rest/DownloadFullTextSearchCsvFile.java	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/java/de/mpiwg/gazetteer/rest/DownloadFullTextSearchCsvFile.java	Mon Jul 25 11:14:59 2016 +0200
@@ -1,6 +1,5 @@
 package de.mpiwg.gazetteer.rest;
 
-import java.io.FileInputStream;
 import java.io.PrintWriter;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
@@ -13,12 +12,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.json.JSONObject;
 
-import de.mpiwg.gazetteer.bo.LGBranch;
-import de.mpiwg.gazetteer.bo.LGFile;
-import de.mpiwg.gazetteer.utils.DataProvider;
-import de.mpiwg.gazetteer.utils.FileManager;
 import de.mpiwg.gazetteer.utils.PropertiesUtils;
-import de.mpiwg.gazetteer.utils.exceptions.GazetteerException;
 
 public class DownloadFullTextSearchCsvFile extends AbstractServletMethod {
 
@@ -29,8 +23,11 @@
 		//String filename = getQueryLongParam(request, "file");
 		String filename = request.getParameter("file");
 		
+		/*
 		byte[] bytes = filename.getBytes(StandardCharsets.ISO_8859_1);
+		
 		filename = new String(bytes, StandardCharsets.UTF_8);
+		*/
 		
 		System.out.println("%%%%% DownloadFullTextSearchCsvFile [filename=" + filename + "]");
 		
--- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java	Mon Jul 25 11:14:59 2016 +0200
@@ -34,7 +34,11 @@
 	
 	// JDBC driver name and database URL
 	static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
-	static final String DB_URL = "jdbc:mysql://localhost/";	// TODO: when move Gazetteer database to SBB, need to re-config this
+	
+	
+	//static final String DB_URL = "jdbc:mysql://localhost/";
+	static final String DB_URL = "jdbc:mysql://194.94.134.66/";	// TODO: when move Gazetteer database to SBB, need to re-config this
+																// replace the IP with SBB's host IP: 194.94.134.66
 	
 	private static String SECTIONS_TABLE = "sections_index";
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/de/mpiwg/web/branch/SortBranchByBookId.java	Mon Jul 25 11:14:59 2016 +0200
@@ -0,0 +1,17 @@
+package de.mpiwg.web.branch;
+
+import java.util.Comparator;
+
+import de.mpiwg.gazetteer.bo.LGBranch;
+
+
+public class SortBranchByBookId implements Comparator<LGBranch>{
+	
+	public int compare(LGBranch o1, LGBranch o2) {
+		if(o1 == null || o2 == null){
+			return o1.getId().compareTo(o2.getId());
+		}
+		return o1.getBook().getId().compareTo(o2.getBook().getId());
+	}
+
+}
\ No newline at end of file
--- a/src/main/java/de/mpiwg/web/jsp/HomePage.java	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/java/de/mpiwg/web/jsp/HomePage.java	Mon Jul 25 11:14:59 2016 +0200
@@ -11,44 +11,14 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 import de.mpiwg.gazetteer.bo.LGBranch;
 import de.mpiwg.gazetteer.bo.LGTopicSectionRelation;
 import de.mpiwg.gazetteer.db.DBBook;
 import de.mpiwg.gazetteer.db.DBSection;
 import de.mpiwg.gazetteer.utils.DBService;
 import de.mpiwg.gazetteer.utils.DataProvider;
-import de.mpiwg.web.books.SortBooksByBookId;
 import de.mpiwg.web.branch.SortBranchByAdminType;
+import de.mpiwg.web.branch.SortBranchByBookId;
 import de.mpiwg.web.branch.SortBranchByBookName;
 import de.mpiwg.web.branch.SortBranchByBranchId;
 import de.mpiwg.web.branch.SortBranchByDynasty;
@@ -450,6 +420,17 @@
 		filter();
 	}
 
+	public void sortByBookIdUp() {
+		Collections.sort(this.completeBranchList, new SortBranchByBookId());
+		filter();
+	}
+
+	public void sortByBookIdDown() {
+		Collections.sort(this.completeBranchList, new SortBranchByBookId());
+		Collections.reverse(this.completeBranchList);
+		filter();
+	}
+
 	
 	public void sortByBookNameUp() {
 		Collections.sort(this.completeBranchList, new SortBranchByBookName());
--- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java	Mon Jul 25 11:14:59 2016 +0200
@@ -108,7 +108,11 @@
 					getSessionBean().getHomePage().sortByBookNameUp();
 				} else if(StringUtils.equals(action, "sortByBookNameDown")) {
 					getSessionBean().getHomePage().sortByBookNameDown();
-
+				} else if(StringUtils.equals(action, "sortByBookIdUp")) {
+					getSessionBean().getHomePage().sortByBookIdUp();
+				} else if(StringUtils.equals(action, "sortByBookIdDown")) {
+					getSessionBean().getHomePage().sortByBookIdDown();
+				
 				} else if(StringUtils.equals(action, "sortByLevel1Up")) {
 					getSessionBean().getHomePage().sortByLevel1Up();
 				} else if(StringUtils.equals(action, "sortByLevel1Down")) {
--- a/src/main/resources/config.properties	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/resources/config.properties	Mon Jul 25 11:14:59 2016 +0200
@@ -1,11 +1,22 @@
-db_gazetter_name=Gazetteer
 files_root=/gazetteer-server/data
 ftsearch_root=/gazetteer-server/ftsearch-data
 
 
+# production server, test server, and local machine
+#db_gazetter_name=Gazetteer
+
+# SBB server:
+db_gazetter_name=gazetteer
+db_gazetter_username=gazetteer
+db_gazetter_password=R-9C7Bmx%2
+
+
+
+# -----
 #Local
-db_gazetter_username=root
-db_gazetter_password=root
+#db_gazetter_username=root
+#db_gazetter_password=root
+
 dvn_server=http://localhost:8082
 dvn_apitoken=ceaee8bb-483c-42c6-841a-f9ad9c39bdb4
 dv_id=2
--- a/src/main/webapp/pages/home.jsp	Mon Jul 18 17:35:32 2016 +0200
+++ b/src/main/webapp/pages/home.jsp	Mon Jul 25 11:14:59 2016 +0200
@@ -301,17 +301,21 @@
 		<form name="homeForm" method="post"
 			action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp">
 			<input name="bean" type="hidden" value="homeBean" />
-	
+			
+			<label class="subTitel">
+				<input type="image"
+					onclick="setAction('forceReloadBranches', 'homeForm');"
+					src="<%=sessionBean.getApplicationBean()
+							.getRefreshImage()%>"
+					width="20" height="20" />
+			</label>
+					
 			<% if (sessionBean.getHomePage().getCompleteBranchList().isEmpty()) { %>
 				<label class="subTitel">You have no task!</label>
 			<% } else { %>
 
 			<div class="subTitel">
-				Your Tasks <input type="image"
-					onclick="setAction('forceReloadBranches', 'homeForm');"
-					src="<%=sessionBean.getApplicationBean()
-							.getRefreshImage()%>"
-					width="20" height="20" />
+				Your Tasks 
 
 				<p class="label">
 					You have