/** * INTERNAL: * Used to verify whether the specified object is deleted or not. */ public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { if (this.isPrivateOwned()) { Object objects = this.getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = getContainerPolicy(); for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } return true; } }
/** * INTERNAL: * Used to verify whether the specified object is deleted or not. */ @Override public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { if (this.isPrivateOwned() || isCascadeRemove()) { Object objects = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = getContainerPolicy(); for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } return true; }
/** * INTERNAL: * Used to verify whether the specified object is deleted or not. */ @Override public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { if (this.isPrivateOwned() || isCascadeRemove()) { Object objects = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = getContainerPolicy(); for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } return true; }
/** * INTERNAL: * Update the reference objects. */ public void postUpdate(WriteObjectQuery query) throws DatabaseException, OptimisticLockException { if (isReadOnly()) { return; } if (!requiresDataModificationEvents() && !shouldObjectModifyCascadeToParts(query)){ return; } // if the target objects are not instantiated, they could not have been changed.... if (!isAttributeValueInstantiatedOrChanged(query.getObject())) { return; } // manage objects added and removed from the collection Object objectsInMemory = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); Object objectsInDB = readPrivateOwnedForObject(query); compareObjectsAndWrite(objectsInDB, objectsInMemory, query); }
/** * Delete all the reference objects with a single query. */ protected void deleteAll(DeleteObjectQuery query, AbstractSession session) throws DatabaseException { Object attribute = getAttributeValueFromObject(query.getObject()); if (usesIndirection()) { if (!this.indirectionPolicy.objectIsInstantiated(attribute)) { // An empty Vector indicates to DeleteAllQuery that no objects should be removed from cache ((DeleteAllQuery)this.deleteAllQuery).executeDeleteAll(session.getSessionForClass(this.referenceClass), query.getTranslationRow(), new Vector(0)); return; } } Object referenceObjects = getRealCollectionAttributeValueFromObject(query.getObject(), session); // PERF: Avoid delete if empty. if (session.isUnitOfWork() && this.containerPolicy.isEmpty(referenceObjects)) { return; } ((DeleteAllQuery)this.deleteAllQuery).executeDeleteAll(session.getSessionForClass(getReferenceClass()), query.getTranslationRow(), this.containerPolicy.vectorFor(referenceObjects, session)); }
/** * Delete all the reference objects with a single query. */ protected void deleteAll(DeleteObjectQuery query, AbstractSession session) throws DatabaseException { Object attribute = getAttributeValueFromObject(query.getObject()); if (usesIndirection()) { if (!this.indirectionPolicy.objectIsInstantiated(attribute)) { // An empty Vector indicates to DeleteAllQuery that no objects should be removed from cache ((DeleteAllQuery)this.deleteAllQuery).executeDeleteAll(session.getSessionForClass(this.referenceClass), query.getTranslationRow(), new Vector(0)); return; } } Object referenceObjects = getRealCollectionAttributeValueFromObject(query.getObject(), session); // PERF: Avoid delete if empty. if (session.isUnitOfWork() && this.containerPolicy.isEmpty(referenceObjects)) { return; } ((DeleteAllQuery)this.deleteAllQuery).executeDeleteAll(session.getSessionForClass(getReferenceClass()), query.getTranslationRow(), this.containerPolicy.vectorFor(referenceObjects, session)); }
/** * Delete all the reference objects with a single query. */ protected void deleteAll(DeleteObjectQuery query) throws DatabaseException { Object attribute = getAttributeAccessor().getAttributeValueFromObject(query.getObject()); if(usesIndirection()) { if(attribute == null || !getIndirectionPolicy().objectIsInstantiated(attribute)) { // An empty Vector indicates to DeleteAllQuery that no objects should be removed from cache ((DeleteAllQuery)getDeleteAllQuery()).executeDeleteAll(query.getSession().getSessionForClass(getReferenceClass()), query.getTranslationRow(), new Vector(0)); return; } } Object referenceObjects = this.getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); ((DeleteAllQuery)getDeleteAllQuery()).executeDeleteAll(query.getSession().getSessionForClass(getReferenceClass()), query.getTranslationRow(), getContainerPolicy().vectorFor(referenceObjects, query.getSession())); }
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); if (cp.isEmpty(objects)) { return;
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); if (cp.isEmpty(objects)) { return;
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); if (cp.isEmpty(objects)) { return;
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession());
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), session); ContainerPolicy cp = getContainerPolicy(); if (this.isCascadeOnDeleteSetOnDatabase && session.isUnitOfWork()) {
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), session); ContainerPolicy cp = getContainerPolicy(); if (this.isCascadeOnDeleteSetOnDatabase && session.isUnitOfWork()) {
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); } else { ContainerPolicy cp = getContainerPolicy(); Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession()); if (cp.isEmpty(objects)) { return;
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession());
Object objects = getRealCollectionAttributeValueFromObject(query.getObject(), query.getSession());