001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/jsf/tags/sakai_2-4-1/example/src/java/example/SimplePropsBean.java $
003: * $Id: SimplePropsBean.java 9278 2006-05-10 23:29:21Z ray@media.berkeley.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005 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 example;
021:
022: import java.io.Serializable;
023: import java.util.ArrayList;
024: import java.util.Date;
025: import java.util.Random;
026:
027: /**
028: * <p>Title: Sakai JSF</p>
029: * <p>Description: Just a few properites so yo can set them.</p>
030: * <p>Copyright: Copyright (c) 2005 Sakai Project</p>
031: * <p>: </p>
032: * @author Ed Smiley
033: * @version 2.0
034: */
035:
036: public class SimplePropsBean implements Serializable {
037: private static final Random r = new Random();
038:
039: private String prop1 = "JSF test 1";
040: private String prop2 = "JSF test 2";
041: private String prop3 = "JSF test 3";
042: private String prop4 = "JSF test 4";
043: private String prop5 = "JSF test 5";
044: private String prop6 = "JSF test 6";
045: private java.util.Date date1 = makeADate();
046: private java.util.Date date2 = makeADate();
047: private java.util.Date date3 = makeADate();
048: private java.util.Date date4 = makeADate();
049: private java.util.List list1 = new ArrayList();
050: private java.util.List list2 = new ArrayList();
051: private java.util.List list3 = new ArrayList();
052: private java.util.List list4 = new ArrayList();
053:
054: public String getProp1() {
055: return prop1;
056: }
057:
058: public void setProp1(String prop1) {
059: this .prop1 = prop1;
060: }
061:
062: public String getProp2() {
063: return prop2;
064: }
065:
066: public void setProp2(String prop2) {
067: this .prop2 = prop2;
068: }
069:
070: public String getProp3() {
071: return prop3;
072: }
073:
074: public void setProp3(String prop3) {
075: this .prop3 = prop3;
076: }
077:
078: public String getProp4() {
079: return prop4;
080: }
081:
082: public void setProp4(String prop4) {
083: this .prop4 = prop4;
084: }
085:
086: public java.util.Date getDate1() {
087: return date1;
088: }
089:
090: public void setDate1(java.util.Date date1) {
091: this .date1 = date1;
092: }
093:
094: public java.util.Date getDate2() {
095: return date2;
096: }
097:
098: public void setDate2(java.util.Date date2) {
099: this .date2 = date2;
100: }
101:
102: public java.util.Date getDate3() {
103: return date3;
104: }
105:
106: public void setDate3(java.util.Date date3) {
107: this .date3 = date3;
108: }
109:
110: public java.util.Date getDate4() {
111: return date4;
112: }
113:
114: public void setDate4(java.util.Date date4) {
115: this .date4 = date4;
116: }
117:
118: public java.util.List getList2() {
119: return list2;
120: }
121:
122: public void setList2(java.util.List list2) {
123: this .list2 = list2;
124: }
125:
126: public java.util.List getList3() {
127: return list3;
128: }
129:
130: public void setList3(java.util.List list3) {
131: this .list3 = list3;
132: }
133:
134: public java.util.List getList4() {
135: return list4;
136: }
137:
138: /**
139: * unit tests
140: * @param args
141: */
142: public static void main(String[] args) {
143: SimplePropsBean spb = new SimplePropsBean();
144: System.out.println("spb.prop1=" + spb.prop1);
145: System.out.println("spb.prop2=" + spb.prop2);
146: System.out.println("spb.prop3=" + spb.prop3);
147: System.out.println("spb.prop4=" + spb.prop4);
148: System.out.println("spb.prop5=" + spb.prop5);
149: System.out.println("spb.prop6=" + spb.prop6);
150: System.out.println("current date=" + new Date());
151: System.out.println("date1=" + spb.date1);
152: System.out.println("date2=" + spb.date2);
153: System.out.println("date3=" + spb.date3);
154: System.out.println("date4=" + spb.date4);
155: if (spb.list1 != null) {
156: System.out.println("list 1 OK");
157: }
158: if (spb.list2 != null) {
159: System.out.println("list 2 OK");
160: }
161: if (spb.list3 != null) {
162: System.out.println("list 3 OK");
163: }
164: if (spb.list4 != null) {
165: System.out.println("list 4 OK");
166: }
167:
168: }
169:
170: public String getProp5() {
171: return prop5;
172: }
173:
174: public void setProp5(String prop5) {
175: this .prop5 = prop5;
176: }
177:
178: public String getProp6() {
179: return prop6;
180: }
181:
182: public void setProp6(String prop6) {
183: this .prop6 = prop6;
184: }
185:
186: /**
187: * @return
188: */
189: private static Date makeADate() {
190: Date currDate = new Date();
191: byte[] b = new byte[1];
192: r.nextBytes(b);
193: long randTime = currDate.getTime() * b[0];
194: Date randDate = new Date(randTime);
195:
196: return randDate;
197: }
198: }
|