Revision 47404
Added by Antonis Lempesis almost 7 years ago
LookUpEntryFactory.java | ||
---|---|---|
11 | 11 |
import eu.dnetlib.api.enabling.ISLookUpServiceException; |
12 | 12 |
import eu.dnetlib.domain.DriverResource; |
13 | 13 |
import eu.dnetlib.domain.EPR; |
14 |
import gr.uoa.di.driver.enabling.islookup.cache.CriteriaCacheKey.Mode; |
|
15 |
import gr.uoa.di.driver.enabling.resultset.ResultSet; |
|
16 | 14 |
import gr.uoa.di.driver.enabling.resultset.ResultSetFactory; |
17 | 15 |
import gr.uoa.di.driver.util.ServiceLocator; |
18 | 16 |
|
... | ... | |
30 | 28 |
} else if (key instanceof CriteriaCacheKey) { |
31 | 29 |
CriteriaCacheKey args = (CriteriaCacheKey) key; |
32 | 30 |
String XQuery = args.getXQuery(); |
33 |
Mode mode = args.getMode(); |
|
34 | 31 |
|
35 |
entry = this.getByCriteria(XQuery, mode);
|
|
32 |
entry = this.getByCriteria(XQuery); |
|
36 | 33 |
} else { |
37 | 34 |
logger.warn("key is not id or query"); |
38 | 35 |
logger.warn("key is: " + key + "(" + key.getClass() + ")"); |
... | ... | |
41 | 38 |
return entry; |
42 | 39 |
} |
43 | 40 |
|
44 |
private List<String> getByCriteria(String XQuery, Mode mode) throws ISLookUpServiceException { |
|
45 |
List<String> res = null; |
|
46 |
|
|
47 |
switch (mode) { |
|
48 |
case RS: |
|
49 |
logger.debug("Mode is 'RS'. Performing normal search"); |
|
50 |
EPR epr = lookUpServiceLocator.getService().searchProfile(XQuery); |
|
51 |
ResultSet<String> rs = rsFactory.createResultSet(epr); |
|
52 |
|
|
53 |
if (rs.size() > 0) |
|
54 |
res = rs.get(1, rs.size()); |
|
55 |
else |
|
56 |
res = Collections.emptyList(); |
|
57 |
break; |
|
58 |
case QUICK: |
|
59 |
logger.debug("Mode is 'QUICK'. Performing quick search"); |
|
60 |
res = lookUpServiceLocator.getService().quickSearchProfile(XQuery); |
|
61 |
break; |
|
62 |
} |
|
63 |
|
|
64 |
return res; |
|
41 |
private List<String> getByCriteria(String XQuery) throws ISLookUpServiceException { |
|
42 |
return lookUpServiceLocator.getService().quickSearchProfile(XQuery); |
|
65 | 43 |
} |
66 | 44 |
|
67 | 45 |
private String getById(String key) throws ISLookUpServiceException { |
Also available in: Unified diff
moved to dnet45