01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/calendar/tags/sakai_2-4-1/calendar-api/api/src/java/org/sakaiproject/calendar/cover/CalendarImporterService.java $
03: * $Id: CalendarImporterService.java 8391 2006-04-27 03:19:24Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 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.calendar.cover;
21:
22: import java.io.InputStream;
23: import java.util.List;
24: import java.util.Map;
25:
26: import org.sakaiproject.exception.ImportException;
27: import org.sakaiproject.component.cover.ComponentManager;
28:
29: /**
30: * <p>CalendarService is a static Cover for the {@link org.sakaiproject.calendar.api.CalendarImporterService};
31: * see that interface for usage details.</p>
32: */
33: public class CalendarImporterService {
34: /** Comma separated value import type */
35: public static final String CSV_IMPORT = org.sakaiproject.calendar.api.CalendarImporterService.CSV_IMPORT;
36:
37: /** MeetingMaker import type */
38: public static final String MEETINGMAKER_IMPORT = org.sakaiproject.calendar.api.CalendarImporterService.MEETINGMAKER_IMPORT;
39:
40: /** Outlook import type */
41: public static final String OUTLOOK_IMPORT = org.sakaiproject.calendar.api.CalendarImporterService.OUTLOOK_IMPORT;
42:
43: /**
44: * Access the component instance: special cover only method.
45: * @return the component instance.
46: */
47: public static org.sakaiproject.calendar.api.CalendarImporterService getInstance() {
48: if (ComponentManager.CACHE_COMPONENTS) {
49: if (m_instance == null)
50: m_instance = (org.sakaiproject.calendar.api.CalendarImporterService) ComponentManager
51: .get(org.sakaiproject.calendar.api.CalendarImporterService.class);
52: return m_instance;
53: } else {
54: return (org.sakaiproject.calendar.api.CalendarImporterService) ComponentManager
55: .get(org.sakaiproject.calendar.api.CalendarImporterService.class);
56: }
57: }
58:
59: private static org.sakaiproject.calendar.api.CalendarImporterService m_instance = null;
60:
61: /* (non-Javadoc)
62: * @see org.sakaiproject.service.legacy.calendar#getDefaultColumnMap(java.lang.String)
63: */
64: public static Map getDefaultColumnMap(String importType)
65: throws ImportException {
66: org.sakaiproject.calendar.api.CalendarImporterService service = getInstance();
67:
68: if (service != null) {
69: return service.getDefaultColumnMap(importType);
70: } else {
71: return null;
72: }
73: }
74:
75: /* (non-Javadoc)
76: * @see org.sakaiproject.service.legacy.calendar#doImport(java.lang.String, java.io.InputStream, java.util.Map, java.lang.String[])
77: */
78: public static List doImport(String importType,
79: InputStream importStream, Map columnMapping,
80: String[] customFieldPropertyNames) throws ImportException {
81: org.sakaiproject.calendar.api.CalendarImporterService service = getInstance();
82:
83: if (service != null) {
84: return service.doImport(importType, importStream,
85: columnMapping, customFieldPropertyNames);
86: } else {
87: return null;
88: }
89: }
90:
91: }
|