File Source: EntriesBean.java
/*
P/P * Method: org.apache.roller.weblogger.ui.struts2.editor.EntriesBean__static_init
*/
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */
18
19 package org.apache.roller.weblogger.ui.struts2.editor;
20
21 import java.text.DateFormat;
22 import java.text.SimpleDateFormat;
23 import java.util.Date;
24 import java.util.List;
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.roller.weblogger.util.Utilities;
27
28
29 /**
30 * A bean for managing entries query data.
31 */
32 public class EntriesBean {
33
34 private String endDateString = null;
35 private String startDateString = null;
36 private String categoryPath = null;
37 private String tagsAsString = null;
38 private String text = null;
39 private String status = "ALL";
40 private String sortBy = "updateTime";
41 private int page = 0;
42
43
/*
P/P * Method: void org.apache.roller.weblogger.ui.struts2.editor.EntriesBean()
*
* Postconditions:
* this.categoryPath == null
* this.endDateString == null
* this.startDateString == null
* this.tagsAsString == null
* this.text == null
* this.page == 0
* this.sortBy == &"updateTime"
* this.status == &"ALL"
*/
44 public EntriesBean() {
45 }
46
47 // convenience method
48 public List<String> getTags() {
/*
P/P * Method: List getTags()
*
* Preconditions:
* init'ed(this.tagsAsString)
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* this.tagsAsString: Addr_Set{null}, Inverse{null}
*/
49 if(getTagsAsString() != null) {
50 return Utilities.splitStringAsTags(getTagsAsString());
51 } else {
52 return null;
53 }
54 }
55
56 public Date getStartDate() {
/*
P/P * Method: Date getStartDate()
*
* Preconditions:
* init'ed(this.startDateString)
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* org.apache.commons.lang.StringUtils:isEmpty(...)@57: {1}, {0}
*/
57 if(!StringUtils.isEmpty(getStartDateString())) try {
58 DateFormat df = new SimpleDateFormat("MM/dd/yy");
59 return df.parse(getStartDateString());
60 } catch(Exception e) { }
61 return null;
62 }
63
64 public Date getEndDate() {
/*
P/P * Method: Date getEndDate()
*
* Preconditions:
* init'ed(this.endDateString)
*
* Postconditions:
* init'ed(return_value)
*
* Test Vectors:
* org.apache.commons.lang.StringUtils:isEmpty(...)@65: {1}, {0}
*/
65 if(!StringUtils.isEmpty(getEndDateString())) try {
66 DateFormat df = new SimpleDateFormat("MM/dd/yy");
67 return df.parse(getEndDateString());
68 } catch(Exception e) { }
69 return null;
70 }
71
72
73 public String getCategoryPath() {
/*
P/P * Method: String getCategoryPath()
*
* Preconditions:
* init'ed(this.categoryPath)
*
* Postconditions:
* return_value == this.categoryPath
* init'ed(return_value)
*/
74 return categoryPath;
75 }
76
77 public void setCategoryPath(String categoryId) {
/*
P/P * Method: void setCategoryPath(String)
*
* Postconditions:
* this.categoryPath == categoryId
* init'ed(this.categoryPath)
*/
78 this.categoryPath = categoryId;
79 }
80
81 public String getTagsAsString() {
/*
P/P * Method: String getTagsAsString()
*
* Preconditions:
* init'ed(this.tagsAsString)
*
* Postconditions:
* return_value == this.tagsAsString
* init'ed(return_value)
*/
82 return tagsAsString;
83 }
84
85 public void setTagsAsString(String tags) {
/*
P/P * Method: void setTagsAsString(String)
*
* Postconditions:
* this.tagsAsString == tags
* init'ed(this.tagsAsString)
*/
86 this.tagsAsString = tags;
87 }
88
89 public String getText() {
/*
P/P * Method: String getText()
*
* Preconditions:
* init'ed(this.text)
*
* Postconditions:
* return_value == this.text
* init'ed(return_value)
*/
90 return text;
91 }
92
93 public void setText(String text) {
/*
P/P * Method: void setText(String)
*
* Postconditions:
* this.text == text
* init'ed(this.text)
*/
94 this.text = text;
95 }
96
97 public String getStatus() {
/*
P/P * Method: String getStatus()
*
* Preconditions:
* init'ed(this.status)
*
* Postconditions:
* return_value == this.status
* init'ed(return_value)
*/
98 return status;
99 }
100
101 public void setStatus(String status) {
/*
P/P * Method: void setStatus(String)
*
* Postconditions:
* this.status == status
* init'ed(this.status)
*/
102 this.status = status;
103 }
104
105 public String getSortBy() {
/*
P/P * Method: String getSortBy()
*
* Preconditions:
* init'ed(this.sortBy)
*
* Postconditions:
* return_value == this.sortBy
* init'ed(return_value)
*/
106 return sortBy;
107 }
108
109 public void setSortBy(String sortBy) {
/*
P/P * Method: void setSortBy(String)
*
* Postconditions:
* this.sortBy == sortBy
* init'ed(this.sortBy)
*/
110 this.sortBy = sortBy;
111 }
112
113 public int getPage() {
/*
P/P * Method: int getPage()
*
* Preconditions:
* init'ed(this.page)
*
* Postconditions:
* return_value == this.page
* init'ed(return_value)
*/
114 return page;
115 }
116
117 public void setPage(int page) {
/*
P/P * Method: void setPage(int)
*
* Postconditions:
* this.page == page
* init'ed(this.page)
*/
118 this.page = page;
119 }
120
121
122 public String toString() {
/*
P/P * Method: String toString()
*
* Preconditions:
* init'ed(this.categoryPath)
* init'ed(this.endDateString)
* init'ed(this.page)
* init'ed(this.sortBy)
* init'ed(this.startDateString)
* init'ed(this.status)
* init'ed(this.tagsAsString)
* init'ed(this.text)
*
* Postconditions:
* init'ed(java.lang.StringBuffer:toString(...)._tainted)
* return_value == &java.lang.StringBuffer:toString(...)
*/
123 StringBuffer buf = new StringBuffer();
124
125 buf.append("startDate = ").append(getStartDate()).append("\n");
126 buf.append("endDate = ").append(getEndDate()).append("\n");
127 buf.append("status = ").append(getStatus()).append("\n");
128 buf.append("sortBy = ").append(getSortBy()).append("\n");
129 buf.append("catPath = ").append(getCategoryPath()).append("\n");
130 buf.append("tags = ").append(getTagsAsString()).append("\n");
131 buf.append("text = ").append(getText()).append("\n");
132 buf.append("page = ").append(getPage()).append("\n");
133
134 return buf.toString();
135 }
136
137 public String getEndDateString() {
/*
P/P * Method: String getEndDateString()
*
* Preconditions:
* init'ed(this.endDateString)
*
* Postconditions:
* return_value == this.endDateString
* init'ed(return_value)
*/
138 return endDateString;
139 }
140
141 public void setEndDateString(String endDateString) {
/*
P/P * Method: void setEndDateString(String)
*
* Postconditions:
* this.endDateString == endDateString
* init'ed(this.endDateString)
*/
142 this.endDateString = endDateString;
143 }
144
145 public String getStartDateString() {
/*
P/P * Method: String getStartDateString()
*
* Preconditions:
* init'ed(this.startDateString)
*
* Postconditions:
* return_value == this.startDateString
* init'ed(return_value)
*/
146 return startDateString;
147 }
148
149 public void setStartDateString(String startDateString) {
/*
P/P * Method: void setStartDateString(String)
*
* Postconditions:
* this.startDateString == startDateString
* init'ed(this.startDateString)
*/
150 this.startDateString = startDateString;
151 }
152
153 }
SofCheck Inspector Build Version : 2.18479
| EntriesBean.java |
2009-Jan-02 14:25:06 |
| EntriesBean.class |
2009-Sep-04 03:12:45 |