Search in sources :

Example 16 with ErrorCallback

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

the class AbstractInstallExecutor method buildAndInstall.

protected void buildAndInstall(final BuildExecutionContext context, final DeploymentMode mode) {
    showBuildMessage();
    buildServiceCaller.call((RemoteCallback<BuildResults>) result -> {
        if (result.getErrorMessages().isEmpty()) {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildAndInstallSuccessful(), NotificationEvent.NotificationType.SUCCESS));
        } else {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildFailed(), NotificationEvent.NotificationType.ERROR));
        }
        buildResultsEvent.fire(result);
        finish();
    }, (ErrorCallback<Message>) (message, throwable) -> handleBuildError(context, message, throwable)).buildAndDeploy(context.getModule(), mode);
}
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 17 with ErrorCallback

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

the class SnapshotBuildAndDeployExecutor method buildDeployWithOneServerTemplate.

@Override
void buildDeployWithOneServerTemplate(final BuildExecutionContext context, final ServerTemplate serverTemplate) {
    showBuildMessage();
    context.setServerTemplate(serverTemplate);
    buildServiceCaller.call((RemoteCallback<BuildResults>) result -> {
        if (result.getErrorMessages().isEmpty()) {
            GAV gav = context.getModule().getPom().getGav();
            settings.addDeployment(gav.getGroupId(), gav.getArtifactId(), serverTemplate.getId());
            settings.save();
        }
        onBuildDeploySuccess(context, result);
    }, (ErrorCallback<Message>) (message, e) -> {
        finish();
        return false;
    }).buildAndDeploy(context.getModule(), DeploymentMode.FORCED);
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) GAV(org.guvnor.common.services.project.model.GAV)

Example 18 with ErrorCallback

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

the class BuildExecutor method start.

@Override
protected void start(final BuildExecutionContext context) {
    showBuildMessage();
    buildServiceCaller.call((RemoteCallback<BuildResults>) result -> {
        if (result.getErrorMessages().isEmpty()) {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildSuccessful(), NotificationEvent.NotificationType.SUCCESS));
        } else {
            notificationEvent.fire(new NotificationEvent(CONSTANTS.BuildFailed(), NotificationEvent.NotificationType.ERROR));
        }
        buildResultsEvent.fire(result);
        finish();
    }, (ErrorCallback<Message>) (message, throwable) -> {
        finish();
        return false;
    }).build(context.getModule());
}
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 19 with ErrorCallback

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

the class ScenarioSimulationEditorBusinessCentralWrapperTest method getDMNMetadata.

@Test
public void getDMNMetadata() {
    ArgumentCaptor<ErrorCallback> errorCallbackArgumentCaptor = ArgumentCaptor.forClass(ErrorCallback.class);
    String dmnPath = "src/test.dmn";
    String dmnName = "DMN-NAME";
    String dmnNameSpace = "DMN-namespace";
    modelLocal.getSettings().setDmnFilePath(dmnPath);
    when(dmnTypeServiceMock.getDMNMetadata(eq(pathMock), eq(dmnPath))).thenReturn(new DMNMetadata(dmnName, dmnNameSpace));
    scenarioSimulationEditorBusinessClientWrapper.getDMNMetadata();
    verify(dmnTypeServiceCaller, times(1)).call(isA(RemoteCallback.class), errorCallbackArgumentCaptor.capture());
    verify(dmnTypeServiceMock, times(1)).getDMNMetadata(eq(pathMock), eq(dmnPath));
    verify(scenarioSimulationEditorPresenterMock, times(1)).reloadSettingsDock();
    assertEquals(dmnName, modelLocal.getSettings().getDmnName());
    assertEquals(dmnNameSpace, modelLocal.getSettings().getDmnNamespace());
    errorCallbackArgumentCaptor.getValue().error("ERROR", new Throwable());
    verify(scenarioSimulationEditorPresenterMock, times(1)).sendNotification(eq("ERROR"), eq(NotificationEvent.NotificationType.ERROR));
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) DMNMetadata(org.drools.workbench.screens.scenariosimulation.model.DMNMetadata) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) Test(org.junit.Test) AbstractScenarioSimulationEditorTest(org.drools.workbench.screens.scenariosimulation.client.editor.AbstractScenarioSimulationEditorTest)

Aggregations

ErrorCallback (org.jboss.errai.common.client.api.ErrorCallback)19 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)19 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)14 List (java.util.List)3 Dependent (javax.enterprise.context.Dependent)3 Inject (javax.inject.Inject)3 Message (org.jboss.errai.bus.client.api.messaging.Message)3 ArrayList (java.util.ArrayList)2 Optional (java.util.Optional)2 Set (java.util.Set)2 TreeSet (java.util.TreeSet)2 Collectors (java.util.stream.Collectors)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