001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.util;
016    
017    import com.liferay.portal.kernel.security.pacl.DoPrivileged;
018    import com.liferay.portal.kernel.util.CalendarFactory;
019    
020    import java.util.Calendar;
021    import java.util.GregorianCalendar;
022    import java.util.Locale;
023    import java.util.TimeZone;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    @DoPrivileged
029    public class CalendarFactoryImpl implements CalendarFactory {
030    
031            @Override
032            public Calendar getCalendar() {
033                    return new GregorianCalendar();
034            }
035    
036            @Override
037            public Calendar getCalendar(int year, int month, int date) {
038                    return new GregorianCalendar(year, month, date);
039            }
040    
041            @Override
042            public Calendar getCalendar(
043                    int year, int month, int date, int hour, int minute) {
044    
045                    return new GregorianCalendar(year, month, date, hour, minute);
046            }
047    
048            @Override
049            public Calendar getCalendar(
050                    int year, int month, int date, int hour, int minute, int second) {
051    
052                    return new GregorianCalendar(year, month, date, hour, minute, second);
053            }
054    
055            @Override
056            public Calendar getCalendar(Locale locale) {
057                    return new GregorianCalendar(locale);
058            }
059    
060            @Override
061            public Calendar getCalendar(TimeZone timeZone) {
062                    return new GregorianCalendar(timeZone);
063            }
064    
065            @Override
066            public Calendar getCalendar(TimeZone timeZone, Locale locale) {
067                    return new GregorianCalendar(timeZone, locale);
068            }
069    
070    }