Search in sources :

Example 1 with ValueModuleNameIndexTerm

use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueModuleNameIndexTerm in project kie-wb-common by kiegroup.

the class RefactoringQueryServiceImpl method convertToRefactoringPageRequest.

private RefactoringPageRequest convertToRefactoringPageRequest(QueryOperationRequest refOpRequest) {
    RefactoringPageRequest request = new RefactoringPageRequest(FindAllChangeImpactQuery.NAME, new HashSet<>(), refOpRequest.getStartRowIndex(), refOpRequest.getPageSize());
    request.getQueryTerms().addAll(refOpRequest.getQueryTerms());
    // add project info
    String projectName = refOpRequest.getModuleName();
    if (projectName != null && projectName != QueryOperationRequest.ALL) {
        ValueModuleNameIndexTerm valueIndexTerm = new ValueModuleNameIndexTerm(projectName);
        Set<ValueIndexTerm> queryTerms = new HashSet<ValueIndexTerm>(1);
        queryTerms.add(valueIndexTerm);
        request.getQueryTerms().addAll(queryTerms);
    }
    String projectRootPathURI = refOpRequest.getModuleRootPathURI();
    if (projectRootPathURI != null && projectRootPathURI != QueryOperationRequest.ALL) {
        ValueModuleRootPathIndexTerm valueIndexTerm = new ValueModuleRootPathIndexTerm(projectRootPathURI);
        Set<ValueIndexTerm> queryTerms = new HashSet<ValueIndexTerm>(1);
        queryTerms.add(valueIndexTerm);
        request.getQueryTerms().addAll(queryTerms);
    }
    String branchName = refOpRequest.getBranchName();
    if (branchName != null && branchName != QueryOperationRequest.ALL) {
        ValueBranchNameIndexTerm valueIndexTerm = new ValueBranchNameIndexTerm(branchName);
        Set<ValueIndexTerm> queryTerms = new HashSet<ValueIndexTerm>(1);
        queryTerms.add(valueIndexTerm);
        request.getQueryTerms().addAll(queryTerms);
    }
    return request;
}
Also used : RefactoringPageRequest(org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRequest) ValueIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm) ValueBranchNameIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueBranchNameIndexTerm) ValueModuleRootPathIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueModuleRootPathIndexTerm) ValueModuleNameIndexTerm(org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueModuleNameIndexTerm) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 ValueBranchNameIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueBranchNameIndexTerm)1 ValueIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm)1 ValueModuleNameIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueModuleNameIndexTerm)1 ValueModuleRootPathIndexTerm (org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueModuleRootPathIndexTerm)1 RefactoringPageRequest (org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRequest)1