Mercurial > hg > ismi-richfaces
annotate src/main/java/de/mpiwg/itgroup/ismi/entry/beans/ApplicationBean.java @ 216:93d33f138c9e default tip
update medeniyet image server URL.
author | casties |
---|---|
date | Wed, 26 Jan 2022 16:39:32 +0100 |
parents | 2522985f44af |
children |
rev | line source |
---|---|
1 | 1 package de.mpiwg.itgroup.ismi.entry.beans; |
2 | |
3 import java.io.Serializable; | |
157
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
4 import java.io.UnsupportedEncodingException; |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
5 import java.net.URLEncoder; |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
6 import java.nio.charset.StandardCharsets; |
1 | 7 import java.util.ArrayList; |
8 import java.util.Arrays; | |
9 import java.util.List; | |
10 | |
11 import javax.faces.context.FacesContext; | |
12 import javax.faces.model.SelectItem; | |
13 import javax.servlet.http.HttpServletRequest; | |
14 | |
157
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
15 import org.apache.commons.codec.binary.Base64; |
1 | 16 import org.apache.commons.lang.StringUtils; |
17 import org.apache.log4j.Logger; | |
18 import org.mpi.openmind.cache.WrapperService; | |
19 import org.mpi.openmind.configuration.ConfigurationService; | |
20 import org.mpi.openmind.repository.bo.Entity; | |
21 import org.mpi.openmind.repository.services.ServiceRegistry; | |
22 import org.mpi.openmind.search.SearchService; | |
23 import org.mpi.openmind.security.SecurityService; | |
24 | |
25 import de.mpiwg.itgroup.ismi.entry.dataBeans.SimpleSearchCache; | |
26 import de.mpiwg.itgroup.ismi.publicView.PublicCodexList; | |
27 | |
28 /** | |
29 * <p> | |
30 * Application scope data bean for your application. Create properties here to | |
31 * represent cached data that should be made available to all users and pages in | |
32 * the application. | |
33 * </p> | |
34 * | |
35 * <p> | |
36 * An instance of this class will be created for you automatically, the first | |
37 * time your application evaluates a value binding expression or method binding | |
38 * expression that references a managed bean using this class. | |
39 * </p> | |
40 * | |
41 * @version ApplicationBean1.java | |
42 * @version Created on 23.06.2009, 10:58:17 | |
43 * @author jurzua | |
44 */ | |
45 | |
46 public class ApplicationBean implements Serializable{ | |
47 | |
48 private static final long serialVersionUID = 804932192506497432L; | |
49 | |
50 private static Logger logger = Logger.getLogger(ApplicationBean.class); | |
51 | |
52 public static String urlISMIExportServiceAuthors = | |
56
ce1cd2450848
change title list export service url. remove biographies menu.
casties
parents:
14
diff
changeset
|
53 "https://ismi-dev.mpiwg-berlin.mpg.de/zope-ismi/database/export/authorsTitlesWitness"; |
1 | 54 |
55 public static String urlISMIExportServiceTitles = | |
56
ce1cd2450848
change title list export service url. remove biographies menu.
casties
parents:
14
diff
changeset
|
56 "https://ismi-dev.mpiwg-berlin.mpg.de/zope-ismi/database/export/titlesWitnesses"; |
1 | 57 |
58 private BiographyBean biographyBean; | |
59 | |
60 private PublicCodexList publicCodexList; | |
61 | |
62 public static String generateExportURL(String urlRoot, List<Long> list, String mode){ | |
63 StringBuilder sb = new StringBuilder(urlRoot); | |
64 | |
65 sb.append("?ids=" + generateIdList(list)); | |
66 | |
67 if(StringUtils.isNotEmpty(mode)){ | |
68 sb.append("&mode=" + mode); | |
69 } | |
70 | |
71 return sb.toString(); | |
72 } | |
73 | |
74 public static String generateIdList(List<Long> list){ | |
75 StringBuilder sb = new StringBuilder(); | |
76 | |
77 int count = 0; | |
78 for(Long id : list){ | |
79 | |
80 if(count>0){ | |
81 sb.append("%7C"); | |
82 } | |
83 sb.append(id); | |
84 count++; | |
85 } | |
86 return sb.toString(); | |
87 } | |
88 | |
89 public static String generateExportURL(String urlRoot, String idList, String mode){ | |
90 StringBuilder sb = new StringBuilder(urlRoot); | |
91 | |
92 sb.append("?ids=" + idList); | |
93 if(StringUtils.isNotEmpty(mode)){ | |
94 sb.append("&mode=" + mode); | |
95 } | |
96 | |
97 return sb.toString(); | |
98 } | |
99 | |
100 | |
101 public static String generateExportURL(String urlRoot, Long id, String mode){ | |
102 StringBuilder sb = new StringBuilder(urlRoot); | |
103 | |
104 sb.append("?ids=" + id); | |
105 if(StringUtils.isNotEmpty(mode)){ | |
106 sb.append("&mode=" + mode); | |
107 } | |
108 | |
109 return sb.toString(); | |
110 } | |
111 | |
157
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
112 /** |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
113 * Returns a URL to the configured QueryBrowser webapp with the query set to the given id. |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
114 * |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
115 * @param id |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
116 * @return |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
117 */ |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
118 public String generateQueryBrowserUrlForId(Long id) { |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
119 String baseUrl = this.getConfService().getQueryBrowserUrl(); |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
120 // generate id_is query for id |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
121 String query = String.format("[[\"id_is\",{\"value\":%d}]]", id); |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
122 try { |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
123 // encode URL and base64 |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
124 String encquery = URLEncoder.encode(query, StandardCharsets.UTF_8.toString()); |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
125 String b64query = Base64.encodeBase64String(encquery.getBytes()); |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
126 String url = baseUrl + "#" + b64query; |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
127 return url; |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
128 } catch (UnsupportedEncodingException e) { |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
129 // this shouldn't happen |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
130 logger.error(e); |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
131 } |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
132 return null; |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
133 } |
2522985f44af
add "query builder" button to entityDetails form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
145
diff
changeset
|
134 |
1 | 135 public static String CURRENT_WITNESS = "CurrentWitness"; |
136 public static String CURRENT_CODEX = "CurrentCodex"; | |
137 public static String CURRENT_TEXT = "CurrentText"; | |
138 public static String CURRENT_PERSON = "CurrentPerson"; | |
139 public static String CURRENT_ALIAS = "CurrentAlias"; | |
140 public static String CURRENT_COLLECTION = "CurrentCollection"; | |
141 public static String CURRENT_REPOSITORY = "CurrentRepository"; | |
142 public static String CURRENT_CITY = "CurrentCity"; | |
143 public static String CURRENT_SUBJECT = "CurrentSubject"; | |
144 public static String CURRENT_ROLE = "CurrentRole"; | |
145 public static String CURRENT_DIGI = "CurrentDigi"; | |
146 | |
147 private transient SimpleSearchCache simpleSearchCache; | |
148 ServiceRegistry serviceRegistry = null; | |
149 | |
150 | |
151 private List<SelectItem> roleList = new ArrayList<SelectItem>(); | |
152 private List<Entity> entityRoleList = new ArrayList<Entity>(); | |
153 private boolean roleListDirty = true; | |
154 | |
155 private static List<SelectItem> yes_no = new ArrayList<SelectItem>(); | |
156 private static List<SelectItem> roles = new ArrayList<SelectItem>(); | |
157 | |
158 private static List<SelectItem> suggestedStatus = new ArrayList<SelectItem>(); | |
159 private static List<SelectItem> suggestedBindings = new ArrayList<SelectItem>(); | |
160 private static List<SelectItem> writingSurfaces = new ArrayList<SelectItem>(); | |
161 private static List<SelectItem> pageLayout = new ArrayList<SelectItem>(); | |
162 private static List<SelectItem> scripts = new ArrayList<SelectItem>(); | |
163 private static List<SelectItem> sourcesOfInformation = new ArrayList<SelectItem>(); | |
164 private static List<SelectItem> suggestedLanguages = new ArrayList<SelectItem>(); | |
165 private static List<SelectItem> suggestedBoolean = new ArrayList<SelectItem>(); | |
166 | |
167 | |
168 public static String STATUS_NEED_VERIFICATION = "needs verification"; | |
169 public static String STATUS_VERIFIED_BY_CATALOGUE = "verified by catalogue"; | |
170 public static String STATUS_VERIFIED_BY_WITNESS = "verified by witness"; | |
171 public static String STATUS_NOT_CHECKED = "not checked"; | |
172 | |
173 public static String FORMATED_DATE = "formatted date"; | |
174 public static String PLAIN_DATE = "plain date"; | |
175 private static List<SelectItem> dateTypes = new ArrayList<SelectItem>(); | |
176 | |
177 private List<SelectItem> suggestedSubjects = null; | |
178 | |
179 public void resetSuggestedSubjects(){ | |
180 this.suggestedSubjects = new ArrayList<SelectItem>(); | |
181 this.suggestedSubjects.add(new SelectItem(null, "-- choose --")); | |
182 | |
183 List<Entity> cats = getWrapper().getEntitiesByAtt("SUBJECT", "type", "main_subject", -1, false); | |
184 | |
185 for(Entity cat : cats){ | |
186 SelectItem item = new SelectItem(cat.getId(), cat.getOwnValue()); | |
187 | |
188 item.setStyle("font-weight: bold; padding-left: 0px; font-size: 14;"); | |
189 this.suggestedSubjects.add(item); | |
190 List<Entity> subCats = getWrapper().getSourcesForTargetRelation(cat, "is_part_of", "SUBJECT", -1); | |
191 for(Entity subCat : subCats){ | |
192 | |
193 item = new SelectItem(subCat.getId(), subCat.getOwnValue()); | |
194 item.setStyle("padding-left: 10px; font-size: 12;"); | |
195 this.suggestedSubjects.add(item); | |
196 | |
197 List<Entity> subsubCats = getWrapper().getSourcesForTargetRelation(subCat, "is_part_of", "SUBJECT", -1); | |
198 for(Entity subsubCat : subsubCats){ | |
199 if(subsubCat != null){ | |
200 item = new SelectItem(subsubCat.getId(), subsubCat.getOwnValue()); | |
201 | |
202 this.suggestedSubjects.add(item); | |
203 | |
204 }else{ | |
119 | 205 logger.debug("error in resetSuggestedSubjects: main="+cat+" sub="+subCat); |
206 //System.out.println("####################ERROR####################"); | |
207 //System.out.println("resetSuggestedSubjects"); | |
208 //System.out.println(" main: " + cat); | |
209 //System.out.println(" sub: " + subCat); | |
1 | 210 } |
211 } | |
212 } | |
213 } | |
214 } | |
215 | |
216 public List<SelectItem> getSuggestedSubjects() { | |
217 if(suggestedSubjects == null){ | |
218 this.resetSuggestedSubjects(); | |
219 } | |
220 return suggestedSubjects; | |
221 } | |
222 | |
223 public void setSuggestedSubjects(List<SelectItem> suggestedSubjects) { | |
224 this.suggestedSubjects = suggestedSubjects; | |
225 } | |
226 | |
227 static{ | |
228 | |
229 dateTypes.add(new SelectItem(FORMATED_DATE)); | |
230 dateTypes.add(new SelectItem(PLAIN_DATE)); | |
231 | |
232 String[] status = new String[]{"needs verification", "verified by catalogue", "verified by witness"}; | |
233 Arrays.sort(status); | |
234 | |
235 suggestedStatus.add(new SelectItem("", STATUS_NOT_CHECKED)); | |
236 for(int i=0; i< status.length; i++){ | |
237 suggestedStatus.add(new SelectItem(status[i])); | |
238 } | |
239 | |
240 String[] binding = new String[]{"cardboard", "leather with flap", "leather without flap"}; | |
241 Arrays.sort(binding); | |
242 | |
243 suggestedBindings.add(new SelectItem("", "-- choose --")); | |
244 for(int i=0; i< binding.length; i++){ | |
245 suggestedBindings.add(new SelectItem(binding[i])); | |
246 } | |
247 | |
248 | |
249 String[] langs = new String[] { "Arabic", "Persian-Farsi", | |
250 "Greek-classical", "Hebrew", "Latin", "Syriac", "Armenian", | |
251 "Castillian", "Catalan", "Chinese", "French", "German", | |
252 "Greek-Byzantine", "Hindi", "Italian", "Mongolian", | |
253 "Persian-Old", "Persian-Middle", "Russian", "Sanskrit", | |
254 "Turkish (Ottoman pre-1839)", "Turkish (Ottoman 1839-)", | |
255 "Turkish (pre-Ottoman)", "Turkish-Republican", "Urdu", "Uighur" }; | |
256 Arrays.sort(langs); | |
257 | |
258 suggestedLanguages.add(new SelectItem("", "-- choose --")); | |
259 for(int i = 0; i < langs.length; i++){ | |
260 suggestedLanguages.add(new SelectItem(langs[i])); | |
261 } | |
262 | |
263 yes_no.add(new SelectItem("", "-- choose --")); | |
264 yes_no.add(new SelectItem("yes")); | |
265 yes_no.add(new SelectItem("no")); | |
266 | |
267 suggestedBoolean.add(new SelectItem("", "-- choose --")); | |
268 suggestedBoolean.add(new SelectItem("true")); | |
269 suggestedBoolean.add(new SelectItem("false")); | |
270 | |
271 roles.add(new SelectItem("", "-- choose --")); | |
272 roles.add(new SelectItem("annotator")); | |
273 roles.add(new SelectItem("author")); | |
274 roles.add(new SelectItem("copyist")); | |
275 roles.add(new SelectItem("illuminator")); | |
276 roles.add(new SelectItem("illustrator")); | |
277 roles.add(new SelectItem("owner")); | |
278 roles.add(new SelectItem("patron")); | |
279 roles.add(new SelectItem("reader")); | |
280 roles.add(new SelectItem("student")); | |
281 roles.add(new SelectItem("teacher")); | |
282 roles.add(new SelectItem("translator")); | |
283 | |
284 writingSurfaces.add(new SelectItem("", "-- choose --")); | |
285 writingSurfaces.add(new SelectItem("HARD", "HARD")); | |
286 writingSurfaces.add(new SelectItem("marble", " marble")); | |
287 writingSurfaces.add(new SelectItem("metal instrument", " metal instrument")); | |
288 writingSurfaces.add(new SelectItem("stone", " stone")); | |
289 writingSurfaces.add(new SelectItem("SOFT", "SOFT")); | |
290 writingSurfaces.add(new SelectItem("paper", " paper")); | |
291 writingSurfaces.add(new SelectItem("papyrus", " papyrus")); | |
292 writingSurfaces.add(new SelectItem("parchment", " parchment")); | |
293 | |
294 pageLayout.add(new SelectItem("", "-- choose --")); | |
295 pageLayout.add(new SelectItem("Frame-ruled")); | |
296 pageLayout.add(new SelectItem("Paper")); | |
297 | |
298 scripts.add(new SelectItem("", "-- choose --")); | |
299 scripts.add(new SelectItem("Maghribi")); | |
300 scripts.add(new SelectItem("Naskh")); | |
301 scripts.add(new SelectItem("Nasta'liq")); | |
302 scripts.add(new SelectItem("Riqa'")); | |
303 scripts.add(new SelectItem("Ruq'ah")); | |
304 scripts.add(new SelectItem("Shikastah")); | |
305 scripts.add(new SelectItem("Sudani")); | |
306 scripts.add(new SelectItem("Ta'liq")); | |
307 scripts.add(new SelectItem("Tawqi'")); | |
308 scripts.add(new SelectItem("Other-see Notes")); | |
309 | |
310 | |
311 sourcesOfInformation.add(new SelectItem("", "-- choose --")); | |
312 sourcesOfInformation.add(new SelectItem("Actual Witness")); | |
313 sourcesOfInformation.add(new SelectItem("Microfilm")); | |
314 sourcesOfInformation.add(new SelectItem("Digital Form (DVD/CD)")); | |
315 sourcesOfInformation.add(new SelectItem("Catalogue (Give Full Citation In Notes)")); | |
316 } | |
317 | |
318 public SearchService getSS() { | |
319 return serviceRegistry.getSearchService(); | |
320 } | |
321 | |
322 public WrapperService getWrapper() { | |
323 return serviceRegistry.getWrapper(); | |
324 } | |
325 | |
326 public SecurityService getSecurityService() { | |
327 return serviceRegistry.getSecurityService(); | |
328 } | |
329 | |
330 public ConfigurationService getConfService(){ | |
331 return serviceRegistry.getConfigurationService(); | |
332 } | |
333 | |
334 /** | |
335 * <p> | |
336 * Construct a new application data bean instance. | |
337 * </p> | |
338 */ | |
339 public ApplicationBean() { | |
340 logger.info("Initialize ApplicationBean1"); | |
341 this.serviceRegistry = new ServiceRegistry(); | |
342 this.simpleSearchCache = new SimpleSearchCache(serviceRegistry); | |
343 } | |
344 | |
345 public List<SelectItem> getYes_no() { | |
346 return yes_no; | |
347 } | |
348 | |
349 public List<SelectItem> getRoles() { | |
350 return roles; | |
351 } | |
352 | |
353 public List<SelectItem> getWritingSurfaces(){ | |
354 return writingSurfaces; | |
355 } | |
356 | |
357 public List<SelectItem> getPageLayout(){ | |
358 return pageLayout; | |
359 } | |
360 | |
361 public List<SelectItem> getScripts(){ | |
362 return scripts; | |
363 } | |
364 | |
365 public List<SelectItem> getSuggestedStatus(){ | |
366 return suggestedStatus; | |
367 } | |
368 | |
369 public List<SelectItem> getSuggestedBindings(){ | |
370 return suggestedBindings; | |
371 } | |
372 | |
373 public List<SelectItem> getSourcesOfInformation(){ | |
374 return sourcesOfInformation; | |
375 } | |
376 | |
377 public List<SelectItem> getSuggestedLanguages(){ | |
378 return suggestedLanguages; | |
379 } | |
380 | |
381 public List<SelectItem> getSuggestedBoolean(){ | |
382 return suggestedBoolean; | |
383 } | |
384 | |
385 public List<SelectItem> getDateTypes(){ | |
386 return dateTypes; | |
387 } | |
388 | |
389 public SimpleSearchCache getSimpleSearchCache() { | |
390 return simpleSearchCache; | |
391 } | |
392 | |
393 public void setSimpleSearchCache(SimpleSearchCache simpleSearchCache) { | |
394 this.simpleSearchCache = simpleSearchCache; | |
395 } | |
396 | |
397 public void setRoleListAsDirty(){ | |
398 this.roleListDirty = true; | |
399 } | |
400 | |
401 public String getRoot(){ | |
402 return FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath(); | |
403 } | |
404 | |
405 public List<SelectItem> getRoleList(){ | |
406 if(roleListDirty){ | |
407 this.roleList = new ArrayList<SelectItem>(); | |
408 this.entityRoleList = getWrapper().getEntitiesByDef("ROLE"); | |
409 for(Entity e : this.entityRoleList){ | |
410 this.roleList.add(new SelectItem(e.getId(), e.getOwnValue())); | |
411 } | |
412 this.roleListDirty = false; | |
413 } | |
414 | |
415 return this.roleList; | |
416 } | |
417 | |
418 public String getEditImage(){ | |
419 return "/resources/images/system/edit_20.png"; | |
420 } | |
421 | |
422 public String getImgEdit16(){ | |
423 return "/resources/images/system/edit_16.png"; | |
424 } | |
425 | |
426 public String getImgEdit32(){ | |
427 return "/resources/images/system/edit_32.png"; | |
428 } | |
429 | |
430 public String getImgRemove16(){ | |
431 return "/resources/images/system/remove_16.png"; | |
432 } | |
433 | |
434 public String getImgRemove32(){ | |
435 return "/resources/images/system/remove_32.png"; | |
436 } | |
437 | |
438 public String getImgVersions16(){ | |
439 return "/resources/images/system/versions_16.png"; | |
440 } | |
441 | |
442 public String getImgVersions32(){ | |
443 return "/resources/images/system/versions_32.png"; | |
444 } | |
445 | |
446 public String getImgSave16(){ | |
447 return "/resources/images/system/save_16.png"; | |
448 } | |
449 | |
450 public String getImgSave32(){ | |
451 return "/resources/images/system/save_32.png"; | |
452 } | |
453 | |
454 public String getImgClean16(){ | |
455 return "/resources/images/system/clean_16.png"; | |
456 } | |
457 | |
458 public String getImgClean32(){ | |
459 return "/resources/images/system/clean_32.png"; | |
460 } | |
461 | |
462 public String getImgNew16(){ | |
463 return "/resources/images/system/new_16.png"; | |
464 } | |
465 | |
466 public String getImgNew32(){ | |
467 return "/resources/images/system/new_32.png"; | |
468 } | |
469 | |
470 public String getImgSeach16(){ | |
471 return "/resources/images/system/search_16.png"; | |
472 } | |
473 | |
474 public String getImgSearch32(){ | |
475 return "/resources/images/system/search_32.png"; | |
476 } | |
477 | |
478 public String getDisplayImage(){ | |
479 return "/resources/images/display_32.png"; | |
480 } | |
481 | |
482 public String getWorldImage(){ | |
483 return "/resources/images/icy_earth_32.png"; | |
484 } | |
485 | |
486 public String getBookImage(){ | |
487 return "/resources/images/book_32.png"; | |
488 } | |
489 | |
490 public String getSearchImage(){ | |
491 return "/resources/images/search_32.png"; | |
492 } | |
493 | |
494 public String getImgNetwork32(){ | |
495 return "/resources/images/network_32.png"; | |
496 } | |
497 | |
498 public String getImgPerson32(){ | |
499 return "/resources/images/person_32.png"; | |
500 } | |
501 | |
502 | |
503 public String getImgDown32(){ | |
504 return "/resources/images/down_32.png"; | |
505 } | |
506 | |
507 public String getImgUp32(){ | |
508 return "/resources/images/up_32.png"; | |
509 } | |
510 | |
511 ///**** | |
512 //private List<Entity> texts; | |
513 private List<SelectItem> textsSelectItems; | |
514 private boolean dirty = false; | |
515 | |
516 private void updateListAllTexts(){ | |
517 textsSelectItems = new ArrayList<SelectItem>(); | |
518 for (Entity text : getWrapper().getEntitiesByDef("TEXT")){ | |
519 textsSelectItems.add(new SelectItem(text.getId(), text.getOwnValue() + " [" +text.getId()+ "]")); | |
520 } | |
521 } | |
522 | |
523 public List<SelectItem> getAllTexts() { | |
524 if(this.dirty || textsSelectItems == null){ | |
525 this.updateListAllTexts(); | |
526 this.dirty = false; | |
527 } | |
528 return textsSelectItems; | |
529 } | |
530 | |
531 public void setAllTextsAsDirty(){ | |
532 this.dirty = true; | |
533 } | |
534 | |
535 public String getJSConfirmationSave(){ | |
536 return "if(!confirm('Do you really want to save the changes?')){ return false; };"; | |
537 } | |
538 | |
539 public String getJSConfirmationLogout(){ | |
540 return "if(!confirm('Do you really want to end your session?')){ return false; };"; | |
541 } | |
542 | |
543 public String getJSConfirmationDelete(){ | |
544 return "if(!confirm('Do you really want to delete this?')){ return false; };"; | |
545 } | |
546 | |
547 public String getJSConfirmationSaveAsNew(){ | |
548 return "if(!confirm('Do you really want to save the entity as new?')){ return false;};"; | |
549 } | |
550 | |
551 public String getJSConfirmationMerge(){ | |
552 return "if(!confirm('Do you really want to merge these entities?')){ return false;};"; | |
553 } | |
554 | |
555 public String getJSConfirmationCleanForm(){ | |
556 return "if(!confirm('Do you really want to clear the form?')){ return false;};"; | |
557 } | |
558 | |
559 public String getContextRoot(){ | |
560 | |
561 HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); | |
562 | |
563 | |
564 | |
565 String port = (StringUtils.equals(request.getLocalPort() + "", "80")) ? "" : (":" + request.getLocalPort()); | |
566 String path = request.getScheme() + "://" + request.getLocalName() + port + request.getContextPath(); | |
567 | |
568 return path; | |
569 } | |
570 | |
571 public BiographyBean getBiographyBean(){ | |
572 if(biographyBean == null) | |
573 this.biographyBean = new BiographyBean(); | |
574 return this.biographyBean; | |
575 } | |
576 | |
577 public PublicCodexList getPublicCodexList(){ | |
578 if(publicCodexList == null){ | |
579 publicCodexList = new PublicCodexList(); | |
580 } | |
581 return publicCodexList; | |
582 } | |
94
d2cee1040062
new servlet lifecycle listener to shut down Spring ApplicationBean.
casties
parents:
60
diff
changeset
|
583 |
d2cee1040062
new servlet lifecycle listener to shut down Spring ApplicationBean.
casties
parents:
60
diff
changeset
|
584 public ServiceRegistry getServiceRegistry() { |
d2cee1040062
new servlet lifecycle listener to shut down Spring ApplicationBean.
casties
parents:
60
diff
changeset
|
585 return this.serviceRegistry; |
d2cee1040062
new servlet lifecycle listener to shut down Spring ApplicationBean.
casties
parents:
60
diff
changeset
|
586 } |
1 | 587 } |