referencing objects view for media, NPE in polytomous key view
authorKatja Luther <k.luther@bgbm.org>
Mon, 21 Mar 2016 13:08:35 +0000 (14:08 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 21 Mar 2016 13:08:35 +0000 (14:08 +0100)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java

index 6936095..feb73fb 100644 (file)
@@ -166,7 +166,7 @@ public class DeleteHandler extends AbstractHandler {
                                        } else if (object instanceof Media){
                         IMediaService service = controller.getMediaService();
                         //TeamOrPersonBase teamOrPerson = (TeamOrPersonBase)service.load(((TeamOrPersonBase) object).getUuid());
-                        result = service.delete(((Media)object).getUuid());
+                        result = service.delete(((Media)object).getUuid(), null);
                         errorMessage = "The media ";
                     }
 
index d1645a7..a52d9df 100644 (file)
@@ -45,6 +45,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.api.service.IGroupService;
+import eu.etaxonomy.cdm.api.service.IMediaService;
 import eu.etaxonomy.cdm.api.service.INameService;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.IReferenceService;
@@ -57,6 +58,7 @@ import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
@@ -82,7 +84,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 
        private String referencedObjectTitleCache;
        private ConversationHolder conversation;
-       private ICdmEntitySession cdmEntitySession;
+       private final ICdmEntitySession cdmEntitySession;
 
        public ReferencingObjectsView() {
            cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
@@ -223,6 +225,8 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                        referencedObject = CdmStore.getService(IUserService.class).load(entity);
                } else if (objectClass.isAssignableFrom(Group.class)){
                        referencedObject = CdmStore.getService(IGroupService.class).load(entity);
+               } else if (objectClass.isAssignableFrom(Media.class)){
+                   referencedObject = CdmStore.getService(IMediaService.class).load(entity);
                } else if (DescriptionBase.class.isAssignableFrom(objectClass)){
                    referencedObject = CdmStore.getService(IDescriptionService.class).load(entity);
                } else if (DescriptionElementBase.class.isAssignableFrom(objectClass)){
index 90ed20b..2f25753 100644 (file)
@@ -69,6 +69,9 @@ public class PolytomousKeyListContentProvider implements
 
        private void getChildrenBreadthFirst(List<PolytomousKeyNode> result,
                        PolytomousKeyNode node) {
+           if (node == null){
+               return;
+           }
                if (!node.getChildren().isEmpty()) {
                        result.addAll(node.getChildren());
                        for (PolytomousKeyNode internalNode : node.getChildren()) {
index 56bd34c..c86490e 100644 (file)
@@ -74,6 +74,11 @@ public class PolytomousKeyListEditor extends EditorPart implements
                        Point point = new Point(event.x, event.y);
 
                        int selectedColumn = getSelectedColumn(table, point);
+
+                       if (table == null || point == null ){
+                           return;
+                       }
+
                        PolytomousKeyNode node = (PolytomousKeyNode) getTableItem(
                         table, point).getData();