Project

General

Profile

« Previous | Next » 

Revision 47404

moved to dnet45

View differences:

CachingISLookUp.java
11 11
import org.apache.log4j.Logger;
12 12

  
13 13
import eu.dnetlib.api.enabling.ISLookUpService;
14
import eu.dnetlib.api.enabling.ISLookUpServiceException;
15 14
import eu.dnetlib.domain.DriverResource;
16
import eu.dnetlib.domain.EPR;
17 15
import eu.dnetlib.domain.SearchCriteria;
18 16
import gr.uoa.di.driver.enabling.ISLookUp;
19 17
import gr.uoa.di.driver.enabling.ISLookUpException;
20
import gr.uoa.di.driver.enabling.islookup.cache.CriteriaCacheKey.Mode;
21 18
import gr.uoa.di.driver.util.ServiceLocator;
22 19
import gr.uoa.di.driver.xml.ResourceToXmlConverter;
23 20

  
......
56 53
			logger.debug("Fetching results for query: " + 
57 54
					converter.toXQueryString(criteria));
58 55
		
59
		CriteriaCacheKey key = new CriteriaCacheKey(criteria, Mode.RS);
56
		CriteriaCacheKey key = new CriteriaCacheKey(criteria);
60 57
		key.setXQuery(converter.toXQueryString(criteria));
61 58
		
62 59
		Element element = criteriaCache.get(key);
......
101 98
			logger.debug("Performing quick search for query: "
102 99
					+ converter.toXQueryString(criteria));
103 100

  
104
		CriteriaCacheKey key = new CriteriaCacheKey(criteria, Mode.QUICK);
101
		CriteriaCacheKey key = new CriteriaCacheKey(criteria);
105 102
		key.setXQuery(converter.toXQueryString(criteria));
106 103
		Element element = criteriaCache.get(key);
107 104

  
......
127 124
			throw new ISLookUpException("More than one results in query");
128 125
	}
129 126

  
130
	@Override
131
	public EPR search(SearchCriteria criteria) throws ISLookUpException {
132
		if (logger.isDebugEnabled())
133
			logger.debug("Performing search for query: " + 
134
					converter.toXQueryString(criteria));
135
		
136
		return this.search(converter.toXQueryString(criteria));
137
	}
138

  
139
	@Override
140
	public EPR search(String XQuery) throws ISLookUpException {
141
		try {
142
			if (logger.isDebugEnabled())
143
				logger.debug("Performing search for query: " + 
144
						XQuery);
145
			
146
			return lookupLocator.getService().searchProfile(XQuery);
147
		} catch (ISLookUpServiceException e) {
148
			throw new ISLookUpException(e);
149
		}
150
	}
151

  
152 127
	public void setLookupLocator(ServiceLocator<ISLookUpService> lookupLocator) {
153 128
		this.lookupLocator = lookupLocator;
154 129
	}

Also available in: Unified diff