| /********************************************************************* |
| * Copyright (c) 2004, 2007 Boeing |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Boeing - initial API and implementation |
| **********************************************************************/ |
| |
| package org.eclipse.osee.orcs.core.internal.search; |
| |
| import org.eclipse.osee.framework.core.OrcsTokenService; |
| import org.eclipse.osee.framework.core.data.ApplicabilityId; |
| import org.eclipse.osee.framework.core.data.ArtifactId; |
| import org.eclipse.osee.framework.core.data.BranchId; |
| import org.eclipse.osee.orcs.OrcsApi; |
| import org.eclipse.osee.orcs.core.ds.ApplicabilityDsQuery; |
| import org.eclipse.osee.orcs.core.ds.QueryData; |
| import org.eclipse.osee.orcs.core.ds.QueryEngine; |
| import org.eclipse.osee.orcs.search.ApplicabilityQuery; |
| import org.eclipse.osee.orcs.search.BranchQuery; |
| import org.eclipse.osee.orcs.search.QueryBuilder; |
| import org.eclipse.osee.orcs.search.QueryFactory; |
| import org.eclipse.osee.orcs.search.TransactionQuery; |
| import org.eclipse.osee.orcs.search.TupleQuery; |
| |
| /** |
| * @author Roberto E. Escobar |
| */ |
| public class QueryFactoryImpl implements QueryFactory { |
| |
| private final CallableQueryFactory artQueryFactory; |
| private final BranchCriteriaFactory branchCriteriaFactory; |
| private final TransactionCriteriaFactory txCriteriaFactory; |
| private final TupleQuery tupleQuery; |
| private final ApplicabilityDsQuery applicabilityDsQuery; |
| private final QueryEngine queryEngine; |
| private final OrcsTokenService tokenService; |
| private final OrcsApi orcsApi; |
| |
| public QueryFactoryImpl(OrcsApi orcsApi, CallableQueryFactory artQueryFactory, BranchCriteriaFactory branchCriteriaFactory, TransactionCriteriaFactory txCriteriaFactory, TupleQuery tupleQuery, ApplicabilityDsQuery applicabilityDsQuery, QueryEngine queryEngine, OrcsTokenService tokenService) { |
| this.orcsApi = orcsApi; |
| this.artQueryFactory = artQueryFactory; |
| this.branchCriteriaFactory = branchCriteriaFactory; |
| this.txCriteriaFactory = txCriteriaFactory; |
| this.tupleQuery = tupleQuery; |
| this.applicabilityDsQuery = applicabilityDsQuery; |
| this.queryEngine = queryEngine; |
| this.tokenService = tokenService; |
| } |
| |
| @Override |
| public BranchQuery branchQuery() { |
| return new BranchQueryImpl(queryEngine, branchCriteriaFactory, |
| new QueryData(this, queryEngine, artQueryFactory, tokenService)); |
| } |
| |
| @Override |
| public QueryBuilder fromBranch(BranchId branch) { |
| return new QueryData(this, queryEngine, artQueryFactory, tokenService, branch); |
| } |
| |
| @Override |
| public QueryBuilder fromBranch(BranchId branch, ArtifactId view) { |
| return new QueryData(this, queryEngine, artQueryFactory, tokenService, branch, view); |
| } |
| |
| @Override |
| public QueryBuilder fromBranch(BranchId branch, ApplicabilityId appId) { |
| return new QueryData(this, queryEngine, artQueryFactory, tokenService, branch, appId); |
| } |
| |
| @Override |
| public TransactionQuery transactionQuery() { |
| return new TransactionQueryImpl(queryEngine, txCriteriaFactory, |
| new QueryData(this, queryEngine, artQueryFactory, tokenService)); |
| } |
| |
| @Override |
| public TupleQuery tupleQuery() { |
| return tupleQuery; |
| } |
| |
| @Override |
| public ApplicabilityQuery applicabilityQuery() { |
| return new ApplicabilityQueryImpl(applicabilityDsQuery, this, orcsApi); |
| } |
| } |