/** * INTERNAL: * Extract the reference pk for rvh usage in remote model. */ public Vector extractPrimaryKeysForReferenceObject(Object domainObject, AbstractSession session) { return this.indirectionPolicy.extractPrimaryKeyForReferenceObject(getAttributeValueFromObject(domainObject), session); }
/** * INTERNAL: * Extract the reference pk for rvh usage in remote model. */ public Object extractPrimaryKeysForReferenceObject(Object domainObject, AbstractSession session) { return this.indirectionPolicy.extractPrimaryKeyForReferenceObject(getAttributeValueFromObject(domainObject), session); }
/** * INTERNAL: * Extract the reference pk for rvh usage in remote model. */ public Object extractPrimaryKeysForReferenceObject(Object domainObject, AbstractSession session) { return this.indirectionPolicy.extractPrimaryKeyForReferenceObject(getAttributeValueFromObject(domainObject), session); }
/** * INTERNAL: * Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSet */ @Override public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) { // if the object is not instantiated, do not instantiate or cascade Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { Object realValue = getRealAttributeValueFromObject(object, uow); if (!visitedObjects.containsKey(realValue)){ visitedObjects.put(realValue, realValue); // remove private owned object from UnitOfWork ChangeSet uow.performRemovePrivateOwnedObjectFromChangeSet(realValue, visitedObjects); } } }
/** * INTERNAL: * Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSet */ public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) { // if the object is not instantiated, do not instantiate or cascade Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { Object realValue = getRealAttributeValueFromObject(object, uow); if (!visitedObjects.containsKey(realValue)){ visitedObjects.put(realValue, realValue); // remove private owned object from UnitOfWork ChangeSet uow.performRemovePrivateOwnedObjectFromChangeSet(realValue, visitedObjects); } } }
/** * INTERNAL: * Cascade removal of orphaned private owned objects from the UnitOfWorkChangeSet */ @Override public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) { // if the object is not instantiated, do not instantiate or cascade Object attributeValue = getAttributeValueFromObject(object); if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { Object realValue = getRealAttributeValueFromObject(object, uow); if (!visitedObjects.containsKey(realValue)){ visitedObjects.put(realValue, realValue); // remove private owned object from UnitOfWork ChangeSet uow.performRemovePrivateOwnedObjectFromChangeSet(realValue, visitedObjects); } } }
/** * INTERNAL: * Cascade remove through mappings that require the cascade. * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!isCascadeRemove()) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null) { if (getAttributeValueFromObject) { attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } if (attributeValue != null && (! visitedObjects.containsKey(attributeValue)) ){ visitedObjects.put(attributeValue, attributeValue); uow.performRemove(attributeValue, visitedObjects); } } }
/** * INTERNAL: * Cascade remove through mappings that require the cascade. * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!this.cascadeRemove) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null) { if (getAttributeValueFromObject) { attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } if (attributeValue != null && (! visitedObjects.containsKey(attributeValue)) ){ visitedObjects.put(attributeValue, attributeValue); if (this.isCascadeOnDeleteSetOnDatabase && !hasRelationTableMechanism()) { uow.getCascadeDeleteObjects().add(attributeValue); } uow.performRemove(attributeValue, visitedObjects); } } }
/** * INTERNAL: * Cascade remove through mappings that require the cascade. * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadePerformRemoveIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!this.cascadeRemove) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null) { if (getAttributeValueFromObject) { attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } if (attributeValue != null && (! visitedObjects.containsKey(attributeValue)) ){ visitedObjects.put(attributeValue, attributeValue); if (this.isCascadeOnDeleteSetOnDatabase && !hasRelationTableMechanism()) { uow.getCascadeDeleteObjects().add(attributeValue); } uow.performRemove(attributeValue, visitedObjects); } } }
Object backUpAttribute = null; cloneAttribute = getAttributeValueFromObject(clone); backUpAttribute = getAttributeValueFromObject(backUp); if ((backUpAttribute == null) && (cloneAttribute == null)) { return null;
Object backUpAttribute = null; cloneAttribute = getAttributeValueFromObject(clone); backUpAttribute = getAttributeValueFromObject(backUp); if ((backUpAttribute == null) && (cloneAttribute == null)) { return null;
Object backUpAttribute = null; cloneAttribute = getAttributeValueFromObject(clone); backUpAttribute = getAttributeValueFromObject(backUp); if ((backUpAttribute == null) && (cloneAttribute == null)) { return null;
/** * INTERNAL: * Record deletion dependencies for foreign key constraints. * This is used during deletion to resolve deletion cycles. */ @Override public void earlyPreDelete(DeleteObjectQuery query, Object object) { AbstractSession session = query.getSession(); // Avoid instantiating objects. Object attributeValue = getAttributeValueFromObject(object); Object targetObject = null; if (!this.indirectionPolicy.objectIsInstantiated(attributeValue) && !this.indirectionPolicy.objectIsEasilyInstantiated(attributeValue)) { AbstractRecord referenceRow = this.indirectionPolicy.extractReferenceRow(attributeValue); targetObject = this.selectionQuery.checkEarlyReturn(session, referenceRow); } else { targetObject = getRealAttributeValueFromAttribute(attributeValue, object, session); } UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)session; if ((targetObject != null) && unitOfWork.getDeletedObjects().containsKey(targetObject)) { unitOfWork.addDeletionDependency(targetObject, object); } }
/** * INTERNAL: * Cascade discover and persist new objects during commit. */ public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set cascadeErrors) { Object attributeValue = null; if (getAttributeValueFromObject){ attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } // remove private owned object from uow list if (isCandidateForPrivateOwnedRemoval()) { uow.removePrivateOwnedObject(this, attributeValue); } uow.discoverAndPersistUnregisteredNewObjects(attributeValue, isCascadePersist(), newObjects, unregisteredExistingObjects, visitedObjects, cascadeErrors); } }
/** * INTERNAL: * Record deletion dependencies for foreign key constraints. * This is used during deletion to resolve deletion cycles. */ @Override public void earlyPreDelete(DeleteObjectQuery query, Object object) { AbstractSession session = query.getSession(); // Avoid instantiating objects. Object attributeValue = getAttributeValueFromObject(object); Object targetObject = null; if (!this.indirectionPolicy.objectIsInstantiated(attributeValue) && !this.indirectionPolicy.objectIsEasilyInstantiated(attributeValue)) { AbstractRecord referenceRow = this.indirectionPolicy.extractReferenceRow(attributeValue); targetObject = this.selectionQuery.checkEarlyReturn(session, referenceRow); } else { targetObject = getRealAttributeValueFromAttribute(attributeValue, object, session); } UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)session; if ((targetObject != null) && unitOfWork.getDeletedObjects().containsKey(targetObject)) { unitOfWork.addDeletionDependency(targetObject, object); } }
/** * INTERNAL: * Cascade discover and persist new objects during commit. */ public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject, Set cascadeErrors) { Object attributeValue = null; if (getAttributeValueFromObject){ attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } // remove private owned object from uow list if (isCandidateForPrivateOwnedRemoval()) { uow.removePrivateOwnedObject(this, attributeValue); } uow.discoverAndPersistUnregisteredNewObjects(attributeValue, isCascadePersist(), newObjects, unregisteredExistingObjects, visitedObjects, cascadeErrors); } }
/** * INTERNAL: * Cascade discover and persist new objects during commit. */ public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, boolean getAttributeValueFromObject) { Object attributeValue = null; if (getAttributeValueFromObject){ attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if (attributeValue != null && this.indirectionPolicy.objectIsInstantiated(attributeValue)) { if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } // remove private owned object from uow list if (isCandidateForPrivateOwnedRemoval()) { uow.removePrivateOwnedObject(this, attributeValue); } uow.discoverAndPersistUnregisteredNewObjects(attributeValue, isCascadePersist(), newObjects, unregisteredExistingObjects, visitedObjects); } }
/** * INTERNAL: * Cascade registerNew for Create through mappings that require the cascade * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!isCascadePersist()) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if ((attributeValue != null) && this.indirectionPolicy.objectIsInstantiated(attributeValue)){ if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } uow.registerNewObjectForPersist(attributeValue, visitedObjects); // add private owned object to uow list if mapping is a candidate and uow should discover new objects and the source object is new. if (isCandidateForPrivateOwnedRemoval() && uow.shouldDiscoverNewObjects() && attributeValue != null && uow.isObjectNew(object)) { uow.addPrivateOwnedObject(this, attributeValue); } } }
/** * INTERNAL: * Cascade registerNew for Create through mappings that require the cascade * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!isCascadePersist()) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if ((attributeValue != null) // no need to check for new as persist must be cascaded. && (this.indirectionPolicy.objectIsInstantiated(attributeValue) || uow.isCloneNewObject(object))) { if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } uow.registerNewObjectForPersist(attributeValue, visitedObjects); // add private owned object to uow list if mapping is a candidate and uow should discover new objects and the source object is new. if (isCandidateForPrivateOwnedRemoval() && uow.shouldDiscoverNewObjects() && (attributeValue != null) && uow.isCloneNewObject(object)) { uow.addPrivateOwnedObject(this, attributeValue); } } }
/** * INTERNAL: * Cascade registerNew for Create through mappings that require the cascade * @param object is either the source object, or attribute value if getAttributeValueFromObject is true. */ public void cascadeRegisterNewIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects, boolean getAttributeValueFromObject) { if (!isCascadePersist()) { return; } Object attributeValue = null; if (getAttributeValueFromObject) { attributeValue = getAttributeValueFromObject(object); } else { attributeValue = object; } if ((attributeValue != null) // no need to check for new as persist must be cascaded. && (this.indirectionPolicy.objectIsInstantiated(attributeValue) || uow.isCloneNewObject(object))) { if (getAttributeValueFromObject){ attributeValue = this.indirectionPolicy.getRealAttributeValueFromObject(object, attributeValue); } uow.registerNewObjectForPersist(attributeValue, visitedObjects); // add private owned object to uow list if mapping is a candidate and uow should discover new objects and the source object is new. if (isCandidateForPrivateOwnedRemoval() && uow.shouldDiscoverNewObjects() && (attributeValue != null) && uow.isCloneNewObject(object)) { uow.addPrivateOwnedObject(this, attributeValue); } } }