Revision 45946
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultForeingKey.java | ||
---|---|---|
146 | 146 |
private String tableName; |
147 | 147 |
private String codeName; |
148 | 148 |
private DynObjectValueItem[] availableValues; |
149 |
private boolean loadAvailableValues; |
|
149 | 150 |
private boolean ensureReferentialIntegrity; |
150 | 151 |
private StoresRepository storesRepository = null; |
151 | 152 |
private FeatureAttributeDescriptor descriptor; |
... | ... | |
157 | 158 |
this.codeName = null; |
158 | 159 |
this.labelFormula = null; |
159 | 160 |
this.ensureReferentialIntegrity = false; |
161 |
this.loadAvailableValues = true; |
|
160 | 162 |
} |
161 | 163 |
|
162 | 164 |
public void setDescriptor(FeatureAttributeDescriptor descriptor) { |
... | ... | |
181 | 183 |
public void unbind() { |
182 | 184 |
this.getStoresRepository(); // Force get stores repository |
183 | 185 |
this.descriptor = null; |
184 |
this.availableValues = null; |
|
185 | 186 |
} |
186 | 187 |
|
187 | 188 |
@Override |
... | ... | |
212 | 213 |
@Override |
213 | 214 |
public void setLabelFormula(String labelFormula) { |
214 | 215 |
this.labelFormula = labelFormula; |
216 |
// Force reload available values with new formula |
|
217 |
this.availableValues = null; |
|
218 |
this.loadAvailableValues = true; |
|
215 | 219 |
} |
216 | 220 |
|
217 | 221 |
@Override |
... | ... | |
426 | 430 |
if (!this.isClosedList()) { |
427 | 431 |
return null; |
428 | 432 |
} |
429 |
if (this.availableValues == null) { |
|
433 |
if (this.availableValues == null && this.loadAvailableValues) {
|
|
430 | 434 |
|
431 | 435 |
FeatureStore foreingStore = null; |
432 | 436 |
FeatureSet.DisposableFeatureSetIterable set = null; |
... | ... | |
453 | 457 |
value = code; |
454 | 458 |
} else { |
455 | 459 |
featureSymbolTable.setFeature(feature); |
456 |
value = labelExpression.execute(symbolTable); |
|
460 |
try { |
|
461 |
value = labelExpression.execute(symbolTable); |
|
462 |
} catch (Exception ex) { |
|
463 |
LOGGER.warn("Can't get label from table: "+this.tableName+" with expression: "+labelExpression.getPhrase(), ex); |
|
464 |
values = null; |
|
465 |
break; |
|
466 |
} |
|
457 | 467 |
} |
458 | 468 |
values[n++] = new DynObjectValueItem(code, Objects.toString(value, Objects.toString(code, "##ERROR##"))); |
459 | 469 |
if (n >= MAX_AVAILABLE_VALUES) { |
... | ... | |
465 | 475 |
} catch (Exception ex) { |
466 | 476 |
LOGGER.warn("Can't get available values for field '" + this.getStoreName() + "." + this.getCodeName() + "' from table '" + this.getTableName() + "'.", ex); |
467 | 477 |
} finally { |
478 |
this.loadAvailableValues = false; |
|
468 | 479 |
DisposeUtils.disposeQuietly(set); |
469 |
DisposeUtils.disposeQuietly(foreingStore); |
|
480 |
DisposeUtils.disposeQuietly(foreingStore);
|
|
470 | 481 |
} |
471 | 482 |
} |
472 | 483 |
return this.availableValues; |
Also available in: Unified diff