Search in sources :

Example 6 with ErrorCallback

use of org.jboss.errai.common.client.api.ErrorCallback 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);
    }
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) Group(org.jboss.errai.security.shared.api.Group) Set(java.util.Set) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) SearchRequestImpl(org.uberfire.ext.security.management.impl.SearchRequestImpl) Collectors(java.util.stream.Collectors) EntryCreationLiveSearchService(org.uberfire.ext.widgets.common.client.dropdown.EntryCreationLiveSearchService) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) LiveSearchResults(org.uberfire.ext.widgets.common.client.dropdown.LiveSearchResults) Inject(javax.inject.Inject) List(java.util.List) Message(org.jboss.errai.bus.client.api.messaging.Message) Dependent(javax.enterprise.context.Dependent) AbstractEntityManager(org.uberfire.ext.security.management.api.AbstractEntityManager) User(org.jboss.errai.security.shared.api.identity.User) Optional(java.util.Optional) LiveSearchCallback(org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback) AssigneeType(org.kie.workbench.common.stunner.bpmn.forms.model.AssigneeType) ClientUserSystemManager(org.uberfire.ext.security.management.client.ClientUserSystemManager) Message(org.jboss.errai.bus.client.api.messaging.Message) SearchRequestImpl(org.uberfire.ext.security.management.impl.SearchRequestImpl)

Example 7 with ErrorCallback

use of org.jboss.errai.common.client.api.ErrorCallback in project kie-wb-common by kiegroup.

the class ProjectImportsScreenPresenterTest method verifyShowHide.

private void verifyShowHide(boolean positive) {
    when(serviceCaller.call(any(RemoteCallback.class), any(ErrorCallback.class))).thenAnswer(new LoadContentAnswer(importsService, importsContent, positive ? null : errorCallback));
    presenter.init(path, placeRequest);
    verify(view).showLoading();
    if (positive) {
        verify(view).hideBusyIndicator();
    } else {
        verify(errorCallback).error(any(Message.class), any(Throwable.class));
    }
}
Also used : LoadContentAnswer(org.kie.workbench.common.screens.projectimportsscreen.client.forms.answer.LoadContentAnswer) Message(org.jboss.errai.bus.client.api.messaging.Message) ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 8 with ErrorCallback

use of org.jboss.errai.common.client.api.ErrorCallback in project kie-wb-common by kiegroup.

the class ContainerRulesConfigPresenter method stopScanner.

public void stopScanner() {
    view.disableActions();
    ruleCapabilitiesService.call(new RemoteCallback<Void>() {

        @Override
        public void callback(final Void response) {
            scannerStatus = KieScannerStatus.STOPPED;
            setScannerStatus();
            updateViewState();
        }
    }, new ErrorCallback<Object>() {

        @Override
        public boolean error(final Object o, final Throwable throwable) {
            notification.fire(new NotificationEvent(view.getStopScannerErrorMessage(), NotificationEvent.NotificationType.ERROR));
            updateViewState();
            return false;
        }
    }).stopScanner(containerSpec);
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 9 with ErrorCallback

use of org.jboss.errai.common.client.api.ErrorCallback in project kie-wb-common by kiegroup.

the class ContainerRulesConfigPresenter method scanNow.

public void scanNow() {
    view.disableActions();
    ruleCapabilitiesService.call(new RemoteCallback<Void>() {

        @Override
        public void callback(final Void response) {
            scannerStatus = KieScannerStatus.STOPPED;
            setScannerStatus();
            updateViewState();
        }
    }, new ErrorCallback<Object>() {

        @Override
        public boolean error(final Object o, final Throwable throwable) {
            notification.fire(new NotificationEvent(view.getScanNowErrorMessage(), NotificationEvent.NotificationType.ERROR));
            updateViewState();
            return false;
        }
    }).scanNow(containerSpec);
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 10 with ErrorCallback

use of org.jboss.errai.common.client.api.ErrorCallback in project kie-wb-common by kiegroup.

the class ContainerRulesConfigPresenter method startScanner.

public void startScanner(final String interval, final String timeUnit) {
    if (interval.trim().isEmpty()) {
        view.errorOnInterval();
        return;
    }
    Long actualInterval = calculateInterval(Long.valueOf(checkNotEmpty("interval", interval)), timeUnit);
    view.disableActions();
    ruleCapabilitiesService.call(new RemoteCallback<Void>() {

        @Override
        public void callback(final Void response) {
            scannerStatus = KieScannerStatus.STARTED;
            setScannerStatus();
            updateViewState();
        }
    }, new ErrorCallback<Object>() {

        @Override
        public boolean error(final Object o, final Throwable throwable) {
            notification.fire(new NotificationEvent(view.getStartScannerErrorMessage(), NotificationEvent.NotificationType.ERROR));
            updateViewState();
            return false;
        }
    }).startScanner(containerSpec, actualInterval);
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Aggregations

ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)12 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)12 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)9 Message (org.jboss.errai.bus.client.api.messaging.Message)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 TreeSet (java.util.TreeSet)2 Collectors (java.util.stream.Collectors)2 Dependent (javax.enterprise.context.Dependent)2 Inject (javax.inject.Inject)2 Group (org.jboss.errai.security.shared.api.Group)2 User (org.jboss.errai.security.shared.api.identity.User)2 AssigneeType (org.kie.workbench.common.stunner.bpmn.forms.model.AssigneeType)2 AbstractEntityManager (org.uberfire.ext.security.management.api.AbstractEntityManager)2 ClientUserSystemManager (org.uberfire.ext.security.management.client.ClientUserSystemManager)2 SearchRequestImpl (org.uberfire.ext.security.management.impl.SearchRequestImpl)2 EntryCreationLiveSearchService (org.uberfire.ext.widgets.common.client.dropdown.EntryCreationLiveSearchService)2 LiveSearchCallback (org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback)2