use of org.eclipse.persistence.queries.FetchGroup in project cuba by cuba-platform.
the class FetchGroupManager method setView.
public void setView(JpaQuery query, String queryString, @Nullable View view, boolean singleResultExpected) {
Preconditions.checkNotNullArgument(query, "query is null");
if (view != null) {
AttributeGroup ag = view.loadPartialEntities() ? new FetchGroup() : new LoadGroup();
applyView(query, queryString, ag, view, singleResultExpected);
} else {
query.setHint(QueryHints.FETCH_GROUP, null);
}
}
use of org.eclipse.persistence.queries.FetchGroup in project cuba by cuba-platform.
the class EclipseLinkDescriptorEventListener method postRefresh.
@Override
public void postRefresh(DescriptorEvent event) {
if (event.getObject() instanceof FetchGroupTracker) {
FetchGroupTracker entity = (FetchGroupTracker) event.getObject();
FetchGroup fetchGroup = entity._persistence_getFetchGroup();
if (fetchGroup != null && !(fetchGroup instanceof CubaEntityFetchGroup))
entity._persistence_setFetchGroup(new CubaEntityFetchGroup(fetchGroup));
}
}
use of org.eclipse.persistence.queries.FetchGroup in project cuba by cuba-platform.
the class EclipseLinkDescriptorEventListener method postBuild.
@Override
public void postBuild(DescriptorEvent event) {
if (event.getObject() instanceof BaseGenericIdEntity) {
BaseEntityInternalAccess.setNew((BaseGenericIdEntity) event.getObject(), false);
}
if (event.getObject() instanceof FetchGroupTracker) {
FetchGroupTracker entity = (FetchGroupTracker) event.getObject();
FetchGroup fetchGroup = entity._persistence_getFetchGroup();
if (fetchGroup != null && !(fetchGroup instanceof CubaEntityFetchGroup))
entity._persistence_setFetchGroup(new CubaEntityFetchGroup(fetchGroup));
}
}
use of org.eclipse.persistence.queries.FetchGroup 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;
}
Aggregations