Search in sources :

Example 6 with BatchLookupResultCache

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByText.

@Override
public List<List<ILookupRow<?>>> getBatchDataByText(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByText(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 7 with BatchLookupResultCache

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByAll.

@Override
public List<List<ILookupRow<?>>> getBatchDataByAll(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByAll(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 8 with BatchLookupResultCache

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache in project scout.rt by eclipse.

the class BatchLookupServiceClientProxy method getBatchDataByKey.

@Override
public List<List<ILookupRow<?>>> getBatchDataByKey(BatchLookupCall batch) {
    List<ILookupCall<?>> allCalls = batch.getCallBatch();
    List<ILookupCall<?>> cleanCalls = new ArrayList<ILookupCall<?>>(allCalls.size());
    // set calls with key==null to null
    for (ILookupCall<?> call : allCalls) {
        if (call != null && call.getKey() == null) {
            cleanCalls.add(null);
        } else {
            cleanCalls.add(call);
        }
    }
    BatchSplit split = new BatchSplit(cleanCalls);
    if (split.getLocalCallCount() > 0) {
        BatchLookupResultCache cache = new BatchLookupResultCache();
        List<ILookupCall<?>> calls = split.getLocalCalls();
        List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
        for (ILookupCall<?> call : calls) {
            result.add(cache.getDataByKey(call));
        }
        split.setLocalResults(result);
    }
    if (split.getRemoteCallCount() > 0) {
        BatchLookupNormalizer normalizer = new BatchLookupNormalizer();
        List<ILookupCall<?>> normCallArray = normalizer.normalizeCalls(split.getRemoteCalls());
        List<List<ILookupRow<?>>> normResultArray = getTargetService().getBatchDataByKey(new BatchLookupCall(normCallArray));
        List<List<ILookupRow<?>>> resultArray = normalizer.denormalizeResults(normResultArray);
        split.setRemoteResults(resultArray);
    }
    List<List<ILookupRow<?>>> results = split.getCombinedResults();
    // set null results to empty list
    for (int i = 0; i < results.size(); i++) {
        if (results.get(i) == null) {
            List<ILookupRow<?>> emptyList = CollectionUtility.emptyArrayList();
            results.set(i, emptyList);
        }
    }
    return results;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) BatchLookupCall(org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupNormalizer(org.eclipse.scout.rt.shared.services.lookup.BatchLookupNormalizer) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 9 with BatchLookupResultCache

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByKey.

@Override
public List<List<ILookupRow<?>>> getBatchDataByKey(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByKey(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Example 10 with BatchLookupResultCache

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache in project scout.rt by eclipse.

the class BatchLookupService method getBatchDataByRec.

@Override
public List<List<ILookupRow<?>>> getBatchDataByRec(BatchLookupCall batch) {
    List<ILookupCall<?>> calls = batch.getCallBatch();
    List<List<ILookupRow<?>>> result = new ArrayList<List<ILookupRow<?>>>();
    BatchLookupResultCache cache = new BatchLookupResultCache();
    for (ILookupCall<?> call : calls) {
        result.add(new ArrayList<ILookupRow<?>>(cache.getDataByRec(call)));
    }
    return result;
}
Also used : ILookupRow(org.eclipse.scout.rt.shared.services.lookup.ILookupRow) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) BatchLookupResultCache(org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache) ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall)

Aggregations

ArrayList (java.util.ArrayList)10 List (java.util.List)10 BatchLookupResultCache (org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache)10 ILookupRow (org.eclipse.scout.rt.shared.services.lookup.ILookupRow)10 ILookupCall (org.eclipse.scout.rt.shared.services.lookup.ILookupCall)8 BatchLookupCall (org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall)6 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)2 IBatchLookupService (org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService)2 LocalLookupCall (org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall)2 BatchLookupNormalizer (org.eclipse.scout.rt.shared.services.lookup.BatchLookupNormalizer)1