comparison src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java @ 43:9dbbbfd474f4

new: 1.existing topic in search result. 2.difference-set of book for topic
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Wed, 23 Dec 2015 16:03:32 +0100
parents ba9515f22897
children 13555aff1f88
comparison
equal deleted inserted replaced
42:815cd86bb9ec 43:9dbbbfd474f4
20 import de.mpiwg.gazetteer.utils.exceptions.NoAuthorizedException; 20 import de.mpiwg.gazetteer.utils.exceptions.NoAuthorizedException;
21 import de.mpiwg.gazetteer.utils.exceptions.VersioningException; 21 import de.mpiwg.gazetteer.utils.exceptions.VersioningException;
22 22
23 public class DataProvider extends AbstractDataProvider{ 23 public class DataProvider extends AbstractDataProvider{
24 24
25 private static Logger logger = Logger.getLogger(DBService.class); 25 private static Logger logger = Logger.getLogger(DataProvider.class);
26 private static DataProvider instance; 26 private static DataProvider instance;
27 27
28 public static DataProvider getInstance(){ 28 public static DataProvider getInstance(){
29 if(instance == null) 29 if(instance == null)
30 instance = new DataProvider(); 30 instance = new DataProvider();
49 49
50 public List<LGFile> getAllFiles(Long branchId){ 50 public List<LGFile> getAllFiles(Long branchId){
51 List<LGFile> list = getFileMap().getValuesByAKey(branchId); 51 List<LGFile> list = getFileMap().getValuesByAKey(branchId);
52 Collections.sort(list); 52 Collections.sort(list);
53 Collections.reverse(list); 53 Collections.reverse(list);
54 return list;
55 }
56
57 public List<LGTopicSectionRelation> getAllExistingTopicSectionRelation() {
58 List<LGTopicSectionRelation> list = new ArrayList<LGTopicSectionRelation>();
59 for (LGTopicSectionRelation relation : getTopicSectionRelationMap().values()) {
60 list.add(relation);
61 }
54 return list; 62 return list;
55 } 63 }
56 64
57 public List<LGBranch> getAllExistingBranches(){ 65 public List<LGBranch> getAllExistingBranches(){
58 List<LGBranch> list = new ArrayList<LGBranch>(); 66 List<LGBranch> list = new ArrayList<LGBranch>();
390 List<LGTopicSectionRelation> topicSectionRelationList = getTopicSectionRelationMap().getValuesByAKey(topicId); 398 List<LGTopicSectionRelation> topicSectionRelationList = getTopicSectionRelationMap().getValuesByAKey(topicId);
391 399
392 // get sections from topicSecionRelation list 400 // get sections from topicSecionRelation list
393 List<DBSection> list = new ArrayList<DBSection>(); 401 List<DBSection> list = new ArrayList<DBSection>();
394 for (LGTopicSectionRelation aRelation : topicSectionRelationList) { 402 for (LGTopicSectionRelation aRelation : topicSectionRelationList) {
395 logger.debug(aRelation.getInfo() ); 403 //logger.debug(aRelation.getInfo() );
396 404
397 DBSection section = DBService.getSectionWithContent(aRelation.getSectionId()); 405 DBSection section = DBService.getSectionWithContent(aRelation.getSectionId());
398 list.add(section); 406 list.add(section);
399 407
400 } 408 }