Mercurial > hg > IndexMetaContextualizer
comparison src/main/java/de/mpiwg/indexmeta/services/DataProvider.java @ 7:bc57f2660b0f
implementation of web service
author | Jorge Urzua <jurzua@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 12 Apr 2013 17:48:42 +0200 |
parents | |
children | 9ce7979fd037 |
comparison
equal
deleted
inserted
replaced
5:7d231e4e86e5 | 7:bc57f2660b0f |
---|---|
1 package de.mpiwg.indexmeta.services; | |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.List; | |
5 | |
6 import org.apache.log4j.Logger; | |
7 | |
8 import de.mpiwg.indexmeta.bo.Contextualization; | |
9 | |
10 public class DataProvider { | |
11 | |
12 protected static Logger logger = Logger.getLogger(DataProvider.class); | |
13 | |
14 public DataProvider(){ | |
15 logger.info("Starting DataProvider *********"); | |
16 } | |
17 | |
18 private PersistentService ps = new PersistentService(); | |
19 | |
20 public List<Contextualization> getCtxByIndexMetaId(String indexMetaId){ | |
21 //QuadKey(indexMetaId, type, remoteId, id) | |
22 return ps.getCtxMap().getValuesByFirstKey(indexMetaId); | |
23 } | |
24 | |
25 public List<Contextualization> getCtxByType(String type){ | |
26 //QuadKey(indexMetaId, type, remoteId, id) | |
27 return ps.getCtxMap().getValuesBySecondKey(type); | |
28 } | |
29 | |
30 public List<Contextualization> getCtxByRemoteId(String remoteId){ | |
31 //QuadKey(indexMetaId, type, remoteId, id) | |
32 return ps.getCtxMap().getValuesByThirdKey(remoteId); | |
33 } | |
34 | |
35 public List<Contextualization> getCtx(String indexMetaId, String elementId){ | |
36 List<Contextualization> rs = new ArrayList<Contextualization>(); | |
37 | |
38 for(Contextualization ctx : ps.getCtxMap().getValuesByFirstKey(indexMetaId)){ | |
39 if(ctx.getElementId().equals(elementId)){ | |
40 rs.add(ctx); | |
41 } | |
42 } | |
43 return rs; | |
44 } | |
45 | |
46 public Contextualization getCtx(Long id){ | |
47 return ps.getCtxMap().getValuesByOwnKey(id); | |
48 } | |
49 | |
50 public void saveCtx(Contextualization ctx){ | |
51 ps.saveCtx(ctx); | |
52 } | |
53 | |
54 } |