use of com.haulmont.cuba.core.global.ValueLoadContext in project cuba by cuba-platform.
the class ValueDatasourceDelegate method beforeLoadValues.
protected ValueLoadContext beforeLoadValues(Map<String, Object> params) {
ValueLoadContext context = new ValueLoadContext();
ValueLoadContext.Query q = (ValueLoadContext.Query) ds.createDataQuery(context, params);
if (q == null) {
ds.detachListener(ds.data.values());
ds.data.clear();
return null;
}
if (ds.firstResult > 0)
q.setFirstResult(ds.firstResult);
if (ds.maxResults > 0) {
q.setMaxResults(ds.maxResults);
}
if (storeName != null)
context.setStoreName(storeName);
context.setSoftDeletion(ds.isSoftDeletion());
context.setIdName(idName);
for (MetaProperty property : ds.metaClass.getProperties()) {
context.addProperty(property.getName());
}
ds.dataLoadError = null;
return context;
}
use of com.haulmont.cuba.core.global.ValueLoadContext in project cuba by cuba-platform.
the class ValueDatasourceDelegate method loadData.
protected void loadData(Map<String, Object> params) {
if (ds.needLoading()) {
ValueLoadContext context = beforeLoadValues(params);
if (context == null) {
return;
}
try {
List<KeyValueEntity> entities = ds.dataSupplier.loadValues(context);
afterLoadValues(params, context, entities);
} catch (Throwable e) {
ds.dataLoadError = e;
}
}
}
Aggregations