diff src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java @ 41:ba9515f22897

new: topic management and adding sections from searching result into topic
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Thu, 17 Dec 2015 13:44:08 +0100
parents 37840afb7b80
children
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java	Mon Dec 07 17:06:57 2015 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java	Thu Dec 17 13:44:08 2015 +0100
@@ -6,6 +6,8 @@
 import de.mpiwg.gazetteer.bo.LGBranch;
 import de.mpiwg.gazetteer.bo.LGFile;
 import de.mpiwg.gazetteer.bo.LGFullTextSearchFile;
+import de.mpiwg.gazetteer.bo.LGTopic;
+import de.mpiwg.gazetteer.bo.LGTopicSectionRelation;
 
 public class AbstractDataProvider {
 
@@ -73,4 +75,48 @@
 	}
 	
 	
+	
+	private DuplexMap<LGTopic, Long, Long> topicMap = null;
+	
+	public void setTopicMap(DuplexMap<LGTopic, Long, Long> topicMap) {
+		this.topicMap = topicMap;
+	}
+
+	protected DuplexMap<LGTopic, Long, Long> getTopicMap(){
+		if(topicMap == null){
+			loadTopics();
+		}
+		return topicMap;
+	}
+	
+	public void loadTopics(){
+		List<LGTopic> list = DBService.getAllLGTopicFromDB();
+		this.topicMap = new DuplexMap<LGTopic, Long, Long>();
+		for(LGTopic item : list){
+			this.topicMap.put(item.getKey(), item);
+		}
+	}
+	
+
+	private DuplexMap<LGTopicSectionRelation, Long, Long> topicSectionRelationMap = null;
+	
+	public void setTopicSectionRelationMap(DuplexMap<LGTopicSectionRelation, Long, Long> topicSectionRelationMap) {
+		this.topicSectionRelationMap = topicSectionRelationMap;
+	}
+
+	protected DuplexMap<LGTopicSectionRelation, Long, Long> getTopicSectionRelationMap(){
+		if(topicSectionRelationMap == null){
+			loadTopicSectionRelations();
+		}
+		return topicSectionRelationMap;
+	}
+	
+	public void loadTopicSectionRelations(){
+		List<LGTopicSectionRelation> list = DBService.getAllLGTopicSectionRelationFromDB();
+		this.topicSectionRelationMap = new DuplexMap<LGTopicSectionRelation, Long, Long>();
+		for(LGTopicSectionRelation item : list){
+			this.topicSectionRelationMap.put(item.getKey(), item);
+		}
+	}
+	
 }