Mercurial > hg > LGServices
view src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java @ 105:16a0796e3871 default tip
remove "console.log" from general.js
author | Calvin Yeh <cyeh@mpipw-berlin.mpg.com> |
---|---|
date | Fri, 29 Sep 2017 16:18:02 +0200 |
parents | ba9515f22897 |
children |
line wrap: on
line source
package de.mpiwg.gazetteer.utils; import java.util.List; import cl.maps.duplex.DuplexMap; 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 { //############################### private DuplexMap<LGBranch, Long, Long> branchMap = null; protected DuplexMap<LGBranch, Long, Long> getBranchMap(){ if(branchMap == null){ loadBranches(); } return branchMap; } public void loadBranches(){ List<LGBranch> list = DBService.getAllLGBranchFromDB(); this.branchMap = new DuplexMap<LGBranch, Long, Long>(); for(LGBranch item : list){ this.branchMap.put(item.getKey(), item); } } private DuplexMap<LGFile, Long, Long> fileMap = null; protected DuplexMap<LGFile, Long, Long> getFileMap(){ if(fileMap == null){ loadFiles(); } return fileMap; } private void loadFiles(){ List<LGFile> list = DBService.getAllLGFileFromDB(); this.fileMap = new DuplexMap<LGFile, Long, Long>(); for(LGFile file : list){ this.fileMap.put(file.getKey(), file); } } private DuplexMap<LGFullTextSearchFile, Long, Long> fullTextSearchFileMap = null; protected DuplexMap<LGFullTextSearchFile, Long, Long> getFullTextSearchFileMap(){ if(fullTextSearchFileMap == null){ loadFullTextSearchFiles(); } return fullTextSearchFileMap; } public void setFullTextSearchFileMap( DuplexMap<LGFullTextSearchFile, Long, Long> fullTextSearchFileMap) { this.fullTextSearchFileMap = fullTextSearchFileMap; } private void loadFullTextSearchFiles(){ List<LGFullTextSearchFile> list = DBService.getAllLGFullTextSearchFileFromDB(); this.fullTextSearchFileMap = new DuplexMap<LGFullTextSearchFile, Long, Long>(); for(LGFullTextSearchFile file : list){ this.fullTextSearchFileMap.put(file.getKey(), file); } } 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); } } }