Mercurial > hg > ismi-richfaces
diff src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java @ 77:985dcecba904
"show scans" link and indicator for all witnesses with digitalization (no check for public).
author | casties |
---|---|
date | Tue, 28 Jun 2016 16:18:49 -0400 |
parents | 70207f24937e |
children | e07e9f5afaa3 |
line wrap: on
line diff
--- 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<Entity> list = new ArrayList<Entity>(); List<Entity> allwits = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); - for (Entity witness : allwits) { - if (this.showWitnessesWithScans) { - List<Entity> 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<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; + } + 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());