# HG changeset patch # User casties # Date 1467145129 14400 # Node ID 985dcecba90441b52e2e762d17bd6e2c9324fe6b # Parent 45b921e683d6c7b9d9b71a963ea8483e6389c470 "show scans" link and indicator for all witnesses with digitalization (no check for public). diff -r 45b921e683d6 -r 985dcecba904 src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Tue Jun 28 11:43:48 2016 -0400 +++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Tue Jun 28 16:18:49 2016 -0400 @@ -7,7 +7,6 @@ import javax.faces.model.SelectItem; import org.apache.log4j.Logger; -import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import de.mpiwg.itgroup.ismi.auxObjects.SelectItem0; @@ -65,20 +64,24 @@ long startWitness = System.currentTimeMillis(); List list = new ArrayList(); List allwits = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); - for (Entity witness : allwits) { - if (this.showWitnessesWithScans) { - List codices = getWrapper().getTargetsForSourceRelation(witness.getId(), is_part_of, CODEX, 1); - Entity codex = codices.get(0); - // TODO: look at DIGITALIZATION - Attribute pub = getWrapper().getAttributeByName(codex.getId(), "public"); - if (pub == null || ! pub.getValue().equals("true")) { - continue; - } - } - SelectItem0 item = new SelectItem0(witness.getId(), witness.getOwnValue() + " [" + witness.getId() + "]", true); - this.witnessItems.add(item); - list.add(witness); - } + boolean hasScans = false; + for (Entity witness : allwits) { + // get CODEX for WITNESS + List 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 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); + this.witnessItems.add(item); + list.add(witness); + } if(list.size() > 0){ this.showWitness(list.get(0).getId()); diff -r 45b921e683d6 -r 985dcecba904 src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java --- a/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java Tue Jun 28 11:43:48 2016 -0400 +++ b/src/main/java/de/mpiwg/itgroup/ismi/utils/templates/WitnessTemplate.java Tue Jun 28 16:18:49 2016 -0400 @@ -206,8 +206,7 @@ } //**** Getting the Codices - List list = - om.getTargetsForSourceRelation(witness.getId(), "is_part_of", "CODEX", 1); + List list = om.getTargetsForSourceRelation(witness.getId(), "is_part_of", "CODEX", 1); if (list.size() > 0) { Entity codex = list.get(0); @@ -217,11 +216,12 @@ } /* - * add scan viewer URL if codex is public + * add scan viewer URL */ - // TODO: use scans attribute if available? - Attribute pub = om.getAttributeByName(codex.getId(), "public"); - if (pub != null && pub.getValue().equals("true")) { + // look at DIGITALIZATION + List digis = om.getSourcesForTargetRelation(codex.getId(), "is_digitalization_of", "DIGITALIZATION", 1); + //Attribute pub = om.getAttributeByName(codex.getId(), "public"); + if (!digis.isEmpty()) { // FIXME: make viewer URL configurable this.scanViewer = "/public/publicWitness.jsp?eid=" + this.id; } diff -r 45b921e683d6 -r 985dcecba904 src/main/webapp/search/displayTitle.xhtml --- a/src/main/webapp/search/displayTitle.xhtml Tue Jun 28 11:43:48 2016 -0400 +++ b/src/main/webapp/search/displayTitle.xhtml Tue Jun 28 16:18:49 2016 -0400 @@ -281,6 +281,14 @@ + + + See witness scans + + +