/** * Constructs a new traversal context by replacing the source path with the provided query and clearing out the * selected candidates. * * @param path the source path of the new context * @return a new traversal context with the provided source path and empty select candidates, but otherwise * identical to this one. */ TraversalContext<BE, E> replacePath(Query path) { return new TraversalContext<>(inventory, path, Query.empty(), backend, entityClass, configuration, observableContext, transactionRetries, this, null, transactionConstructor); }
/** * @return a symmetric builder that will start appending filter fragments to the query */ public static SymmetricExtender filter() { return empty().extend().filter(); }
/** * @return a symmetric builder that will start appending path fragments to the query */ public static SymmetricExtender path() { return empty().extend().path(); }
TraversalContext<BE, E> toCreatedEntity(E entity, boolean cache) { return new TraversalContext<>(inventory, Query.to(entity.getPath()), Query.empty(), backend, entityClass, configuration, observableContext, transactionRetries, this, cache ? entity : null, null); }
@Override public final void initialize(Configuration configuration) { this.backend = doInitialize(configuration); tenantContext = new TraversalContext<>(this, Query.empty(), Query.path().with(With.type(Tenant.class)).get(), backend, Tenant.class, configuration, observableContext, transactionConstructor); relationshipContext = new TraversalContext<>(this, Query.empty(), Query.path().get(), backend, Relationship.class, configuration, observableContext, transactionConstructor); this.configuration = configuration; }
/** * This is a sort of copy constructor. * Can be used by subclasses when implementing the {@link #cloneWith(TransactionConstructor)} method. * * @param orig the original instance to copy stuff over from * @param backend if not null, then use this backend instead of the one used by {@code orig} * @param transactionConstructor if not null, then use this ctor instead of the one used by {@code orig} */ protected BaseInventory(BaseInventory<E> orig, InventoryBackend<E> backend, TransactionConstructor<E> transactionConstructor) { this.observableContext = orig.observableContext; this.configuration = orig.configuration; this.backend = backend == null ? orig.backend : backend; this.transactionConstructor = transactionConstructor == null ? orig.transactionConstructor : transactionConstructor; tenantContext = new TraversalContext<>(this, Query.empty(), Query.path().with(With.type(Tenant.class)).get(), this.backend, Tenant.class, configuration, observableContext, this.transactionConstructor); relationshipContext = new TraversalContext<>(this, Query.empty(), Query.path().get(), this.backend, Relationship.class, configuration, observableContext, this.transactionConstructor); }