/** * INTERNAL: * Return FetchGroup held by the object. */ public FetchGroup getObjectFetchGroup(Object domainObject) { if (domainObject != null) { return ((FetchGroupTracker)domainObject)._persistence_getFetchGroup(); } return null; }
/** * INTERNAL: * Return true if the object is partially fetched and cached. * It applies to the query with fetch group. */ public boolean isPartialObject(Object domainObject) { if (domainObject != null) { FetchGroup fetchGroupInCache = ((FetchGroupTracker)domainObject)._persistence_getFetchGroup(); //if the fetch group reference is not null, it means the object is partial. return (fetchGroupInCache != null); } return false; }
/** * Return true if the attribute of the object has already been fetched */ public boolean isAttributeFetched(Object entity, String attributeName) { FetchGroup fetchGroup = ((FetchGroupTracker) entity)._persistence_getFetchGroup(); if (fetchGroup == null) { return true; } return fetchGroup.containsAttributeInternal(attributeName); }
/** * INTERNAL: * Return if the cached object data is sufficiently valid against a fetch group */ public boolean isObjectValidForFetchGroup(Object object, FetchGroup fetchGroup) { FetchGroup groupInObject = ((FetchGroupTracker)object)._persistence_getFetchGroup(); return (groupInObject == null) || groupInObject.isSupersetOf(fetchGroup); }
/** * If the object has a fetch group then the whole object is read in. */ public static void loadUnfetchedObject(FetchGroupTracker entity) { if(entity._persistence_getFetchGroup() != null) { EntityManagerImpl.processUnfetchedAttribute(entity, null); } }
/** * INTERNAL: * Load/fetch the unfetched object. This method is used by the ClassWaver.. */ public static void processUnfetchedAttribute(FetchGroupTracker entity, String attributeName) { String errorMsg = entity._persistence_getFetchGroup().onUnfetchedAttribute(entity, attributeName); if(errorMsg != null) { throw new IllegalStateException(errorMsg); // cuba: changed to IllegalStateException } }
/** * INTERNAL: * Load/fetch the unfetched object. This method is used by the ClassWeaver. */ public static void processUnfetchedAttributeForSet(FetchGroupTracker entity, String attributeName) { String errorMsg = entity._persistence_getFetchGroup().onUnfetchedAttributeForSet(entity, attributeName); if(errorMsg != null) { throw new IllegalStateException(errorMsg); // cuba: changed to IllegalStateException } }
/** * Return true if the attribute of the object has already been fetched */ public boolean isAttributeFetched(Object object, String attributeName) { FetchGroup fetchgroup = ((FetchGroupTracker)object)._persistence_getFetchGroup(); return (fetchgroup == null) || (fetchgroup.containsAttribute(attributeName)); }
/** * INTERNAL: * Return if the cached object data is sufficiently valid against a fetch group */ public boolean isObjectValidForFetchGroup(Object object, FetchGroup fetchGroup) { FetchGroup groupInObject = ((FetchGroupTracker)object)._persistence_getFetchGroup(); return (groupInObject == null) || groupInObject.isSupersetOf(fetchGroup); }
/** * Return true if the attribute of the object has already been fetched */ public boolean isAttributeFetched(Object entity, String attributeName) { FetchGroup fetchGroup = ((FetchGroupTracker) entity)._persistence_getFetchGroup(); if (fetchGroup == null) { return true; } return fetchGroup.containsAttributeInternal(attributeName); }
/** * INTERNAL: * Union the fetch group of the domain object with the new fetch group. */ public void unionEntityFetchGroupIntoObject(Object source, EntityFetchGroup newEntityFetchGroup, AbstractSession session, boolean shouldClone) { //this order is important as we need to be merging into the target fetchgroup setObjectFetchGroup(source, flatUnionFetchGroups(newEntityFetchGroup, ((FetchGroupTracker)source)._persistence_getFetchGroup(), shouldClone), session); }
/** * INTERNAL: * Copy fetch group reference from the source object to the target */ public void copyFetchGroupInto(Object source, Object target, AbstractSession session) { if (isPartialObject(source)) { setObjectFetchGroup(target, ((FetchGroupTracker)source)._persistence_getFetchGroup(), session); } }
/** * INTERNAL: * Copy fetch group reference from the source object to the target */ public void copyFetchGroupInto(Object source, Object target, AbstractSession session) { if (isPartialObject(source)) { setObjectFetchGroup(target, ((FetchGroupTracker)source)._persistence_getFetchGroup(), session); } }
/** * INTERNAL: * Copy fetch group reference from the source object to the target */ public void copyFetchGroupInto(Object source, Object target, AbstractSession session) { if (isPartialObject(source)) { setObjectFetchGroup(target, ((FetchGroupTracker)source)._persistence_getFetchGroup(), session); } }
/** * INTERNAL: * Union the fetch group of the domain object with the new fetch group. */ public void unionFetchGroupIntoObject(Object source, FetchGroup newFetchGroup, AbstractSession session) { setObjectFetchGroup(source, unionFetchGroups(((FetchGroupTracker)source)._persistence_getFetchGroup(), newFetchGroup), session); }
/** * INTERNAL: * Union the fetch group of the domain object with the new fetch group. */ public void unionEntityFetchGroupIntoObject(Object source, EntityFetchGroup newEntityFetchGroup, AbstractSession session, boolean shouldClone) { //this order is important as we need to be merging into the target fetchgroup setObjectFetchGroup(source, flatUnionFetchGroups(newEntityFetchGroup, ((FetchGroupTracker)source)._persistence_getFetchGroup(), shouldClone), session); }
/** * INTERNAL: * Copy fetch group reference from the source object to the target */ public void copyAggregateFetchGroupInto(Object source, Object target, Object rootEntity, AbstractSession session) { if (isPartialObject(source)) { FetchGroup newGroup = ((FetchGroupTracker)source)._persistence_getFetchGroup().clone(); // must clone because original is linked to orig root newGroup.setRootEntity((FetchGroupTracker) rootEntity); setObjectFetchGroup(target, newGroup, session); } }
/** * INTERNAL: * Copy fetch group reference from the source object to the target */ public void copyAggregateFetchGroupInto(Object source, Object target, Object rootEntity, AbstractSession session) { if (isPartialObject(source)) { FetchGroup newGroup = ((FetchGroupTracker)source)._persistence_getFetchGroup().clone(); // must clone because original is linked to orig root newGroup.setRootEntity((FetchGroupTracker) rootEntity); setObjectFetchGroup(target, newGroup, session); } }
@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)); } }
@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)); } }