001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumsSynopticBean.java $
003: * $Id: MessageForumsSynopticBean.java $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.tool.messageforums.ui;
021:
022: import java.io.IOException;
023:
024: import java.util.ArrayList;
025: import java.util.Collection;
026: import java.util.Collections;
027: import java.util.Comparator;
028: import java.util.Date;
029: import java.util.Iterator;
030: import java.util.List;
031: import java.util.Map;
032: import java.util.Vector;
033:
034: import javax.faces.event.ActionEvent;
035: import javax.faces.application.FacesMessage;
036: import javax.faces.context.ExternalContext;
037: import javax.faces.context.FacesContext;
038: import javax.faces.model.SelectItem;
039:
040: import org.apache.commons.logging.Log;
041: import org.apache.commons.logging.LogFactory;
042: import org.sakaiproject.api.app.messageforums.Area;
043: import org.sakaiproject.api.app.messageforums.AreaManager;
044: import org.sakaiproject.api.app.messageforums.DiscussionForum;
045: import org.sakaiproject.api.app.messageforums.DiscussionTopic;
046: import org.sakaiproject.api.app.messageforums.MembershipManager;
047: import org.sakaiproject.api.app.messageforums.Message;
048: import org.sakaiproject.api.app.messageforums.MessageForumsMessageManager;
049: import org.sakaiproject.api.app.messageforums.MessageForumsTypeManager;
050: import org.sakaiproject.api.app.messageforums.PrivateForum;
051: import org.sakaiproject.api.app.messageforums.PrivateMessage;
052: import org.sakaiproject.api.app.messageforums.Topic;
053: import org.sakaiproject.api.app.messageforums.UnreadStatus;
054: import org.sakaiproject.api.app.messageforums.ui.DiscussionForumManager;
055: import org.sakaiproject.api.app.messageforums.ui.PrivateMessageManager;
056: import org.sakaiproject.api.app.messageforums.ui.UIPermissionsManager;
057: import org.sakaiproject.authz.cover.AuthzGroupService;
058: import org.sakaiproject.component.app.messageforums.MembershipItem;
059: import org.sakaiproject.component.app.messageforums.dao.hibernate.PrivateTopicImpl;
060: import org.sakaiproject.component.cover.ServerConfigurationService;
061: import org.sakaiproject.entity.api.ResourceProperties;
062: import org.sakaiproject.entity.api.ResourcePropertiesEdit;
063: import org.sakaiproject.exception.IdUnusedException;
064: import org.sakaiproject.tool.cover.SessionManager;
065: import org.sakaiproject.site.api.Site;
066: import org.sakaiproject.site.api.SitePage;
067: import org.sakaiproject.site.api.ToolConfiguration;
068: import org.sakaiproject.site.cover.SiteService;
069: import org.sakaiproject.tool.cover.ToolManager;
070: import org.sakaiproject.tool.messageforums.ui.MessageForumSynopticBean.DecoratedCompiledMessageStats;
071: import org.sakaiproject.user.api.Preferences;
072: import org.sakaiproject.user.api.PreferencesEdit;
073: import org.sakaiproject.user.api.PreferencesService;
074: import org.sakaiproject.util.ResourceLoader;
075:
076: public class MessageForumStatisticsBean {
077:
078: /**
079: * Used to store Statistic information on message forum per
080: * per user
081: */
082:
083: public class DecoratedCompiledMessageStatistics {
084: private String siteName;
085: private String siteId;
086: private String siteUser;
087: private String siteUserId;
088: private int authoredForumsAmt;
089: private int readForumsAmt;
090: private int unreadForumsAmt;
091: private Double percentReadForumsAmt;
092:
093: public String getSiteName() {
094: return this .siteName;
095: }
096:
097: public void setSiteName(String newValue) {
098: this .siteName = newValue;
099: }
100:
101: public String getSiteId() {
102: return this .siteId;
103: }
104:
105: public void setSiteId(String newValue) {
106: this .siteId = newValue;
107: }
108:
109: public String getSiteUser() {
110: return this .siteUser;
111: }
112:
113: public void setSiteUser(String newValue) {
114: this .siteUser = newValue;
115: }
116:
117: public String getSiteUserId() {
118: return this .siteUserId;
119: }
120:
121: public void setSiteUserId(String newValue) {
122: this .siteUserId = newValue;
123: }
124:
125: public int getAuthoredForumsAmt() {
126: return this .authoredForumsAmt;
127: }
128:
129: public void setAuthoredForumsAmt(int newValue) {
130: this .authoredForumsAmt = newValue;
131: }
132:
133: public int getReadForumsAmt() {
134: return this .readForumsAmt;
135: }
136:
137: public void setReadForumsAmt(int newValue) {
138: this .readForumsAmt = newValue;
139: }
140:
141: public int getUnreadForumsAmt() {
142: return this .unreadForumsAmt;
143: }
144:
145: public void setUnreadForumsAmt(int newValue) {
146: this .unreadForumsAmt = newValue;
147: }
148:
149: public Double getPercentReadForumsAmt() {
150: return this .percentReadForumsAmt;
151: }
152:
153: public void setPercentReadFOrumsAmt(Double newValue) {
154: this .percentReadForumsAmt = newValue;
155: }
156: }
157:
158: /* === End DecoratedCompiledMessageStatistics === */
159:
160: public class DecoratedCompiledUserStatistics {
161: private String siteName;
162: private String siteId;
163: private String siteUser;
164: private String siteUserId;
165: private String forumTitle;
166: private Date forumDate;
167: private String forumSubject;
168:
169: public String getSiteName() {
170: return this .siteName;
171: }
172:
173: public void setSiteName(String newValue) {
174: this .siteName = newValue;
175: }
176:
177: public String getSiteId() {
178: return this .siteId;
179: }
180:
181: public void setSiteId(String newValue) {
182: this .siteId = newValue;
183: }
184:
185: public String getSiteUser() {
186: return this .siteUser;
187: }
188:
189: public void setSiteUser(String newValue) {
190: this .siteUser = newValue;
191: }
192:
193: public String getSiteUserId() {
194: return this .siteUserId;
195: }
196:
197: public void setSiteUserId(String newValue) {
198: this .siteUserId = newValue;
199: }
200:
201: public String getForumTitle() {
202: return this .forumTitle;
203: }
204:
205: public void setForumTitle(String newValue) {
206: this .forumTitle = newValue;
207: }
208:
209: public Date getForumDate() {
210: return forumDate;
211: }
212:
213: public void setForumDate(Date newValue) {
214: this .forumDate = newValue;
215: }
216:
217: public String getForumSubject() {
218: return forumSubject;
219: }
220:
221: public void setForumSubject(String newValue) {
222: this .forumSubject = newValue;
223: }
224: }
225:
226: /* === End DecoratedCompiledUserStatistics == */
227:
228: /** Decorated Bean to store stats for user **/
229: public DecoratedCompiledMessageStatistics userInfo = null;
230: public DecoratedCompiledUserStatistics userAuthoredInfo = null;
231:
232: private Map courseMemberMap;
233: protected boolean ascending = true;
234: protected String sortBy = NAME_SORT;
235:
236: private static final String LIST_PAGE = "dfStatisticsList";
237: private static final String NAME_SORT = "sort_by_name";
238: private static final String AUTHORED_SORT = "sort_by_num_authored";
239: private static final String READ_SORT = "sort_by_num_read";
240: private static final String UNREAD_SORT = "sort_by_num_unread";
241: private static final String PERCENT_READ_SORT = "sort_by_percent_read";
242: private static final String SITE_USER_ID = "siteUserId";
243: private static final String SITE_USER = "siteUser";
244:
245: private static final String FORUM_STATISTICS = "dfStatisticsList";
246: private static final String FORUM_STATISTICS_USER = "dfStatisticsUser";
247:
248: public String selectedSiteUserId = null;
249: public String selectedSiteUser = null;
250:
251: //Comparatibles
252: public static Comparator NameComparatorAsc;
253: public static Comparator AuthoredComparatorAsc;
254: public static Comparator ReadComparatorAsc;
255: public static Comparator UnreadComparatorAsc;
256: public static Comparator PercentReadComparatorAsc;
257: public static Comparator NameComparatorDesc;
258: public static Comparator AuthoredComparatorDesc;
259: public static Comparator ReadComparatorDesc;
260: public static Comparator UnreadComparatorDesc;
261: public static Comparator PercentReadComparatorDesc;
262: public static Comparator DateComparaterDesc;
263:
264: public Map getCourseMemberMap() {
265: return this .courseMemberMap;
266: }
267:
268: public void setCourseMemberMap(Map newValue) {
269: this .courseMemberMap = newValue;
270: }
271:
272: /** to get accces to log file */
273: private static final Log LOG = LogFactory
274: .getLog(MessageForumSynopticBean.class);
275:
276: /** Needed if within a site so we only need stats for this site */
277: private MessageForumsMessageManager messageManager;
278:
279: /** Needed to get topics if tool within a site */
280: private DiscussionForumManager forumManager;
281:
282: private MembershipManager membershipManager;
283:
284: /** Needed to determine if user has read permission of topic */
285: private UIPermissionsManager uiPermissionsManager;
286:
287: public void setMessageManager(
288: MessageForumsMessageManager messageManager) {
289: this .messageManager = messageManager;
290: }
291:
292: public void setForumManager(DiscussionForumManager forumManager) {
293: this .forumManager = forumManager;
294: }
295:
296: public String getSelectedSiteUserId() {
297: return this .selectedSiteUserId;
298: }
299:
300: public String getSelectedSiteUser() {
301: return this .selectedSiteUser;
302: }
303:
304: public void setUiPermissionsManager(
305: UIPermissionsManager uiPermissionsManager) {
306: this .uiPermissionsManager = uiPermissionsManager;
307: }
308:
309: public void setMembershipManager(MembershipManager membershipManager) {
310: this .membershipManager = membershipManager;
311: }
312:
313: public DecoratedCompiledMessageStatistics getUserInfo() {
314: return userInfo;
315: }
316:
317: public void setUserInfo(DecoratedCompiledMessageStatistics userInfo) {
318: this .userInfo = userInfo;
319: }
320:
321: public List getAllUserStatistics() {
322: final List statistics = new ArrayList();
323:
324: courseMemberMap = membershipManager.getAllCourseMembers(true,
325: false, false);
326: List members = membershipManager
327: .convertMemberMapToList(courseMemberMap);
328:
329: for (Iterator i = members.iterator(); i.hasNext();) {
330: MembershipItem item = (MembershipItem) i.next();
331:
332: userInfo = new DecoratedCompiledMessageStatistics();
333:
334: String name = item.getName();
335: if (null != item.getUser()) {
336: String userId = item.getUser().getId();
337: userInfo.setSiteUser(name);
338: userInfo.setSiteUserId(userId);
339:
340: //Number of authored, read, unread, and percent forum messages is a little harder
341: // need to loop through all topics and add them up
342: final List topicsList = forumManager
343: .getDiscussionForums();
344: int authoredForum = 0, readForum = 0, unreadForum = 0, totalForum = 0;
345:
346: final Iterator forumIter = topicsList.iterator();
347:
348: while (forumIter.hasNext()) {
349: final DiscussionForum df = (DiscussionForum) forumIter
350: .next();
351:
352: final List topics = df.getTopics();
353: final Iterator topicIter = topics.iterator();
354:
355: while (topicIter.hasNext()) {
356: final Topic topic = (Topic) topicIter.next();
357:
358: if (uiPermissionsManager.isRead(
359: (DiscussionTopic) topic, df)) {
360: totalForum += messageManager
361: .findMessageCountByTopicId(topic
362: .getId());
363: authoredForum += messageManager
364: .findAuhtoredMessageCountByTopicIdByUserId(
365: topic.getId(), userId);
366: unreadForum += messageManager
367: .findUnreadMessageCountByTopicIdByUserId(
368: topic.getId(), userId);
369: readForum += messageManager
370: .findReadMessageCountByTopicIdByUserId(
371: topic.getId(), userId);
372: }
373: }
374: }
375: Double percentRead = 0.0;
376: //check to see if there are more than 0 messages in this forum
377: if (totalForum > 0) {
378: percentRead = (new Double(readForum) / new Double(
379: totalForum));
380: }
381: userInfo.setAuthoredForumsAmt(authoredForum);
382: userInfo.setReadForumsAmt(readForum);
383: userInfo.setUnreadForumsAmt(unreadForum);
384: userInfo.setPercentReadFOrumsAmt(percentRead);
385:
386: statistics.add(userInfo);
387: }
388: }
389: sortStatistics(statistics);
390: return statistics;
391: }
392:
393: public List getUserAuthoredStatistics() {
394: final List statistics = new ArrayList();
395:
396: //get all of the forum topics user has authored
397: final List topicsList = forumManager.getDiscussionForums();
398:
399: final Iterator forumIter = topicsList.iterator();
400:
401: while (forumIter.hasNext()) {
402: final DiscussionForum df = (DiscussionForum) forumIter
403: .next();
404:
405: final List topics = df.getTopics();
406: final Iterator topicIter = topics.iterator();
407:
408: while (topicIter.hasNext()) {
409: final Topic topic = (Topic) topicIter.next();
410:
411: if (uiPermissionsManager.isRead(
412: (DiscussionTopic) topic, df)) {
413: List messageList = messageManager
414: .findMessagesByTopicId(topic.getId());
415: final Iterator messageIter = messageList.iterator();
416: while (messageIter.hasNext()) {
417: final Message mes = (Message) messageIter
418: .next();
419:
420: if (mes.getCreatedBy().equals(
421: selectedSiteUserId)) {
422: userAuthoredInfo = new DecoratedCompiledUserStatistics();
423: userAuthoredInfo
424: .setSiteUserId(selectedSiteUserId);
425: userAuthoredInfo.setForumTitle(topic
426: .getTitle());
427: userAuthoredInfo.setForumDate(mes
428: .getCreated());
429: userAuthoredInfo.setForumSubject(mes
430: .getTitle());
431: statistics.add(userAuthoredInfo);
432: }
433: }
434: }
435: }
436: }
437: Collections.sort(statistics, DateComparaterDesc);
438: return statistics;
439: }
440:
441: public List getUserReadStatistics() {
442: final List statistics = new ArrayList();
443:
444: //get all of the forum topics user has authored
445: final List topicsList = forumManager.getDiscussionForums();
446:
447: final Iterator forumIter = topicsList.iterator();
448:
449: while (forumIter.hasNext()) {
450: final DiscussionForum df = (DiscussionForum) forumIter
451: .next();
452:
453: final List topics = df.getTopics();
454: final Iterator topicIter = topics.iterator();
455:
456: while (topicIter.hasNext()) {
457: final Topic topic = (Topic) topicIter.next();
458:
459: if (uiPermissionsManager.isRead(
460: (DiscussionTopic) topic, df)) {
461: List messageList = messageManager
462: .findMessagesByTopicId(topic.getId());
463: final Iterator messageIter = messageList.iterator();
464: while (messageIter.hasNext()) {
465: final Message mes = (Message) messageIter
466: .next();
467: UnreadStatus status = messageManager
468: .findUnreadStatusByUserId(
469: topic.getId(), mes.getId(),
470: selectedSiteUserId);
471:
472: if (status != null) {
473: userAuthoredInfo = new DecoratedCompiledUserStatistics();
474: userAuthoredInfo
475: .setSiteUserId(selectedSiteUserId);
476: userAuthoredInfo.setForumTitle(topic
477: .getTitle());
478: userAuthoredInfo.setForumDate(mes
479: .getCreated());
480: userAuthoredInfo.setForumSubject(mes
481: .getTitle());
482: statistics.add(userAuthoredInfo);
483: }
484: }
485: }
486: }
487: }
488: Collections.sort(statistics, DateComparaterDesc);
489: return statistics;
490: }
491:
492: /**
493: * Sorting Utils
494: */
495:
496: private List sortStatistics(List statistics) {
497: Comparator comparator = determineComparator();
498: Collections.sort(statistics, comparator);
499: return statistics;
500: }
501:
502: public void toggleSort(String sortByType) {
503: if (sortBy.equals(sortByType)) {
504: if (ascending) {
505: ascending = false;
506: } else {
507: ascending = true;
508: }
509: } else {
510: sortBy = sortByType;
511: ascending = true;
512: }
513: }
514:
515: public String toggleNameSort() {
516: toggleSort(NAME_SORT);
517: return LIST_PAGE;
518: }
519:
520: public String toggleAuthoredSort() {
521: toggleSort(AUTHORED_SORT);
522: return LIST_PAGE;
523: }
524:
525: public String toggleReadSort() {
526: toggleSort(READ_SORT);
527: return LIST_PAGE;
528: }
529:
530: public String toggleUnreadSort() {
531: toggleSort(UNREAD_SORT);
532: return LIST_PAGE;
533: }
534:
535: public String togglePercentReadSort() {
536: toggleSort(PERCENT_READ_SORT);
537: return LIST_PAGE;
538: }
539:
540: public boolean isNameSort() {
541: if (sortBy.equals(NAME_SORT))
542: return true;
543: return false;
544: }
545:
546: public boolean isAuthoredSort() {
547: if (sortBy.equals(AUTHORED_SORT))
548: return true;
549: return false;
550: }
551:
552: public boolean isReadSort() {
553: if (sortBy.equals(READ_SORT))
554: return true;
555: return false;
556: }
557:
558: public boolean isUnreadSort() {
559: if (sortBy.equals(UNREAD_SORT))
560: return true;
561: return false;
562: }
563:
564: public boolean isPercentReadSort() {
565: if (sortBy.equals(PERCENT_READ_SORT))
566: return true;
567: return false;
568: }
569:
570: public boolean isAscending() {
571: return ascending;
572: }
573:
574: private Comparator determineComparator() {
575: if (ascending) {
576: if (sortBy.equals(NAME_SORT)) {
577: return NameComparatorAsc;
578: } else if (sortBy.equals(AUTHORED_SORT)) {
579: return AuthoredComparatorAsc;
580: } else if (sortBy.equals(READ_SORT)) {
581: return ReadComparatorAsc;
582: } else if (sortBy.equals(UNREAD_SORT)) {
583: return UnreadComparatorAsc;
584: } else if (sortBy.equals(PERCENT_READ_SORT)) {
585: return PercentReadComparatorAsc;
586: }
587: } else {
588: if (sortBy.equals(NAME_SORT)) {
589: return NameComparatorDesc;
590: } else if (sortBy.equals(AUTHORED_SORT)) {
591: return AuthoredComparatorDesc;
592: } else if (sortBy.equals(READ_SORT)) {
593: return ReadComparatorDesc;
594: } else if (sortBy.equals(UNREAD_SORT)) {
595: return UnreadComparatorDesc;
596: } else if (sortBy.equals(PERCENT_READ_SORT)) {
597: return PercentReadComparatorDesc;
598: }
599: }
600: //default return NameComparatorAsc
601: return NameComparatorAsc;
602: }
603:
604: static {
605: /**
606: * Comparators for DecoratedCompileMessageStatistics
607: */
608: NameComparatorAsc = new Comparator() {
609: public int compare(Object item, Object anotherItem) {
610: String name1 = ((DecoratedCompiledMessageStatistics) item)
611: .getSiteUser().toUpperCase();
612: String name2 = ((DecoratedCompiledMessageStatistics) anotherItem)
613: .getSiteUser().toUpperCase();
614: return name1.compareTo(name2);
615: }
616: };
617:
618: AuthoredComparatorAsc = new Comparator() {
619: public int compare(Object item, Object anotherItem) {
620: int authored1 = ((DecoratedCompiledMessageStatistics) item)
621: .getAuthoredForumsAmt();
622: int authored2 = ((DecoratedCompiledMessageStatistics) anotherItem)
623: .getAuthoredForumsAmt();
624: return authored1 - authored2;
625: }
626: };
627:
628: ReadComparatorAsc = new Comparator() {
629: public int compare(Object item, Object anotherItem) {
630: int read1 = ((DecoratedCompiledMessageStatistics) item)
631: .getReadForumsAmt();
632: int read2 = ((DecoratedCompiledMessageStatistics) anotherItem)
633: .getReadForumsAmt();
634: return read1 - read2;
635: }
636: };
637:
638: UnreadComparatorAsc = new Comparator() {
639: public int compare(Object item, Object anotherItem) {
640: int unread1 = ((DecoratedCompiledMessageStatistics) item)
641: .getUnreadForumsAmt();
642: int unread2 = ((DecoratedCompiledMessageStatistics) anotherItem)
643: .getUnreadForumsAmt();
644: return unread1 - unread2;
645: }
646: };
647:
648: PercentReadComparatorAsc = new Comparator() {
649: public int compare(Object item, Object anotherItem) {
650: double percentRead1 = ((DecoratedCompiledMessageStatistics) item)
651: .getPercentReadForumsAmt();
652: double percentRead2 = ((DecoratedCompiledMessageStatistics) anotherItem)
653: .getPercentReadForumsAmt();
654: if (percentRead1 == percentRead2) {
655: return 0;
656: } else if (percentRead1 < percentRead2) {
657: return -1;
658: } else {
659: return 1;
660: }
661: }
662: };
663: NameComparatorDesc = new Comparator() {
664: public int compare(Object item, Object anotherItem) {
665: String name1 = ((DecoratedCompiledMessageStatistics) item)
666: .getSiteUser().toUpperCase();
667: String name2 = ((DecoratedCompiledMessageStatistics) anotherItem)
668: .getSiteUser().toUpperCase();
669: return name2.compareTo(name1);
670: }
671: };
672:
673: AuthoredComparatorDesc = new Comparator() {
674: public int compare(Object item, Object anotherItem) {
675: int authored1 = ((DecoratedCompiledMessageStatistics) item)
676: .getAuthoredForumsAmt();
677: int authored2 = ((DecoratedCompiledMessageStatistics) anotherItem)
678: .getAuthoredForumsAmt();
679: return authored2 - authored1;
680: }
681: };
682:
683: ReadComparatorDesc = new Comparator() {
684: public int compare(Object item, Object anotherItem) {
685: int read1 = ((DecoratedCompiledMessageStatistics) item)
686: .getReadForumsAmt();
687: int read2 = ((DecoratedCompiledMessageStatistics) anotherItem)
688: .getReadForumsAmt();
689: return read2 - read1;
690: }
691: };
692:
693: UnreadComparatorDesc = new Comparator() {
694: public int compare(Object item, Object anotherItem) {
695: int unread1 = ((DecoratedCompiledMessageStatistics) item)
696: .getUnreadForumsAmt();
697: int unread2 = ((DecoratedCompiledMessageStatistics) anotherItem)
698: .getUnreadForumsAmt();
699: return unread2 - unread1;
700: }
701: };
702:
703: PercentReadComparatorDesc = new Comparator() {
704: public int compare(Object item, Object anotherItem) {
705: double percentRead1 = ((DecoratedCompiledMessageStatistics) item)
706: .getPercentReadForumsAmt();
707: double percentRead2 = ((DecoratedCompiledMessageStatistics) anotherItem)
708: .getPercentReadForumsAmt();
709: if (percentRead1 == percentRead2) {
710: return 0;
711: } else if (percentRead1 < percentRead2) {
712: return 1;
713: } else {
714: return -1;
715: }
716: }
717: };
718:
719: /**
720: * Comparator for DecoratedCompiledUserStatistics
721: */
722:
723: DateComparaterDesc = new Comparator() {
724: public int compare(Object item, Object anotherItem) {
725: Date date1 = ((DecoratedCompiledUserStatistics) item)
726: .getForumDate();
727: Date date2 = ((DecoratedCompiledUserStatistics) anotherItem)
728: .getForumDate();
729: return date2.compareTo(date1);
730: }
731: };
732: }
733:
734: /**
735: * Actions
736: */
737:
738: /**
739: * @return
740: */
741: public String processActionStatisticsUser() {
742: LOG.debug("processActionStatisticsUser");
743: selectedSiteUserId = getExternalParameterByKey(SITE_USER_ID);
744: selectedSiteUser = getExternalParameterByKey(SITE_USER);
745: return FORUM_STATISTICS_USER;
746: }
747:
748: // **************************************** helper methods**********************************
749:
750: private String getExternalParameterByKey(String parameterId) {
751: ExternalContext context = FacesContext.getCurrentInstance()
752: .getExternalContext();
753: Map paramMap = context.getRequestParameterMap();
754:
755: return (String) paramMap.get(parameterId);
756: }
757: }
|