annotate src/main/java/de/mpiwg/itgroup/ismi/browse/AbstractEntityRepositoryBean.java @ 103:03dcbaf8b8cf

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