use of org.eclipse.scout.rt.platform.exception.VetoException in project scout.rt by eclipse.
the class AbstractSmartField2 method handleMissingLookupRow.
protected VALUE handleMissingLookupRow(String text) {
doSearch(text, false, true);
IContentAssistFieldDataFetchResult<VALUE> fetchResult = getLookupRowFetcher().getResult();
int numResults = 0;
if (fetchResult != null && fetchResult.getLookupRows() != null) {
numResults = fetchResult.getLookupRows().size();
if (numResults == 1) {
ILookupRow<VALUE> singleMatchLookupRow = CollectionUtility.firstElement(fetchResult.getLookupRows());
setLookupRow(singleMatchLookupRow);
return returnLookupRowAsValue(singleMatchLookupRow);
}
}
boolean notUnique = numResults > 1;
VetoException veto = new VetoException(TEXTS.get(notUnique ? "SmartFieldNotUnique" : "SmartFieldCannotComplete", text));
veto.withCode(notUnique ? NOT_UNIQUE_ERROR_CODE : NO_RESULTS_ERROR_CODE);
throw veto;
}
Aggregations