mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
Локальные views для расширенных сущностей. #PL-1872
This commit is contained in:
parent
7408b8e326
commit
d134a6c0f3
@ -10,6 +10,7 @@ import com.haulmont.cuba.core.entity.BaseEntity;
|
||||
import com.haulmont.cuba.core.entity.Entity;
|
||||
import com.haulmont.cuba.core.entity.SoftDelete;
|
||||
import com.haulmont.cuba.core.entity.Updatable;
|
||||
import com.haulmont.cuba.core.global.Metadata;
|
||||
import com.haulmont.cuba.core.global.View;
|
||||
import com.haulmont.cuba.core.global.ViewProperty;
|
||||
import org.apache.commons.lang.ClassUtils;
|
||||
@ -18,6 +19,7 @@ import org.apache.openjpa.persistence.FetchPlan;
|
||||
|
||||
import javax.annotation.ManagedBean;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -31,6 +33,9 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@ManagedBean("cuba_FetchPlanManager")
|
||||
public class FetchPlanManager {
|
||||
|
||||
@Inject
|
||||
private Metadata metadata;
|
||||
|
||||
private Map<View, Set<FetchPlanField>> fetchPlans = new ConcurrentHashMap<View, Set<FetchPlanField>>();
|
||||
|
||||
public void setView(FetchPlan fetchPlan, @Nullable View view) {
|
||||
@ -133,6 +138,10 @@ public class FetchPlanManager {
|
||||
if (hasDeclaredField(entityClass, property))
|
||||
return entityClass;
|
||||
|
||||
Class extendedClass = metadata.getExtendedEntities().getExtendedClass(metadata.getClassNN(entityClass));
|
||||
if (extendedClass != null && hasDeclaredField(extendedClass, property))
|
||||
return extendedClass;
|
||||
|
||||
List<Class> superclasses = ClassUtils.getAllSuperclasses(entityClass);
|
||||
for (int i = 0; i < superclasses.size(); i++) {
|
||||
Class superclass = superclasses.get(i);
|
||||
|
Loading…
Reference in New Issue
Block a user