@Test public void testGetFilteredOntologyHierarchies() { when(utilMock.getAttr(hierarchyMock)).thenReturn("attr"); uut.getFilteredOntologyHierarchies("version", ontologyHierarchyListMock); verify(viewMock).clearTreeStore(isA(OntologiesView.ViewType.class)); verify(viewMock, times(2)).maskTree(isA(OntologiesView.ViewType.class)); verify(serviceFacadeMock, times(2)).getFilteredOntologyHierarchy(anyString(), anyString(), anyString(), asyncOntologyHierarchyCaptor.capture()); asyncOntologyHierarchyCaptor.getValue().onSuccess(hierarchyMock); verify(viewMock).reSortTree(isA(OntologiesView.ViewType.class)); verify(viewMock).unmaskTree(isA(OntologiesView.ViewType.class)); }
void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { view.clearTreeStore(OntologiesView.ViewType.PREVIEW); for (OntologyHierarchy hierarchy: result) { view.maskTree(OntologiesView.ViewType.PREVIEW); String attr = ontologyUtil.getAttr(hierarchy); if (Strings.isNullOrEmpty(attr)) { continue; } serviceFacade.getFilteredOntologyHierarchy(version, hierarchy.getIri(), attr, new AsyncCallback<OntologyHierarchy>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } @Override public void onSuccess(OntologyHierarchy result) { if (result != null) { List<OntologyHierarchy> hierarchies = Lists.newArrayList(result); addHierarchies(OntologiesView.ViewType.PREVIEW, null, hierarchies); view.reSortTree(OntologiesView.ViewType.PREVIEW); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } } }); } }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { view.clearTreeStore(OntologiesView.ViewType.PREVIEW); for (OntologyHierarchy hierarchy: result) { view.maskTree(OntologiesView.ViewType.PREVIEW); String attr = ontologyUtil.getAttr(hierarchy); if (Strings.isNullOrEmpty(attr)) { continue; } serviceFacade.getFilteredOntologyHierarchy(version, hierarchy.getIri(), attr, new AsyncCallback<OntologyHierarchy>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } @Override public void onSuccess(OntologyHierarchy result) { if (result != null) { List<OntologyHierarchy> hierarchies = Lists.newArrayList(result); addHierarchies(OntologiesView.ViewType.PREVIEW, null, hierarchies); view.reSortTree(OntologiesView.ViewType.PREVIEW); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } } }); } } }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { view.clearTreeStore(OntologiesView.ViewType.PREVIEW); for (OntologyHierarchy hierarchy: result) { view.maskTree(OntologiesView.ViewType.PREVIEW); String attr = ontologyUtil.getAttr(hierarchy); if (Strings.isNullOrEmpty(attr)) { continue; } serviceFacade.getFilteredOntologyHierarchy(version, hierarchy.getIri(), attr, new AsyncCallback<OntologyHierarchy>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } @Override public void onSuccess(OntologyHierarchy result) { if (result != null) { List<OntologyHierarchy> hierarchies = Lists.newArrayList(result); addHierarchies(OntologiesView.ViewType.PREVIEW, null, hierarchies); view.reSortTree(OntologiesView.ViewType.PREVIEW); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } } }); } } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { view.clearTreeStore(OntologiesView.ViewType.PREVIEW); for (OntologyHierarchy hierarchy: result) { view.maskTree(OntologiesView.ViewType.PREVIEW); String attr = ontologyUtil.getAttr(hierarchy); if (Strings.isNullOrEmpty(attr)) { continue; } serviceFacade.getFilteredOntologyHierarchy(version, hierarchy.getIri(), attr, new AsyncCallback<OntologyHierarchy>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } @Override public void onSuccess(OntologyHierarchy result) { if (result != null) { List<OntologyHierarchy> hierarchies = Lists.newArrayList(result); addHierarchies(OntologiesView.ViewType.PREVIEW, null, hierarchies); view.reSortTree(OntologiesView.ViewType.PREVIEW); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } } }); } } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); @Override void go(HasOneWidget container); @Override OntologiesView getView(); @Override void appsDNDtoHierarchy(List<App> apps, OntologyHierarchy hierarchy); @Override void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp); @Override void onRefreshOntologies(RefreshOntologiesEvent event); @Override void onSelectOntologyVersion(SelectOntologyVersionEvent event); @Override void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event); @Override void onCategorizeButtonClicked(CategorizeButtonClickedEvent event); @Override void onPublishOntologyClick(PublishOntologyClickEvent event); @Override void onPreviewHierarchySelected(PreviewHierarchySelectedEvent event); @Override void onHierarchySelected(HierarchySelectedEvent event); @Override OntologyHierarchy getHierarchyFromElement(Element el); @Override OntologyHierarchy getSelectedHierarchy(); @Override Ontology getSelectedOntology(); @Override void onDeleteOntologyButtonClicked(final DeleteOntologyButtonClickedEvent event); @Override void onDeleteHierarchy(final DeleteHierarchyEvent event); @Override void onDeleteAppsSelected(DeleteAppsSelected event); @Override void onRefreshPreviewButtonClicked(RefreshPreviewButtonClicked event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); void onRestoreAppButtonClicked(RestoreAppButtonClicked event); void getTrashItems(); }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { view.clearTreeStore(OntologiesView.ViewType.PREVIEW); for (OntologyHierarchy hierarchy: result) { view.maskTree(OntologiesView.ViewType.PREVIEW); String attr = ontologyUtil.getAttr(hierarchy); if (Strings.isNullOrEmpty(attr)) { continue; } serviceFacade.getFilteredOntologyHierarchy(version, hierarchy.getIri(), attr, new AsyncCallback<OntologyHierarchy>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } @Override public void onSuccess(OntologyHierarchy result) { if (result != null) { List<OntologyHierarchy> hierarchies = Lists.newArrayList(result); addHierarchies(OntologiesView.ViewType.PREVIEW, null, hierarchies); view.reSortTree(OntologiesView.ViewType.PREVIEW); view.unmaskTree(OntologiesView.ViewType.PREVIEW); } } }); } } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); @Override void go(HasOneWidget container); @Override OntologiesView getView(); @Override void appsDNDtoHierarchy(List<App> apps, OntologyHierarchy hierarchy); @Override void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp); @Override void onRefreshOntologies(RefreshOntologiesEvent event); @Override void onSelectOntologyVersion(SelectOntologyVersionEvent event); @Override void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event); @Override void onCategorizeButtonClicked(CategorizeButtonClickedEvent event); @Override void onPublishOntologyClick(PublishOntologyClickEvent event); @Override void onPreviewHierarchySelected(PreviewHierarchySelectedEvent event); @Override void onHierarchySelected(HierarchySelectedEvent event); @Override OntologyHierarchy getHierarchyFromElement(Element el); @Override OntologyHierarchy getSelectedHierarchy(); @Override Ontology getSelectedOntology(); @Override void onDeleteOntologyButtonClicked(final DeleteOntologyButtonClickedEvent event); @Override void onDeleteHierarchy(final DeleteHierarchyEvent event); @Override void onDeleteAppsSelected(DeleteAppsSelected event); @Override void onRefreshPreviewButtonClicked(RefreshPreviewButtonClicked event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); void onRestoreAppButtonClicked(RestoreAppButtonClicked event); void getTrashItems();  }