Source Code Cross Referenced for QuestionPoolServiceImpl.java in  » ERP-CRM-Financial » sakai » org » sakaiproject » tool » assessment » shared » impl » questionpool » 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 » ERP CRM Financial » sakai » org.sakaiproject.tool.assessment.shared.impl.questionpool 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:         * $URL$
003:         * $Id$
004:         ***********************************************************************************
005:         *
006:         * Copyright (c) 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.shared.impl.questionpool;
021:
022:        import java.util.ArrayList;
023:        import java.util.List;
024:        import java.util.Map;
025:
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:        import org.osid.shared.SharedException;
029:
030:        import org.sakaiproject.tool.assessment.data.ifc.questionpool.QuestionPoolDataIfc;
031:        import org.sakaiproject.tool.assessment.data.model.Tree;
032:        import org.sakaiproject.tool.assessment.facade.QuestionPoolFacade;
033:        import org.sakaiproject.tool.assessment.facade.QuestionPoolIteratorFacade;
034:        import org.sakaiproject.tool.assessment.services.QuestionPoolService;
035:        import org.sakaiproject.tool.assessment.shared.api.questionpool.QuestionPoolServiceAPI;
036:        import org.sakaiproject.tool.assessment.services.QuestionPoolServiceException;
037:
038:        /**
039:         *
040:         * The QuestionPoolServiceAPI declares a shared interface to control question
041:         * pool information.
042:         * @author Ed Smiley <esmiley@stanford.edu>
043:         */
044:        public class QuestionPoolServiceImpl implements  QuestionPoolServiceAPI {
045:            private static Log log = LogFactory
046:                    .getLog(QuestionPoolServiceImpl.class);
047:
048:            /**
049:             * Creates a new QuestionPoolServiceImpl object.
050:             */
051:            public QuestionPoolServiceImpl() {
052:            }
053:
054:            /**
055:             * Get all pools from the back end.
056:             */
057:            public List getAllPools(String agentId) {
058:                List list = new ArrayList();
059:                try {
060:                    QuestionPoolService service = new QuestionPoolService();
061:                    QuestionPoolIteratorFacade iter = service
062:                            .getAllPools(agentId);
063:                    while (iter.hasNext()) {
064:                        QuestionPoolDataIfc pool = (QuestionPoolDataIfc) iter
065:                                .next();
066:                        list.add(pool);
067:                    }
068:                    return list;
069:                } catch (SharedException ex) {
070:                    throw new QuestionPoolServiceException(ex);
071:                } catch (Exception ex) {
072:                    throw new QuestionPoolServiceException(ex);
073:                }
074:            }
075:
076:            /**
077:             * Get basic info for pools(just id and  title)  for displaying in pulldown .
078:             */
079:            public List getBasicInfoOfAllPools(String agentId) {
080:                try {
081:                    QuestionPoolService service = new QuestionPoolService();
082:                    return service.getBasicInfoOfAllPools(agentId);
083:                } catch (Exception ex) {
084:                    throw new QuestionPoolServiceException(ex);
085:                }
086:            }
087:
088:            /**
089:             * Get a particular pool from the backend, with all questions.
090:             */
091:            public QuestionPoolDataIfc getPool(Long poolId, String agentId) {
092:                try {
093:                    QuestionPoolService service = new QuestionPoolService();
094:                    return service.getPool(poolId, agentId);
095:                } catch (Exception ex) {
096:                    throw new QuestionPoolServiceException(ex);
097:                }
098:            }
099:
100:            /**
101:             * Get a list of pools that have a specific Agent
102:             */
103:            public List getPoolIdsByItem(String itemId) {
104:                try {
105:                    QuestionPoolService service = new QuestionPoolService();
106:                    return service.getPoolIdsByItem(itemId);
107:                } catch (Exception ex) {
108:                    throw new QuestionPoolServiceException(ex);
109:                }
110:            }
111:
112:            public boolean hasItem(String itemId, Long poolId) {
113:                try {
114:                    QuestionPoolService service = new QuestionPoolService();
115:                    return service.hasItem(itemId, poolId);
116:                } catch (Exception ex) {
117:                    throw new QuestionPoolServiceException(ex);
118:                }
119:            }
120:
121:            /**
122:             * Get pool id's by agent.
123:             */
124:            public List getPoolIdsByAgent(String agentId) {
125:                try {
126:                    QuestionPoolService service = new QuestionPoolService();
127:                    return service.getPoolIdsByAgent(agentId);
128:                } catch (Exception ex) {
129:                    throw new QuestionPoolServiceException(ex);
130:                }
131:            }
132:
133:            /**
134:             * Get a list of pools that have a specific parent
135:             */
136:            public List getSubPools(Long poolId) {
137:                try {
138:                    QuestionPoolService service = new QuestionPoolService();
139:                    return service.getSubPools(poolId);
140:                } catch (Exception ex) {
141:                    throw new QuestionPoolServiceException(ex);
142:                }
143:            }
144:
145:            /**
146:             * Get the size of a subpool.
147:             */
148:            public int getSubPoolSize(Long poolId) {
149:                try {
150:                    QuestionPoolService service = new QuestionPoolService();
151:                    return service.getSubPoolSize(poolId);
152:                } catch (Exception ex) {
153:                    throw new QuestionPoolServiceException(ex);
154:                }
155:            }
156:
157:            /**
158:             * Checks to see if a pool has subpools
159:             */
160:            public boolean hasSubPools(Long poolId) {
161:                try {
162:                    QuestionPoolService service = new QuestionPoolService();
163:                    return service.hasSubPools(poolId);
164:                } catch (Exception ex) {
165:                    throw new QuestionPoolServiceException(ex);
166:                }
167:            }
168:
169:            /**
170:             * Get all items sorted by orderby
171:             */
172:            public List getAllItemsSorted(Long poolId, String orderBy,
173:                    String ascending) {
174:                try {
175:                    QuestionPoolService service = new QuestionPoolService();
176:                    return service
177:                            .getAllItemsSorted(poolId, orderBy, ascending);
178:                } catch (Exception ex) {
179:                    throw new QuestionPoolServiceException(ex);
180:                }
181:            }
182:
183:            /**
184:             * Get all scores for a published assessment from the back end.
185:             */
186:            public List getAllItems(Long poolId) {
187:                try {
188:                    QuestionPoolService service = new QuestionPoolService();
189:                    return service.getAllItems(poolId);
190:                } catch (Exception ex) {
191:                    throw new QuestionPoolServiceException(ex);
192:                }
193:            }
194:
195:            /**
196:             * Save a question to a pool.
197:             */
198:            public void addItemToPool(String itemId, Long poolId) {
199:                try {
200:                    QuestionPoolService service = new QuestionPoolService();
201:                    service.addItemToPool(itemId, poolId);
202:                } catch (Exception ex) {
203:                    throw new QuestionPoolServiceException(ex);
204:                }
205:            }
206:
207:            /**
208:             * Move a question to a pool.
209:             */
210:            public void moveItemToPool(String itemId, Long sourceId, Long destId) {
211:                try {
212:                    QuestionPoolService service = new QuestionPoolService();
213:                    service.moveItemToPool(itemId, sourceId, destId);
214:                } catch (Exception ex) {
215:                    throw new QuestionPoolServiceException(ex);
216:                }
217:            }
218:
219:            /**
220:             * Is a pool a descendant of the other?
221:             */
222:            public boolean isDescendantOf(Long poolA, Long poolB, String agentId) {
223:                try {
224:                    QuestionPoolService service = new QuestionPoolService();
225:                    return service.isDescendantOf(poolA, poolB, agentId);
226:                } catch (Exception ex) {
227:                    throw new QuestionPoolServiceException(ex);
228:                }
229:            }
230:
231:            /**
232:             * Move a subpool to a pool.
233:             */
234:            public void movePool(String agentId, Long sourceId, Long destId) {
235:                try {
236:                    QuestionPoolService service = new QuestionPoolService();
237:                    service.movePool(agentId, sourceId, destId);
238:                } catch (Exception ex) {
239:                    throw new QuestionPoolServiceException(ex);
240:                }
241:            }
242:
243:            /**
244:             * Delete a pool
245:             */
246:            public void deletePool(Long poolId, String agentId, Tree tree) {
247:                try {
248:                    QuestionPoolService service = new QuestionPoolService();
249:                    service.deletePool(poolId, agentId, tree);
250:                } catch (Exception ex) {
251:                    throw new QuestionPoolServiceException(ex);
252:                }
253:            }
254:
255:            /**
256:             * removes a Question from the question pool. This does not  *delete* the question itself
257:             */
258:            public void removeQuestionFromPool(String questionId, Long poolId) {
259:                try {
260:                    QuestionPoolService service = new QuestionPoolService();
261:                    service.removeQuestionFromPool(questionId, poolId);
262:                } catch (Exception ex) {
263:                    throw new QuestionPoolServiceException(ex);
264:                }
265:            }
266:
267:            /**
268:             * Copy a subpool to a pool.
269:             */
270:            public void copyPool(Tree tree, String agentId, Long sourceId,
271:                    Long destId, String prependString1, String prependString2) {
272:                try {
273:                    QuestionPoolService service = new QuestionPoolService();
274:                    service.copyPool(tree, agentId, sourceId, destId,
275:                            prependString1, prependString2);
276:                } catch (Exception ex) {
277:                    throw new QuestionPoolServiceException(ex);
278:                }
279:            }
280:
281:            /**
282:             * Save a question pool.
283:             */
284:            public QuestionPoolDataIfc savePool(QuestionPoolDataIfc pool) {
285:                try {
286:                    QuestionPoolService service = new QuestionPoolService();
287:                    Long poolId = pool.getQuestionPoolId();
288:                    String agentId = null;
289:                    try {
290:                        agentId = pool.getOwner().getIdString();
291:                    } catch (Exception ax) {
292:                        throw new QuestionPoolServiceException(ax);
293:                    }
294:                    QuestionPoolFacade facade = service
295:                            .getPool(poolId, agentId);
296:
297:                    return service.savePool(facade);
298:                } catch (Exception ex) {
299:                    throw new QuestionPoolServiceException(ex);
300:                }
301:            }
302:
303:            public Map getQuestionPoolItemMap() {
304:                try {
305:                    QuestionPoolService service = new QuestionPoolService();
306:                    return service.getQuestionPoolItemMap();
307:                } catch (Exception ex) {
308:                    throw new QuestionPoolServiceException(ex);
309:                }
310:            }
311:
312:        }
w___w__w._ja_v___a__2__s_.__c__om | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.