Mercurial > hg > ismi-richfaces
diff src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java @ 72:70207f24937e
cleaned displayAuthor. added filter for witnesses with scans.
author | casties |
---|---|
date | Tue, 22 Dec 2015 20:07:13 +0100 |
parents | 4ec8d4cfad26 |
children | 985dcecba904 |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Thu Dec 17 17:31:07 2015 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/search/beans/DisplayBean.java Tue Dec 22 20:07:13 2015 +0100 @@ -7,6 +7,7 @@ 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; @@ -30,6 +31,7 @@ //Witness elements protected List<SelectItem0> witnessItems = new ArrayList<SelectItem0>(); protected Long selectedWitnessId; + protected boolean showWitnessesWithScans = false; //Title elements protected Long selectedTitleId; @@ -61,10 +63,21 @@ //****** getting witnesses ********************** long startWitness = System.currentTimeMillis(); - List<Entity> list = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); - for(Entity src : list){ - SelectItem0 item = new SelectItem0(src.getId(), src.getOwnValue() + " [" + src.getId() + "]", true); + 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); } if(list.size() > 0){ @@ -193,6 +206,13 @@ } + + public void changeShowWitnessesWithScans() { + if (this.selectedTitleId != null) { + showTitle(this.selectedTitleId); + } + } + public int getWitnessItemsSize() { if(witnessItems != null) return witnessItems.size(); @@ -226,4 +246,12 @@ public void setSelectedTitleId(Long selectedTitleId) { this.selectedTitleId = selectedTitleId; } + + public boolean isShowWitnessesWithScans() { + return showWitnessesWithScans; + } + + public void setShowWitnessesWithScans(boolean showWitnessesWithScans) { + this.showWitnessesWithScans = showWitnessesWithScans; + } }