use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.
the class BatchLookupServiceClientProxy method getBatchDataByText.
@Override
public List<List<ILookupRow<?>>> getBatchDataByText(BatchLookupCall batch) {
BatchSplit split = new BatchSplit(batch);
if (split.getLocalCallCount() > 0) {
BatchLookupResultCache cache = new BatchLookupResultCache();
List<ILookupCall<?>> calls = split.getLocalCalls();
List<List<ILookupRow<?>>> resultArray = new ArrayList<List<ILookupRow<?>>>();
for (ILookupCall<?> call : calls) {
resultArray.add(cache.getDataByText(call));
}
split.setLocalResults(resultArray);
}
if (split.getRemoteCallCount() > 0) {
List<List<ILookupRow<?>>> resultArray = getTargetService().getBatchDataByText(new BatchLookupCall(split.getRemoteCalls()));
split.setRemoteResults(resultArray);
}
return split.getCombinedResults();
}
use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.
the class BatchLookupServiceClientProxy method getBatchDataByRec.
@Override
public List<List<ILookupRow<?>>> getBatchDataByRec(BatchLookupCall batch) {
BatchSplit split = new BatchSplit(batch);
if (split.getLocalCallCount() > 0) {
BatchLookupResultCache cache = new BatchLookupResultCache();
List<ILookupCall<?>> calls = split.getLocalCalls();
List<List<ILookupRow<?>>> resultArray = new ArrayList<List<ILookupRow<?>>>();
for (ILookupCall<?> call : calls) {
resultArray.add(cache.getDataByRec(call));
}
split.setLocalResults(resultArray);
}
if (split.getRemoteCallCount() > 0) {
List<List<ILookupRow<?>>> resultArray = getTargetService().getBatchDataByRec(new BatchLookupCall(split.getRemoteCalls()));
split.setRemoteResults(resultArray);
}
return split.getCombinedResults();
}
use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.
the class BatchLookupServiceClientProxy method getBatchDataByAll.
@Override
public List<List<ILookupRow<?>>> getBatchDataByAll(BatchLookupCall batch) {
BatchSplit split = new BatchSplit(batch);
if (split.getLocalCallCount() > 0) {
BatchLookupResultCache cache = new BatchLookupResultCache();
List<ILookupCall<?>> calls = split.getLocalCalls();
List<List<ILookupRow<?>>> resultArray = new ArrayList<List<ILookupRow<?>>>();
for (ILookupCall<?> call : calls) {
resultArray.add(cache.getDataByAll(call));
}
split.setLocalResults(resultArray);
}
if (split.getRemoteCallCount() > 0) {
List<List<ILookupRow<?>>> resultArray = getTargetService().getBatchDataByAll(new BatchLookupCall(split.getRemoteCalls()));
split.setRemoteResults(resultArray);
}
return split.getCombinedResults();
}
use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.
the class AbstractContentAssistColumn method updateDisplayTexts.
@Override
public void updateDisplayTexts(List<ITableRow> rows) {
try {
if (rows.size() > 0) {
BatchLookupCall batchCall = new BatchLookupCall();
ArrayList<ITableRow> batchRowList = new ArrayList<ITableRow>();
BatchLookupResultCache lookupResultCache = new BatchLookupResultCache();
for (ITableRow row : rows) {
ILookupCall<?> call = prepareLookupCall(row);
if (call != null && call.getKey() != null) {
// split: local vs remote
if (call instanceof LocalLookupCall) {
applyLookupResult(row, lookupResultCache.getDataByKey(call));
} else {
batchRowList.add(row);
batchCall.addLookupCall(call);
}
} else {
applyLookupResult(row, new ArrayList<ILookupRow<?>>(0));
}
}
//
if (!batchCall.isEmpty()) {
ITableRow[] tableRows = batchRowList.toArray(new ITableRow[batchRowList.size()]);
IBatchLookupService service = BEANS.get(IBatchLookupService.class);
List<List<ILookupRow<?>>> resultArray = service.getBatchDataByKey(batchCall);
for (int i = 0; i < tableRows.length; i++) {
applyLookupResult(tableRows[i], resultArray.get(i));
}
}
}
} catch (RuntimeException e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
}
use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.
the class AbstractSmartColumn2 method updateDisplayTexts.
@Override
public void updateDisplayTexts(List<ITableRow> rows) {
try {
if (rows.size() > 0) {
BatchLookupCall batchCall = new BatchLookupCall();
ArrayList<ITableRow> batchRowList = new ArrayList<ITableRow>();
BatchLookupResultCache lookupResultCache = new BatchLookupResultCache();
for (ITableRow row : rows) {
ILookupCall<?> call = prepareLookupCall(row);
if (call != null && call.getKey() != null) {
// split: local vs remote
if (call instanceof LocalLookupCall) {
applyLookupResult(row, lookupResultCache.getDataByKey(call));
} else {
batchRowList.add(row);
batchCall.addLookupCall(call);
}
} else {
applyLookupResult(row, new ArrayList<ILookupRow<?>>(0));
}
}
//
if (!batchCall.isEmpty()) {
ITableRow[] tableRows = batchRowList.toArray(new ITableRow[batchRowList.size()]);
IBatchLookupService service = BEANS.get(IBatchLookupService.class);
List<List<ILookupRow<?>>> resultArray = service.getBatchDataByKey(batchCall);
for (int i = 0; i < tableRows.length; i++) {
applyLookupResult(tableRows[i], resultArray.get(i));
}
}
}
} catch (RuntimeException e) {
BEANS.get(ExceptionHandler.class).handle(e);
}
}
Aggregations