use of io.jmix.core.LoadContext in project jmix by jmix-framework.
the class SingleValueOwningPropertyHolder method loadValue.
protected Object loadValue() {
MetaClass metaClass = getMetadata().getClass(getPropertyInfo().getJavaType());
LoadOptions loadOptions = getLoadOptions();
LoadContext<?> loadContext = new LoadContext<>(metaClass).setId(getEntityId()).setHint(PersistenceHints.SOFT_DELETION, false).setHints(loadOptions.getHints()).setAccessConstraints(loadOptions.getAccessConstraints());
Object value = getDataManager().load(loadContext);
if (value == null) {
getSecurityState(getOwner()).addErasedId(getPropertyInfo().getName(), getEntityId());
}
return value;
}
use of io.jmix.core.LoadContext in project jmix by jmix-framework.
the class ListPrintFormAction method printAll.
protected void printAll() {
ContainerDataUnit unit = (ContainerDataUnit) target.getItems();
CollectionContainer container = unit.getContainer();
if (container instanceof CollectionPropertyContainer) {
// as CollectionPropertyContainer does not have loader it always fetches all records,
// so print these records as selected
printSelected(new HashSet(container.getMutableItems()));
return;
}
CollectionLoader loader = (CollectionLoader) ((HasLoader) unit.getContainer()).getLoader();
MetaClass metaClass = container.getEntityMetaClass();
LoadContext loadContext = loader.createLoadContext();
ParameterPrototype parameterPrototype = new ParameterPrototype(metaClass.getName());
parameterPrototype.setMetaClassName(metaClass.getName());
LoadContext.Query query = loadContext.getQuery();
parameterPrototype.setQueryString(query.getQueryString());
parameterPrototype.setQueryParams(query.getParameters());
parameterPrototype.setCondition(query.getCondition());
parameterPrototype.setSort(query.getSort());
if (!Strings.isNullOrEmpty(loadContext.getFetchPlan().getName())) {
parameterPrototype.setFetchPlanName(loadContext.getFetchPlan().getName());
} else {
parameterPrototype.setFetchPlan(loadContext.getFetchPlan());
}
Window window = ComponentsHelper.getWindowNN(target);
openRunReportScreen(window.getFrameOwner(), parameterPrototype, metaClass);
}
Aggregations