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); } }
private static EntityIndex<UUIDKey, BerkeleyDBPrivateSignatoryEntity> subIndex( BerkeleyDBPersistenceManager persistenceManager) { try { return persistenceManager.getEntityStore().privateSignatoryEntityMarkSubIndex(true); } catch (DatabaseException e) { throw persistenceManager.convertDatabaseException(e); } }
@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); }