use of org.guvnor.structure.organizationalunit.OrganizationalUnit 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);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class LibraryPlaces method setupLibraryPerspective.
private void setupLibraryPerspective() {
OrganizationalUnit activeOu = projectContext.getActiveOrganizationalUnit().orElseThrow(() -> new IllegalStateException("Cannot setup library perspective without active space."));
PortablePreconditions.checkNotNull("libraryPerspective", libraryPerspective);
final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
part.setSelectable(false);
if (!projectContext.getActiveWorkspaceProject().isPresent()) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(activeOu));
}
closeLibraryPlaces();
placeManager.goTo(part, libraryPerspective.getRootPanel());
setupLibraryBreadCrumbsWithoutProject();
hideDocks();
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class LibraryPlaces method goToLibrary.
public void goToLibrary() {
if (!projectContext.getActiveOrganizationalUnit().isPresent()) {
libraryService.call(new RemoteCallback<OrganizationalUnit>() {
@Override
public void callback(OrganizationalUnit organizationalUnit) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(organizationalUnit));
setupLibraryPerspective();
}
}).getDefaultOrganizationalUnit();
} else {
setupLibraryPerspective();
}
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class LibraryScreenTest method organizationalUnitEditedTest.
@Test
public void organizationalUnitEditedTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final List<String> contributors = new ArrayList<>();
contributors.add("admin");
doReturn(contributors).when(organizationalUnit).getContributors();
libraryScreen.organizationalUnitEdited(new AfterEditOrganizationalUnitEvent(mock(OrganizationalUnit.class), organizationalUnit));
verify(view).setContributorsCount(contributors.size());
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class LibraryScreenTest method setupTest.
@Test
public void setupTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn("name").when(organizationalUnit).getName();
doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
doReturn(12).when(contributorsListPresenter).getContributorsCount();
libraryScreen.init();
verify(view).init(libraryScreen);
verify(view).setTitle("name");
verify(view).setContributorsCount(12);
}
Aggregations