diff --git a/pom.xml b/pom.xml index ddc809f0f0..ebbe9fdcc6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.11 + 7.0.0-SNAPSHOT pom diff --git a/webprotege-gwt-ui-client/pom.xml b/webprotege-gwt-ui-client/pom.xml index eb1d2d5121..a561748d73 100644 --- a/webprotege-gwt-ui-client/pom.xml +++ b/webprotege-gwt-ui-client/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.11 + 7.0.0-SNAPSHOT webprotege-gwt-ui-client diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java index 2f83fa1a0f..a5dfd8a979 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/Messages.java @@ -448,6 +448,11 @@ public interface Messages extends com.google.gwt.i18n.client.Messages { @Key("hierarchy.objectproperties") String hierarchy_objectproperties(); + + @DefaultMessage("Configure hierarchy...") + @Key("hierarchy.configure") + String hierarchy_configure(); + @DefaultMessage("History") @Key("history") diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveEntitiesToParentPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveEntitiesToParentPresenter.java index f6aca3e7e4..e43ef7b358 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveEntitiesToParentPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveEntitiesToParentPresenter.java @@ -2,12 +2,12 @@ import com.google.common.collect.ImmutableSet; import com.google.gwt.user.client.ui.AcceptsOneWidget; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyFieldPresenter; import edu.stanford.bmir.protege.web.shared.HasBrowserText; import edu.stanford.bmir.protege.web.shared.bulkop.MoveEntitiesToParentAction; import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData; import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.semanticweb.owlapi.model.EntityType; import org.semanticweb.owlapi.model.OWLClass; @@ -112,7 +112,7 @@ public void displayErrorMessage() { } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - hierarchyFieldPresenter.setHierarchyId(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + hierarchyFieldPresenter.setHierarchyDescriptor(hierarchyDescriptor); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveToParentUiAction.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveToParentUiAction.java index 9d38da4b4e..465aea3f93 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveToParentUiAction.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/bulkop/MoveToParentUiAction.java @@ -2,6 +2,7 @@ import com.google.common.collect.ImmutableSet; import edu.stanford.bmir.protege.web.client.action.AbstractUiAction; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData; import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import org.semanticweb.owlapi.model.EntityType; @@ -54,7 +55,7 @@ public void execute() { workflow.start(); } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - parentPresenter.setHierarchyId(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + parentPresenter.setHierarchyDescriptor(hierarchyDescriptor); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesPresenter.java index 6166762327..478da09fe7 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesPresenter.java @@ -6,6 +6,7 @@ import edu.stanford.bmir.protege.web.client.Messages; import edu.stanford.bmir.protege.web.client.bulkop.BulkEditOperationPresenter; import edu.stanford.bmir.protege.web.client.bulkop.BulkOpMessageFormatter; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyFieldPresenter; import edu.stanford.bmir.protege.web.shared.HasBrowserText; import edu.stanford.bmir.protege.web.shared.dispatch.Action; @@ -127,7 +128,7 @@ public void displayErrorMessage() { } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - hierarchyFieldPresenter.setHierarchyId(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + hierarchyFieldPresenter.setHierarchyDescriptor(hierarchyDescriptor); } } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesUiAction.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesUiAction.java index 49d7a6fc00..27c7bc1153 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesUiAction.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/entity/MergeEntitiesUiAction.java @@ -5,8 +5,8 @@ import edu.stanford.bmir.protege.web.client.action.AbstractUiAction; import edu.stanford.bmir.protege.web.client.bulkop.BulkEditOperationWorkflow; import edu.stanford.bmir.protege.web.client.bulkop.BulkEditOperationWorkflowFactory; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -44,8 +44,8 @@ public void setSelectionSupplier(@Nonnull Supplier> this.selectionSupplier = checkNotNull(selectionSupplier); } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - presenter.setHierarchyId(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + presenter.setHierarchyDescriptor(hierarchyDescriptor); } @Override diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyPortletPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyPortletPresenter.java index 744380fb90..3f7abc4aaf 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyPortletPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyPortletPresenter.java @@ -174,17 +174,18 @@ public void startPortlet(@Nonnull PortletUi portletUi, actionStatePresenter.start(eventBus); - hierarchyModel.start(eventBus, CLASS_HIERARCHY); + hierarchyModel.start(eventBus, ClassHierarchyDescriptor.get()); renderer.setDisplayLanguage(displayNameSettingsManager.getLocalDisplayNameSettings()); treeWidget.setRenderer(renderer); treeWidget.setModel(GraphTreeNodeModel.create(hierarchyModel, node -> node.getEntity())); treeWidget.setDropHandler(this.dropHandler); - dropHandler.start(CLASS_HIERARCHY); + dropHandler.start(ClassHierarchyDescriptor.get()); contextMenuPresenterFactory.create(hierarchyModel, treeWidget, createClassAction, - deleteClassAction) + deleteClassAction, + getProjectId()) .install(); tagVisibilityPresenter.start(filterView, treeWidget); diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyContextMenuPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyContextMenuPresenter.java index 599f225420..d95c3b07f2 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyContextMenuPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyContextMenuPresenter.java @@ -10,6 +10,7 @@ import edu.stanford.bmir.protege.web.client.bulkop.EditAnnotationsUiAction; import edu.stanford.bmir.protege.web.client.bulkop.MoveToParentUiAction; import edu.stanford.bmir.protege.web.client.bulkop.SetAnnotationValueUiAction; +import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.entity.MergeEntitiesUiAction; import edu.stanford.bmir.protege.web.client.library.msgbox.InputBox; import edu.stanford.bmir.protege.web.client.library.popupmenu.PopupMenu; @@ -18,6 +19,7 @@ import edu.stanford.bmir.protege.web.client.watches.WatchUiAction; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; import edu.stanford.bmir.protege.web.shared.entity.OWLEntityData; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; import edu.stanford.protege.gwt.graphtree.client.TreeWidget; import edu.stanford.protege.gwt.graphtree.shared.tree.TreeNode; import edu.stanford.protege.gwt.graphtree.shared.tree.impl.GraphTreeNodeModel; @@ -90,10 +92,15 @@ public class EntityHierarchyContextMenuPresenter { private final InputBox inputBox; + private DispatchServiceManager dispatch; + private ProjectId projectId; + public EntityHierarchyContextMenuPresenter(@Nonnull EntityHierarchyModel model, @Nonnull TreeWidget treeWidget, @Nonnull UIAction createEntityAction, @Nonnull UIAction deleteEntityAction, + @Nonnull ProjectId projectId, + @Provided @Nonnull DispatchServiceManager dispatch, @Provided @Nonnull SetAnnotationValueUiAction setAnnotationValueUiAction, @Provided @Nonnull MoveToParentUiAction moveToParentUiAction, @Provided @Nonnull MergeEntitiesUiAction mergeEntitiesAction, @Provided @Nonnull EditAnnotationsUiAction editAnnotationsUiAction, @@ -102,6 +109,8 @@ public EntityHierarchyContextMenuPresenter(@Nonnull EntityHierarchyModel model, @Provided @Nonnull WatchUiAction watchUiAction, @Provided @Nonnull LoggedInUserProjectPermissionChecker permissionChecker, @Provided @Nonnull InputBox inputBox) { + this.projectId = projectId; + this.dispatch = dispatch; this.setAnnotationValueUiAction = checkNotNull(setAnnotationValueUiAction); this.moveToParentUiAction = checkNotNull(moveToParentUiAction); this.editAnnotationsUiAction = checkNotNull(editAnnotationsUiAction); @@ -158,8 +167,8 @@ private void createContextMenu() { contextMenu.addItem(messages.refreshTree(), this::handleRefresh); // This needs tidying somehow. We don't do this for other actions. - moveToParentUiAction.setHierarchyId(model.getHierarchyId()); - mergeEntitiesAction.setHierarchyId(model.getHierarchyId()); + moveToParentUiAction.setHierarchyDescriptor(model.getHierarchyDescriptor()); + mergeEntitiesAction.setHierarchyDescriptor(model.getHierarchyDescriptor()); Supplier> selectionSupplier = () -> treeWidget.getSelectedNodes().stream() .map(TreeNode::getUserObject) @@ -169,6 +178,7 @@ private void createContextMenu() { moveToParentUiAction.setSelectionSupplier(selectionSupplier); mergeEntitiesAction.setSelectionSupplier(selectionSupplier); editAnnotationsUiAction.setSelectionSupplier(selectionSupplier); + updateActionStates(); } @@ -200,7 +210,6 @@ private void updateActionStates() { } } - private void pruneSelectedNodesToRoot() { treeWidget.pruneToSelectedNodes(); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyDropHandler.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyDropHandler.java index 64578bafbb..d055b85e9e 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyDropHandler.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyDropHandler.java @@ -3,7 +3,6 @@ import com.google.gwt.core.client.GWT; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.bmir.protege.web.shared.hierarchy.MoveHierarchyNodeAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import edu.stanford.protege.gwt.graphtree.client.TreeNodeDropHandler; @@ -36,18 +35,18 @@ public EntityHierarchyDropHandler(@Nonnull ProjectId projectId, } @Nonnull - private Optional hierarchyId = Optional.empty(); + private Optional hierarchyDescriptor = Optional.empty(); - public void start(@Nonnull HierarchyId hierarchyId) { - this.hierarchyId = Optional.of(hierarchyId); + public void start(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + this.hierarchyDescriptor = Optional.of(hierarchyDescriptor); } @Override public boolean isDropPossible(@Nonnull Path nodePath, @Nonnull Path targetPath, @Nonnull DropType dropType) { - if(!hierarchyId.isPresent()) { + if(!hierarchyDescriptor.isPresent()) { return false; } if(nodePath.isEmpty()) { @@ -69,7 +68,7 @@ public void handleDrop(@Nonnull Path nodePath, @Nonnull DropType dropType, @Nonnull DropEndHandler dropEndHandler) { GWT.log("[EntityHierarchyDropHandler] handleDrop. From: " + nodePath + " To: " + nodePath); - if(!hierarchyId.isPresent()) { + if(!hierarchyDescriptor.isPresent()) { dropEndHandler.handleDropCancelled(); return; } @@ -87,7 +86,7 @@ public void handleDrop(@Nonnull Path nodePath, return; } dispatchServiceManager.execute(MoveHierarchyNodeAction.create(projectId, - hierarchyId.get(), + hierarchyDescriptor.get(), nodePath, targetPath, dropType), diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyModel.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyModel.java index 528e878531..401c5c74d3 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyModel.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/EntityHierarchyModel.java @@ -2,6 +2,7 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.SetMultimap; +import com.google.gwt.user.client.Window; import com.google.web.bindery.event.shared.HandlerRegistration; import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.entity.EntityNodeUpdater; @@ -45,7 +46,7 @@ public class EntityHierarchyModel implements GraphModel, private final Set rootNodes = new HashSet<>(); @Nonnull - private HierarchyId hierarchyId = CLASS_HIERARCHY; + private HierarchyDescriptor hierarchyDescriptor = ClassHierarchyDescriptor.get(); @Inject public EntityHierarchyModel(@Nonnull DispatchServiceManager dispatchServiceManager, @@ -57,18 +58,28 @@ public EntityHierarchyModel(@Nonnull DispatchServiceManager dispatchServiceManag } @Nonnull - public HierarchyId getHierarchyId() { - return hierarchyId; + public HierarchyDescriptor getHierarchyDescriptor() { + return hierarchyDescriptor; } - public void start(@Nonnull WebProtegeEventBus eventBus, @Nonnull HierarchyId hierarchyId) { - this.hierarchyId = checkNotNull(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + if(this.hierarchyDescriptor.equals(hierarchyDescriptor)) { + return; + } + this.hierarchyDescriptor = hierarchyDescriptor; + parent2ChildMap.clear(); + rootNodes.clear(); + nodeCache.clear(); + } + + public void start(@Nonnull WebProtegeEventBus eventBus, @Nonnull HierarchyDescriptor hierarchyDescriptor) { + this.hierarchyDescriptor = checkNotNull(hierarchyDescriptor); hierarchyNodeUpdater.start(eventBus, this); eventBus.addProjectEventHandler(projectId, ON_HIERARCHY_CHANGED, this::handleEntityHierarchyChanged); } private void handleEntityHierarchyChanged(EntityHierarchyChangedEvent event) { - if (!event.getHierarchyId().equals(hierarchyId)) { + if (!event.getHierarchyDescriptor().equals(hierarchyDescriptor)) { return; } GraphModelChangeProcessor changeProcessor = new GraphModelChangeProcessor(parent2ChildMap, rootNodes); @@ -100,7 +111,7 @@ public void updateNode(@Nonnull EntityNode node) { @Override public void getRootNodes(GetRootNodesCallback callback) { - dispatchServiceManager.execute(GetHierarchyRootsAction.create(projectId, hierarchyId), result -> { + dispatchServiceManager.execute(GetHierarchyRootsAction.create(projectId, hierarchyDescriptor), result -> { cacheRootNodes(result); try { dispatchServiceManager.beginBatch(); @@ -124,7 +135,7 @@ private void cacheRootNodes(GetHierarchyRootsResult result) { @Override public void getSuccessorNodes(@Nonnull OWLEntity parent, @Nonnull GetSuccessorNodesCallback callback) { - dispatchServiceManager.execute(GetHierarchyChildrenAction.create(projectId, parent, hierarchyId), + dispatchServiceManager.execute(GetHierarchyChildrenAction.create(projectId, parent, hierarchyDescriptor), result -> { cacheEdges(parent, result); callback.handleSuccessorNodes(result.getSuccessorMap()); @@ -143,7 +154,7 @@ private void cacheEdges(@Nonnull OWLEntity parent, GetHierarchyChildrenResult re @Override public void getPathsFromRootNodes(@Nonnull OWLEntity node, @Nonnull GetPathsBetweenNodesCallback callback) { - dispatchServiceManager.execute(GetHierarchyPathsToRootAction.create(projectId, node, hierarchyId), + dispatchServiceManager.execute(GetHierarchyPathsToRootAction.create(projectId, node, hierarchyDescriptor), result -> { try { dispatchServiceManager.beginBatch(); diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyFieldPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyFieldPresenter.java index 73e1d8fea6..ab5f98a84c 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyFieldPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyFieldPresenter.java @@ -70,7 +70,7 @@ public class HierarchyFieldPresenter { @Nonnull private final DisplayNameSettingsManager displayNameSettingsManager; - private Optional hierarchyId = Optional.empty(); + private Optional hierarchyDescriptor = Optional.empty(); private Optional hierarchyPopupPresenter = Optional.empty(); @@ -116,9 +116,9 @@ public void setSyncWithCurrentSelectionVisible(boolean visible) { } private void handleShowPopupHierarchy(UIObject target) { - hierarchyId.ifPresent(id -> { + hierarchyDescriptor.ifPresent(desc -> { if(!hierarchyPopupPresenter.isPresent()) { - HierarchyPopupPresenter hierarchyPopupPresenter = hierarchyPopupPresenterFactory.create(id); + HierarchyPopupPresenter hierarchyPopupPresenter = hierarchyPopupPresenterFactory.create(desc); hierarchyPopupPresenter.start(eventBus); hierarchyPopupPresenter.setDisplayNameSettings(displayNameSettingsManager.getLocalDisplayNameSettings()); this.hierarchyPopupPresenter = Optional.of(hierarchyPopupPresenter); @@ -162,7 +162,7 @@ private void updateButtonState() { OWLEntity e = entity.getEntity(); view.setMoveToParentButtonEnabled(!e.isTopEntity()); view.setMoveToSiblingButtonEnabled(!e.isTopEntity() && !e.isBottomEntity()); - hierarchyId.ifPresent(id -> { + hierarchyDescriptor.ifPresent(id -> { dispatch.execute(GetHierarchyChildrenAction.create(projectId, e, id, @@ -178,19 +178,19 @@ private void updateButtonState() { private void handleMoveToParent(UIObject target) { - hierarchyId.ifPresent(id -> { + hierarchyDescriptor.ifPresent(descriptor -> { view.getEntity() .map(OWLEntityData::getEntity) - .ifPresent(entity -> getPathsToRootAndMoveToParent(id, entity, target)); + .ifPresent(entity -> getPathsToRootAndMoveToParent(descriptor, entity, target)); }); } - private void getPathsToRootAndMoveToParent(HierarchyId id, OWLEntity entity, UIObject target) { + private void getPathsToRootAndMoveToParent(HierarchyDescriptor descriptor, OWLEntity entity, UIObject target) { EntityNodeListPopupPresenter popup = popupPresenterFactory.create((pageRequest, consumer) -> { dispatch.execute(GetHierarchyPathsToRootAction.create(projectId, entity, - id), + descriptor), result -> { List data = result.getPaths() .stream() @@ -208,20 +208,20 @@ private void getPathsToRootAndMoveToParent(HierarchyId id, OWLEntity entity, UIO } private void handleMoveToSibling(UIObject target) { - hierarchyId.ifPresent(id -> { + hierarchyDescriptor.ifPresent(desc -> { view.getEntity().map(OWLEntityData::getEntity) - .ifPresent(entity -> getSiblingsAndMoveToSibling(id, entity, target)); + .ifPresent(entity -> getSiblingsAndMoveToSibling(desc, entity, target)); }); } - private void getSiblingsAndMoveToSibling(@Nonnull HierarchyId id, + private void getSiblingsAndMoveToSibling(@Nonnull HierarchyDescriptor desc, @Nonnull OWLEntity entity, @Nonnull UIObject target) { EntityNodeListPopupPresenter popup = popupPresenterFactory.create((pageRequest, consumer) -> { dispatch.execute(GetHierarchySiblingsAction.create(projectId, entity, - id, + desc, pageRequest), result -> { Page data = result.getSiblings() @@ -234,20 +234,20 @@ private void getSiblingsAndMoveToSibling(@Nonnull HierarchyId id, private void handleMoveToChild(UIObject target) { - hierarchyId.ifPresent(id -> { + hierarchyDescriptor.ifPresent(desc -> { view.getEntity().map(OWLEntityData::getEntity) - .ifPresent(entity -> getChildrenAndMoveToChild(id, entity, target)); + .ifPresent(entity -> getChildrenAndMoveToChild(desc, entity, target)); }); } - private void getChildrenAndMoveToChild(@Nonnull HierarchyId id, + private void getChildrenAndMoveToChild(@Nonnull HierarchyDescriptor desc, @Nonnull OWLEntity entity, @Nonnull UIObject target) { EntityNodeListPopupPresenter popup = popupPresenterFactory.create(((pageRequest, consumer) -> { dispatch.execute(GetHierarchyChildrenAction.create(projectId, entity, - id, + desc, pageRequest), result -> { Page data = result.getChildren() @@ -283,8 +283,8 @@ public void setEntityType(PrimitiveType entityType) { view.setEntityType(entityType); } - public void setHierarchyId(@Nonnull HierarchyId hierarchyId) { - this.hierarchyId = Optional.of(hierarchyId); + public void setHierarchyDescriptor(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + this.hierarchyDescriptor = Optional.of(hierarchyDescriptor); } public void clearEntity() { diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyPopupPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyPopupPresenter.java index 6f880f010e..98b4f8ce5b 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyPopupPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyPopupPresenter.java @@ -6,7 +6,6 @@ import com.google.gwt.user.client.ui.UIObject; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; import edu.stanford.bmir.protege.web.shared.event.WebProtegeEventBus; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.bmir.protege.web.shared.lang.DisplayNameSettings; import org.semanticweb.owlapi.model.OWLEntity; @@ -24,9 +23,8 @@ */ public class HierarchyPopupPresenter { - - @Nonnull - private final HierarchyId hierarchyId; + @Nonnull + private final HierarchyDescriptor hierarchyDescriptor; @Nonnull private final HierarchyPopupView view; @@ -38,12 +36,11 @@ public class HierarchyPopupPresenter { private Optional selectedEntity = Optional.empty(); - @Inject @AutoFactory - public HierarchyPopupPresenter(@Nonnull HierarchyId hierarchyId, + public HierarchyPopupPresenter(@Nonnull HierarchyDescriptor hierarchyDescriptor, @Provided @Nonnull HierarchyPopupView view, @Provided @Nonnull EntityHierarchyModel model) { - this.hierarchyId = checkNotNull(hierarchyId); + this.hierarchyDescriptor = checkNotNull(hierarchyDescriptor); this.view = view; this.model = checkNotNull(model); popupPanel = new PopupPanel(true, true); @@ -53,7 +50,7 @@ public HierarchyPopupPresenter(@Nonnull HierarchyId hierarchyId, public void start(@Nonnull WebProtegeEventBus eventBus) { model.start(eventBus, - hierarchyId); + hierarchyDescriptor); view.setModel(model); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletPresenter.java index 819f27f2e9..696a250861 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletPresenter.java @@ -173,22 +173,22 @@ public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { deleteAction.setRequiresSelection(true); actionStatePresenter.registerAction(DELETE_PROPERTY, deleteAction); - startTree(OBJECT_PROPERTY_HIERARCHY, + startTree(ObjectPropertyHierarchyDescriptor.get(), messages.hierarchy_objectproperties(), eventBus, objectPropertyHierarchyModel, objectPropertyTree); - startTree(DATA_PROPERTY_HIERARCHY, + startTree(DataPropertyHierarchyDescriptor.get(), messages.hierarchy_dataproperties(), eventBus, dataPropertyHierarchyModel, dataPropertyTree); - startTree(ANNOTATION_PROPERTY_HIERARCHY, + startTree(AnnotationPropertyHierarchyDescriptor.get(), messages.hierarchy_annotationproperties(), eventBus, annotationPropertyHierarchyModel, annotationPropertyTree); - view.setSelectedHierarchy(OBJECT_PROPERTY_HIERARCHY); - view.setHierarchyIdSelectedHandler(this::handleHierarchySwitched); + view.setSelectedHierarchy(ObjectPropertyHierarchyDescriptor.get()); + view.setHierarchyIdSelectedHandler(hierarchyDescriptor -> handleHierarchySwitched(hierarchyDescriptor)); tagVisibilityPresenter.start(filterView, view); actionStatePresenter.start(eventBus); portletUi.setWidget(view); @@ -199,18 +199,18 @@ public void startPortlet(PortletUi portletUi, WebProtegeEventBus eventBus) { * Starts and setups the specified model and tree using the specified event bus. The renderer will be set and a * context menu will be installed. * - * @param hierarchyId The hierarchy Id + * @param hierarchyDescriptor The hierarchy descriptor * @param label The label for the tree * @param eventBus The event bus * @param model The model * @param treeWidget The tree */ - private void startTree(@Nonnull HierarchyId hierarchyId, + private void startTree(@Nonnull HierarchyDescriptor hierarchyDescriptor, @Nonnull String label, @Nonnull WebProtegeEventBus eventBus, @Nonnull EntityHierarchyModel model, @Nonnull TreeWidget treeWidget) { - model.start(eventBus, hierarchyId); + model.start(eventBus, hierarchyDescriptor); eventBus.addProjectEventHandler(getProjectId(), DisplayNameSettingsChangedEvent.ON_DISPLAY_LANGUAGE_CHANGED, event -> { @@ -223,12 +223,13 @@ private void startTree(@Nonnull HierarchyId hierarchyId, contextMenuPresenterFactory.create(model, treeWidget, createAction, - deleteAction) + deleteAction, + getProjectId()) .install(); EntityHierarchyDropHandler entityHierarchyDropHandler = entityHierarchyDropHandlerProvider.get(); treeWidget.setDropHandler(entityHierarchyDropHandler); - entityHierarchyDropHandler.start(hierarchyId); - view.addHierarchy(hierarchyId, + entityHierarchyDropHandler.start(hierarchyDescriptor); + view.addHierarchy(hierarchyDescriptor, label, treeWidget); TreeWidgetUpdater updater = updaterFactory.create(treeWidget, model); @@ -243,7 +244,7 @@ private void handleSelectionChanged(SelectionChangeEvent selectionChangeEvent, T transmitSelectionFromTree(); } - private void handleHierarchySwitched(@Nonnull HierarchyId hierarchyId) { + private void handleHierarchySwitched(@Nonnull HierarchyDescriptor hierarchyDescriptor) { GWT.log("[PropertyHierarchyPortletPresenter] handling hierarchy switched"); transmitSelectionFromTree(); } @@ -302,19 +303,19 @@ private void setSelectionInTree(Optional entity) { private void setSelectionInTree(@Nonnull OWLEntity sel) { if (sel.isOWLObjectProperty()) { - view.setSelectedHierarchy(OBJECT_PROPERTY_HIERARCHY); + view.setSelectedHierarchy(ObjectPropertyHierarchyDescriptor.get()); if (!objectPropertyTree.getSelectedKeys().contains(sel)) { objectPropertyTree.revealTreeNodesForKey(sel, REVEAL_FIRST); } } else if (sel.isOWLDataProperty()) { - view.setSelectedHierarchy(DATA_PROPERTY_HIERARCHY); + view.setSelectedHierarchy(DataPropertyHierarchyDescriptor.get()); if (!dataPropertyTree.getSelectedKeys().contains(sel)) { dataPropertyTree.revealTreeNodesForKey(sel, REVEAL_FIRST); } } else if (sel.isOWLAnnotationProperty()) { - view.setSelectedHierarchy(ANNOTATION_PROPERTY_HIERARCHY); + view.setSelectedHierarchy(AnnotationPropertyHierarchyDescriptor.get()); if (!annotationPropertyTree.getSelectedKeys().contains(sel)) { annotationPropertyTree.revealTreeNodesForKey(sel, REVEAL_FIRST); } @@ -322,7 +323,7 @@ else if (sel.isOWLAnnotationProperty()) { } private void handleCreate() { - view.getSelectedHierarchyId().ifPresent(hierarchyId -> { + view.getSelectedHierarchyDescriptor().ifPresent(hierarchyId -> { if (hierarchyId.equals(OBJECT_PROPERTY_HIERARCHY)) { handleCreateObjectProperty(); } diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletView.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletView.java index e06e67cb7f..699682f7a8 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletView.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletView.java @@ -2,7 +2,6 @@ import com.google.gwt.user.client.ui.IsWidget; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.protege.gwt.graphtree.client.TreeWidget; import org.semanticweb.owlapi.model.OWLEntity; @@ -14,19 +13,19 @@ */ public interface PropertyHierarchyPortletView extends IsWidget { - interface HierarchyIdSelectedHandler { - void handleHierarchyIdSelected(@Nonnull HierarchyId hierarchyId); + interface HierarchySelectedHandler { + void handleHierarchyDescriptorSelected(@Nonnull HierarchyDescriptor hierarchyDescriptor); } - void addHierarchy(@Nonnull HierarchyId hierarchyId, + void addHierarchy(@Nonnull HierarchyDescriptor hierarchyDescriptor, @Nonnull String label, @Nonnull TreeWidget view); - void setHierarchyIdSelectedHandler(@Nonnull HierarchyIdSelectedHandler hierarchySwitchedHandler); + void setHierarchyIdSelectedHandler(@Nonnull HierarchySelectedHandler hierarchySwitchedHandler); - void setSelectedHierarchy(@Nonnull HierarchyId hierarchyId); + void setSelectedHierarchy(@Nonnull HierarchyDescriptor hierarchyDescriptor); - Optional getSelectedHierarchyId(); + Optional getSelectedHierarchyDescriptor(); Optional> getSelectedHierarchy(); diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletViewImpl.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletViewImpl.java index 8c818c3cb1..0e4db5b71b 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletViewImpl.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/PropertyHierarchyPortletViewImpl.java @@ -5,7 +5,6 @@ import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.*; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; -import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; import edu.stanford.protege.gwt.graphtree.client.TreeWidget; import org.semanticweb.owlapi.model.OWLEntity; @@ -32,12 +31,12 @@ interface PropertyHierarchyPortletViewImplUiBinder extends UiBinder hierarchyIds = new ArrayList<>(); + private final List hierarchyDescriptors = new ArrayList<>(); private final List> views = new ArrayList<>(); @Nonnull - private HierarchyIdSelectedHandler hierarchyIdSelectedHandler = hierarchyId -> {}; + private HierarchySelectedHandler hierarchySelectedHandler = hierarchyDescriptor -> {}; @Inject public PropertyHierarchyPortletViewImpl() { @@ -47,41 +46,41 @@ public PropertyHierarchyPortletViewImpl() { private void handleTabSelectionChanged() { int selection = switcher.getSelectedTab(); - HierarchyId hierarchyId = hierarchyIds.get(selection); + HierarchyDescriptor hierarchyDescriptor = hierarchyDescriptors.get(selection); IsWidget view = views.get(selection); hierarchyContainer.setWidget(view); - hierarchyIdSelectedHandler.handleHierarchyIdSelected(hierarchyId); + hierarchySelectedHandler.handleHierarchyDescriptorSelected(hierarchyDescriptor); } @Override - public void addHierarchy(@Nonnull HierarchyId hierarchyId, + public void addHierarchy(@Nonnull HierarchyDescriptor hierarchyDescriptor, @Nonnull String label, @Nonnull TreeWidget view) { switcher.addTab(checkNotNull(label)); - hierarchyIds.add(checkNotNull(hierarchyId)); + hierarchyDescriptors.add(checkNotNull(hierarchyDescriptor)); views.add(checkNotNull(view)); } @Override - public void setHierarchyIdSelectedHandler(@Nonnull HierarchyIdSelectedHandler hierarchyIdSelectedHandler) { - this.hierarchyIdSelectedHandler = checkNotNull(hierarchyIdSelectedHandler); + public void setHierarchyIdSelectedHandler(@Nonnull HierarchySelectedHandler hierarchySelectedHandler) { + this.hierarchySelectedHandler = checkNotNull(hierarchySelectedHandler); } @Override - public void setSelectedHierarchy(@Nonnull HierarchyId hierarchyId) { - int selection = hierarchyIds.indexOf(hierarchyId); + public void setSelectedHierarchy(@Nonnull HierarchyDescriptor hierarchyDescriptor) { + int selection = hierarchyDescriptors.indexOf(hierarchyDescriptor); if(switcher.getSelectedTab() == selection) { return; } - GWT.log("[PropertyHierarchyPortletViewImpl] Switching tab to " + hierarchyId); + GWT.log("[PropertyHierarchyPortletViewImpl] Switching tab to " + hierarchyDescriptor); switcher.selectTab(selection); IsWidget view = views.get(selection); hierarchyContainer.setWidget(view); } @Override - public Optional getSelectedHierarchyId() { - return Optional.of(hierarchyIds.get(switcher.getSelectedTab())); + public Optional getSelectedHierarchyDescriptor() { + return Optional.of(hierarchyDescriptors.get(switcher.getSelectedTab())); } @Override diff --git a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/individualslist/IndividualsListPresenter.java b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/individualslist/IndividualsListPresenter.java index a7406045cc..70a99e3721 100644 --- a/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/individualslist/IndividualsListPresenter.java +++ b/webprotege-gwt-ui-client/src/main/java/edu/stanford/bmir/protege/web/client/individualslist/IndividualsListPresenter.java @@ -10,6 +10,7 @@ import edu.stanford.bmir.protege.web.client.dispatch.DispatchServiceManager; import edu.stanford.bmir.protege.web.client.entity.CreateEntityPresenter; import edu.stanford.bmir.protege.web.client.entity.EntityNodeUpdater; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyFieldPresenter; import edu.stanford.bmir.protege.web.client.library.msgbox.MessageBox; import edu.stanford.bmir.protege.web.client.permissions.LoggedInUserProjectPermissionChecker; @@ -128,7 +129,7 @@ public void start(AcceptsOneWidget container, WebProtegeEventBus eventBus) { entityNodeUpdater.start(eventBus, this); hierarchyFieldPresenter.setEntityType(PrimitiveType.CLASS); hierarchyFieldPresenter.setEntityChangedHandler(this::handleTypeChanged); - hierarchyFieldPresenter.setHierarchyId(HierarchyId.CLASS_HIERARCHY); + hierarchyFieldPresenter.setHierarchyDescriptor(ClassHierarchyDescriptor.get()); hierarchyFieldPresenter.start(view.getTypeFieldContainer(), eventBus); view.setInstanceRetrievalTypeChangedHandler(this::handleRetrievalTypeChanged); if(selectionModel.getSelection().map(Entity::isOWLNamedIndividual).orElse(false)) { diff --git a/webprotege-gwt-ui-server-core/pom.xml b/webprotege-gwt-ui-server-core/pom.xml index b49e6f8986..6eaa21ca7d 100644 --- a/webprotege-gwt-ui-server-core/pom.xml +++ b/webprotege-gwt-ui-server-core/pom.xml @@ -5,7 +5,7 @@ webprotege-gwt-ui edu.stanford.protege - 6.0.11 + 7.0.0-SNAPSHOT 4.0.0 diff --git a/webprotege-gwt-ui-server-core/src/main/java/edu/stanford/bmir/protege/web/server/dispatch/impl/DispatchServiceExecutorImpl.java b/webprotege-gwt-ui-server-core/src/main/java/edu/stanford/bmir/protege/web/server/dispatch/impl/DispatchServiceExecutorImpl.java index ed4ba61afa..ad2e4e2243 100644 --- a/webprotege-gwt-ui-server-core/src/main/java/edu/stanford/bmir/protege/web/server/dispatch/impl/DispatchServiceExecutorImpl.java +++ b/webprotege-gwt-ui-server-core/src/main/java/edu/stanford/bmir/protege/web/server/dispatch/impl/DispatchServiceExecutorImpl.java @@ -1,5 +1,6 @@ package edu.stanford.bmir.protege.web.server.dispatch.impl; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import edu.stanford.bmir.protege.web.server.dispatch.DispatchServiceExecutor; import edu.stanford.bmir.protege.web.server.dispatch.ExecutionContext; @@ -57,9 +58,14 @@ public , R extends Result> DispatchServiceResultContainer ex try { if(action instanceof TranslateEventListAction){ var translateEventsAction = (TranslateEventListAction) action; - - GetProjectEventsResult result = objectMapper.readValue(translateEventsAction.getEventList(), GetProjectEventsResult.class); - return DispatchServiceResultContainer.create(result); + try { + GetProjectEventsResult result = objectMapper.readValue(translateEventsAction.getEventList(), GetProjectEventsResult.class); + return DispatchServiceResultContainer.create(result); + } catch (JsonProcessingException e) { + logger.error("Error when translating event list", e); + logger.error(translateEventsAction.getEventList()); + throw new ActionExecutionException("An error occurred when translating the given event list. See logs for more information."); + } } if(action instanceof GetUserInfoAction) { var websocketUrl = System.getenv("webprotege.websocketUrl"); diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/event/EventsSerializationTestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/event/EventsSerializationTestCase.java index 9b15a302be..d90d10d5fc 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/event/EventsSerializationTestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/event/EventsSerializationTestCase.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; import edu.stanford.bmir.protege.web.shared.hierarchy.EntityHierarchyChangedEvent; import edu.stanford.bmir.protege.web.shared.hierarchy.HierarchyId; @@ -166,7 +167,7 @@ public void shouldSerializeEntityHierarchyChangedEvent() throws IOException { )); JsonSerializationTestUtil.testSerialization( new EntityHierarchyChangedEvent(mockProjectId(), - HierarchyId.CLASS_HIERARCHY, + ClassHierarchyDescriptor.get(), new GraphModelChangedEvent(changes)), WebProtegeEvent.class ); diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildren_Serialization_TestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildren_Serialization_TestCase.java index cca89c8d7f..9d612c2e0c 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildren_Serialization_TestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildren_Serialization_TestCase.java @@ -1,5 +1,7 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.Action; import edu.stanford.bmir.protege.web.shared.dispatch.Result; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; @@ -14,6 +16,7 @@ import static edu.stanford.bmir.protege.web.MockingUtils.*; +import static org.mockito.Mockito.mock; /** * Matthew Horridge @@ -26,7 +29,7 @@ public class GetHierarchyChildren_Serialization_TestCase { public void shouldSerializeAction() throws IOException { var action = GetHierarchyChildrenAction.create(ProjectId.getNil(), mockOWLClass(), - HierarchyId.CLASS_HIERARCHY, + ClassHierarchyDescriptor.get(), PageRequest.requestFirstPage()); JsonSerializationTestUtil.testSerialization(action, Action.class); } diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRoot_Serialization_TestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRoot_Serialization_TestCase.java index c87fcebfda..3cd2a1a604 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRoot_Serialization_TestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRoot_Serialization_TestCase.java @@ -4,6 +4,7 @@ import com.google.auto.value.AutoValue; import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ImmutableSet; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.Action; import edu.stanford.bmir.protege.web.shared.dispatch.Result; import edu.stanford.bmir.protege.web.shared.match.JsonSerializationTestUtil; @@ -27,7 +28,7 @@ public class GetHierarchyPathsToRoot_Serialization_TestCase { public void shouldSerializeAction() throws IOException { var action = GetHierarchyPathsToRootAction.create(ProjectId.getNil(), mockOWLClass(), - HierarchyId.CLASS_HIERARCHY); + ClassHierarchyDescriptor.get()); JsonSerializationTestUtil.testSerialization(action, Action.class); } diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRoots_Serialization_TestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRoots_Serialization_TestCase.java index 1832521af1..e51b4450fd 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRoots_Serialization_TestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRoots_Serialization_TestCase.java @@ -1,5 +1,6 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.Action; import edu.stanford.bmir.protege.web.shared.dispatch.Result; import edu.stanford.bmir.protege.web.shared.match.JsonSerializationTestUtil; @@ -22,7 +23,7 @@ public class GetHierarchyRoots_Serialization_TestCase { @Test public void shouldSerializeAction() throws IOException { var action = GetHierarchyRootsAction.create(ProjectId.getNil(), - HierarchyId.CLASS_HIERARCHY); + ClassHierarchyDescriptor.get()); JsonSerializationTestUtil.testSerialization(action, Action.class); } diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchySiblings_Serialization_TestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchySiblings_Serialization_TestCase.java index 3494d16aae..fdf8611ca1 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchySiblings_Serialization_TestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchySiblings_Serialization_TestCase.java @@ -1,5 +1,6 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.Action; import edu.stanford.bmir.protege.web.shared.dispatch.Result; import edu.stanford.bmir.protege.web.shared.match.JsonSerializationTestUtil; @@ -24,7 +25,7 @@ public abstract class GetHierarchySiblings_Serialization_TestCase { public void shouldSerializeAction() throws IOException { var action = GetHierarchySiblingsAction.create(ProjectId.getNil(), mockOWLClass(), - HierarchyId.CLASS_HIERARCHY, + ClassHierarchyDescriptor.get(), PageRequest.requestFirstPage()); JsonSerializationTestUtil.testSerialization(action, Action.class); } diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/MoveHierarchyNode_Serialization_TestCase.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/MoveHierarchyNode_Serialization_TestCase.java index 24f9c0ae2b..24ae79f62d 100644 --- a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/MoveHierarchyNode_Serialization_TestCase.java +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/MoveHierarchyNode_Serialization_TestCase.java @@ -1,5 +1,6 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.Action; import edu.stanford.bmir.protege.web.shared.dispatch.Result; import edu.stanford.bmir.protege.web.shared.match.JsonSerializationTestUtil; @@ -22,7 +23,8 @@ public class MoveHierarchyNode_Serialization_TestCase { @Test public void shouldSerializeAction() throws IOException { var action = MoveHierarchyNodeAction.create(mockProjectId(), - HierarchyId.CLASS_HIERARCHY, Path.asPath(mockOWLClassNode()), + ClassHierarchyDescriptor.get(), + Path.asPath(mockOWLClassNode()), Path.emptyPath(), DropType.ADD); JsonSerializationTestUtil.testSerialization(action, Action.class); diff --git a/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchyJsonTest.java b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchyJsonTest.java new file mode 100644 index 0000000000..66dc903b61 --- /dev/null +++ b/webprotege-gwt-ui-server-core/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchyJsonTest.java @@ -0,0 +1,81 @@ +package edu.stanford.bmir.protege.web.shared.hierarchy; + +import com.fasterxml.jackson.databind.ObjectMapper; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; +import edu.stanford.bmir.protege.web.server.jackson.ObjectMapperProvider; +import edu.stanford.bmir.protege.web.shared.DataFactory; +import edu.stanford.bmir.protege.web.shared.lang.LanguageMap; +import org.junit.Before; +import org.junit.Test; +import org.semanticweb.owlapi.model.OWLClass; +import org.semanticweb.owlapi.model.OWLDataFactory; +import org.springframework.boot.test.json.JacksonTester; +import org.springframework.boot.test.json.JsonContent; + +import java.util.Collections; + +import static org.assertj.core.api.Assertions.assertThat; + +public class NamedHierarchyJsonTest { + + private JacksonTester jacksonTester; + + private OWLDataFactory dataFactory; + + @Before + public void setup() { + ObjectMapper objectMapper = new ObjectMapperProvider().get(); + JacksonTester.initFields(this, objectMapper); + } + + @Test + public void testSerializeNamedHierarchy() throws Exception { + dataFactory = DataFactory.get(); + HierarchyId hierarchyId = HierarchyId.get("test-hierarchy-id"); + LanguageMap label = LanguageMap.of("en", "Test Label"); + LanguageMap description = LanguageMap.of("en", "Test Description"); + OWLClass owlClass = dataFactory.getOWLThing(); + HierarchyDescriptor hierarchyDescriptor = ClassHierarchyDescriptor.get(Collections.singleton(owlClass)); + + NamedHierarchy namedHierarchy = NamedHierarchy.get(hierarchyId, label, description, hierarchyDescriptor); + + JsonContent json = jacksonTester.write(namedHierarchy); + System.out.println(json.getJson()); + + assertThat(json).hasJsonPathStringValue("$.hierarchyId"); + assertThat(json).hasJsonPathMapValue("$.label"); + assertThat(json).hasJsonPathMapValue("$.description"); + assertThat(json).hasJsonPathMapValue("$.hierarchyDescriptor"); + } + + @Test + public void testDeserializeNamedHierarchy() throws Exception { + var json = "{\"hierarchyId\": \"test-hierarchy-id\",\n" + + " \"label\": {\n" + + " \"en\": \"Test Label\"\n" + + " },\n" + + " \"description\": {\n" + + " \"en\": \"Test Description\"\n" + + " },\n" + + " \"hierarchyDescriptor\": {\n" + + " \"@type\": \"ClassHierarchyDescriptor\",\n" + + " \"roots\": [\n" + + " {\n" + + "\"@type\": \"Class\"," + + " \"iri\": \"http://www.w3.org/2002/07/owl#Thing\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " }"; + + var objectContent = jacksonTester.parse(json); + var namedHierarchy = objectContent.getObject(); + + assertThat(namedHierarchy.getHierarchyId()).isNotNull(); + assertThat(namedHierarchy.getLabel()).isNotNull(); + assertThat(namedHierarchy.getDescription()).isNotNull(); + assertThat(namedHierarchy.getHierarchyDescriptor()).isNotNull(); + } + + } diff --git a/webprotege-gwt-ui-server/pom.xml b/webprotege-gwt-ui-server/pom.xml index 494f0827ff..9c3987f4a6 100644 --- a/webprotege-gwt-ui-server/pom.xml +++ b/webprotege-gwt-ui-server/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.11 + 7.0.0-SNAPSHOT webprotege-gwt-ui-server diff --git a/webprotege-gwt-ui-shared-core/pom.xml b/webprotege-gwt-ui-shared-core/pom.xml index 1b7614d1ab..4d81575ffa 100644 --- a/webprotege-gwt-ui-shared-core/pom.xml +++ b/webprotege-gwt-ui-shared-core/pom.xml @@ -5,7 +5,7 @@ webprotege-gwt-ui edu.stanford.protege - 6.0.11 + 7.0.0-SNAPSHOT 4.0.0 diff --git a/webprotege-gwt-ui-shared/pom.xml b/webprotege-gwt-ui-shared/pom.xml index 7bac9c8764..cdf5e3489a 100644 --- a/webprotege-gwt-ui-shared/pom.xml +++ b/webprotege-gwt-ui-shared/pom.xml @@ -6,7 +6,7 @@ edu.stanford.protege webprotege-gwt-ui - 6.0.11 + 7.0.0-SNAPSHOT webprotege-gwt-ui-shared diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/AnnotationPropertyHierarchyDescriptor.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/AnnotationPropertyHierarchyDescriptor.java new file mode 100644 index 0000000000..bcd8792cca --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/AnnotationPropertyHierarchyDescriptor.java @@ -0,0 +1,31 @@ +package edu.stanford.bmir.protege.web.client.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import org.semanticweb.owlapi.model.OWLAnnotationProperty; +import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; + +import java.util.Collections; +import java.util.Set; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("AnnotationPropertyHierarchyDescriptor") +public abstract class AnnotationPropertyHierarchyDescriptor implements HierarchyDescriptor { + + @JsonCreator + public static AnnotationPropertyHierarchyDescriptor get(@JsonProperty("roots") Set roots) { + return new AutoValue_AnnotationPropertyHierarchyDescriptor(roots); + } + + public static AnnotationPropertyHierarchyDescriptor get() { + return get(Collections.emptySet()); + } + + @JsonProperty("roots") + public abstract Set getRoots(); + +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyDescriptor.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyDescriptor.java new file mode 100644 index 0000000000..2afc4428ea --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ClassHierarchyDescriptor.java @@ -0,0 +1,35 @@ +package edu.stanford.bmir.protege.web.client.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.DataFactory; +import org.semanticweb.owlapi.model.OWLClass; + +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +@JsonTypeName("ClassHierarchyDescriptor") +@AutoValue +@GwtCompatible(serializable = true) +public abstract class ClassHierarchyDescriptor implements HierarchyDescriptor { + + @JsonCreator + public static ClassHierarchyDescriptor get(@JsonProperty("roots") Set roots) { + return new AutoValue_ClassHierarchyDescriptor(new LinkedHashSet<>(roots)); + } + + /** + * Get the class hierarchy descriptor for the class hierarchy rooted at owl:Thing + */ + public static ClassHierarchyDescriptor get() { + return get(Collections.singleton(DataFactory.getOWLThing())); + } + + @JsonProperty("roots") + public abstract Set getRoots(); + +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/DataPropertyHierarchyDescriptor.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/DataPropertyHierarchyDescriptor.java new file mode 100644 index 0000000000..069ce1f5e9 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/DataPropertyHierarchyDescriptor.java @@ -0,0 +1,33 @@ +package edu.stanford.bmir.protege.web.client.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.DataFactory; +import org.semanticweb.owlapi.model.OWLDataAllValuesFrom; +import org.semanticweb.owlapi.model.OWLDataProperty; +import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; + +import java.util.Collections; +import java.util.Set; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("DataPropertyHierarchyDescriptor") +public abstract class DataPropertyHierarchyDescriptor implements HierarchyDescriptor { + + + @JsonCreator + public static DataPropertyHierarchyDescriptor get(@JsonProperty("roots") Set roots) { + return new AutoValue_DataPropertyHierarchyDescriptor(roots); + } + + public static DataPropertyHierarchyDescriptor get() { + return get(Collections.singleton(DataFactory.getOWLDataProperty(OWLRDFVocabulary.OWL_TOP_DATA_PROPERTY.getIRI()))); + } + + @JsonProperty("roots") + public abstract Set getRoots(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyDescriptor.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyDescriptor.java new file mode 100644 index 0000000000..01eca86512 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/HierarchyDescriptor.java @@ -0,0 +1,14 @@ +package edu.stanford.bmir.protege.web.client.hierarchy; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME) +@JsonSubTypes({ + @JsonSubTypes.Type(ClassHierarchyDescriptor.class), + @JsonSubTypes.Type(ObjectPropertyHierarchyDescriptor.class), + @JsonSubTypes.Type(DataPropertyHierarchyDescriptor.class), + @JsonSubTypes.Type(AnnotationPropertyHierarchyDescriptor.class) +}) +public interface HierarchyDescriptor { +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ObjectPropertyHierarchyDescriptor.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ObjectPropertyHierarchyDescriptor.java new file mode 100644 index 0000000000..2b9e2c38d9 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/client/hierarchy/ObjectPropertyHierarchyDescriptor.java @@ -0,0 +1,31 @@ +package edu.stanford.bmir.protege.web.client.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.DataFactory; +import org.semanticweb.owlapi.model.OWLObjectProperty; +import org.semanticweb.owlapi.vocab.OWLRDFVocabulary; + +import java.util.Collections; +import java.util.Set; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("ObjectPropertyHierarchyDescriptor") +public abstract class ObjectPropertyHierarchyDescriptor implements HierarchyDescriptor { + + @JsonCreator + public static ObjectPropertyHierarchyDescriptor get(@JsonProperty("roots") Set roots) { + return new AutoValue_ObjectPropertyHierarchyDescriptor(roots); + } + + public static ObjectPropertyHierarchyDescriptor get() { + return get(Collections.singleton(DataFactory.getOWLObjectProperty(OWLRDFVocabulary.OWL_TOP_OBJECT_PROPERTY.getIRI()))); + } + + @JsonProperty("roots") + public abstract Set getRoots(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java index 74c4168cf0..4d9194af06 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Action.java @@ -224,7 +224,8 @@ @Type(value = UpdateFrameAction.class), @Type(value = UpdateNamedIndividualFrameAction.class), @Type(value = UpdateObjectPropertyFrameAction.class), - @Type(value = TranslateEventListAction.class) + @Type(value = TranslateEventListAction.class), + @Type(value = SetNamedHierarchiesAction.class) }) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME) public interface Action extends IsSerializable { diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java index 5b5f1e34aa..c7d3f4db2c 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/Result.java @@ -1,9 +1,7 @@ package edu.stanford.bmir.protege.web.shared.dispatch; import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.gwt.user.client.rpc.IsSerializable; import edu.stanford.bmir.protege.web.shared.app.GetApplicationSettingsResult; import edu.stanford.bmir.protege.web.shared.app.SetApplicationSettingsResult; @@ -210,7 +208,8 @@ @JsonSubTypes.Type(UpdateDataPropertyFrameResult.class), @JsonSubTypes.Type(UpdateAnnotationPropertyFrameResult.class), @JsonSubTypes.Type(UpdateNamedIndividualFrameResult.class), - @JsonSubTypes.Type(GetUserInfoResult.class) + @JsonSubTypes.Type(GetUserInfoResult.class), + @JsonSubTypes.Type(SetNamedHierarchiesResult.class), }) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME) public interface Result extends IsSerializable { diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java index 9ddef29955..d46ca212a1 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/dispatch/RpcWhiteList.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableSetMultimap; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.user.client.rpc.IsSerializable; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.app.GetApplicationSettingsAction; import edu.stanford.bmir.protege.web.shared.app.GetApplicationSettingsResult; import edu.stanford.bmir.protege.web.shared.app.SetApplicationSettingsAction; @@ -17,7 +18,6 @@ import edu.stanford.bmir.protege.web.shared.crud.gen.GeneratedAnnotationsSettings; import edu.stanford.bmir.protege.web.shared.crud.supplied.WhiteSpaceTreatment; import edu.stanford.bmir.protege.web.shared.crud.uuid.UuidFormat; -import edu.stanford.bmir.protege.web.shared.crud.uuid.UuidSuffixKit; import edu.stanford.bmir.protege.web.shared.csv.DocumentId; import edu.stanford.bmir.protege.web.shared.diff.DiffElement; import edu.stanford.bmir.protege.web.shared.dispatch.actions.*; @@ -218,776 +218,394 @@ public class RpcWhiteList implements IsSerializable, Action, Result { DiffElement _DiffElement; DisplayNameSettings _DisplayNameSettings; - + DocumentId _DocumentId; + DropType _DropType; EdgeCriteria _EdgeCriteria; - EditAnnotationsAction _EditAnnotationsAction; - EditAnnotationsResult _EditAnnotationsResult; - EditCommentAction _EditCommentAction; - EditCommentResult _EditCommentResult; - + EntityCrudKit _EntityCrudKit; EntityCrudKitPrefixSettings _EntityCrudKitPrefixSettings; - EntityCrudKitSettings _EntityCrudKitSettings; - EntityCrudKitSuffixSettings _EntityCrudKitSuffixSettings; - EntityDeprecationSettings _EntityDeprecationSettings; - EntityDiscussionThread _EntityDiscussionThread; - EntityFormSelector _EntityFormSelector; - EntityGraph _EntityGraph; - EntityGraphFilter _EntityGraphFilter; - EntityGraphSettings _EntityGraphSettings; - EntityLookupResult _EntityLookupResult; - EntityNameControlDescriptor _EntityNameControlDescriptor; - EntityNameMatchResult _EntityNameMatchResult; - EntityNameMatchType _EntityNameMatchType; - EntitySearchResult _EntitySearchResult; - ExistingOntologyMergeAddAction _ExistingOntologyMergeAddAction; - ExistingOntologyMergeAddResult _ExistingOntologyMergeAddResult; - ExpansionState _ExpansionState; - FieldRun _FieldRun; - FilterName _FilterName; - FilterState _FilterState; - FormControlData _FormControlData; - FormControlDataDto _FormControlDataDto; - FormControlDescriptor _FormControlDescriptor; - FormControlDescriptorDto _FormControlDescriptorDto; - + FormDataByFormId _FormDataByFormId; FormDataDto _FormDataDto; - FormDescriptor _FormDescriptor; - FormDescriptorDto _FormDescriptorDto; - FormEntitySubject _FormEntitySubject; - FormEntitySubjectDto _FormEntitySubjectDto; - FormFieldData _FormFieldData; - FormFieldDataDto _FormFieldDataDto; - FormFieldDeprecationStrategy _FormFieldDeprecationStrategy; - FormFieldDescriptor _FormFieldDescriptor; - FormFieldDescriptorDto _FormFieldDescriptorDto; - FormId _FormId; - FormPageRequest _FormPageRequest; - FormPageRequest.SourceType _FormPageRequest_SourceType; - FormPurpose _FormPurpose; - FormRegionFilter _FormRegionFilter; - FormRegionId _FormRegionId; - FormRegionOrdering _FormRegionOrdering; - FormRegionOrderingDirection _FormRegionOrderingDirection; - FormSubjectDto _FormSubjectDto; - + GeneratedAnnotationsSettings _GeneratedAnnotationsSettings; GetAllOntologiesAction _GetAllOntologiesAction; - GetAllOntologiesResult _GetAllOntologiesResult; - GetAnnotationPropertyFrameAction _GetAnnotationPropertyFrameAction; - GetAnnotationPropertyFrameResult _GetAnnotationPropertyFrameResult; - GetApplicationSettingsAction _GetApplicationSettingsAction; - GetApplicationSettingsResult _GetApplicationSettingsResult; - + GetAuthenticatedUserDetailsAction _GetAuthenticatedUserDetailsAction; + GetAuthenticatedUserDetailsResult _GetAuthenticatedUserDetailsResult; GetAvailableProjectsAction _GetAvailableProjectsAction; - GetAvailableProjectsResult _GetAvailableProjectsResult; - GetAvailableProjectsWithPermissionAction _GetAvailableProjectsWithPermissionAction; - GetAvailableProjectsWithPermissionResult _GetAvailableProjectsWithPermissionResult; - GetClassFrameAction _GetClassFrameAction; - GetClassFrameResult _GetClassFrameResult; - GetCommentedEntitiesAction _GetCommentedEntitiesAction; - GetCommentedEntitiesResult _GetCommentedEntitiesResult; - - GetAuthenticatedUserDetailsAction _GetAuthenticatedUserDetailsAction; - - GetAuthenticatedUserDetailsResult _GetAuthenticatedUserDetailsResult; - GetDataPropertyFrameAction _GetDataPropertyFrameAction; - GetDataPropertyFrameResult _GetDataPropertyFrameResult; - GetDeprecatedEntitiesAction _GetDeprecatedEntitiesAction; - GetDeprecatedEntitiesResult _GetDeprecatedEntitiesResult; - GetEmailAddressAction _GetEmailAddressAction; - GetEmailAddressResult _GetEmailAddressResult; - GetEntityCreationFormsAction _GetEntityCreationFormsAction; - GetEntityCreationFormsResult _GetEntityCreationFormsResult; - GetEntityCrudKitsAction _GetEntityCrudKitsAction; - GetEntityCrudKitsResult _GetEntityCrudKitsResult; - GetEntityDeprecationFormsAction _GetEntityDeprecationFormsAction; - GetEntityDeprecationFormsResult _GetEntityDeprecationFormsResult; - GetEntityDiscussionThreadsAction _GetEntityDiscussionThreadsAction; - GetEntityDiscussionThreadsResult _GetEntityDiscussionThreadsResult; - GetEntityFormDescriptorAction _GetEntityFormDescriptorAction; - GetEntityFormDescriptorResult _GetEntityFormDescriptorResult; - GetEntityFormsAction _GetEntityFormsAction; - GetEntityFormsResult _GetEntityFormsResult; - GetEntityGraphAction _GetEntityGraphAction; - GetEntityGraphResult _GetEntityGraphResult; - GetEntityHtmlRenderingAction _GetEntityHtmlRenderingAction; - GetEntityHtmlRenderingResult _GetEntityHtmlRenderingResult; - GetEntityRenderingAction _GetEntityRenderingAction; - GetEntityRenderingResult _GetEntityRenderingResult; - GetEntityTagsAction _GetEntityTagsAction; - GetEntityTagsResult _GetEntityTagsResult; - GetHeadRevisionNumberAction _GetHeadRevisionNumberAction; - GetHeadRevisionNumberResult _GetHeadRevisionNumberResult; - GetHierarchyChildrenAction _GetHierarchyChildrenAction; - GetHierarchyChildrenResult _GetHierarchyChildrenResult; - GetHierarchyPathsToRootAction _GetHierarchyPathsToRootAction; - GetHierarchyPathsToRootResult _GetHierarchyPathsToRootResult; - GetHierarchyRootsAction _GetHierarchyRootsAction; - GetHierarchyRootsResult _GetHierarchyRootsResult; - GetHierarchySiblingsAction _GetHierarchySiblingsAction; - GetHierarchySiblingsResult _GetHierarchySiblingsResult; - GetIndividualsAction _GetIndividualsAction; - GetIndividualsPageContainingIndividualAction _GetIndividualsPageContainingIndividualAction; - GetIndividualsPageContainingIndividualResult _GetIndividualsPageContainingIndividualResult; - GetIndividualsResult _GetIndividualsResult; - GetManchesterSyntaxFrameAction _GetManchesterSyntaxFrameAction; - GetManchesterSyntaxFrameCompletionsAction _GetManchesterSyntaxFrameCompletionsAction; - GetManchesterSyntaxFrameCompletionsResult _GetManchesterSyntaxFrameCompletionsResult; - GetManchesterSyntaxFrameResult _GetManchesterSyntaxFrameResult; - GetMatchingEntitiesAction _GetMatchingEntitiesAction; - GetMatchingEntitiesResult _GetMatchingEntitiesResult; - GetNamedIndividualFrameAction _GetNamedIndividualFrameAction; - GetNamedIndividualFrameResult _GetNamedIndividualFrameResult; - GetObjectAction _GetObjectAction; - GetObjectPropertyFrameAction _GetObjectPropertyFrameAction; - GetObjectPropertyFrameResult _GetObjectPropertyFrameResult; - GetOboNamespacesAction _GetOboNamespacesAction; - GetOboNamespacesResult _GetOboNamespacesResult; - GetOboTermCrossProductAction _GetOboTermCrossProductAction; - GetOboTermCrossProductResult _GetOboTermCrossProductResult; - GetOboTermDefinitionAction _GetOboTermDefinitionAction; - GetOboTermDefinitionResult _GetOboTermDefinitionResult; - GetOboTermIdAction _GetOboTermIdAction; - GetOboTermIdResult _GetOboTermIdResult; - GetOboTermRelationshipsAction _GetOboTermRelationshipsAction; - GetOboTermRelationshipsResult _GetOboTermRelationshipsResult; - GetOboTermSynonymsAction _GetOboTermSynonymsAction; - GetOboTermSynonymsResult _GetOboTermSynonymsResult; - GetOboTermXRefsAction _GetOboTermXRefsAction; - GetOboTermXRefsResult _GetOboTermXRefsResult; - GetOntologyAnnotationsAction _GetOntologyAnnotationsAction; - GetOntologyAnnotationsResult _GetOntologyAnnotationsResult; - GetOntologyFramesAction _GetOntologyFramesAction; - GetOntologyFramesResult _GetOntologyFramesResult; - GetPersonIdCompletionsAction _GetPersonIdCompletionsAction; - GetPersonIdCompletionsResult _GetPersonIdCompletionsResult; - GetPerspectiveDetailsAction _GetPerspectiveDetailsAction; - GetPerspectiveDetailsResult _GetPerspectiveDetailsResult; - GetPerspectiveLayoutAction _GetPerspectiveLayoutAction; - GetPerspectiveLayoutResult _GetPerspectiveLayoutResult; - GetPerspectivesAction _GetPerspectivesAction; - GetPerspectivesResult _GetPerspectivesResult; - GetPossibleItemCompletionsAction _GetPossibleItemCompletionsAction; - GetPossibleItemCompletionsResult _GetPossibleItemCompletionsResult; - GetProjectChangesAction _GetProjectChangesAction; - GetProjectChangesResult _GetProjectChangesResult; - GetProjectDetailsAction _GetProjectDetailsAction; - GetProjectDetailsResult _GetProjectDetailsResult; - GetProjectEventsAction _GetProjectEventsAction; - GetProjectEventsResult _GetProjectEventsResult; - GetProjectFormDescriptorsAction _GetProjectFormDescriptorsAction; - GetProjectFormDescriptorsResult _GetProjectFormDescriptorsResult; - GetProjectInfoAction _GetProjectInfoAction; - GetProjectInfoResult _GetProjectInfoResult; - GetProjectLangTagsAction _GetProjectLangTagsAction; - GetProjectLangTagsResult _GetProjectLangTagsResult; - GetProjectPermissionsAction _GetProjectPermissionsAction; - GetProjectPermissionsResult _GetProjectPermissionsResult; - GetProjectPrefixDeclarationsAction _GetProjectPrefixDeclarationsAction; - GetProjectPrefixDeclarationsResult _GetProjectPrefixDeclarationsResult; - GetProjectSettingsAction _GetProjectSettingsAction; - GetProjectSettingsResult _GetProjectSettingsResult; - GetProjectSharingSettingsAction _GetProjectSharingSettingsAction; - GetProjectSharingSettingsResult _GetProjectSharingSettingsResult; - GetProjectTagsAction _GetProjectTagsAction; - GetProjectTagsResult _GetProjectTagsResult; - GetRevisionSummariesAction _GetRevisionSummariesAction; - GetRevisionSummariesResult _GetRevisionSummariesResult; - GetRootOntologyIdAction _GetRootOntologyIdAction; - GetRootOntologyIdResult _GetRootOntologyIdResult; - GetSearchSettingsAction _GetSearchSettingsAction; - GetSearchSettingsResult _GetSearchSettingsResult; - GetUsageAction _GetUsageAction; - GetUsageResult _GetUsageResult; - GetUserIdCompletionsAction _GetUserIdCompletionsAction; - GetUserIdCompletionsResult _GetUserIdCompletionsResult; - + GetUserInfoResult _GetUserInfoResult; GetUserProjectEntityGraphCriteriaAction _GetUserProjectEntityGraphCriteriaAction; - GetUserProjectEntityGraphCriteriaResult _GetUserProjectEntityGraphCriteriaResult; - GetWatchedEntityChangesAction _GetWatchedEntityChangesAction; - GetWatchedEntityChangesResult _GetWatchedEntityChangesResult; - GetWatchesAction _GetWatchesAction; - GetWatchesResult _GetWatchesResult; - GraphNode _GraphNode; - GridCellData _GridCellData; - GridCellDataDto _GridCellDataDto; - GridColumnDescriptor _GridColumnDescriptor; - GridColumnDescriptorDto _GridColumnDescriptorDto; - GridControlData _GridControlData; - GridControlDataDto _GridControlDataDto; - GridControlDescriptor _GridControlDescriptor; - GridRowData _GridRowData; - GridRowDataDto _GridRowDataDto; - + HierarchyDescriptor _HierarchyDescriptor; HierarchyFilterType _HierarchyFilterType; - HierarchyPositionCriteria _HierarchyPositionCriteria; - IRI _IRI; - IRIData _IRIData; - ImageControlDescriptor _ImageControlDescriptor; - ImmutableSetMultimap _ImmutableSetMultimap; - InstanceRetrievalMode _InstanceRetrievalMode; - + InternalServerError _InternalServerError; IsAEdge _IsAEdge; - LangTag _LangTag; - LangTagFilter _LangTagFilter; - LanguageMap _LanguageMap; - LoadProjectAction _LoadProjectAction; - LoadProjectResult _LoadProjectResult; - LogOutUserAction _LogOutUserAction; - LogOutUserResult _LogOutUserResult; - LookupEntitiesAction _LookupEntitiesAction; - LookupEntitiesResult _LookupEntitiesResult; - MergeEntitiesAction _MergeEntitiesAction; - MergeEntitiesResult _MergeEntitiesResult; - MergeUploadedProjectAction _MergeUploadedProjectAction; - MergeUploadedProjectResult _MergeUploadedProjectResult; - MoveEntitiesToParentAction _MoveEntitiesToParentAction; - MoveEntitiesToParentResult _MoveEntitiesToParentResult; - MoveHierarchyNodeAction _MoveHierarchyNodeAction; - MoveHierarchyNodeResult _MoveHierarchyNodeResult; - MoveProjectsToTrashAction _MoveProjectsToTrashAction; - MoveProjectsToTrashResult _MoveProjectsToTrashResult; - MultiChoiceControlDescriptor _MultiChoiceControlDescriptor; - MultiMatchType _MultiMatchType; - NamedIndividualFrame _NamedIndividualFrame; - NewOntologyMergeAddAction _NewOntologyMergeAddAction; - NewOntologyMergeAddResult _NewOntologyMergeAddResult; - NumberControlDescriptor _NumberControlDescriptor; - OWLAnnotationPropertyData _OWLAnnotationPropertyData; - OWLClassData _OWLClassData; - OWLDataPropertyData _OWLDataPropertyData; - OWLDatatypeData _OWLDatatypeData; - OWLLiteral _OWLLiteral; - OWLLiteralData _OWLLiteralData; - OWLLiteralImplPlain _OWLLiteralImplPlain; - OWLNamedIndividualData _OWLNamedIndividualData; - OWLPrimitiveData _OWLPrimitiveData; - ObjectPropertyCharacteristic _ObjectPropertyCharacteristic; - ObjectPropertyFrame _ObjectPropertyFrame; - Operation _Operation; - Optionality _Optionality; - OwlBinding _OwlBinding; - OwlClassBinding _OwlClassBinding; - OWLObjectPropertyData _OwlObjectPropertyData; - OwlPropertyBinding _OwlPropertyBinding; - OwlSubClassBinding _OwlSubClassBinding; - ParentNode _ParentNode; - Password _Password; - Path _Path; - PerformEntitySearchAction _PerformEntitySearchAction; - PerformEntitySearchResult _PerformEntitySearchResult; - PerformLoginAction _PerformLoginAction; - PerformLoginResult _PerformLoginResult; - PerspectiveDescriptor _PerspectiveDescriptor; - PerspectiveLayout _PerspectiveLayout; - PlainAnnotationPropertyFrame _PlainAnnotationPropertyFrame; - PlainClassFrame _PlainClassFrame; - PlainDataPropertyFrame _PlainDataPropertyFrame; - PlainNamedIndividualFrame _PlainNamedIndividualFrame; - PlainObjectPropertyFrame _PlainObjectPropertyFrame; - PlainPropertyValue _PlainPropertyValue; - PrefixNameMatchType _PrefixNameMatchType; - PrimitiveFormControlData _PrimitiveFormControlData; - PrimitiveFormControlDataDto _PrimitiveFormControlDataDto; - ProjectAction _ProjectAction; - ProjectChange _ProjectChange; - ProjectDetails _ProjectDetails; - ProjectSettings _ProjectSettings; - ProjectUserEntityGraphSettings _ProjectUserEntityGraphSettings; - ProjectWebhookEventType _ProjectWebhookEventType; - PropertyValue _PropertyValue; - PropertyValueDescriptor _PropertyValueDescriptor; - RebuildPermissionsAction _RebuildPermissionsAction; - RebuildPermissionsResult _RebuildPermissionsResult; - RelationshipEdge _RelationshipEdge; - RelationshipPresence _RelationshipPresence; - RemoveProjectFromTrashAction _RemoveProjectFromTrashAction; - RemoveProjectFromTrashResult _RemoveProjectFromTrashResult; - Repeatability _Repeatability; - ResetPasswordAction _ResetPasswordAction; - ResetPasswordResult _ResetPasswordResult; - ResetPerspectiveLayoutAction _ResetPerspectiveLayoutAction; - ResetPerspectiveLayoutResult _ResetPerspectiveLayoutResult; - ResetPerspectivesAction _ResetPerspectivesAction; - ResetPerspectivesResult _ResetPerspectivesResult; - RevertRevisionAction _RevertRevisionAction; - RevertRevisionResult _RevertRevisionResult; - RevisionNumber _RevisionNumber; - RpcWhiteList _RpcWhiteList; - SafeHtml _SafeHtml; - SearchResultMatch _SearchResultMatch; - SearchResultMatchPosition _SearchResultMatchPosition; - SetAnnotationValueAction _SetAnnotationValueAction; - SetAnnotationValueResult _SetAnnotationValueResult; - SetApplicationSettingsAction _SetApplicationSettingsAction; - SetApplicationSettingsResult _SetApplicationSettingsResult; - SetDiscussionThreadStatusAction _SetDiscussionThreadStatusAction; - SetDiscussionThreadStatusResult _SetDiscussionThreadStatusResult; - SetEmailAddressAction _SetEmailAddressAction; - SetEmailAddressResult _SetEmailAddressResult; - SetEntityCrudKitSettingsAction _SetEntityCrudKitSettingsAction; - SetEntityCrudKitSettingsResult _SetEntityCrudKitSettingsResult; - SetEntityFormDataResult _SetEntityFormDataResult; - SetEntityFormDescriptorAction _SetEntityFormDescriptorAction; - SetEntityFormDescriptorResult _SetEntityFormDescriptorResult; - SetEntityFormsDataAction _SetEntityFormsDataAction; - SetEntityGraphActiveFiltersAction _SetEntityGraphActiveFiltersAction; - SetEntityGraphActiveFiltersResult _SetEntityGraphActiveFiltersResult; - SetEntityWatchesAction _SetEntityWatchesAction; - SetEntityWatchesResult _SetEntityWatchesResult; - SetManchesterSyntaxFrameAction _SetManchesterSyntaxFrameAction; - SetManchesterSyntaxFrameResult _SetManchesterSyntaxFrameResult; - SetOboTermCrossProductAction _SetOboTermCrossProductAction; - SetOboTermCrossProductResult _SetOboTermCrossProductResult; - SetOboTermDefinitionAction _SetOboTermDefinitionAction; - SetOboTermDefinitionResult _SetOboTermDefinitionResult; - SetOboTermIdAction _SetOboTermIdAction; - SetOboTermIdResult _SetOboTermIdResult; - SetOboTermRelationshipsAction _SetOboTermRelationshipsAction; - SetOboTermRelationshipsResult _SetOboTermRelationshipsResult; - SetOboTermSynonymsAction _SetOboTermSynonymsAction; - SetOboTermSynonymsResult _SetOboTermSynonymsResult; - SetOboTermXRefsAction _SetOboTermXRefsAction; - SetOboTermXRefsResult _SetOboTermXRefsResult; - SetOntologyAnnotationsAction _SetOntologyAnnotationsAction; - SetOntologyAnnotationsResult _SetOntologyAnnotationsResult; - SetPerspectiveLayoutAction _SetPerspectiveLayoutAction; - SetPerspectiveLayoutResult _SetPerspectiveLayoutResult; - SetPerspectivesAction _SetPerspectivesAction; - SetPerspectivesResult _SetPerspectivesResult; - SetProjectFormDescriptorsAction _SetProjectFormDescriptorsAction; - SetProjectFormDescriptorsResult _SetProjectFormDescriptorsResult; - SetProjectPrefixDeclarationsAction _SetProjectPrefixDeclarationsAction; - SetProjectPrefixDeclarationsResult _SetProjectPrefixDeclarationsResult; - SetProjectSettingsAction _SetProjectSettingsAction; - SetProjectSettingsResult _SetProjectSettingsResult; - SetProjectSharingSettingsAction _SetProjectSharingSettingsAction; - SetProjectSharingSettingsResult _SetProjectSharingSettingsResult; - SetProjectTagsAction _SetProjectTagsAction; - SetProjectTagsResult _SetProjectTagsResult; - SetSearchSettingsAction _SetSearchSettingsAction; - SetSearchSettingsResult _SetSearchSettingsResult; - SetUserProjectEntityGraphSettingsAction _SetUserProjectEntityGraphSettingsAction; - SetUserProjectEntityGraphSettingsResult _SetUserProjectEntityGraphSettingsResult; - ShortForm _ShortForm; - SingleChoiceControlDescriptor _SingleChoiceControlDescriptor; - SingleChoiceControlType _SingleChoiceControlType; - SlackIntegrationSettings _SlackIntegrationSettings; - SortingKey _SortingKey; - State _State; - Status _Status; - SubFormControlDescriptor _SubFormControlDescriptor; - SubmitFileResult _SubmitFileResult; - Tag _Tag; - + TagData _TagData; TerminalNode _TerminalNode; - TextControlDescriptor _TextControlDescriptor; - UpdateAnnotationPropertyFrameAction _UpdateAnnotationPropertyFrameAction; - + UpdateAnnotationPropertyFrameResult _UpdateAnnotationPropertyFrameResult; UpdateClassFrameAction _UpdateClassFrameAction; - + UpdateClassFrameResult _UpdateClassFrameResult; UpdateDataPropertyFrameAction _UpdateDataPropertyFrameAction; - + UpdateDataPropertyFrameResult _UpdateDataPropertyFrameResult; UpdateEntityTagsAction _UpdateEntityTagsAction; - UpdateEntityTagsResult _UpdateEntityTagsResult; - UpdateFormDescriptorAction _UpdateFormDescriptorAction; - UpdateFormDescriptorResult _UpdateFormDescriptorResult; - UpdateFrameAction _UpdateFrameAction; - UpdateNamedIndividualFrameAction _UpdateNamedIndividualFrameAction; - + UpdateNamedIndividualFrameResult _UpdateNamedIndividualFrameResult; UpdateObjectAction _UpdateObjectAction; - UpdateObjectPropertyFrameAction _UpdateObjectPropertyFrameAction; - + UpdateObjectPropertyFrameResult _UpdateObjectPropertyFrameResult; UpdateObjectResult _UpdateObjectResult; - UuidFormat _UuidFormat; - WebProtegeEvent _WebProtegeEvent; - WebhookSetting _WebhookSetting; - WebhookSettings _WebhookSettings; - WhiteSpaceTreatment _WhiteSpaceTreatment; - OwlBinding get_OwlBinding; - PlainPropertyValue get_PlainPropertyValue; - PrimitiveFormControlData primitiveFormControlData; - - TagData _TagData; - - FormDataByFormId _FormDataByFormId; - - InternalServerError _InternalServerError; - - UpdateClassFrameResult _UpdateClassFrameResult; - - UpdateObjectPropertyFrameResult _UpdateObjectPropertyFrameResult; - - UpdateDataPropertyFrameResult _UpdateDataPropertyFrameResult; - - UpdateAnnotationPropertyFrameResult _UpdateAnnotationPropertyFrameResult; - - UpdateNamedIndividualFrameResult _UpdateNamedIndividualFrameResult; - - DocumentId _DocumentId; - - DropType _DropType; - - EntityCrudKit _EntityCrudKit; - - GetUserInfoResult _GetUserInfoResult; - - GeneratedAnnotationsSettings _GeneratedAnnotationsSettings; + SetNamedHierarchiesAction _SetNamedHierarchiesAction; + SetNamedHierarchiesResult _SetNamedHierarchiesResult; public RpcWhiteList() { } diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/EntityHierarchyChangedEvent.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/EntityHierarchyChangedEvent.java index 038cc75eb2..87927c21c7 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/EntityHierarchyChangedEvent.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/EntityHierarchyChangedEvent.java @@ -1,7 +1,10 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.web.bindery.event.shared.Event; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; import edu.stanford.bmir.protege.web.shared.entity.EntityNode; import edu.stanford.bmir.protege.web.shared.event.ProjectEvent; @@ -22,21 +25,23 @@ public class EntityHierarchyChangedEvent extends ProjectEvent ON_HIERARCHY_CHANGED = new Event.Type<>(); - private HierarchyId hierarchyId; + private HierarchyDescriptor hierarchyDescriptor; private GraphModelChangedEvent changeEvent; - public EntityHierarchyChangedEvent(@Nonnull ProjectId source, - @Nonnull HierarchyId hierarchyId, - @Nonnull GraphModelChangedEvent changeEvent) { + @JsonCreator + public EntityHierarchyChangedEvent(@JsonProperty("projectId") @Nonnull ProjectId source, + @JsonProperty("hierarchyDescriptor") @Nonnull HierarchyDescriptor hierarchyDescriptor, + @JsonProperty("changeEvent") @Nonnull GraphModelChangedEvent changeEvent) { super(source); - this.hierarchyId = checkNotNull(hierarchyId); + this.hierarchyDescriptor = checkNotNull(hierarchyDescriptor); this.changeEvent = checkNotNull(changeEvent); } + @JsonProperty("hierarchyDescriptor") @Nonnull - public HierarchyId getHierarchyId() { - return hierarchyId; + public HierarchyDescriptor getHierarchyDescriptor() { + return hierarchyDescriptor; } @GwtSerializationConstructor @@ -66,11 +71,19 @@ public boolean equals(Object o) { return false; } EntityHierarchyChangedEvent that = (EntityHierarchyChangedEvent) o; - return hierarchyId.equals(that.hierarchyId) && changeEvent.equals(that.changeEvent) && getSource().equals(that.getSource()); + return hierarchyDescriptor.equals(that.hierarchyDescriptor) && changeEvent.equals(that.changeEvent) && getSource().equals(that.getSource()); } @Override public int hashCode() { - return Objects.hash(hierarchyId, changeEvent, getSource()); + return Objects.hash(hierarchyDescriptor, changeEvent, getSource()); + } + + @Override + public String toString() { + return "EntityHierarchyChangedEvent{" + + "hierarchyDescriptor=" + hierarchyDescriptor + + ", changeEvent=" + changeEvent + + '}'; } } diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction.java index 378a11c965..901da51f7e 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction.java @@ -5,8 +5,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.auto.value.AutoValue; import com.google.common.annotations.GwtCompatible; -import com.google.common.base.Objects; -import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; import edu.stanford.bmir.protege.web.shared.pagination.PageRequest; import edu.stanford.bmir.protege.web.shared.project.ProjectId; @@ -28,15 +27,15 @@ public abstract class GetHierarchyChildrenAction extends AbstractHasProjectActio @JsonCreator public static GetHierarchyChildrenAction create(@JsonProperty("projectId") @Nonnull ProjectId projectId, @JsonProperty("entity") @Nonnull OWLEntity entity, - @JsonProperty("hierarchyId") @Nonnull HierarchyId hierarchyId, + @JsonProperty("hierarchyDescriptor") @Nonnull HierarchyDescriptor hierarchyDescriptor, @JsonProperty("pageRequest") @Nonnull PageRequest pageRequest) { - return new AutoValue_GetHierarchyChildrenAction(projectId, entity, hierarchyId, pageRequest); + return new AutoValue_GetHierarchyChildrenAction(projectId, entity, hierarchyDescriptor, pageRequest); } public static GetHierarchyChildrenAction create(@Nonnull ProjectId projectId, @Nonnull OWLEntity entity, - @Nonnull HierarchyId hierarchyId) { - return create(projectId, entity, hierarchyId, PageRequest.requestFirstPage()); + @Nonnull HierarchyDescriptor hierarchyDescriptor) { + return create(projectId, entity, hierarchyDescriptor, PageRequest.requestFirstPage()); } @Nonnull @@ -45,7 +44,7 @@ public static GetHierarchyChildrenAction create(@Nonnull ProjectId projectId, public abstract OWLEntity getEntity(); - public abstract HierarchyId getHierarchyId(); + public abstract HierarchyDescriptor getHierarchyDescriptor(); @Nonnull public abstract PageRequest getPageRequest(); diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction.java index 7f4294446d..08c415aa64 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction.java @@ -5,8 +5,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.auto.value.AutoValue; import com.google.common.annotations.GwtCompatible; -import com.google.common.base.Objects; -import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.dispatch.AbstractHasProjectAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.semanticweb.owlapi.model.OWLEntity; @@ -27,8 +26,8 @@ public abstract class GetHierarchyPathsToRootAction extends AbstractHasProjectAc @JsonCreator public static GetHierarchyPathsToRootAction create(@JsonProperty("projectId") @Nonnull ProjectId projectId, @JsonProperty("entity") @Nonnull OWLEntity entity, - @JsonProperty("hierarchyId") @Nonnull HierarchyId hierarchyId) { - return new AutoValue_GetHierarchyPathsToRootAction(projectId, entity, hierarchyId); + @JsonProperty("hierarchyDescriptor") @Nonnull HierarchyDescriptor hierarchyDescriptor) { + return new AutoValue_GetHierarchyPathsToRootAction(projectId, entity, hierarchyDescriptor); } @Nonnull @@ -39,5 +38,5 @@ public static GetHierarchyPathsToRootAction create(@JsonProperty("projectId") @N public abstract OWLEntity getEntity(); @Nonnull - public abstract HierarchyId getHierarchyId(); + public abstract HierarchyDescriptor getHierarchyDescriptor(); } diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction.java index ee886bb95a..a624736330 100644 --- a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction.java +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.google.common.base.Objects; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.annotations.GwtSerializationConstructor; import edu.stanford.bmir.protege.web.shared.dispatch.ProjectAction; import edu.stanford.bmir.protege.web.shared.project.ProjectId; @@ -19,19 +20,19 @@ public class GetHierarchyRootsAction implements ProjectAction fromNodePath, @JsonProperty("toNodeParentPath") @Nonnull Path toNodeParentPath, @JsonProperty("dropType") @Nonnull DropType dropType) { - return new AutoValue_MoveHierarchyNodeAction(projectId, hierarchyId, fromNodePath, toNodeParentPath, dropType); + return new AutoValue_MoveHierarchyNodeAction(projectId, hierarchyDescriptor, fromNodePath, toNodeParentPath, dropType); } @Nonnull @@ -38,7 +38,7 @@ public static MoveHierarchyNodeAction create(@JsonProperty("projectId") @Nonnull public abstract ProjectId getProjectId(); @Nonnull - public abstract HierarchyId getHierarchyId(); + public abstract HierarchyDescriptor getHierarchyDescriptor(); @Nonnull public abstract Path getFromNodePath(); diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchy.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchy.java new file mode 100644 index 0000000000..0ec629b4e3 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/NamedHierarchy.java @@ -0,0 +1,39 @@ +package edu.stanford.bmir.protege.web.shared.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; +import edu.stanford.bmir.protege.web.shared.lang.LanguageMap; + +import javax.annotation.Nonnull; + +@AutoValue +@GwtCompatible(serializable = true) +public abstract class NamedHierarchy { + + @JsonCreator + public static NamedHierarchy get(@JsonProperty("hierarchyId") HierarchyId hierarchyId, + @JsonProperty("label") LanguageMap label, + @JsonProperty("description") LanguageMap description, + @JsonProperty("hierarchyDescriptor") HierarchyDescriptor hierarchyDescriptor) { + return new AutoValue_NamedHierarchy(hierarchyId, label, description, hierarchyDescriptor); + } + + @Nonnull + @JsonProperty("hierarchyId") + public abstract HierarchyId getHierarchyId(); + + @Nonnull + @JsonProperty("label") + public abstract LanguageMap getLabel(); + + @Nonnull + @JsonProperty("description") + public abstract LanguageMap getDescription(); + + @Nonnull + @JsonProperty("hierarchyDescriptor") + public abstract HierarchyDescriptor getHierarchyDescriptor(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesAction.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesAction.java new file mode 100644 index 0000000000..6e7534dc48 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesAction.java @@ -0,0 +1,35 @@ +package edu.stanford.bmir.protege.web.shared.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; +import edu.stanford.bmir.protege.web.shared.dispatch.ProjectAction; +import edu.stanford.bmir.protege.web.shared.lang.LanguageMap; +import edu.stanford.bmir.protege.web.shared.project.ProjectId; + +import javax.annotation.Nonnull; +import java.util.List; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.hierarchies.SetNamedHierarchies") +public abstract class SetNamedHierarchiesAction implements ProjectAction { + + @JsonCreator + public static SetNamedHierarchiesAction get(@JsonProperty("projectId") ProjectId projectId, + @JsonProperty("namedHierarchies") List namedHierarchies) { + return new AutoValue_SetNamedHierarchiesAction(projectId, namedHierarchies); + } + + @Nonnull + @Override + @JsonProperty("projectId") + public abstract ProjectId getProjectId(); + + @Nonnull + @JsonProperty("namedHierarchies") + public abstract List getNamedHierarchies(); +} diff --git a/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesResult.java b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesResult.java new file mode 100644 index 0000000000..0a195f3ba0 --- /dev/null +++ b/webprotege-gwt-ui-shared/src/main/java/edu/stanford/bmir/protege/web/shared/hierarchy/SetNamedHierarchiesResult.java @@ -0,0 +1,18 @@ +package edu.stanford.bmir.protege.web.shared.hierarchy; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.google.auto.value.AutoValue; +import com.google.common.annotations.GwtCompatible; +import edu.stanford.bmir.protege.web.shared.dispatch.Result; + +@AutoValue +@GwtCompatible(serializable = true) +@JsonTypeName("webprotege.hierarchies.SetNamedHierarchies") +public abstract class SetNamedHierarchiesResult implements Result { + + @JsonCreator + public static SetNamedHierarchiesResult get() { + return new AutoValue_SetNamedHierarchiesResult(); + } +} diff --git a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction_TestCase.java b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction_TestCase.java index 34aff7f60f..e17ae55fdb 100644 --- a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction_TestCase.java +++ b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyChildrenAction_TestCase.java @@ -1,6 +1,7 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.junit.Before; import org.junit.Test; @@ -25,17 +26,17 @@ public class GetHierarchyChildrenAction_TestCase { private OWLEntity entity; @Mock - private HierarchyId hierarchyId; + private HierarchyDescriptor hierarchyDescriptor; @Before public void setUp() { - action = GetHierarchyChildrenAction.create(projectId, entity, hierarchyId); + action = GetHierarchyChildrenAction.create(projectId, entity, hierarchyDescriptor); } @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIf_projectId_IsNull() { - GetHierarchyChildrenAction.create(null, entity, hierarchyId); + GetHierarchyChildrenAction.create(null, entity, hierarchyDescriptor); } @Test @@ -46,7 +47,7 @@ public void shouldReturnSupplied_projectId() { @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIf_entity_IsNull() { - GetHierarchyChildrenAction.create(projectId, null, hierarchyId); + GetHierarchyChildrenAction.create(projectId, null, hierarchyDescriptor); } @Test @@ -62,7 +63,7 @@ public void shouldThrowNullPointerExceptionIf_hierarchyId_IsNull() { @Test public void shouldReturnSupplied_hierarchyId() { - assertThat(action.getHierarchyId(), is(this.hierarchyId)); + assertThat(action.getHierarchyDescriptor(), is(this.hierarchyDescriptor)); } @Test @@ -78,27 +79,27 @@ public void shouldNotBeEqualToNull() { @Test public void shouldBeEqualToOther() { - assertThat(action, is(GetHierarchyChildrenAction.create(projectId, entity, hierarchyId))); + assertThat(action, is(GetHierarchyChildrenAction.create(projectId, entity, hierarchyDescriptor))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_projectId() { - assertThat(action, is(not(GetHierarchyChildrenAction.create(mock(ProjectId.class), entity, hierarchyId)))); + assertThat(action, is(not(GetHierarchyChildrenAction.create(mock(ProjectId.class), entity, hierarchyDescriptor)))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_entity() { - assertThat(action, is(not(GetHierarchyChildrenAction.create(projectId, mock(OWLEntity.class), hierarchyId)))); + assertThat(action, is(not(GetHierarchyChildrenAction.create(projectId, mock(OWLEntity.class), hierarchyDescriptor)))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_hierarchyId() { - assertThat(action, is(not(GetHierarchyChildrenAction.create(projectId, entity, mock(HierarchyId.class))))); + assertThat(action, is(not(GetHierarchyChildrenAction.create(projectId, entity, mock(HierarchyDescriptor.class))))); } @Test public void shouldBeEqualToOtherHashCode() { - assertThat(action.hashCode(), is(GetHierarchyChildrenAction.create(projectId, entity, hierarchyId).hashCode())); + assertThat(action.hashCode(), is(GetHierarchyChildrenAction.create(projectId, entity, hierarchyDescriptor).hashCode())); } @Test diff --git a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction_TestCase.java b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction_TestCase.java index fb727cfeaa..5c503d4132 100644 --- a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction_TestCase.java +++ b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyPathsToRootAction_TestCase.java @@ -1,6 +1,7 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.junit.Before; import org.junit.Test; @@ -25,17 +26,17 @@ public class GetHierarchyPathsToRootAction_TestCase { private OWLEntity entity; @Mock - private HierarchyId hierarchyId; + private HierarchyDescriptor hierarchyDescriptor; @Before public void setUp() { - action = GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyId); + action = GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyDescriptor); } @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIf_projectId_IsNull() { - GetHierarchyPathsToRootAction.create(null, entity, hierarchyId); + GetHierarchyPathsToRootAction.create(null, entity, hierarchyDescriptor); } @Test @@ -46,7 +47,7 @@ public void shouldReturnSupplied_projectId() { @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIf_entity_IsNull() { - GetHierarchyPathsToRootAction.create(projectId, null, hierarchyId); + GetHierarchyPathsToRootAction.create(projectId, null, hierarchyDescriptor); } @Test @@ -62,7 +63,7 @@ public void shouldThrowNullPointerExceptionIf_hierarchyId_IsNull() { @Test public void shouldReturnSupplied_hierarchyId() { - assertThat(action.getHierarchyId(), is(this.hierarchyId)); + assertThat(action.getHierarchyDescriptor(), is(this.hierarchyDescriptor)); } @Test @@ -78,27 +79,27 @@ public void shouldNotBeEqualToNull() { @Test public void shouldBeEqualToOther() { - assertThat(action, is(GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyId))); + assertThat(action, is(GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyDescriptor))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_projectId() { - assertThat(action, is(not(GetHierarchyPathsToRootAction.create(mock(ProjectId.class), entity, hierarchyId)))); + assertThat(action, is(not(GetHierarchyPathsToRootAction.create(mock(ProjectId.class), entity, hierarchyDescriptor)))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_entity() { - assertThat(action, is(not(GetHierarchyPathsToRootAction.create(projectId, mock(OWLEntity.class), hierarchyId)))); + assertThat(action, is(not(GetHierarchyPathsToRootAction.create(projectId, mock(OWLEntity.class), hierarchyDescriptor)))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_hierarchyId() { - assertThat(action, is(not(GetHierarchyPathsToRootAction.create(projectId, entity, mock(HierarchyId.class))))); + assertThat(action, is(not(GetHierarchyPathsToRootAction.create(projectId, entity, mock(HierarchyDescriptor.class))))); } @Test public void shouldBeEqualToOtherHashCode() { - assertThat(action.hashCode(), is(GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyId).hashCode())); + assertThat(action.hashCode(), is(GetHierarchyPathsToRootAction.create(projectId, entity, hierarchyDescriptor).hashCode())); } @Test diff --git a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction_TestCase.java b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction_TestCase.java index 6567b0b3aa..442199acba 100644 --- a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction_TestCase.java +++ b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/GetHierarchyRootsAction_TestCase.java @@ -1,6 +1,8 @@ package edu.stanford.bmir.protege.web.shared.hierarchy; +import edu.stanford.bmir.protege.web.client.hierarchy.ClassHierarchyDescriptor; +import edu.stanford.bmir.protege.web.client.hierarchy.HierarchyDescriptor; import edu.stanford.bmir.protege.web.shared.project.ProjectId; import org.junit.Before; import org.junit.Test; @@ -19,17 +21,17 @@ public class GetHierarchyRootsAction_TestCase { @Mock private ProjectId projectId; @Mock - private HierarchyId hierarchyId; + private HierarchyDescriptor hierarchyDescriptor; @Before public void setUp() { - action = GetHierarchyRootsAction.create(projectId, hierarchyId); + action = GetHierarchyRootsAction.create(projectId, hierarchyDescriptor); } @SuppressWarnings("ConstantConditions") @Test(expected = NullPointerException.class) public void shouldThrowNullPointerExceptionIf_projectId_IsNull() { - GetHierarchyRootsAction.create(null, hierarchyId); + GetHierarchyRootsAction.create(null, hierarchyDescriptor); } @Test @@ -45,7 +47,7 @@ public void shouldThrowNullPointerExceptionIf_hierarchyId_IsNull() { @Test public void shouldReturnSupplied_hierarchyId() { - assertThat(action.getHierarchyId(), is(this.hierarchyId)); + assertThat(action.getHierarchyDescriptor(), is(this.hierarchyDescriptor)); } @Test @@ -61,22 +63,22 @@ public void shouldNotBeEqualToNull() { @Test public void shouldBeEqualToOther() { - assertThat(action, is(GetHierarchyRootsAction.create(projectId, hierarchyId))); + assertThat(action, is(GetHierarchyRootsAction.create(projectId, hierarchyDescriptor))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_projectId() { - assertThat(action, is(not(GetHierarchyRootsAction.create(mock(ProjectId.class), hierarchyId)))); + assertThat(action, is(not(GetHierarchyRootsAction.create(mock(ProjectId.class), hierarchyDescriptor)))); } @Test public void shouldNotBeEqualToOtherThatHasDifferent_hierarchyId() { - assertThat(action, is(not(GetHierarchyRootsAction.create(projectId, mock(HierarchyId.class))))); + assertThat(action, is(not(GetHierarchyRootsAction.create(projectId, mock(ClassHierarchyDescriptor.class))))); } @Test public void shouldBeEqualToOtherHashCode() { - assertThat(action.hashCode(), is(GetHierarchyRootsAction.create(projectId, hierarchyId).hashCode())); + assertThat(action.hashCode(), is(GetHierarchyRootsAction.create(projectId, hierarchyDescriptor).hashCode())); } @Test diff --git a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/HierarchyId_TestCase.java b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/HierarchyId_TestCase.java index e611b3ae98..7e1d3ce7b8 100644 --- a/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/HierarchyId_TestCase.java +++ b/webprotege-gwt-ui-shared/src/test/java/edu/stanford/bmir/protege/web/shared/hierarchy/HierarchyId_TestCase.java @@ -1,30 +1,31 @@ - package edu.stanford.bmir.protege.web.shared.hierarchy; +import org.assertj.core.api.Assertions; import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.junit.jupiter.api.Assertions.assertThrows; -@RunWith(MockitoJUnitRunner.class) public class HierarchyId_TestCase { private static final String ID = "TheHierarchy"; + private HierarchyId hierarchyId; - @Before + @BeforeEach public void setUp() { hierarchyId = HierarchyId.get(ID); } @SuppressWarnings("ConstantConditions") - @Test(expected = NullPointerException.class) + @Test public void shouldThrowNullPointerException() { - HierarchyId.get(null); + assertThrows(NullPointerException.class, () -> { + HierarchyId.get(null); + }); } @Test @@ -52,4 +53,31 @@ public void shouldBeEqualToOtherHashCode() { public void shouldImplementToString() { assertThat(hierarchyId.toString(), Matchers.startsWith("HierarchyId")); } + + + @Test + public void shouldReturnClassHierarchyIsBuiltIn() { + Assertions.assertThat(HierarchyId.CLASS_HIERARCHY.isBuiltIn()).isTrue(); + } + + @Test + public void shouldReturnObjectPropertyHierarchyIsBuiltIn() { + Assertions.assertThat(HierarchyId.OBJECT_PROPERTY_HIERARCHY.isBuiltIn()).isTrue(); + } + + @Test + public void shouldReturnDataPropertyHierarchyIsBuiltIn() { + Assertions.assertThat(HierarchyId.DATA_PROPERTY_HIERARCHY.isBuiltIn()).isTrue(); + } + + @Test + public void shouldReturnAnnotationPropertyHierarchyIsBuiltIn() { + Assertions.assertThat(HierarchyId.ANNOTATION_PROPERTY_HIERARCHY.isBuiltIn()).isTrue(); + } + + @Test + public void shouldReturnOtherHierarchyIsNotBuiltIn() { + Assertions.assertThat(HierarchyId.get("other").isBuiltIn()).isFalse(); + } + }