Search in sources :

Example 11 with ErrorCallback

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

the class ContainerRulesConfigPresenter method upgrade.

public void upgrade(final String version) {
    view.disableActions();
    ruleCapabilitiesService.call(new RemoteCallback<Void>() {

        @Override
        public void callback(final Void response) {
            if (version != null && !version.isEmpty() && version.compareTo(containerSpec.getReleasedId().getVersion()) == 0) {
                notification.fire(new NotificationEvent(view.getUpgradeSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
            }
            updateViewState();
        }
    }, new ErrorCallback<Object>() {

        @Override
        public boolean error(final Object o, final Throwable throwable) {
            notification.fire(new NotificationEvent(view.getUpgradeErrorMessage(), NotificationEvent.NotificationType.ERROR));
            updateViewState();
            return false;
        }
    }).upgradeContainer(containerSpec, new ReleaseId(containerSpec.getReleasedId().getGroupId(), containerSpec.getReleasedId().getArtifactId(), version));
}
Also used : ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ReleaseId(org.kie.server.api.model.ReleaseId) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Example 12 with ErrorCallback

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

the class NewContainerWizard method complete.

@Override
public void complete() {
    final Map<Capability, ContainerConfig> mapConfig = new HashMap<Capability, ContainerConfig>();
    if (getPages().size() == 2) {
        mapConfig.put(Capability.PROCESS, processConfigPagePresenter.buildProcessConfig());
    }
    mapConfig.put(Capability.RULE, new RuleConfig(null, KieScannerStatus.STOPPED));
    final ContainerSpec newContainer = newContainerFormPresenter.buildContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), mapConfig);
    specManagementService.call(new RemoteCallback<Void>() {

        @Override
        public void callback(final Void o) {
            notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerWizardSaveSuccess(), NotificationEvent.NotificationType.SUCCESS));
            clear();
            NewContainerWizard.super.complete();
            serverTemplateSelectedEvent.fire(new ServerTemplateSelected(serverTemplate, newContainer.getId()));
        }
    }, new ErrorCallback<Object>() {

        @Override
        public boolean error(final Object o, final Throwable throwable) {
            notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerWizardSaveError(), NotificationEvent.NotificationType.ERROR));
            NewContainerWizard.this.pageSelected(0);
            NewContainerWizard.this.start();
            return false;
        }
    }).saveContainerSpec(newContainerFormPresenter.getServerTemplate().getId(), newContainer);
}
Also used : Capability(org.kie.server.controller.api.model.spec.Capability) HashMap(java.util.HashMap) ErrorCallback(org.jboss.errai.common.client.api.ErrorCallback) ContainerSpec(org.kie.server.controller.api.model.spec.ContainerSpec) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) ServerTemplateSelected(org.kie.workbench.common.screens.server.management.client.events.ServerTemplateSelected) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) ContainerConfig(org.kie.server.controller.api.model.spec.ContainerConfig) RuleConfig(org.kie.server.controller.api.model.spec.RuleConfig)

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