01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/services/shared/TypeService.java $
03: * $Id: TypeService.java 9273 2006-05-10 22:34:28Z daisyf@stanford.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the"License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.tool.assessment.services.shared;
21:
22: import java.util.List;
23:
24: import org.apache.commons.logging.Log;
25: import org.apache.commons.logging.LogFactory;
26:
27: import org.sakaiproject.tool.assessment.facade.TypeFacade;
28: import org.sakaiproject.tool.assessment.services.PersistenceService;
29:
30: /**
31: * The QuestionPoolService calls the service locator to reach the
32: * manager on the back end.
33: * @author Rachel Gollub <rgollub@stanford.edu>
34: */
35: public class TypeService {
36: private static Log log = LogFactory.getLog(TypeService.class);
37:
38: /**
39: * Creates a new QuestionPoolService object.
40: */
41: public TypeService() {
42: }
43:
44: public TypeFacade getTypeById(String typeId) {
45: try {
46: return PersistenceService.getInstance()
47: .getTypeFacadeQueries().getTypeFacadeById(
48: new Long(typeId));
49: } catch (Exception e) {
50: log.error(e);
51: throw new RuntimeException(e);
52: }
53: }
54:
55: public List getFacadeListByAuthorityDomain(String authority,
56: String domain) {
57: try {
58: return PersistenceService.getInstance()
59: .getTypeFacadeQueries()
60: .getFacadeListByAuthorityDomain(authority, domain);
61: } catch (Exception e) {
62: log.error(e);
63: throw new RuntimeException(e);
64: }
65: }
66:
67: public List getListByAuthorityDomain(String authority, String domain) {
68: try {
69: return PersistenceService.getInstance()
70: .getTypeFacadeQueries().getListByAuthorityDomain(
71: authority, domain);
72: } catch (Exception e) {
73: log.error(e);
74: throw new RuntimeException(e);
75: }
76: }
77:
78: public List getFacadeItemTypes() {
79: try {
80: return PersistenceService.getInstance()
81: .getTypeFacadeQueries().getFacadeItemTypes();
82: } catch (Exception e) {
83: log.error(e);
84: throw new RuntimeException(e);
85: }
86: }
87: }
|