001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/tags/sakai_2-4-1/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/shared/BackingBean.java $
003: * $Id: BackingBean.java 15083 2006-09-20 20:03:55Z lydial@stanford.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 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.assessment.ui.bean.shared;
021:
022: import java.io.Serializable;
023: import java.util.ArrayList;
024: import java.util.List;
025:
026: import org.sakaiproject.tool.assessment.ui.listener.author.AuthorActionListener;
027: import org.sakaiproject.tool.assessment.ui.listener.select.SelectActionListener;
028: import org.sakaiproject.tool.assessment.ui.listener.delivery.BeginDeliveryActionListener;
029: import org.apache.commons.logging.LogFactory;
030: import org.apache.commons.logging.Log;
031:
032: /**
033: * <p> </p>
034: * <p>Description: Backing Bean with some properties</p>
035: * <p>Copyright: Copyright (c) 2004</p>
036: * <p>Organization: Sakai Project</p>
037: * @author Ed Smiley
038: * @version $id: $
039: */
040:
041: public class BackingBean implements Serializable {
042: /**
043: *
044: */
045: private static final long serialVersionUID = -1137408628089300518L;
046:
047: private static Log log = LogFactory.getLog(BackingBean.class);
048:
049: private String prop1;
050: private String prop2;
051: private String prop3;
052: private String prop4;
053: private String prop5;
054: private String prop6;
055: private List list;
056:
057: public BackingBean() {
058: prop1 = "prop1";
059: prop2 = "prop2";
060: prop3 = "prop3";
061: prop4 = "prop4";
062: prop5 = "prop5";
063: prop6 = "prop6";
064: list = getBackingBeanList();
065: }
066:
067: public String getProp1() {
068: return prop1;
069: }
070:
071: public void setProp1(String p) {
072: prop1 = p;
073: }
074:
075: public String getProp2() {
076: return prop2;
077: }
078:
079: public void setProp2(String p) {
080: prop2 = p;
081: }
082:
083: public String getProp3() {
084: return prop3;
085: }
086:
087: public void setProp3(String p) {
088: prop3 = p;
089: }
090:
091: public String getProp4() {
092: return prop4;
093: }
094:
095: public void setProp4(String p) {
096: prop4 = p;
097: }
098:
099: public String getProp5() {
100: return prop5;
101: }
102:
103: public void setProp5(String p) {
104: prop5 = p;
105: }
106:
107: public String getProp6() {
108: return prop6;
109: }
110:
111: public void setProp6(String p) {
112: prop6 = p;
113: }
114:
115: public List getList() {
116: return list;
117: }
118:
119: public void setList(List p) {
120: list = p;
121: }
122:
123: public String chooseAgentAdminGo() {
124: log.info("Choosing admin");
125: prop1 = "admin";
126:
127: // Call listener before going on.
128: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
129: listener.processAction(null);
130:
131: return "beginAssessment";
132: }
133:
134: public String chooseAgentRachelGo() {
135: log.info("Choosing rachel");
136: prop1 = "rachel";
137:
138: // Call listener before going on.
139: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
140: listener.processAction(null);
141:
142: return "beginAssessment";
143: }
144:
145: public String chooseAgentMarithGo() {
146: log.info("Choosing marith");
147: prop1 = "marith";
148:
149: // Call listener before going on.
150: BeginDeliveryActionListener listener = new BeginDeliveryActionListener();
151: listener.processAction(null);
152:
153: return "beginAssessment";
154: }
155:
156: public String chooseAgentAdmin() {
157: log.info("Choosing admin");
158: prop1 = "admin";
159:
160: // Call listener before going on.
161: SelectActionListener listener = new SelectActionListener();
162: listener.processAction(null);
163:
164: return "select";
165: }
166:
167: public String chooseAgentRachel() {
168: log.info("Choosing rachel");
169: prop1 = "rachel";
170:
171: // Call listener before going on.
172: SelectActionListener listener = new SelectActionListener();
173: listener.processAction(null);
174:
175: return "select";
176: }
177:
178: public String chooseAgentMarith() {
179: log.info("Choosing marith");
180: prop1 = "marith";
181:
182: // Call listener before going on.
183: SelectActionListener listener = new SelectActionListener();
184: listener.processAction(null);
185:
186: return "select";
187: }
188:
189: public String chooseAgentAdminInstructor() {
190: log.info("Choosing admin instructor");
191: prop1 = "admin";
192:
193: // Call listener before going on.
194: AuthorActionListener listener = new AuthorActionListener();
195: listener.processAction(null);
196:
197: return "author";
198: }
199:
200: // makes a whole bunch of backing beans.
201: private List getBackingBeanList() {
202: ArrayList list = new ArrayList();
203: String[] lastNames = { "Black", "Chang", "Dumbledore",
204: "Granger", "McGonagle", "Potter", "Snape", "Weasley", };
205:
206: String[] firstNames = { "Alice", "Bruce", "Carrie", "David",
207: "Elmer", "Fresia" };
208:
209: for (int ilast = 0; ilast < lastNames.length; ilast++) {
210: for (int ifirst = 0; ifirst < firstNames.length; ifirst++) {
211: for (char c = 'A'; c < 'A' + 2; c++) //6; c++)
212: {
213: SubBackingBean bean = new SubBackingBean();
214: bean.setName(firstNames[ifirst] + " " + c + "."
215: + lastNames[ilast]);
216: bean.setAddress(("" + (ilast + ifirst + c))
217: + " Privet Drive");
218: bean.setId(("" + Math.random()).substring(2));
219:
220: list.add(bean);
221: }
222: }
223: }
224:
225: return list;
226: }
227: }
|