protected BerkeleyDBLocalDelegateTreeSubNodeMap( BerkeleyDBPersistenceManager persistenceManager, BerkeleyDBTransaction transaction, DelegateTreeNode parent, Namespace from, Namespace to) { try { this.persistenceManager = persistenceManager; this.transaction = transaction; this.parent = parent; this.index = persistenceManager .getEntityStore() .delegateTreeSubNodeEntityParentSubindex( new BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData( parent.getStatementUuid(), parent.getPrefix())); this.from = from; this.primaryKeyFrom = new BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData(parent.getStatementUuid(), from); this.to = to; this.primaryKeyTo = new BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData(parent.getStatementUuid(), to); } catch (DatabaseException e) { throw persistenceManager.convertDatabaseException(e); } }
public BerkeleyDBLocalDelegateTreeSubNodeMap( BerkeleyDBPersistenceManager persistenceManager, BerkeleyDBTransaction transaction, DelegateTreeNode parent) { this( persistenceManager, transaction, parent, parent.getPrefix().initiator(), parent.getPrefix().terminator()); }
@Override public boolean containsKey(Object key) { if (key == null) return false; if (!(key instanceof Namespace)) return false; Namespace prefix = (Namespace) key; if (prefix.compareTo(from) < 0) return false; if (prefix.compareTo(to) >= 0) return false; BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData pk = new BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData(parent.getStatementUuid(), prefix); return transaction.contains(index, pk); }
@Override public DelegateTreeSubNode get(Object key) { if (key == null) return null; if (!(key instanceof Namespace)) return null; Namespace prefix = (Namespace) key; if (prefix.compareTo(from) < 0) return null; if (prefix.compareTo(to) >= 0) return null; BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData pk = new BerkeleyDBDelegateTreeNodeEntity.PrimaryKeyData(parent.getStatementUuid(), prefix); BerkeleyDBDelegateTreeNodeEntity entity = transaction.get(index, pk); if (entity == null) return null; return (DelegateTreeSubNode) persistenceManager.entityToDelegateTreeNode(entity); }