Search in sources :

Example 1 with AfterCreateOrganizationalUnitEvent

use of org.guvnor.structure.events.AfterCreateOrganizationalUnitEvent in project kie-wb-common by kiegroup.

the class OrganizationalUnitPopUpPresenter method saveCreation.

void saveCreation(final String name, final String defaultGroupId, final String owner) {
    final Command saveCommand = () -> {
        final Collection<Repository> repositories = new ArrayList<>();
        final List<String> contributors = contributorsManagementPresenter.getSelectedContributorsUserNames();
        final RemoteCallback<OrganizationalUnit> successCallback = (OrganizationalUnit newOrganizationalUnit) -> {
            afterCreateOrganizationalUnitEvent.fire(new AfterCreateOrganizationalUnitEvent(newOrganizationalUnit));
            view.hideBusyIndicator();
            notificationEvent.fire(new NotificationEvent(view.getSaveSuccessMessage(), NotificationEvent.NotificationType.SUCCESS));
            view.hide();
        };
        final HasBusyIndicatorDefaultErrorCallback errorCallback = new HasBusyIndicatorDefaultErrorCallback(view);
        organizationalUnitService.call(successCallback, errorCallback).createOrganizationalUnit(name, owner, defaultGroupId, repositories, contributors);
    };
    validateDuplicatedOrganizationalUnit(name, saveCommand);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Command(org.uberfire.mvp.Command) AfterCreateOrganizationalUnitEvent(org.guvnor.structure.events.AfterCreateOrganizationalUnitEvent) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) Collection(java.util.Collection) ArrayList(java.util.ArrayList) List(java.util.List) NotificationEvent(org.uberfire.workbench.events.NotificationEvent) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 AfterCreateOrganizationalUnitEvent (org.guvnor.structure.events.AfterCreateOrganizationalUnitEvent)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 HasBusyIndicatorDefaultErrorCallback (org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback)1 Command (org.uberfire.mvp.Command)1 NotificationEvent (org.uberfire.workbench.events.NotificationEvent)1