Source Code Cross Referenced for CommentManagementForm.java in  » Blogger-System » apache-roller-3.1 » org » apache » roller » ui » authoring » struts » formbeans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Blogger System » apache roller 3.1 » org.apache.roller.ui.authoring.struts.formbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  The ASF licenses this file to You
004:         * under the Apache License, Version 2.0 (the "License"); you may not
005:         * use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.  For additional information regarding
015:         * copyright in this work, please see the NOTICE file in the top level
016:         * directory of this distribution.
017:         */
018:        package org.apache.roller.ui.authoring.struts.formbeans;
019:
020:        import java.text.DateFormat;
021:        import java.text.ParseException;
022:        import java.util.ArrayList;
023:        import java.util.Calendar;
024:        import java.util.Date;
025:        import java.util.Iterator;
026:        import java.util.List;
027:        import java.util.Locale;
028:
029:        import javax.servlet.ServletRequest;
030:        import org.apache.commons.logging.Log;
031:        import org.apache.commons.logging.LogFactory;
032:
033:        import org.apache.struts.action.ActionMapping;
034:        import org.apache.roller.pojos.CommentData;
035:        import org.apache.roller.util.DateUtil;
036:        import org.apache.roller.util.Utilities;
037:
038:        /**
039:         * @struts.form name="commentManagementForm"
040:         * @author Dave Johnson
041:         */
042:        public class CommentManagementForm extends
043:                org.apache.struts.action.ActionForm implements 
044:                java.io.Serializable {
045:
046:            private static Log logger = LogFactory.getFactory().getInstance(
047:                    CommentManagementForm.class);
048:
049:            private String entryid = null;
050:            private String handle = null;
051:
052:            private String searchString = null;
053:            private String startDateString;
054:            private String endDateString;
055:
056:            /** ALL, NO_SPAM or ONLY_SPAM */
057:            private String spamString = "ALL";
058:
059:            /** ALL, NO_APPROVED or ONLY_APPROVED */
060:            private String approvedString = "ALL";
061:
062:            /** max comments displayed per page */
063:            private int count = 30;
064:
065:            /** offset into current query results */
066:            private int offset = 0;
067:
068:            /** IDs of comments to mark as spam */
069:            private String[] spamComments = new String[0];
070:
071:            /** IDs of comments to mark as approved */
072:            private String[] approvedComments = new String[0];
073:
074:            /** IDs of comments to delete */
075:            private String[] deleteComments = new String[0];
076:
077:            /** Limit updates to just this set of comma-separated IDs */
078:            private String ids = null;
079:
080:            public void reset(ActionMapping mapping, ServletRequest request) {
081:                // reset time fields to current time
082:                Calendar cal = Calendar.getInstance(request.getLocale());
083:                Date now = new Date();
084:                cal.setTime(now);
085:
086:                DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT,
087:                        request.getLocale());
088:                setEndDateString(df.format(now));
089:
090:                cal.set(Calendar.DAY_OF_MONTH, 1);
091:                setStartDateString(df.format(cal.getTime()));
092:            }
093:
094:            public void loadCheckboxes(List comments) {
095:                ArrayList all = new ArrayList();
096:                ArrayList approvedList = new ArrayList();
097:                ArrayList spamList = new ArrayList();
098:                Iterator it = comments.iterator();
099:                while (it.hasNext()) {
100:                    CommentData comment = (CommentData) it.next();
101:                    all.add(comment.getId());
102:                    if (comment.getApproved().booleanValue()) {
103:                        approvedList.add(comment.getId());
104:                    }
105:                    if (comment.getSpam().booleanValue()) {
106:                        spamList.add(comment.getId());
107:                    }
108:                }
109:                String[] idArray = (String[]) all
110:                        .toArray(new String[all.size()]);
111:                ids = Utilities.stringArrayToString(idArray, ",");
112:
113:                approvedComments = (String[]) approvedList
114:                        .toArray(new String[approvedList.size()]);
115:                spamComments = (String[]) spamList.toArray(new String[spamList
116:                        .size()]);
117:            }
118:
119:            public Date getStartDate(Locale locale) {
120:                Date startDate = null;
121:                final DateFormat df = DateFormat.getDateInstance(
122:                        DateFormat.SHORT, locale);
123:                if (null != getStartDateString()
124:                        && getStartDateString().trim().length() > 0) {
125:                    try {
126:                        startDate = DateUtil.getStartOfDay(df
127:                                .parse(getStartDateString()));
128:                    } catch (ParseException e) {
129:                        // what!?! calendar widget handed us a bad date?
130:                        logger.debug("Parsing startDate", e);
131:                    }
132:                }
133:                return startDate;
134:            }
135:
136:            public Date getEndDate(Locale locale) {
137:                Date endDate = null;
138:                final DateFormat df = DateFormat.getDateInstance(
139:                        DateFormat.SHORT, locale);
140:                if (null != getEndDateString()
141:                        && getEndDateString().trim().length() > 0) {
142:                    try {
143:                        endDate = DateUtil.getEndOfDay(df
144:                                .parse(getEndDateString()));
145:                    } catch (ParseException e) {
146:                        // what!?! calendar widget handed us a bad date?
147:                        logger.debug("Parsing endDate", e);
148:                    }
149:                }
150:                return endDate;
151:            }
152:
153:            public Boolean getSpam() {
154:                if (spamString.equals("ONLY_SPAM")) {
155:                    return Boolean.TRUE;
156:                } else if (spamString.equals("NO_SPAM")) {
157:                    return Boolean.FALSE;
158:                }
159:                return null;
160:            }
161:
162:            public Boolean getPending() {
163:                if (approvedString.equals("ONLY_PENDING")) {
164:                    return Boolean.TRUE;
165:                }
166:                return null;
167:            }
168:
169:            public Boolean getApproved() {
170:                if (approvedString.equals("ONLY_APPROVED")) {
171:                    return Boolean.TRUE;
172:                } else if (approvedString.equals("ONLY_DISAPPROVED")) {
173:                    return Boolean.FALSE;
174:                }
175:                return null;
176:            }
177:
178:            public int getCount() {
179:                return count;
180:            }
181:
182:            public void setCount(int count) {
183:                this .count = count;
184:            }
185:
186:            public int getOffset() {
187:                return offset;
188:            }
189:
190:            public void setOffset(int offset) {
191:                this .offset = offset;
192:            }
193:
194:            public String getStartDateString() {
195:                return startDateString;
196:            }
197:
198:            public void setStartDateString(String startDateString) {
199:                this .startDateString = startDateString;
200:            }
201:
202:            public String getEndDateString() {
203:                return endDateString;
204:            }
205:
206:            public void setEndDateString(String endDateString) {
207:                this .endDateString = endDateString;
208:            }
209:
210:            public String getSpamString() {
211:                return spamString;
212:            }
213:
214:            public void setSpamString(String spamString) {
215:                this .spamString = spamString;
216:            }
217:
218:            public String getPendingString() {
219:                return approvedString;
220:            }
221:
222:            public void setPendingString(String pendingString) {
223:                this .approvedString = pendingString;
224:            }
225:
226:            public String getIds() {
227:                return ids;
228:            }
229:
230:            public void setIds(String ids) {
231:                this .ids = ids;
232:            }
233:
234:            public String getSearchString() {
235:                return searchString;
236:            }
237:
238:            public void setSearchString(String searchString) {
239:                this .searchString = searchString;
240:            }
241:
242:            public String getEntryid() {
243:                return entryid;
244:            }
245:
246:            public void setEntryid(String entryid) {
247:                this .entryid = entryid;
248:            }
249:
250:            public String getWeblog() {
251:                return handle;
252:            }
253:
254:            public void setWeblog(String handle) {
255:                this .handle = handle;
256:            }
257:
258:            public String[] getDeleteComments() {
259:                return deleteComments;
260:            }
261:
262:            public void setDeleteComments(String[] deleteComments) {
263:                this .deleteComments = deleteComments;
264:            }
265:
266:            public String[] getSpamComments() {
267:                return spamComments;
268:            }
269:
270:            public void setSpamComments(String[] commentsToMarkAsSpam) {
271:                this .spamComments = commentsToMarkAsSpam;
272:            }
273:
274:            public String[] getApprovedComments() {
275:                return approvedComments;
276:            }
277:
278:            public void setApprovedComments(String[] approvedComments) {
279:                this.approvedComments = approvedComments;
280:            }
281:
282:        }
ww__w__.ja___va___2s___.c___o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.