use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm in project kie-wb-common by kiegroup.
the class RuleFlowGroupFormProvider method getRuleFlowGroupNames.
@SuppressWarnings("unchecked")
private Map<Object, String> getRuleFlowGroupNames() {
List<RefactoringPageRow> results = queryService.query(FindRuleFlowNamesQuery.NAME, new HashSet<ValueIndexTerm>() {
{
add(new ValueSharedPartIndexTerm("*", PartType.RULEFLOW_GROUP, ValueIndexTerm.TermSearchType.WILDCARD));
}
});
Map<Object, String> ruleFlowGroupNames = new TreeMap<Object, String>();
for (RefactoringPageRow row : results) {
ruleFlowGroupNames.put(((Map<String, String>) row.getValue()).get("name"), ((Map<String, String>) row.getValue()).get("name"));
}
return ruleFlowGroupNames;
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm in project kie-wb-common by kiegroup.
the class FindBpmnProcessIdsQueryTest method findBpmnProcessIdsQueryTermsTest.
@Test
public void findBpmnProcessIdsQueryTermsTest() {
FindBpmnProcessIdsQuery query = new FindBpmnProcessIdsQuery();
Set<ValueIndexTerm> queryTerms = new HashSet<>();
try {
query.validateTerms(queryTerms);
fail("The required resources term is missing, but no exception was thrown.");
} catch (IllegalArgumentException iae) {
assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains("Expected 'ValueResourceIndexTerm' term was not found."));
}
queryTerms = new HashSet<>();
queryTerms.add(new ValueResourceIndexTerm("not-bpmn2-resources", ResourceType.JAVA));
try {
query.validateTerms(queryTerms);
fail("The required resources term is missing, but no exception was thrown.");
} catch (IllegalArgumentException iae) {
assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains(ERROR_MSG));
}
queryTerms = new HashSet<>();
queryTerms.add(new ValueResourceIndexTerm("*", ResourceType.BPMN2, ValueIndexTerm.TermSearchType.WILDCARD));
try {
query.validateTerms(queryTerms);
} catch (IllegalArgumentException iae) {
fail("The activation term is acceptable here, but an exception was thrown.");
}
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm in project kie-wb-common by kiegroup.
the class FindDataTypesService method getDataTypeNames.
public List<String> getDataTypeNames() {
// Query Java resources
List<RefactoringPageRow> results = queryService.query(FindDataTypesQuery.NAME, new HashSet<ValueIndexTerm>() {
{
add(new ValueResourceIndexTerm("*", ResourceType.JAVA, ValueIndexTerm.TermSearchType.WILDCARD));
}
});
final List<String> dataTypeNames = new ArrayList<String>();
for (RefactoringPageRow row : results) {
dataTypeNames.add((String) row.getValue());
}
Collections.sort(dataTypeNames);
return dataTypeNames;
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm in project kie-wb-common by kiegroup.
the class RuleFlowGroupFormProviderTest method findRuleFlowNamesQueryTermsTest.
@Test
public void findRuleFlowNamesQueryTermsTest() {
FindRuleFlowNamesQuery query = new FindRuleFlowNamesQuery();
Set<ValueIndexTerm> queryTerms = new HashSet<>();
try {
query.validateTerms(queryTerms);
fail("The required rule-flow term is missing, but no exception was thrown.");
} catch (IllegalArgumentException iae) {
assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains("At least 1 term"));
}
queryTerms = new HashSet<>();
queryTerms.add(new ValueSharedPartIndexTerm("not-rule-flow", PartType.ACTIVATION_GROUP));
try {
query.validateTerms(queryTerms);
fail("The required rule-flow term is missing, but no exception was thrown.");
} catch (IllegalArgumentException iae) {
assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains(ERROR_MSG));
}
queryTerms = new HashSet<>();
queryTerms.add(new ValueSharedPartIndexTerm("not-rule-flow", PartType.ACTIVATION_GROUP));
queryTerms.add(new ValueSharedPartIndexTerm("rule-flow", PartType.RULEFLOW_GROUP));
try {
query.validateTerms(queryTerms);
fail("The activation term is not acceptable here, but no exception was thrown.");
} catch (IllegalArgumentException iae) {
assertTrue("Incorrect error message: " + iae.getMessage(), iae.getMessage().contains(ERROR_MSG));
}
queryTerms = new HashSet<>();
queryTerms.add(new ValueSharedPartIndexTerm("rule-flow", PartType.RULEFLOW_GROUP));
query.validateTerms(queryTerms);
}
use of org.kie.workbench.common.services.refactoring.model.index.terms.valueterms.ValueIndexTerm in project kie-wb-common by kiegroup.
the class LibraryServiceImpl method buildProjectAssetsQuery.
private HashSet<ValueIndexTerm> buildProjectAssetsQuery(ProjectAssetsQuery query) {
final HashSet<ValueIndexTerm> queryTerms = new HashSet<>();
queryTerms.add(new LibraryValueModuleRootPathIndexTerm(query.getProject().getRootPath().toURI()));
if (query.hasFilter()) {
queryTerms.add(new LibraryValueFileNameIndexTerm("*" + query.getFilter() + "*", ValueIndexTerm.TermSearchType.WILDCARD));
}
if (query.hasExtension()) {
queryTerms.add(new LibraryValueFileExtensionIndexTerm(query.getExtensions()));
}
return queryTerms;
}
Aggregations