01: /**********************************************************************************
02: * $URL$
03: * $Id$
04: ***********************************************************************************
05: *
06: * Copyright (c) 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.shared.impl.common;
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.data.ifc.shared.TypeIfc;
28: import org.sakaiproject.tool.assessment.services.shared.TypeService;
29: import org.sakaiproject.tool.assessment.services.CommonServiceException;
30: import org.sakaiproject.tool.assessment.shared.api.common.TypeServiceAPI;
31:
32: /**
33: * Declares a shared interface to control type information.
34: * @author Ed Smiley <esmiley@stanford.edu>
35: */
36: public class TypeServiceImpl implements TypeServiceAPI {
37: private static Log log = LogFactory.getLog(TypeServiceImpl.class);
38:
39: /**
40: * Get type for id
41: * @param typeId the id
42: * @return the type
43: */
44: public TypeIfc getTypeById(String typeId) {
45: try {
46: TypeService service = new TypeService();
47: return service.getTypeById(typeId);
48: } catch (Exception ex) {
49: throw new CommonServiceException(ex);
50: }
51: }
52:
53: /**
54: * Get list of types for authority/domain.
55: * @param authority the authority
56: * @param domain the domain
57: * @return list of TypeIfc
58: */
59: public List getListByAuthorityDomain(String authority, String domain) {
60: try {
61: TypeService service = new TypeService();
62: return service.getListByAuthorityDomain(authority, domain);
63: } catch (Exception ex) {
64: throw new CommonServiceException(ex);
65: }
66: }
67:
68: /**
69: * Return list of item TypeIfcs.
70: * @return list of item TypeIfcs
71: */
72: public List getItemTypes() {
73: try {
74: TypeService service = new TypeService();
75: return service.getFacadeItemTypes();// TypeFacades, implement TypeIfc
76: } catch (Exception ex) {
77: throw new CommonServiceException(ex);
78: }
79: }
80: }
|