Mercurial > hg > ismi-richfaces
annotate src/main/java/de/mpiwg/itgroup/ismi/browse/AbstractEntityRepositoryBean.java @ 169:0b5d02012299 public_by_author
more work on publicByAuthor feature.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 31 May 2018 20:26:10 +0200 |
parents | 29bd63f749c6 |
children | aa564b1b5e1f |
rev | line source |
---|---|
1 | 1 package de.mpiwg.itgroup.ismi.browse; |
2 | |
3 import java.util.ArrayList; | |
4 import java.util.Collections; | |
5 import java.util.HashMap; | |
6 import java.util.List; | |
7 import java.util.Map; | |
8 | |
9 import javax.faces.event.ActionEvent; | |
10 import javax.faces.event.ValueChangeEvent; | |
11 import javax.faces.model.SelectItem; | |
12 | |
13 import org.apache.commons.lang.StringUtils; | |
14 import org.apache.log4j.Logger; | |
15 import org.mpi.openmind.repository.bo.Attribute; | |
16 import org.mpi.openmind.repository.bo.Entity; | |
17 import org.mpi.openmind.repository.services.utils.AttributeFilter; | |
18 | |
19 import de.mpiwg.itgroup.ismi.util.guiComponents.DataPaginator; | |
20 | |
21 public class AbstractEntityRepositoryBean extends AbstractBrowse { | |
22 | |
23 private static final long serialVersionUID = 3154642100627969159L; | |
24 | |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
25 protected static Logger logger = Logger.getLogger(AbstractEntityRepositoryBean.class); |
1 | 26 |
27 public static String MODE_ADVANCED = "advanced"; | |
28 public static String MODE_ALL = "all"; | |
29 public static String MODE_NONE = "none"; | |
30 | |
31 | |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
32 protected String objectClass = null; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
33 protected List<Entity> entities = new ArrayList<Entity>(); |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
34 protected List<Entity> currentEntities = new ArrayList<Entity>(); |
1 | 35 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
36 protected List<SelectItem> definitions = new ArrayList<SelectItem>(); |
1 | 37 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
38 protected transient DataPaginator advancedPaginator = new DataPaginator(); |
1 | 39 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
40 protected String ocTerm; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
41 protected String currentTab; |
1 | 42 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
43 protected String textFullTitle; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
44 protected String textFullTitleTranslit; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
45 protected String textShortTitle; |
1 | 46 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
47 protected String personName; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
48 protected String personNameTranslit; |
1 | 49 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
50 protected String codexIdentifier; |
1 | 51 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
52 protected String collectionName; |
1 | 53 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
54 protected String placeName; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
55 protected String placeType; |
1 | 56 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
57 protected String aliasAlias; |
1 | 58 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
59 protected String repositoryName; |
1 | 60 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
61 protected String witnessFullTitle; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
62 protected String witnessFullTitleTranslit; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
63 protected String witnessAhlwardtNo; |
1 | 64 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
65 protected boolean advancedSearch = false; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
66 protected String resultMode = MODE_NONE; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
67 protected String resultSummaryMsg; |
1 | 68 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
69 protected String subjectType; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
70 protected List<SelectItem> suggestedSubjectTypes = new ArrayList<SelectItem>(); |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
71 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
72 protected String referenceBibIdNo; |
1 | 73 |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
74 protected String page; |
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
75 protected String pageMsg; |
1 | 76 |
77 public static String main_subject = "main_subject"; | |
78 public static String sub_subject = "sub_subject"; | |
79 | |
80 public AbstractEntityRepositoryBean(){ | |
81 suggestedSubjectTypes.add(new SelectItem(null, "-- choose --")); | |
82 suggestedSubjectTypes.add(new SelectItem(main_subject, main_subject)); | |
83 suggestedSubjectTypes.add(new SelectItem(sub_subject, sub_subject)); | |
84 this.updateDefinitions(getWrapper().getLWDefinitions()); | |
85 } | |
86 | |
103 | 87 /** |
88 * Put the current subset of this.entites in this.currentEntities. | |
89 */ | |
169
0b5d02012299
more work on publicByAuthor feature.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
146
diff
changeset
|
90 protected void updateAdvancedEntities() { |
103 | 91 if (StringUtils.isNotEmpty(getObjectClass())) { |
92 this.advancedPaginator.initCount(); | |
93 int startRecord = this.advancedPaginator.getCurrentPage() * this.advancedPaginator.getItemsPerPage(); | |
94 if ((this.advancedPaginator.getCurrentPage() + 1) == this.advancedPaginator.getNumberOfPages()) { | |
95 int mod = this.entities.size() % advancedPaginator.getItemsPerPage(); | |
96 if (mod == 0) { | |
97 this.currentEntities = entities.subList(startRecord, | |
98 startRecord + this.advancedPaginator.getItemsPerPage()); | |
99 } else { | |
100 this.currentEntities = entities.subList(startRecord, startRecord + mod); | |
101 } | |
102 | |
103 } else { | |
104 this.currentEntities = entities.subList(startRecord, | |
105 startRecord + this.advancedPaginator.getItemsPerPage()); | |
106 } | |
107 } else { | |
108 // empty object_class | |
109 this.currentEntities = new ArrayList<Entity>(); | |
110 } | |
111 } | |
1 | 112 |
113 public String advancedFirst() { | |
114 this.advancedPaginator.first(); | |
115 this.updateAdvancedEntities(); | |
116 return GOTO_ENTITY_REPOSITORY; | |
117 } | |
118 | |
119 public String advancedLast() { | |
120 this.advancedPaginator.last(); | |
121 this.updateAdvancedEntities(); | |
122 return GOTO_ENTITY_REPOSITORY; | |
123 } | |
124 | |
125 public String advancedFastForward() { | |
126 this.advancedPaginator.fastForward(); | |
127 this.updateAdvancedEntities(); | |
128 return GOTO_ENTITY_REPOSITORY; | |
129 } | |
130 | |
131 public String advancedFastRewind() { | |
132 this.advancedPaginator.fastRewind(); | |
133 this.updateAdvancedEntities(); | |
134 return GOTO_ENTITY_REPOSITORY; | |
135 } | |
136 | |
137 public String advancedPrevious() { | |
138 this.advancedPaginator.previous(); | |
139 this.updateAdvancedEntities(); | |
140 return GOTO_ENTITY_REPOSITORY; | |
141 } | |
142 | |
143 public String advancedNext() { | |
144 this.advancedPaginator.next(); | |
145 this.updateAdvancedEntities(); | |
146 return GOTO_ENTITY_REPOSITORY; | |
147 } | |
148 | |
149 public void reset(){ | |
150 this.entities = new ArrayList<Entity>(); | |
151 this.currentEntities = new ArrayList<Entity>(); | |
152 this.resultSummaryMsg = new String(); | |
153 } | |
154 | |
155 public void actionGoToPageAdvancedResult(ActionEvent event){ | |
156 this.pageMsg = ""; | |
157 try{ | |
158 Integer page = new Integer(getPage()); | |
159 this.advancedPaginator.goToPage(page - 1); | |
160 this.updateAdvancedEntities(); | |
161 }catch(Exception e){ | |
162 this.pageMsg = "page is invalid!"; | |
163 } | |
164 } | |
165 | |
166 public DataPaginator getAdvancedPaginator() { | |
167 return advancedPaginator; | |
168 } | |
169 | |
170 public void setAdvancedPaginator(DataPaginator advancedPaginator) { | |
171 this.advancedPaginator = advancedPaginator; | |
172 } | |
173 | |
174 public void updateDefinitions(List<Entity> defs) { | |
175 this.definitions = new ArrayList<SelectItem>(); | |
176 SelectItem option = null; | |
177 for (Entity def : defs) { | |
178 if (def.getOwnValue() != null) { | |
179 option = new SelectItem(def.getOwnValue()); | |
180 this.definitions.add(option); | |
181 } | |
182 } | |
183 this.setEntities(new ArrayList<Entity>()); | |
184 if (defs.size() > 0) { | |
185 this.objectClass = defs.get(0).getOwnValue(); | |
186 } | |
187 } | |
188 | |
189 public void actionDisplayAdvancedSearch(ActionEvent event) { | |
190 this.advancedSearch = true; | |
191 } | |
192 | |
193 public void actionHideAdvancedSearch(ActionEvent event) { | |
194 this.advancedSearch = false; | |
195 } | |
196 | |
197 public void actionChangeDefinition(ValueChangeEvent event) { | |
198 this.objectClass = (String) event.getNewValue(); | |
199 } | |
200 | |
201 public void searchByOwnvalue(){ | |
202 this.resultMode = MODE_ADVANCED; | |
203 this.setPage(""); | |
204 this.currentEntities = new ArrayList<Entity>(); | |
205 this.entities = getWrapper().searchEntityByOwnValue(objectClass, ocTerm); | |
206 this.resultSummaryMsg = ""; | |
207 | |
208 if(this.entities.size() > 0){ | |
209 | |
210 this.advancedPaginator.setCurrentPage(0); | |
211 int entitiesCount = this.entities.size(); | |
212 this.advancedPaginator.resetNumberOfPages(entitiesCount); | |
213 this.updateAdvancedEntities(); | |
214 }else { | |
215 this.resultSummaryMsg = "No items were found!"; | |
216 } | |
217 } | |
218 | |
219 | |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
220 public void searchByAttributes() throws Exception { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
221 this.resultMode = MODE_ADVANCED; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
222 this.setPage(""); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
223 this.entities = new ArrayList<Entity>(); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
224 this.currentEntities = new ArrayList<Entity>(); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
225 |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
226 List<AttributeFilter> filterList = new ArrayList<AttributeFilter>(); |
1 | 227 |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
228 this.resultSummaryMsg = ""; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
229 Map<Entity, Attribute> resultMap = new HashMap<Entity, Attribute>(); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
230 |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
231 /* |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
232 * create list of filters for the selected attributes |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
233 */ |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
234 if (this.objectClass.equals(TEXT)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
235 if (StringUtils.isNotEmpty(textFullTitle)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
236 filterList.add(new AttributeFilter("full_title", this.textFullTitle, TEXT)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
237 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
238 if (StringUtils.isNotEmpty(textFullTitleTranslit)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
239 filterList.add(new AttributeFilter("full_title_translit", textFullTitleTranslit, TEXT)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
240 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
241 if (StringUtils.isNotEmpty(textShortTitle)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
242 List<Entity> l = getWrapper().searchEntityByAttributeOfTarRelation(TEXT, "is_prime_alias_title_of", |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
243 ALIAS, "alias", textShortTitle, 20); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
244 for (Entity e : l) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
245 this.entities.add(e); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
246 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
247 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
248 } else if (this.objectClass.equals(WITNESS)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
249 // witnessAhlwardtNo |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
250 if (StringUtils.isNotEmpty(this.witnessAhlwardtNo)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
251 filterList.add(new AttributeFilter("ahlwardt_no", this.witnessAhlwardtNo, WITNESS)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
252 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
253 } else if (this.objectClass.equals(SUBJECT)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
254 if (StringUtils.isNotEmpty(this.subjectType)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
255 filterList.add(new AttributeFilter("type", this.subjectType, SUBJECT)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
256 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
257 } else if (this.objectClass.equals(ALIAS)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
258 if (StringUtils.isNotEmpty(this.aliasAlias)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
259 filterList.add(new AttributeFilter("alias", this.aliasAlias, ALIAS)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
260 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
261 } else if (this.objectClass.equals(COLLECTION)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
262 if (StringUtils.isNotEmpty(this.collectionName)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
263 filterList.add(new AttributeFilter("name", this.collectionName, COLLECTION)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
264 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
265 } else if (this.objectClass.equals(REPOSITORY)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
266 if (StringUtils.isNotEmpty(this.repositoryName)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
267 filterList.add(new AttributeFilter("name", this.repositoryName, REPOSITORY)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
268 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
269 } else if (this.objectClass.equals(PLACE)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
270 if (StringUtils.isNotEmpty(this.placeName)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
271 filterList.add(new AttributeFilter("name", this.placeName, PLACE)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
272 } |
104 | 273 if (StringUtils.isNotEmpty(this.placeType)) { |
274 filterList.add(new AttributeFilter("type", this.placeType, PLACE)); | |
275 } | |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
276 } else if (this.objectClass.equals(CODEX)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
277 if (StringUtils.isNotEmpty(this.codexIdentifier)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
278 filterList.add(new AttributeFilter("identifier", this.codexIdentifier, CODEX)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
279 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
280 } else if (this.objectClass.equals(REFERENCE)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
281 // search "#bibIdNo\W" as regex in endnote-id attribute |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
282 if (StringUtils.isNotEmpty(this.referenceBibIdNo)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
283 filterList.add(new AttributeFilter("endnote-id", "#" + this.referenceBibIdNo + "[[:>:]]", REFERENCE, true)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
284 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
285 } else if (this.objectClass.equals(PERSON)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
286 if (StringUtils.isNotEmpty(this.personName)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
287 filterList.add(new AttributeFilter("name", this.personName, PERSON)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
288 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
289 if (StringUtils.isNotEmpty(this.personNameTranslit)) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
290 filterList.add(new AttributeFilter("name_translit", this.personNameTranslit, PERSON)); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
291 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
292 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
293 |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
294 /* |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
295 * run search and sort result (by ownvalue) |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
296 */ |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
297 if (filterList.size() > 0) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
298 resultMap = getWrapper().searchEntityByAttributeFilter(filterList, 500); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
299 // pack entities (Map keys) into List |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
300 for (Entity ent : resultMap.keySet()) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
301 this.entities.add(ent); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
302 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
303 // sort List (by ownvalue) |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
304 Collections.sort(entities); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
305 } |
1 | 306 |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
307 if (resultMap.size() > 0) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
308 this.resultSummaryMsg = resultMap.size() + " items were found!"; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
309 this.advancedPaginator.setCurrentPage(0); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
310 int entitiesCount = this.entities.size(); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
311 this.advancedPaginator.resetNumberOfPages(entitiesCount); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
312 this.updateAdvancedEntities(); |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
313 } else { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
314 this.resultSummaryMsg = "No items were found!"; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
315 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
316 } |
1 | 317 |
146
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
318 public void searchByPublic() { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
319 this.resultMode = MODE_ADVANCED; |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
320 this.setPage(""); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
321 this.currentEntities = new ArrayList<Entity>(); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
322 boolean isPublic = true; |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
323 this.entities = getWrapper().searchEntityByPublic(objectClass, isPublic); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
324 this.resultSummaryMsg = ""; |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
325 |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
326 if (this.entities.size() > 0) { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
327 this.advancedPaginator.setCurrentPage(0); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
328 int entitiesCount = this.entities.size(); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
329 this.advancedPaginator.resetNumberOfPages(entitiesCount); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
330 this.updateAdvancedEntities(); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
331 } else { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
332 this.resultSummaryMsg = "No items were found!"; |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
333 } |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
334 } |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
335 |
1 | 336 public boolean isRenderedSearch(){ |
337 if(StringUtils.isNotEmpty(this.objectClass) && ( | |
338 objectClass.equals(SUBJECT) || | |
339 objectClass.equals(REPOSITORY) || | |
340 objectClass.equals(ALIAS) || | |
341 objectClass.equals(COLLECTION) || | |
342 objectClass.equals(TEXT) || | |
343 objectClass.equals(PERSON) || | |
344 objectClass.equals(CODEX) || | |
345 objectClass.equals(WITNESS) || | |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
346 objectClass.equals(PLACE) || |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
347 objectClass.equals(REFERENCE))) { |
1 | 348 return true; |
349 } | |
350 return false; | |
351 } | |
352 | |
353 public String actionSearchByAttributes() { | |
354 try { | |
355 this.searchByAttributes(); | |
356 } catch (Exception e) { | |
357 printInternalError(e); | |
358 logger.error(e.getMessage(), e); | |
359 } | |
360 | |
361 return GOTO_ENTITY_REPOSITORY; | |
362 } | |
363 | |
364 public String actionSearchByOwnvalue(){ | |
365 try { | |
366 this.searchByOwnvalue(); | |
367 } catch (Exception e) { | |
368 printInternalError(e); | |
369 logger.error(e.getMessage(), e); | |
370 } | |
371 | |
372 return GOTO_ENTITY_REPOSITORY; | |
373 } | |
374 | |
146
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
375 public String actionSearchByPublic() { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
376 try { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
377 this.searchByPublic(); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
378 } catch (Exception e) { |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
379 printInternalError(e); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
380 logger.error(e.getMessage(), e); |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
381 } |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
382 |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
383 return GOTO_ENTITY_REPOSITORY; |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
384 } |
29bd63f749c6
add Browse by Public.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
104
diff
changeset
|
385 |
1 | 386 public boolean isAdvancedSearch() { |
387 return advancedSearch; | |
388 } | |
389 | |
390 public void setAdvancedSearch(boolean advancedSearch) { | |
391 this.advancedSearch = advancedSearch; | |
392 } | |
393 | |
394 public String getTextFullTitle() { | |
395 return textFullTitle; | |
396 } | |
397 | |
398 public void setTextFullTitle(String textFullTitle) { | |
399 this.textFullTitle = textFullTitle; | |
400 } | |
401 | |
402 public String getTextFullTitleTranslit() { | |
403 return textFullTitleTranslit; | |
404 } | |
405 | |
406 public void setTextFullTitleTranslit(String textFullTitleTranslit) { | |
407 this.textFullTitleTranslit = textFullTitleTranslit; | |
408 } | |
409 | |
410 public String getTextShortTitle() { | |
411 return textShortTitle; | |
412 } | |
413 | |
414 public void setTextShortTitle(String textShortTitle) { | |
415 this.textShortTitle = textShortTitle; | |
416 } | |
417 | |
418 public String getPersonName() { | |
419 return personName; | |
420 } | |
421 | |
422 public void setPersonName(String personName) { | |
423 this.personName = personName; | |
424 } | |
425 | |
426 public String getPersonNameTranslit() { | |
427 return personNameTranslit; | |
428 } | |
429 | |
430 public void setPersonNameTranslit(String personNameTranslit) { | |
431 this.personNameTranslit = personNameTranslit; | |
432 } | |
433 | |
434 public String getObjectClass() { | |
435 return objectClass; | |
436 } | |
437 | |
438 public void setObjectClass(String objectClass) { | |
439 this.objectClass = objectClass; | |
440 } | |
441 | |
442 public List<Entity> getEntities() { | |
443 return this.entities; | |
444 } | |
445 | |
446 public void setEntities(List<Entity> entities) { | |
447 this.entities = entities; | |
448 } | |
449 | |
450 public List<SelectItem> getDefinitions() { | |
451 return definitions; | |
452 } | |
453 | |
454 public void setDefinitions(List<SelectItem> definitions) { | |
455 this.definitions = definitions; | |
456 } | |
457 | |
458 public String getResultMode() { | |
459 return resultMode; | |
460 } | |
461 | |
462 public void setResultMode(String resultMode) { | |
463 this.resultMode = resultMode; | |
464 } | |
465 | |
466 public String getResultSummaryMsg() { | |
467 return resultSummaryMsg; | |
468 } | |
469 | |
470 public void setResultSummaryMsg(String resultSummaryMsg) { | |
471 this.resultSummaryMsg = resultSummaryMsg; | |
472 } | |
473 | |
474 public String getPage() { | |
475 return page; | |
476 } | |
477 | |
478 public void setPage(String page) { | |
479 this.page = page; | |
480 } | |
481 | |
482 public String getPageMsg() { | |
483 return pageMsg; | |
484 } | |
485 | |
486 public void setPageMsg(String pageMsg) { | |
487 this.pageMsg = pageMsg; | |
488 } | |
489 public String getCodexIdentifier() { | |
490 return codexIdentifier; | |
491 } | |
492 public void setCodexIdentifier(String codexIdentifier) { | |
493 this.codexIdentifier = codexIdentifier; | |
494 } | |
495 public String getPlaceName() { | |
496 return placeName; | |
497 } | |
498 public void setPlaceName(String placeName) { | |
499 this.placeName = placeName; | |
500 } | |
501 | |
104 | 502 /** |
503 * @return the placeType | |
504 */ | |
505 public String getPlaceType() { | |
506 return placeType; | |
507 } | |
508 | |
509 /** | |
510 * @param placeType the placeType to set | |
511 */ | |
512 public void setPlaceType(String placeType) { | |
513 this.placeType = placeType; | |
514 } | |
515 | |
516 public String getCollectionName() { | |
1 | 517 return collectionName; |
518 } | |
519 | |
520 public void setCollectionName(String collectionName) { | |
521 this.collectionName = collectionName; | |
522 } | |
523 | |
524 public String getAliasAlias() { | |
525 return aliasAlias; | |
526 } | |
527 | |
528 public void setAliasAlias(String aliasAlias) { | |
529 this.aliasAlias = aliasAlias; | |
530 } | |
531 | |
532 public String getRepositoryName() { | |
533 return repositoryName; | |
534 } | |
535 | |
536 public void setRepositoryName(String repositoryName) { | |
537 this.repositoryName = repositoryName; | |
538 } | |
539 | |
540 public String getSubjectType() { | |
541 return subjectType; | |
542 } | |
543 | |
544 public void setSubjectType(String subjectType) { | |
545 this.subjectType = subjectType; | |
546 } | |
547 | |
548 public List<SelectItem> getSuggestedSubjectTypes() { | |
549 return suggestedSubjectTypes; | |
550 } | |
551 | |
552 public void setSuggestedSubjectTypes(List<SelectItem> suggestedTypes) { | |
553 this.suggestedSubjectTypes = suggestedTypes; | |
554 } | |
555 public List<Entity> getCurrentEntities() { | |
556 return currentEntities; | |
557 } | |
558 | |
559 public void setCurrentEntities(List<Entity> currentEntities) { | |
560 this.currentEntities = currentEntities; | |
561 } | |
562 | |
563 public String getWitnessFullTitle() { | |
564 return witnessFullTitle; | |
565 } | |
566 | |
567 public void setWitnessFullTitle(String witnessFullTitle) { | |
568 this.witnessFullTitle = witnessFullTitle; | |
569 } | |
570 | |
571 public String getWitnessFullTitleTranslit() { | |
572 return witnessFullTitleTranslit; | |
573 } | |
574 | |
575 public void setWitnessFullTitleTranslit(String witnessFullTitleTranslit) { | |
576 this.witnessFullTitleTranslit = witnessFullTitleTranslit; | |
577 } | |
578 | |
579 public String getWitnessAhlwardtNo() { | |
580 return witnessAhlwardtNo; | |
581 } | |
582 | |
583 public void setWitnessAhlwardtNo(String witnessAhlwardtNo) { | |
584 this.witnessAhlwardtNo = witnessAhlwardtNo; | |
585 } | |
586 | |
81
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
587 /** |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
588 * @return the referenceBibIdNo |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
589 */ |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
590 public String getReferenceBibIdNo() { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
591 return referenceBibIdNo; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
592 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
593 |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
594 /** |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
595 * @param referenceBibIdNo the referenceBibIdNo to set |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
596 */ |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
597 public void setReferenceBibIdNo(String referenceBibIdNo) { |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
598 this.referenceBibIdNo = referenceBibIdNo; |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
599 } |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
600 |
0d5d36c83e77
added search for bibliography id attribute for REFERENCEs.
casties
parents:
78
diff
changeset
|
601 public String getOcTerm() { |
1 | 602 return ocTerm; |
603 } | |
604 | |
605 public void setOcTerm(String ocTerm) { | |
606 this.ocTerm = ocTerm; | |
607 } | |
608 | |
609 public String getCurrentTab() { | |
610 return currentTab; | |
611 } | |
612 | |
613 public void setCurrentTab(String currentTab) { | |
614 this.currentTab = currentTab; | |
615 } | |
616 | |
617 | |
618 } |