use of org.jboss.errai.bus.client.api.messaging.Message in project kie-wb-common by kiegroup.
the class PopupHelperTest method testGetPopupErrorCallback.
@Test
public void testGetPopupErrorCallback() {
Message message = mock(Message.class);
popupHelper.getPopupErrorCallback().error(message, new Exception(MESSAGE));
verify(popupHelper, times(1)).showErrorPopup(MESSAGE);
}
use of org.jboss.errai.bus.client.api.messaging.Message in project kie-wb-common by kiegroup.
the class ProjectPage method fetchRepository.
private void fetchRepository(final ExampleRepository selectedRepository) {
examplesService.call(new RemoteCallback<Set<ExampleProject>>() {
@Override
public void callback(final Set<ExampleProject> projects) {
activeView = projectsView;
model.getProjects().clear();
model.setSourceRepository(selectedRepository);
final List<ExampleProject> sortedProjects = sort(projects);
projectsView.setProjectsInRepository(sortedProjects);
exampleProjects = sortedProjects;
pageSelectedEvent.fire(new WizardPageSelectedEvent(ProjectPage.this));
}
}, new DefaultErrorCallback() {
@Override
public boolean error(final Message message, final Throwable throwable) {
model.setSourceRepository(null);
model.getSelectedRepository().setUrlValid(false);
return super.error(message, throwable);
}
}).getProjects(selectedRepository);
}
use of org.jboss.errai.bus.client.api.messaging.Message in project kie-wb-common by kiegroup.
the class ImportRepositoryPopUpPresenter method importRepository.
public void importRepository() {
final String repositoryUrl = view.getRepositoryURL();
if (isEmpty(repositoryUrl)) {
view.showError(view.getEmptyRepositoryURLValidationMessage());
return;
}
OrganizationalUnit ou = context.getActiveOrganizationalUnit().orElseThrow(() -> new IllegalStateException("Cannot import project without an active organizational unit."));
view.showBusyIndicator(view.getLoadingMessage());
libraryService.call((WorkspaceProject project) -> {
view.hideBusyIndicator();
view.hide();
libraryPlaces.goToProject(project);
}, new DefaultErrorCallback() {
@Override
public boolean error(Message message, Throwable throwable) {
view.hideBusyIndicator();
view.showError(view.getNoProjectsToImportMessage());
return false;
}
}).importProject(ou, repositoryUrl, view.getUserName(), view.getPassword());
}
use of org.jboss.errai.bus.client.api.messaging.Message in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchService method search.
@Override
public void search(final String pattern, final int maxResults, final LiveSearchCallback<String> callback) {
final List<String> filteredCustomEntries;
if (pattern == null || pattern.isEmpty()) {
filteredCustomEntries = customEntries;
} else {
filteredCustomEntries = customEntries.stream().filter(entry -> entry.contains(pattern)).collect(Collectors.toList());
}
RemoteCallback<AbstractEntityManager.SearchResponse<?>> searchResponseRemoteCallback = response -> processFilterResponse(response, filteredCustomEntries, maxResults, callback);
ErrorCallback<Message> searchErrorCallback = (message, throwable) -> processError(callback);
SearchRequestImpl request = new SearchRequestImpl(pattern, 1, maxResults);
if (AssigneeType.USER.equals(type)) {
userSystemManager.users(searchResponseRemoteCallback, searchErrorCallback).search(request);
} else {
userSystemManager.groups(searchResponseRemoteCallback, searchErrorCallback).search(request);
}
}
use of org.jboss.errai.bus.client.api.messaging.Message in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchService method searchEntry.
@Override
public void searchEntry(String key, LiveSearchCallback<String> callback) {
SearchRequestImpl request = new SearchRequestImpl(key, 1, 1);
ErrorCallback<Message> searchErrorCallback = (message, throwable) -> processError(callback);
RemoteCallback<AbstractEntityManager.SearchResponse<?>> searchResponseRemoteCallback = response -> searchEntry(key, response, callback);
if (AssigneeType.USER.equals(type)) {
userSystemManager.users(searchResponseRemoteCallback, searchErrorCallback).search(request);
} else {
userSystemManager.groups(searchResponseRemoteCallback, searchErrorCallback).search(request);
}
}
Aggregations