comparison src/main/java/de/mpiwg/gazetteer/utils/AbstractDataProvider.java @ 0:3e62083dbcbf

First commit. This project comes from LGServer. We removed the framework icefaces. Now, LGServices uses just JSP and jquery.
author "jurzua <jurzua@mpiwg-berlin.mpg.de>"
date Thu, 23 Apr 2015 15:46:01 +0200
parents
children ce2e3f2814c0
comparison
equal deleted inserted replaced
-1:000000000000 0:3e62083dbcbf
1 package de.mpiwg.gazetteer.utils;
2
3 import java.util.List;
4
5 import cl.maps.duplex.DuplexMap;
6 import de.mpiwg.gazetteer.bo.LGBranch;
7 import de.mpiwg.gazetteer.bo.LGFile;
8 import de.mpiwg.gazetteer.bo.SearchRulesFile;
9
10 public class AbstractDataProvider {
11
12
13 //###############################
14
15 private DuplexMap<LGBranch, Long, Long> branchMap = null;
16
17 protected DuplexMap<LGBranch, Long, Long> getBranchMap(){
18 if(branchMap == null){
19 loadBranches();
20 }
21 return branchMap;
22 }
23
24 public void loadBranches(){
25 List<LGBranch> list = DBService.getAllLGBranchFromDB();
26 this.branchMap = new DuplexMap<LGBranch, Long, Long>();
27 for(LGBranch item : list){
28 this.branchMap.put(item.getKey(), item);
29 }
30 }
31
32
33 private DuplexMap<LGFile, Long, Long> fileMap = null;
34
35 protected DuplexMap<LGFile, Long, Long> getFileMap(){
36 if(fileMap == null){
37 loadFiles();
38 }
39 return fileMap;
40 }
41
42
43 private void loadFiles(){
44 List<LGFile> list = DBService.getAllLGFileFromDB();
45 this.fileMap = new DuplexMap<LGFile, Long, Long>();
46 for(LGFile file : list){
47 this.fileMap.put(file.getKey(), file);
48 }
49 }
50 }