@Override protected XKeySetView<K> createBaseView(XMap<K, V> baseMap, ViewInfo viewInfo) { if (viewInfo instanceof MapViewInfos.KeySet) { return baseMap.keySet(); } throw new IllegalArgumentException(LAZY_COMMON_RESOURCE.get().illegalViewInfo()); }
@SuppressWarnings("unchecked") Boolean visionallyRemoveAllImpl(Collection<?> c) { RootData<K, V> rootData = this.<RootData<K, V>>getRootData(); if (rootData.isLoaded()) { return null; } if (!rootData.isVisionallyReadable(QueuedOperationType.DETACH)) { return null; } if (rootData.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().visionOperationWhenDataIsBeingLoaded()); } int len = 0; Object[] arr = new Object[c.size() << 1]; for (Object o : c) { Ref<V> ref = rootData.visionallyRead((K) o, QueuedOperationType.DETACH); if (ref == null) { return null; } if (ref.get() == null) { continue; } arr[len++] = o; arr[len++] = ref.get(); } for (int i = 0; i < len; i += 2) { rootData.visinallyRemove((K) arr[i], (V) arr[i + 1]); } return len != 0; }
@SuppressWarnings("unchecked") Boolean visionallRemoveImpl(Object o) { if (!(o instanceof Entry<?, ?>)) { return false; } RootData<K, V> rootData = this.<RootData<K, V>>getRootData(); if (rootData.isLoaded()) { return null; } if (!rootData.isVisionallyReadable(QueuedOperationType.DETACH)) { return null; } if (rootData.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().visionOperationWhenDataIsBeingLoaded()); } Entry<K, V> e = (Entry<K, V>) o; Ref<V> ref = rootData.visionallyRead(e.getKey(), null); if (ref != null) { if (ref.get() == null) { return false; } if (!rootData.valueUnifiedComparator().equals(ref.get(), e.getValue())) { return false; } rootData.visinallyRemove(e.getKey(), ref.get()); return true; } return null; }
@Deprecated @Override public final V getElement(Object entry) { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final Serializable getStoredSnapshot() { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final void preInsert(CollectionPersister persister) throws HibernateException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final boolean isRowUpdatePossible() { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final void beforeInitialize(CollectionPersister persister, int anticipatedSize) { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final Collection<V> getQueuedOrphans(String entityName) { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final Iterator<V> queuedAdditionIterator() { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final boolean setCurrentSession(SessionImplementor session) throws HibernateException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@SuppressWarnings("unchecked") @Override protected org.babyfish.collection.XMap.XEntry<K, V> createBaseView( XMap<K, V> baseMap, ViewInfo viewInfo) { if (viewInfo instanceof MapViewInfos.RealByKey) { K key = (K) ((MapViewInfos.RealByKey) viewInfo).getKey(); return baseMap.real(key); } throw new IllegalArgumentException(LAZY_COMMON_RESOURCE.get().illegalViewInfo()); }
@Deprecated @Override public final Iterator<V> getDeletes(CollectionPersister persister, boolean indexIsFormula) throws HibernateException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final V readFrom( ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner) throws HibernateException, SQLException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
@Deprecated @Override public final void initializeFromCache( CollectionPersister persister, Serializable disassembled, Object owner) throws HibernateException { throw new UnsupportedOperationException( LAZY_COMMON_RESOURCE .get() .persistentCollectionBehaviorIsInvalid( EntityOrderedMap.class, org.hibernate.collection.spi.PersistentCollection.class)); }
public final void load() { if (!this.isLoaded()) { if (this.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().loadingOperationWhenDataIsBeingLoaded()); } this.setLoading(true); try { this.onLoad(); // The second setLoading(true) is very important! // because onLoad() may set the initializing to be false. this.setLoading(true); this.performQueuedOrphans(); } finally { this.setLoading(false); } this.setLoaded(true); } }
@SuppressWarnings("unchecked") Ref<V> visionallyRemoveImpl(Object key) { RootData<K, V> rootData = this.getRootData(); if (rootData.isLoaded()) { return null; } if (!rootData.isVisionallyReadable(QueuedOperationType.DETACH)) { return null; } if (!rootData.getLazyBehaviorProcessor().preVisionallyRead(1)) { return null; } if (rootData.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().visionOperationWhenDataIsBeingLoaded()); } Ref<V> ref = rootData.visionallyRead((K) key, QueuedOperationType.DETACH); if (ref != null) { rootData.visinallyRemove((K) key, ref.get()); } return ref; }
@SuppressWarnings("unchecked") Boolean visionallyRemoveAllImpl(Collection<?> c) { RootData<K, V> rootData = this.<RootData<K, V>>getRootData(); if (rootData.isLoaded()) { return null; } if (!rootData.isVisionallyReadable(QueuedOperationType.DETACH)) { return null; } if (rootData.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().visionOperationWhenDataIsBeingLoaded()); } int len = 0; Object[] arr = new Object[c.size() << 1]; UnifiedComparator<? super V> valueUnifiedComparator = rootData.valueUnifiedComparator(); for (Object o : c) { if (o instanceof Entry<?, ?>) { Entry<K, V> e = (Entry<K, V>) o; Ref<V> ref = rootData.visionallyRead(e.getKey(), QueuedOperationType.DETACH); if (ref == null) { return null; } if (ref.get() == null) { continue; } if (!valueUnifiedComparator.equals(ref.get(), e.getValue())) { continue; } arr[len++] = e.getKey(); arr[len++] = ref.get(); } } for (int i = 0; i < len; i += 2) { rootData.visinallyRemove((K) arr[i], (V) arr[i + 1]); } return len != 0; }
@SuppressWarnings("unchecked") Boolean visionallyRemoveImpl(Object o) { RootData<K, V> rootData = this.<RootData<K, V>>getRootData(); if (rootData.isLoaded()) { return null; } if (!rootData.isVisionallyReadable(QueuedOperationType.DETACH)) { return null; } if (rootData.isLoading()) { throw new IllegalStateException( LAZY_COMMON_RESOURCE.get().visionOperationWhenDataIsBeingLoaded()); } Ref<V> ref = rootData.visionallyRead((K) o, QueuedOperationType.DETACH); if (ref != null) { if (ref.get() == null) { return false; } rootData.visinallyRemove((K) o, ref.get()); return true; } return null; }