Search in sources :

Example 6 with FetchGroupTracker

use of org.eclipse.persistence.queries.FetchGroupTracker in project cuba by cuba-platform.

the class GlobalPersistentAttributesLoadChecker method isLoadedCommonCheck.

protected PropertyLoadedState isLoadedCommonCheck(Object entity, String property) {
    if (entity instanceof BaseGenericIdEntity) {
        BaseGenericIdEntity baseGenericIdEntity = (BaseGenericIdEntity) entity;
        String[] inaccessibleAttributes = BaseEntityInternalAccess.getInaccessibleAttributes(baseGenericIdEntity);
        if (inaccessibleAttributes != null) {
            for (String inaccessibleAttr : inaccessibleAttributes) {
                if (inaccessibleAttr.equals(property))
                    return PropertyLoadedState.NO;
            }
        }
        if (entity instanceof FetchGroupTracker) {
            FetchGroup fetchGroup = ((FetchGroupTracker) entity)._persistence_getFetchGroup();
            if (fetchGroup != null) {
                boolean inFetchGroup = fetchGroup.getAttributeNames().contains(property);
                if (!inFetchGroup) {
                    // definitely not loaded
                    return PropertyLoadedState.NO;
                } else {
                    // requires additional check specific for the tier
                    return PropertyLoadedState.UNKNOWN;
                }
            }
        }
    }
    return PropertyLoadedState.UNKNOWN;
}
Also used : FetchGroupTracker(org.eclipse.persistence.queries.FetchGroupTracker) BaseGenericIdEntity(com.haulmont.cuba.core.entity.BaseGenericIdEntity) FetchGroup(org.eclipse.persistence.queries.FetchGroup)

Aggregations

FetchGroup (org.eclipse.persistence.queries.FetchGroup)6 FetchGroupTracker (org.eclipse.persistence.queries.FetchGroupTracker)6 MetaClass (com.haulmont.chile.core.model.MetaClass)2 MetaProperty (com.haulmont.chile.core.model.MetaProperty)2 BaseGenericIdEntity (com.haulmont.cuba.core.entity.BaseGenericIdEntity)2 Entity (com.haulmont.cuba.core.entity.Entity)1 CubaEntityFetchGroup (com.haulmont.cuba.core.sys.persistence.CubaEntityFetchGroup)1 Method (java.lang.reflect.Method)1 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 ValueHolderInterface (org.eclipse.persistence.indirection.ValueHolderInterface)1 DatabaseField (org.eclipse.persistence.internal.helper.DatabaseField)1 DatabaseValueHolder (org.eclipse.persistence.internal.indirection.DatabaseValueHolder)1 AbstractRecord (org.eclipse.persistence.internal.sessions.AbstractRecord)1 DatabaseMapping (org.eclipse.persistence.mappings.DatabaseMapping)1 Converter (org.eclipse.persistence.mappings.converters.Converter)1 AbstractColumnMapping (org.eclipse.persistence.mappings.foundation.AbstractColumnMapping)1 Session (org.eclipse.persistence.sessions.Session)1