changeset 83:e07e9f5afaa3

fix display bug when WITNESS has no CODEX.
author casties
date Mon, 26 Sep 2016 17:25:43 +0200
parents c000b4b386bc
children e2f6ccc4d322
files src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java	Wed Sep 21 19:53:15 2016 +0200
+++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java	Mon Sep 26 17:25:43 2016 +0200
@@ -68,14 +68,16 @@
             for (Entity witness : allwits) {
                 // get CODEX for WITNESS
                 List<Entity> codices = getWrapper().getTargetsForSourceRelation(witness.getId(), is_part_of, CODEX, 1);
-                Entity codex = codices.get(0);
-                // Attribute pub = getWrapper().getAttributeByName(codex.getId(), "public");
-                // if (pub == null || ! pub.getValue().equals("true")) {
-                // look at DIGITALIZATION
-                List<Entity> digis = getWrapper().getSourcesForTargetRelation(codex.getId(), is_digitalization_of, DIGITALIZATION, 1);
-                hasScans = !digis.isEmpty();
-                if (this.showWitnessesWithScans && !hasScans) {
-                    continue;
+                if (codices.isEmpty()) {
+                    logger.error("WITNESS ["+witness.getId()+"] has no CODEX!");
+                } else {
+                    Entity codex = codices.get(0);
+                    // look at DIGITALIZATION of CODEX
+                    List<Entity> digis = getWrapper().getSourcesForTargetRelation(codex.getId(), is_digitalization_of, DIGITALIZATION, 1);
+                    hasScans = !digis.isEmpty();
+                    if (this.showWitnessesWithScans && !hasScans) {
+                        continue;
+                    }
                 }
                 String witlabel = witness.getOwnValue() + " [" + witness.getId() + "]" + (hasScans ? "+S" : "");
                 SelectItem0 item = new SelectItem0(witness.getId(), witlabel, true);