/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if (isPrivateOwned()) {// Must check ownership for uow and cascading. if (!query.shouldCascadeOnlyDependentParts()) { containerPolicy.deleteWrappedObject(objectDeleted, query.getSession()); } } }
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if (isPrivateOwned()) {// Must check ownership for uow and cascading. if (!query.shouldCascadeOnlyDependentParts()) { containerPolicy.deleteWrappedObject(objectDeleted, query.getSession()); } } }
/** * INTERNAL: * An object was removed to the collection during an update, delete it if private. */ protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException { if (isPrivateOwned()) {// Must check ownership for uow and cascading. if (!query.shouldCascadeOnlyDependentParts()) { containerPolicy.deleteWrappedObject(objectDeleted, query.getSession()); } } }
/** * INTERNAL: * Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes * as apposed to detected changes. If an attribute can not be change tracked it's * changes can be detected through this process. */ public void calculateDeferredChanges(ChangeRecord changeRecord, AbstractSession session) { CollectionChangeRecord collectionRecord = (CollectionChangeRecord)changeRecord; // TODO: Handle events that fired after collection was replaced. compareCollectionsForChange(collectionRecord.getOriginalCollection(), collectionRecord.getLatestCollection(), collectionRecord, session); if(this.isPrivateOwned()) { postCalculateChanges(collectionRecord, (UnitOfWorkImpl)session); } }
/** * INTERNAL: * Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes * as apposed to detected changes. If an attribute can not be change tracked it's * changes can be detected through this process. */ @Override public void calculateDeferredChanges(ChangeRecord changeRecord, AbstractSession session) { CollectionChangeRecord collectionRecord = (CollectionChangeRecord)changeRecord; // TODO: Handle events that fired after collection was replaced. compareCollectionsForChange(collectionRecord.getOriginalCollection(), collectionRecord.getLatestCollection(), collectionRecord, session); if(this.isPrivateOwned()) { postCalculateChanges(collectionRecord, (UnitOfWorkImpl)session); } }
/** * INTERNAL: * Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes * as apposed to detected changes. If an attribute can not be change tracked it's * changes can be detected through this process. */ @Override public void calculateDeferredChanges(ChangeRecord changeRecord, AbstractSession session) { CollectionChangeRecord collectionRecord = (CollectionChangeRecord)changeRecord; // TODO: Handle events that fired after collection was replaced. compareCollectionsForChange(collectionRecord.getOriginalCollection(), collectionRecord.getLatestCollection(), collectionRecord, session); if(this.isPrivateOwned()) { postCalculateChanges(collectionRecord, (UnitOfWorkImpl)session); } }
/** * INTERNAL: * We are not using a remote valueholder * so we need to replace the reference object(s) with * the corresponding object(s) from the remote session. */ public void fixRealObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, RemoteSession session) { //bug 4147755 getRealAttribute... / setReal Object attributeValue = getRealAttributeValueFromObject(object, session); // the object collection could be null, check here to avoid NPE if (attributeValue == null) { setAttributeValueInObject(object, null); return; } ObjectLevelReadQuery tempQuery = query; if (!tempQuery.shouldMaintainCache()) { if ((!tempQuery.shouldCascadeParts()) || (tempQuery.shouldCascadePrivateParts() && (!isPrivateOwned()))) { tempQuery = null; } } Object remoteAttributeValue = session.getObjectsCorrespondingToAll(attributeValue, objectDescriptors, processedObjects, tempQuery, this.containerPolicy); setRealAttributeValueInObject(object, remoteAttributeValue); }
/** * INTERNAL: * We are not using a remote valueholder * so we need to replace the reference object(s) with * the corresponding object(s) from the remote session. */ @Override public void fixRealObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession session) { //bug 4147755 getRealAttribute... / setReal Object attributeValue = getRealAttributeValueFromObject(object, session); // the object collection could be null, check here to avoid NPE if (attributeValue == null) { setAttributeValueInObject(object, null); return; } ObjectLevelReadQuery tempQuery = query; if (!tempQuery.shouldMaintainCache()) { if ((!tempQuery.shouldCascadeParts()) || (tempQuery.shouldCascadePrivateParts() && (!isPrivateOwned()))) { tempQuery = null; } } Object remoteAttributeValue = session.getObjectsCorrespondingToAll(attributeValue, objectDescriptors, processedObjects, tempQuery, this.containerPolicy); setRealAttributeValueInObject(object, remoteAttributeValue); }
/** * INTERNAL: * We are not using a remote valueholder * so we need to replace the reference object(s) with * the corresponding object(s) from the remote session. */ @Override public void fixRealObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession session) { //bug 4147755 getRealAttribute... / setReal Object attributeValue = getRealAttributeValueFromObject(object, session); // the object collection could be null, check here to avoid NPE if (attributeValue == null) { setAttributeValueInObject(object, null); return; } ObjectLevelReadQuery tempQuery = query; if (!tempQuery.shouldMaintainCache()) { if ((!tempQuery.shouldCascadeParts()) || (tempQuery.shouldCascadePrivateParts() && (!isPrivateOwned()))) { tempQuery = null; } } Object remoteAttributeValue = session.getObjectsCorrespondingToAll(attributeValue, objectDescriptors, processedObjects, tempQuery, this.containerPolicy); setRealAttributeValueInObject(object, remoteAttributeValue); }
if (m_deleteAll != null && mapping.isPrivateOwned()) { mapping.setMustDeleteReferenceObjectsOneByOne(! m_deleteAll);
/** * INTERNAL: * Copy of the attribute of the object. * This is NOT used for unit of work but for templatizing an object. */ public void buildCopy(Object copy, Object original, ObjectCopyingPolicy policy) { Object attributeValue = getRealCollectionAttributeValueFromObject(original, policy.getSession()); Object valuesIterator = this.containerPolicy.iteratorFor(attributeValue); attributeValue = this.containerPolicy.containerInstance(this.containerPolicy.sizeFor(attributeValue)); while (this.containerPolicy.hasNext(valuesIterator)) { Object originalValue = this.containerPolicy.next(valuesIterator, policy.getSession()); Object copyValue = originalValue; if (policy.shouldCascadeAllParts() || (policy.shouldCascadePrivateParts() && isPrivateOwned())) { copyValue = policy.getSession().copyObject(originalValue, policy); } else { // Check for backrefs to copies. copyValue = policy.getCopies().get(originalValue); if (copyValue == null) { copyValue = originalValue; } } this.containerPolicy.addInto(copyValue, attributeValue, policy.getSession()); } setRealAttributeValueInObject(copy, attributeValue); }
/** * INTERNAL: * Checks if object is deleted from the database or not. */ public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { // Row is built for translation if (isReadOnly()) { return true; } if (isPrivateOwned()) { Object objects = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = this.containerPolicy; for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } AbstractRecord row = getDescriptor().getObjectBuilder().buildRowForTranslation(object, session); //cr 3819 added the line below to fix the translationtable to ensure that it // contains the required values prepareTranslationRow(row, object, session); Object value = session.executeQuery(getSelectionQuery(), row); return this.containerPolicy.isEmpty(value); }
/** * INTERNAL: * Checks if object is deleted from the database or not. */ @Override public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { // Row is built for translation if (isReadOnly()) { return true; } if (isPrivateOwned() || isCascadeRemove()) { Object objects = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = this.containerPolicy; for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } AbstractRecord row = getDescriptor().getObjectBuilder().buildRowForTranslation(object, session); //cr 3819 added the line below to fix the translationtable to ensure that it // contains the required values prepareTranslationRow(row, object, getDescriptor(), session); Object value = session.executeQuery(getSelectionQuery(), row); return this.containerPolicy.isEmpty(value); }
Object originalKey = this.containerPolicy.keyFromIterator(valuesIterator); Object copyKey = originalKey; if (group.shouldCascadeAllParts() || (group.shouldCascadePrivateParts() && isPrivateOwned()) || group.shouldCascadeTree()) { copyValue = copyElement(originalValue, group); copyKey = group.getSession().copyInternal(originalKey, group);
/** * INTERNAL: * Checks if object is deleted from the database or not. */ @Override public boolean verifyDelete(Object object, AbstractSession session) throws DatabaseException { // Row is built for translation if (isReadOnly()) { return true; } if (isPrivateOwned() || isCascadeRemove()) { Object objects = getRealCollectionAttributeValueFromObject(object, session); ContainerPolicy containerPolicy = this.containerPolicy; for (Object iter = containerPolicy.iteratorFor(objects); containerPolicy.hasNext(iter);) { if (!session.verifyDelete(containerPolicy.next(iter, session))) { return false; } } } AbstractRecord row = getDescriptor().getObjectBuilder().buildRowForTranslation(object, session); //cr 3819 added the line below to fix the translationtable to ensure that it // contains the required values prepareTranslationRow(row, object, getDescriptor(), session); Object value = session.executeQuery(getSelectionQuery(), row); return this.containerPolicy.isEmpty(value); }
Object originalKey = this.containerPolicy.keyFromIterator(valuesIterator); Object copyKey = originalKey; if (group.shouldCascadeAllParts() || (group.shouldCascadePrivateParts() && isPrivateOwned()) || group.shouldCascadeTree()) { copyValue = copyElement(originalValue, group); copyKey = group.getSession().copyInternal(originalKey, group);
if (m_deleteAll != null && mapping.isPrivateOwned()) { mapping.setMustDeleteReferenceObjectsOneByOne(! m_deleteAll);
if (isPrivateOwned()) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setIsExecutionClone(true);
if (isPrivateOwned()) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setIsExecutionClone(true);
if (isPrivateOwned()) { InsertObjectQuery insertQuery = new InsertObjectQuery(); insertQuery.setIsExecutionClone(true);