Mercurial > hg > LGServer
view src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java @ 0:7682c04c63a8
First commit of the source code!
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Tue, 10 Mar 2015 14:50:41 +0100 |
parents | |
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.SearchRulesFile; 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); } } }