KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > modules > base > PubBaseAction


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.modules.base;
7
8 import java.text.ParseException JavaDoc;
9 import java.util.*;
10
11 import javax.servlet.http.HttpServletRequest JavaDoc;
12
13 import com.raptus.owxv3.*;
14 import com.raptus.owxv3.api.*;
15
16 /**
17  *
18  * <hr>
19  * <table width="100%" border="0">
20  * <tr>
21  * <td width="24%"><b>Filename</b></td><td width="76%">PubBaseAction.java</td>
22  * </tr>
23  * <tr>
24  * <td width="24%"><b>Author</b></td><td width="76%">Guy Z�rcher (gzuercher@raptus.com)</td>
25  * </tr>
26  * <tr>
27  * <td width="24%"><b>Date</b></td><td width="76%">20th of April 2001</td>
28  * </tr>
29  * </table>
30  * <hr>
31  * <table width="100%" border="0">
32  * <tr>
33  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
34  * </tr>
35  * </table>
36  * <hr>
37  */

38 //public class PubBaseAction extends VModuleAnonAction
39
public class PubBaseAction extends VModuleRoleAction
40 {
41     /**
42      *
43      */

44     public static final String JavaDoc SECTION_ELEMENT_PROPERTY_MAXROWS = "maxlistrows";
45
46     /**
47      *
48      */

49     protected String JavaDoc dispatchVModuleElement(HttpServletRequest JavaDoc request,
50                                             String JavaDoc element,
51                                             org.apache.struts.action.ActionForm form,
52                                             VModule vm,
53                                             Locale locale)
54     {
55         // 20020115/gz: BUGFIX: all "elements" are treated the same for the same action!
56
//if(element.compareToIgnoreCase(BaseConstants.ELEMENT_INDEX) == 0)
57
//{
58
CategoryFilter filter=null;
59             String JavaDoc catid = request.getParameter("selcatid");
60
61             if(catid!=null)
62             {
63                 filter = new CategoryFilter(catid);
64             }
65
66             String JavaDoc pageNoParam = request.getParameter("page");
67
68             //if( ( (((PagedListBean) form).isListLoaded(locale) == false) && pageNoParam != null) || (pageNoParam == null) )
69
//{
70
LoggingManager.log("Loading " + locale.toString() + " public news list from " +
71                                    "database for virtual module " + vm.getIdentification(), this);
72
73                 int maxRows = 0;
74                 try
75                 {
76                     //// HERE ////
77
VModuleSectionElement elemObj = vm.getSection(Constants.SECTION_PUBLICS).getElement(element);
78                     maxRows = elemObj.getIntegerProperty(SECTION_ELEMENT_PROPERTY_MAXROWS);
79                 }
80                 catch(ParseException JavaDoc e) {
81                     LoggingManager.log("ParseException while retrieving custom vm properties!", this);
82                 }
83
84                 // initialize the business object
85
BaseObject nwobj = new BaseObject(vm, locale);
86
87                 // retrieve the list from the business object
88
// get the filter
89
//CategoryFilter filter = (CategoryFilter)request.getSession().getAttribute(Constants.SESSIONKEY_CATEGORY_FILTER);
90
Vector newsList = nwobj.loadPubBaseListEntries(filter);
91
92
93                 // pass the list to the bean (in scope)
94
((PagedListBean) form).setMaxRows(maxRows);
95                 ((PagedListBean) form).setList(newsList, locale,vm.getIdentification());
96                 ((PagedListBean) form).setURI(request.getRequestURI());
97             //}
98
//else
99
//{
100
// just tell the bean what page of the list to display
101
LoggingManager.log("Using session copy of public news list for virtual module " +
102                                    vm.getIdentification(), this);
103                 int pageNo = 1;
104                 if(pageNoParam != null)
105                 {
106                     try
107                     {
108                         pageNo = Integer.parseInt(pageNoParam);
109                     }
110                     catch(NumberFormatException JavaDoc e) {
111                         LoggingManager.log("NumberFormatException while converting parameter <page> " + pageNoParam, this);
112                     }
113                 }
114
115                 ((PagedListBean) form).setCurrentPage(pageNo);
116             //}
117

118             // return the requested action
119
return Constants.SECTION_PUBLICS + Constants.DEFAULT_SPACER + element;
120         //}
121

122         //return null; // unknown action
123
}
124
125 }
126
127 // eof
128
Popular Tags