use of org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow in project kie-wb-common by kiegroup.
the class FileLoader method loadPaths.
public List<Path> loadPaths(final Path path, final String suffix) {
PortablePreconditions.checkNotNull("path", path);
PortablePreconditions.checkNotNull("suffix", suffix);
org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);
// Check Path exists
final List<Path> items = new ArrayList<>();
if (!Files.exists(nioPath)) {
return items;
}
// Ensure Path represents a Folder
if (!Files.isDirectory(nioPath)) {
nioPath = nioPath.getParent();
}
final Set<ValueIndexTerm> queryTerms = new HashSet<>();
final ArrayList<String> extensions = new ArrayList<>();
extensions.add(suffix);
queryTerms.add(new LibraryValueRepositoryRootIndexTerm(Paths.convert(nioPath).toURI(), ValueIndexTerm.TermSearchType.NORMAL));
queryTerms.add(new LibraryValueFileExtensionIndexTerm(extensions));
final List<RefactoringPageRow> rows = refactoringQueryService.query(FindAllLibraryAssetsQuery.NAME, queryTerms);
for (RefactoringPageRow row : rows) {
items.add((Path) row.getValue());
}
return items;
}
use of org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow in project kie-wb-common by kiegroup.
the class RefactoringQueryServiceImpl method queryToList.
@Override
public List<RefactoringPageRow> queryToList(final QueryOperationRequest queryOpRequest) {
final RefactoringPageRequest request = convertToRefactoringPageRequest(queryOpRequest);
final List<RefactoringPageRow> response = query(request.getQueryName(), request.getQueryTerms());
return response;
}
use of org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow in project kie-wb-common by kiegroup.
the class RefactoringQueryServiceImpl method queryToPageResponse.
/* (non-Javadoc)
* @see org.kie.workbench.common.services.refactoring.service.RefactoringQueryService#queryToPageResponse(org.kie.workbench.common.services.refactoring.service.impact.QueryOperationRequest)
*/
@Override
public PageResponse<RefactoringPageRow> queryToPageResponse(QueryOperationRequest queryOpRequest) {
final RefactoringPageRequest request = convertToRefactoringPageRequest(queryOpRequest);
final PageResponse<RefactoringPageRow> response = query(request);
return response;
}
use of org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow in project kie-wb-common by kiegroup.
the class PackageServiceLoaderImpl method find.
public Set<String> find(final Path path) {
final Set<String> result = new HashSet<>();
try {
final WorkspaceProject workspaceProject = projectService.resolveProject(path);
final List<RefactoringPageRow> rows = refactoringQueryService.query(FindPackageNamesQuery.NAME, getValueIndexTerms(workspaceProject));
for (RefactoringPageRow row : rows) {
result.add(row.getValue().toString());
}
} catch (Exception e) {
return result;
}
return result;
}
use of org.kie.workbench.common.services.refactoring.model.query.RefactoringPageRow in project kie-wb-common by kiegroup.
the class ScoreCardServiceLoaderImpl method find.
public Set<String> find(final Path path, final String packageName) {
final Set<String> result = new HashSet<>();
try {
final WorkspaceProject workspaceProject = projectService.resolveProject(path);
final List<RefactoringPageRow> rows = refactoringQueryService.query(FindScorecardNamesQuery.NAME, new HashSet<ValueIndexTerm>() {
{
add(new ValueSharedPartIndexTerm("*", PartType.SCORECARD_MODEL_NAME, ValueIndexTerm.TermSearchType.WILDCARD));
add(new ValueModuleRootPathIndexTerm(workspaceProject.getMainModule().getRootPath().toURI()));
add(new ValuePackageNameIndexTerm(packageName));
}
});
for (RefactoringPageRow row : rows) {
result.add(row.getValue().toString());
}
} finally {
return result;
}
}
Aggregations