Revision 46140
Added by Michele Artini about 7 years ago
DsManagerClient.java | ||
---|---|---|
8 | 8 |
|
9 | 9 |
import org.apache.commons.lang3.StringUtils; |
10 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
11 |
import org.springframework.cache.annotation.CacheEvict; |
|
12 |
import org.springframework.cache.annotation.Cacheable; |
|
11 | 13 |
import org.springframework.stereotype.Component; |
12 | 14 |
import org.springframework.web.client.RestTemplate; |
13 | 15 |
|
... | ... | |
143 | 145 |
ImmutableMap.of("dsId", dsId, "ifaceId", ifaceId)); |
144 | 146 |
} |
145 | 147 |
|
148 |
@Cacheable(cacheNames = "apis_browsable_fields", key = "#root.methodName") |
|
146 | 149 |
public List<BrowsableField> listBrowsableFields() { |
147 | 150 |
return Arrays.asList((new RestTemplate()).getForObject(props.getDatasourceManagerUrl() + "/browse/api/fields", BrowsableField[].class)); |
148 | 151 |
} |
... | ... | |
151 | 154 |
return Arrays.asList((new RestTemplate()).getForObject(props.getDatasourceManagerUrl() + "/browse/api/" + field.trim(), BrowseTerm[].class)); |
152 | 155 |
} |
153 | 156 |
|
157 |
@Cacheable("apis_search") |
|
154 | 158 |
public List<SearchInterfacesEntry> searchInterface(final String field, final String value) { |
155 | 159 |
return Arrays.asList((new RestTemplate()).getForObject( |
156 | 160 |
props.getDatasourceManagerUrl() + "/search/api/" + field.trim(), |
... | ... | |
158 | 162 |
ImmutableMap.of("value", value))); |
159 | 163 |
} |
160 | 164 |
|
165 |
@CacheEvict(value = "apis_search", allEntries = true, beforeInvocation = true) |
|
166 |
public void emptyCache() {} |
|
167 |
|
|
161 | 168 |
} |
Also available in: Unified diff