Mercurial > hg > ismi-richfaces
comparison 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 |
comparison
equal
deleted
inserted
replaced
71:38dc1f0e2451 | 72:70207f24937e |
---|---|
5 | 5 |
6 import javax.faces.event.ActionEvent; | 6 import javax.faces.event.ActionEvent; |
7 import javax.faces.model.SelectItem; | 7 import javax.faces.model.SelectItem; |
8 | 8 |
9 import org.apache.log4j.Logger; | 9 import org.apache.log4j.Logger; |
10 import org.mpi.openmind.repository.bo.Attribute; | |
10 import org.mpi.openmind.repository.bo.Entity; | 11 import org.mpi.openmind.repository.bo.Entity; |
11 | 12 |
12 import de.mpiwg.itgroup.ismi.auxObjects.SelectItem0; | 13 import de.mpiwg.itgroup.ismi.auxObjects.SelectItem0; |
13 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; | 14 import de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; |
14 import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils; | 15 import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils; |
28 protected WitnessTemplate witness; | 29 protected WitnessTemplate witness; |
29 | 30 |
30 //Witness elements | 31 //Witness elements |
31 protected List<SelectItem0> witnessItems = new ArrayList<SelectItem0>(); | 32 protected List<SelectItem0> witnessItems = new ArrayList<SelectItem0>(); |
32 protected Long selectedWitnessId; | 33 protected Long selectedWitnessId; |
34 protected boolean showWitnessesWithScans = false; | |
33 | 35 |
34 //Title elements | 36 //Title elements |
35 protected Long selectedTitleId; | 37 protected Long selectedTitleId; |
36 protected List<SelectItem0> titleItems = new ArrayList<SelectItem0>(); | 38 protected List<SelectItem0> titleItems = new ArrayList<SelectItem0>(); |
37 | 39 |
59 this.titleItems = SelectItem0.valueChange(titleItems, textId); | 61 this.titleItems = SelectItem0.valueChange(titleItems, textId); |
60 this.title = new TitleTemplate(entTitle, getWrapper(), false); | 62 this.title = new TitleTemplate(entTitle, getWrapper(), false); |
61 | 63 |
62 //****** getting witnesses ********************** | 64 //****** getting witnesses ********************** |
63 long startWitness = System.currentTimeMillis(); | 65 long startWitness = System.currentTimeMillis(); |
64 List<Entity> list = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); | 66 List<Entity> list = new ArrayList<Entity>(); |
65 for(Entity src : list){ | 67 List<Entity> allwits = getWrapper().getSourcesForTargetRelation(selectedTitleId, is_exemplar_of, WITNESS, -1); |
66 SelectItem0 item = new SelectItem0(src.getId(), src.getOwnValue() + " [" + src.getId() + "]", true); | 68 for (Entity witness : allwits) { |
69 if (this.showWitnessesWithScans) { | |
70 List<Entity> codices = getWrapper().getTargetsForSourceRelation(witness.getId(), is_part_of, CODEX, 1); | |
71 Entity codex = codices.get(0); | |
72 // TODO: look at DIGITALIZATION | |
73 Attribute pub = getWrapper().getAttributeByName(codex.getId(), "public"); | |
74 if (pub == null || ! pub.getValue().equals("true")) { | |
75 continue; | |
76 } | |
77 } | |
78 SelectItem0 item = new SelectItem0(witness.getId(), witness.getOwnValue() + " [" + witness.getId() + "]", true); | |
67 this.witnessItems.add(item); | 79 this.witnessItems.add(item); |
80 list.add(witness); | |
68 } | 81 } |
69 | 82 |
70 if(list.size() > 0){ | 83 if(list.size() > 0){ |
71 this.showWitness(list.get(0).getId()); | 84 this.showWitness(list.get(0).getId()); |
72 } | 85 } |
191 printInternalError(e); | 204 printInternalError(e); |
192 } | 205 } |
193 | 206 |
194 } | 207 } |
195 | 208 |
209 | |
210 public void changeShowWitnessesWithScans() { | |
211 if (this.selectedTitleId != null) { | |
212 showTitle(this.selectedTitleId); | |
213 } | |
214 } | |
215 | |
196 public int getWitnessItemsSize() { | 216 public int getWitnessItemsSize() { |
197 if(witnessItems != null) | 217 if(witnessItems != null) |
198 return witnessItems.size(); | 218 return witnessItems.size(); |
199 return 0; | 219 return 0; |
200 } | 220 } |
224 } | 244 } |
225 | 245 |
226 public void setSelectedTitleId(Long selectedTitleId) { | 246 public void setSelectedTitleId(Long selectedTitleId) { |
227 this.selectedTitleId = selectedTitleId; | 247 this.selectedTitleId = selectedTitleId; |
228 } | 248 } |
249 | |
250 public boolean isShowWitnessesWithScans() { | |
251 return showWitnessesWithScans; | |
252 } | |
253 | |
254 public void setShowWitnessesWithScans(boolean showWitnessesWithScans) { | |
255 this.showWitnessesWithScans = showWitnessesWithScans; | |
256 } | |
229 } | 257 } |