Line 141... |
Line 141... |
141 |
final SQLRowValues res = this.getValues(id);
|
141 |
final SQLRowValues res = this.getValues(id);
|
142 |
return res == null ? null : createItem(res);
|
142 |
return res == null ? null : createItem(res);
|
143 |
}
|
143 |
}
|
144 |
|
144 |
|
145 |
public final List<IComboSelectionItem> getComboItems() {
|
145 |
public final List<IComboSelectionItem> getComboItems() {
|
- |
|
146 |
return this.getComboItems(true);
|
- |
|
147 |
}
|
- |
|
148 |
|
- |
|
149 |
public final List<IComboSelectionItem> getComboItems(final boolean readCache) {
|
146 |
if (this.comboFields.isEmpty())
|
150 |
if (this.comboFields.isEmpty())
|
147 |
throw new IllegalStateException("La liste des items listitems est vide!! Ils faut utiliser addComboItem...");
|
151 |
throw new IllegalStateException("La liste des items listitems est vide!! Ils faut utiliser addComboItem...");
|
148 |
|
152 |
|
149 |
// freeze the fetcher otherwise it will change with the filter
|
153 |
// freeze the fetcher otherwise it will change with the filter
|
150 |
// and that will cause the cache to fail
|
154 |
// and that will cause the cache to fail
|
151 |
final SQLRowValuesListFetcher comboSelect = this.getFetcher(null).freeze();
|
155 |
final SQLRowValuesListFetcher comboSelect = this.getFetcher(null).freeze();
|
152 |
|
156 |
|
153 |
final CacheKey cacheKey = new CacheKey(comboSelect, this.fieldSeparator, this.undefLabel, this.customizeItem);
|
157 |
final CacheKey cacheKey = new CacheKey(comboSelect, this.fieldSeparator, this.undefLabel, this.customizeItem);
|
- |
|
158 |
if (readCache) {
|
154 |
final CacheResult<List<IComboSelectionItem>> l = cache.check(cacheKey);
|
159 |
final CacheResult<List<IComboSelectionItem>> l = cache.check(cacheKey);
|
155 |
if (l.getState() == CacheResult.State.INTERRUPTED)
|
160 |
if (l.getState() == CacheResult.State.INTERRUPTED)
|
156 |
throw new RTInterruptedException("interrupted while waiting for the cache");
|
161 |
throw new RTInterruptedException("interrupted while waiting for the cache");
|
157 |
else if (l.getState() == CacheResult.State.VALID)
|
162 |
else if (l.getState() == CacheResult.State.VALID)
|
158 |
return l.getRes();
|
163 |
return l.getRes();
|
- |
|
164 |
}
|
159 |
|
165 |
|
160 |
try {
|
166 |
try {
|
161 |
final List<IComboSelectionItem> result = new ArrayList<IComboSelectionItem>();
|
167 |
final List<IComboSelectionItem> result = new ArrayList<IComboSelectionItem>();
|
- |
|
168 |
// SQLRowValuesListFetcher don't cache
|
162 |
for (final SQLRowValues vals : comboSelect.fetch()) {
|
169 |
for (final SQLRowValues vals : comboSelect.fetch()) {
|
163 |
if (Thread.currentThread().isInterrupted())
|
170 |
if (Thread.currentThread().isInterrupted())
|
164 |
throw new RTInterruptedException("interrupted in fill");
|
171 |
throw new RTInterruptedException("interrupted in fill");
|
165 |
result.add(createItem(vals));
|
172 |
result.add(createItem(vals));
|
166 |
}
|
173 |
}
|