Search in sources :

Example 1 with ViewBuilder

use of com.haulmont.cuba.core.global.ViewBuilder in project jmix by jmix-framework.

the class CubaFetchPlanRepository method deployDefaultFetchPlan.

@Override
protected FetchPlan deployDefaultFetchPlan(MetaClass metaClass, String name, Set<FetchPlanLoader.FetchPlanInfo> visited) {
    if (View.MINIMAL.equals(name)) {
        Class<? extends Entity> javaClass = metaClass.getJavaClass();
        FetchPlanLoader.FetchPlanInfo info = new FetchPlanLoader.FetchPlanInfo(metaClass, name);
        if (visited.contains(info)) {
            throw new DevelopmentException(String.format("Fetch plans cannot have cyclic references. FetchPlan %s for class %s", name, metaClass.getName()));
        }
        ViewBuilder viewBuilder = (ViewBuilder) fetchPlans.builder(javaClass).name(name);
        addAttributesToInstanceNameFetchPlan(metaClass, viewBuilder, info, visited);
        storeFetchPlan(metaClass, viewBuilder.build());
        return viewBuilder.build();
    }
    return super.deployDefaultFetchPlan(metaClass, name, visited);
}
Also used : FetchPlanLoader(io.jmix.core.impl.FetchPlanLoader) ViewBuilder(com.haulmont.cuba.core.global.ViewBuilder) DevelopmentException(io.jmix.core.DevelopmentException)

Aggregations

ViewBuilder (com.haulmont.cuba.core.global.ViewBuilder)1 DevelopmentException (io.jmix.core.DevelopmentException)1 FetchPlanLoader (io.jmix.core.impl.FetchPlanLoader)1