@Test public void testHierarchyToDNDToApp_Classified() { App targetAppMock = mock(App.class); when(utilMock.isUnclassified(hierarchyMock)).thenReturn(false); when(targetAppMock.getName()).thenReturn("name"); uut = new OntologiesPresenterImpl(serviceFacadeMock, appServiceMock, editorStoreMock, previewStoreMock, factoryMock, avuFactoryMock, appearanceMock, previewGridPresenterMock, editorGridPresenterMock, categorizeViewMock) { @Override boolean previewTreeHasHierarchy(OntologyHierarchy hierarchy) { return false; } @Override void getFilteredOntologyHierarchies(String version, List<OntologyHierarchy> result) { } @Override public Ontology getSelectedOntology() { return ontologyMock; } }; uut.announcer = announcerMock; uut.properties = propertiesMock; uut.ontologyUtil = utilMock; uut.hierarchyDNDtoApp(hierarchyMock, targetAppMock); verify(serviceFacadeMock).addAVUsToApp(eq(targetAppMock), eq(avuListBeanMock), asyncAvuListCaptor.capture()); asyncAvuListCaptor.getValue().onSuccess(avuListMock); verify(announcerMock).schedule(any(SuccessAnnouncementConfig.class)); }
@Override public void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp) { if (ontologyUtil.isUnclassified(hierarchy)) { clearAvus(targetApp); return; } if (hierarchy.getIri().equalsIgnoreCase(OntologiesView.TRASH_CATEGORY)) { deleteApp(targetApp); return; } AvuList avuList = ontologyUtil.convertHierarchiesToAvus(hierarchy); serviceFacade.addAVUsToApp(targetApp, avuList, new AsyncCallback<List<Avu>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<Avu> result) { announcer.schedule(new SuccessAnnouncementConfig(appearance.appClassified(targetApp.getName(), hierarchy.getLabel()))); view.selectHierarchy(hierarchy); view.deselectAll(); if (!previewTreeHasHierarchy(hierarchy)) { getFilteredOntologyHierarchies(getSelectedOntology().getVersion(), editorTreeStore.getRootItems()); } } }); }
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 { @Override public void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp) { if (ontologyUtil.isUnclassified(hierarchy)) { clearAvus(targetApp); return; } if (hierarchy.getIri().equalsIgnoreCase(OntologiesView.TRASH_CATEGORY)) { deleteApp(targetApp); return; } AvuList avuList = ontologyUtil.convertHierarchiesToAvus(hierarchy); serviceFacade.addAVUsToApp(targetApp, avuList, new AsyncCallback<List<Avu>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<Avu> result) { announcer.schedule(new SuccessAnnouncementConfig(appearance.appClassified(targetApp.getName(), hierarchy.getLabel()))); view.selectHierarchy(hierarchy); view.deselectAll(); if (!previewTreeHasHierarchy(hierarchy)) { getFilteredOntologyHierarchies(getSelectedOntology().getVersion(), editorTreeStore.getRootItems()); } } }); } }
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 { @Override public void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp) { if (ontologyUtil.isUnclassified(hierarchy)) { clearAvus(targetApp); return; } if (hierarchy.getIri().equalsIgnoreCase(OntologiesView.TRASH_CATEGORY)) { deleteApp(targetApp); return; } AvuList avuList = ontologyUtil.convertHierarchiesToAvus(hierarchy); serviceFacade.addAVUsToApp(targetApp, avuList, new AsyncCallback<List<Avu>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<Avu> result) { announcer.schedule(new SuccessAnnouncementConfig(appearance.appClassified(targetApp.getName(), hierarchy.getLabel()))); view.selectHierarchy(hierarchy); view.deselectAll(); if (!previewTreeHasHierarchy(hierarchy)) { getFilteredOntologyHierarchies(getSelectedOntology().getVersion(), editorTreeStore.getRootItems()); } } }); } @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 { @Override public void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp) { if (ontologyUtil.isUnclassified(hierarchy)) { clearAvus(targetApp); return; } if (hierarchy.getIri().equalsIgnoreCase(OntologiesView.TRASH_CATEGORY)) { deleteApp(targetApp); return; } AvuList avuList = ontologyUtil.convertHierarchiesToAvus(hierarchy); serviceFacade.addAVUsToApp(targetApp, avuList, new AsyncCallback<List<Avu>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<Avu> result) { announcer.schedule(new SuccessAnnouncementConfig(appearance.appClassified(targetApp.getName(), hierarchy.getLabel()))); view.selectHierarchy(hierarchy); view.deselectAll(); if (!previewTreeHasHierarchy(hierarchy)) { getFilteredOntologyHierarchies(getSelectedOntology().getVersion(), editorTreeStore.getRootItems()); } } }); } @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 { @Override public void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp) { if (ontologyUtil.isUnclassified(hierarchy)) { clearAvus(targetApp); return; } if (hierarchy.getIri().equalsIgnoreCase(OntologiesView.TRASH_CATEGORY)) { deleteApp(targetApp); return; } AvuList avuList = ontologyUtil.convertHierarchiesToAvus(hierarchy); serviceFacade.addAVUsToApp(targetApp, avuList, new AsyncCallback<List<Avu>>() { @Override public void onFailure(Throwable caught) { ErrorHandler.post(caught); } @Override public void onSuccess(List<Avu> result) { announcer.schedule(new SuccessAnnouncementConfig(appearance.appClassified(targetApp.getName(), hierarchy.getLabel()))); view.selectHierarchy(hierarchy); view.deselectAll(); if (!previewTreeHasHierarchy(hierarchy)) { getFilteredOntologyHierarchies(getSelectedOntology().getVersion(), editorTreeStore.getRootItems()); } } }); } @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();  }