/** * INTERNAL: * Return whether this IndirectSet has been registered in a UnitOfWork */ public boolean hasBeenRegistered() { return getValueHolder() instanceof org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder; }
/** * INTERNAL: * Return whether this IndirectSet has been registered in a UnitOfWork */ public boolean hasBeenRegistered() { return getValueHolder() instanceof org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder; }
/** * INTERNAL: * Return whether this IndirectSet has been registered in a UnitOfWork */ public boolean hasBeenRegistered() { return getValueHolder() instanceof org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder; }
/** * Return whether the contents have been read from the database. */ @Override public boolean isInstantiated() { return this.getValueHolder().isInstantiated(); }
/** * Return whether the contents have been read from the database. */ @Override public boolean isInstantiated() { return this.getValueHolder().isInstantiated(); }
/** * Return whether the contents have been read from the database. */ public boolean isInstantiated() { return this.getValueHolder().isInstantiated(); }
/** * INTERNAL: * Return if add/remove should trigger instantiation or avoid. * Current instantiation is avoided is using change tracking. */ protected boolean shouldAvoidInstantiation() { return (!isInstantiated()) && (_persistence_getPropertyChangeListener() instanceof AttributeChangeListener) && ((WeavedAttributeValueHolderInterface)getValueHolder()).shouldAllowInstantiationDeferral(); } }
/** * INTERNAL: * Return the freshly-built delegate. */ protected Set<E> buildDelegate() { Set<E> newDelegate = (Set<E>)getValueHolder().getValue(); if (newDelegate == null) { newDelegate = new HashSet<>(this.initialCapacity, this.loadFactor); } // This can either be another indirect set or a HashSet. // It can be another indirect list because the mapping's query uses the same container policy. // Unwrap any redundant indirection layers, which can cause issues and impact performance. while (newDelegate instanceof IndirectSet) { newDelegate = ((IndirectSet) newDelegate).getDelegate(); } // First add/remove any cached changes. if (hasAddedElements()) { for (Iterator<E> iterator = getAddedElements().iterator(); iterator.hasNext(); ) { newDelegate.add(iterator.next()); } this.addedElements = null; } if (hasRemovedElements()) { for (Iterator<E> iterator = getRemovedElements().iterator(); iterator.hasNext(); ) { newDelegate.remove(iterator.next()); } this.removedElements = null; } return newDelegate; }
/** * INTERNAL: * Return the freshly-built delegate. */ protected Set buildDelegate() { Set delegate = (Set)getValueHolder().getValue(); // This can either be another indirect set or a HashSet. // It can be another indirect list because the mapping's query uses the same container policy. // Unwrap any redundent indirection layers, which can cause issues and impact performance. while (delegate instanceof IndirectSet) { delegate = ((IndirectSet) delegate).getDelegate(); } // First add/remove any cached changes. if (hasAddedElements()) { for (Iterator iterator = getAddedElements().iterator(); iterator.hasNext(); ) { delegate.add(iterator.next()); } this.addedElements = null; } if (hasRemovedElements()) { for (Iterator iterator = getRemovedElements().iterator(); iterator.hasNext(); ) { delegate.remove(iterator.next()); } this.removedElements = null; } return delegate; }
/** * INTERNAL: * Return the freshly-built delegate. */ protected Set<E> buildDelegate() { Set delegate = (Set)getValueHolder().getValue(); if (delegate == null) { delegate = new HashSet<>(this.initialCapacity, this.loadFactor); } // This can either be another indirect set or a HashSet. // It can be another indirect list because the mapping's query uses the same container policy. // Unwrap any redundent indirection layers, which can cause issues and impact performance. while (delegate instanceof IndirectSet) { delegate = ((IndirectSet) delegate).getDelegate(); } // First add/remove any cached changes. if (hasAddedElements()) { for (Iterator iterator = getAddedElements().iterator(); iterator.hasNext(); ) { delegate.add(iterator.next()); } this.addedElements = null; } if (hasRemovedElements()) { for (Iterator iterator = getRemovedElements().iterator(); iterator.hasNext(); ) { delegate.remove(iterator.next()); } this.removedElements = null; } return delegate; }
/** * INTERNAL: * Return if add/remove should trigger instantiation or avoid. * Current instantiation is avoided is using change tracking. */ protected boolean shouldAvoidInstantiation() { return (!isInstantiated()) && (shouldUseLazyInstantiation()) && (_persistence_getPropertyChangeListener() instanceof AttributeChangeListener) && ((WeavedAttributeValueHolderInterface)getValueHolder()).shouldAllowInstantiationDeferral(); } }
/** * INTERNAL: * Return if add/remove should trigger instantiation or avoid. * Current instantiation is avoided is using change tracking. */ protected boolean shouldAvoidInstantiation() { return (!isInstantiated()) && (shouldUseLazyInstantiation()) && (_persistence_getPropertyChangeListener() instanceof AttributeChangeListener) && ((WeavedAttributeValueHolderInterface)getValueHolder()).shouldAllowInstantiationDeferral(); } }
/** * Raise the add change event and relationship maintainence. */ protected void raiseAddChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.ADD)); } if (hasBeenRegistered()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceSet(element, null); } }
/** * Raise the add change event and relationship maintainence. */ protected void raiseAddChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.ADD, true)); } if (isRelationshipMaintenanceRequired()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceSet(element, null); } }
/** * Raise the remove change event. */ protected void raiseRemoveChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.REMOVE)); } if (hasBeenRegistered()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceRemove(element); } }
/** * Raise the add change event and relationship maintainence. */ protected void raiseAddChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.ADD, true)); } if (isRelationshipMaintenanceRequired()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceSet(element, null); } }
/** * Raise the remove change event. */ protected void raiseRemoveChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.REMOVE, true)); } if (isRelationshipMaintenanceRequired()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceRemove(element); } }
/** * Raise the remove change event. */ protected void raiseRemoveChangeEvent(Object element) { if (hasTrackedPropertyChangeListener()) { _persistence_getPropertyChangeListener().propertyChange(new CollectionChangeEvent(this, getTrackedAttributeName(), this, element, CollectionChangeEvent.REMOVE, true)); } if (isRelationshipMaintenanceRequired()) { ((UnitOfWorkQueryValueHolder)getValueHolder()).updateForeignReferenceRemove(element); } }